From 51e156b303174567062db59268bc8afa43ef730f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 23 Jun 2016 14:47:32 +0000 Subject: [PATCH 001/280] Add grammar sandbox framework --- lib/command.c | 6 +++++ lib/grammar_sandbox.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 lib/grammar_sandbox.c diff --git a/lib/command.c b/lib/command.c index 34864e9d3f..b5a754fccf 100644 --- a/lib/command.c +++ b/lib/command.c @@ -34,6 +34,8 @@ Boston, MA 02111-1307, USA. */ #include "workqueue.h" #include "vrf.h" +#include "grammar_sandbox.c" + /* Command vector which includes some level of command lists. Normally each daemon maintains each own cmdvec. */ vector cmdvec = NULL; @@ -4079,6 +4081,10 @@ cmd_init (int terminal) install_element (ENABLE_NODE, &show_version_cmd); install_element (ENABLE_NODE, &show_commandtree_cmd); + /**/ + grammar_sandbox_init(); + /**/ + if (terminal) { install_element (ENABLE_NODE, &config_terminal_length_cmd); diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c new file mode 100644 index 0000000000..c19be7f934 --- /dev/null +++ b/lib/grammar_sandbox.c @@ -0,0 +1,53 @@ +#include "command.h" + +#define GRAMMAR_STR "CLI grammar sandbox\n" + +DEFUN (grammar_midkey_test, + grammar_midkey_test_cmd, + "grammar {one|two} test", + GRAMMAR_STR + "First option\n" + "Second option\n" + "Test parameter to end string\n") +{ + return CMD_SUCCESS; +} + +DEFUN (grammar_onemidkey_test, + grammar_onemidkey_test_cmd, + "grammar {onekey} test", + GRAMMAR_STR + "First option\n" + "Test parameter to end string\n") +{ + return CMD_SUCCESS; +} + +DEFUN (grammar_smashmouth_test, + grammar_smashmouth_test_cmd, + "grammar {smash MOUTH} test", + GRAMMAR_STR + "It ain't easy bein' cheesy\n" + "Test parameter to end string\n") +{ + return CMD_SUCCESS; +} + +DEFUN (grammar_midopt_test, + grammar_midopt_test_cmd, + "grammar [option] test", + GRAMMAR_STR + "optional argument\n" + "Test parameter to end string\n") +{ + return CMD_SUCCESS; +} + + +void grammar_sandbox_init(void); +void grammar_sandbox_init() { + install_element (ENABLE_NODE, &grammar_midkey_test_cmd); + install_element (ENABLE_NODE, &grammar_onemidkey_test_cmd); + install_element (ENABLE_NODE, &grammar_midopt_test_cmd); + install_element (ENABLE_NODE, &grammar_smashmouth_test_cmd); +} From 04e64062184c93c35bf004b07004ed4676675679 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 23 Jun 2016 15:14:06 +0000 Subject: [PATCH 002/280] lib: Cleanup cmd_execute_command Signed-off-by: Quentin Young --- lib/command.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/command.c b/lib/command.c index b5a754fccf..4b571ba75d 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2599,7 +2599,7 @@ cmd_execute_command_real (vector vline, int cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, int vtysh) { - int ret, saved_ret, tried = 0; + int ret, saved_ret = 0; enum node_type onode, try_node; onode = try_node = vty->node; @@ -2615,9 +2615,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, shifted_vline = vector_init (vector_count(vline)); /* use memcpy? */ for (index = 1; index < vector_active (vline); index++) - { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); - } + vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); ret = cmd_execute_command_real (shifted_vline, FILTER_RELAXED, vty, cmd); @@ -2632,24 +2630,22 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, if (vtysh) return saved_ret; - /* This assumes all nodes above CONFIG_NODE are childs of CONFIG_NODE */ - while ( ret != CMD_SUCCESS && ret != CMD_WARNING - && vty->node > CONFIG_NODE ) + if (ret != CMD_SUCCESS && ret != CMD_WARNING) { - try_node = node_parent(try_node); - vty->node = try_node; - ret = cmd_execute_command_real (vline, FILTER_RELAXED, vty, cmd); - tried = 1; - if (ret == CMD_SUCCESS || ret == CMD_WARNING) - { - /* succesfull command, leave the node as is */ - return ret; - } + /* This assumes all nodes above CONFIG_NODE are childs of CONFIG_NODE */ + while (vty->node > CONFIG_NODE) + { + try_node = node_parent(try_node); + vty->node = try_node; + ret = cmd_execute_command_real (vline, FILTER_RELAXED, vty, cmd); + if (ret == CMD_SUCCESS || ret == CMD_WARNING) + return ret; + } + /* no command succeeded, reset the vty to the original node */ + vty->node = onode; } - /* no command succeeded, reset the vty to the original node and - return the error for this node */ - if ( tried ) - vty->node = onode; + + /* return command status for original node */ return saved_ret; } From 92055a924a9fe1f8ae730580904487598ae25da9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 6 Jul 2016 17:16:55 +0000 Subject: [PATCH 003/280] lib: Add parser, lexer, and command tree skeleton Signed-off-by: Quentin Young --- lib/cmdtree.c | 41 +++++++++++++++++++++ lib/command.lex | 35 ++++++++++++++++++ lib/command.y | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 lib/cmdtree.c create mode 100644 lib/command.lex create mode 100644 lib/command.y diff --git a/lib/cmdtree.c b/lib/cmdtree.c new file mode 100644 index 0000000000..921c6d9cc6 --- /dev/null +++ b/lib/cmdtree.c @@ -0,0 +1,41 @@ +#include +#include + +enum tree_node_type +{ + WORD_TN, + IPV4_TN, + IPV4_PREFIX_TN, + IPV6_TN, + IPV6_PREFIX_TN, + VARIABLE_TN, + RANGE_TN, + NUMBER_TN, + SELECTOR_TN, + OPTION_TN +} + +struct tree_node +{ + enum tree_node_type type; + vector children; + int leaf; + (int) (*func(struct cmd_info *, struct vty *, int, const char *[])); +} + +void add_node(struct tree_node *parent, struct tree_node *child) +{ + +} + +// checks nodes for equivalence; definition of equivalence depends +// on node type (WORD_TN strcmps words, etc) +int cmp_node(struct tree_node *first, struct tree_node *second) +{ + +} + +int merge_tree(struct tree_node *first, struct tree_node *second) +{ + +} diff --git a/lib/command.lex b/lib/command.lex new file mode 100644 index 0000000000..35450cd45f --- /dev/null +++ b/lib/command.lex @@ -0,0 +1,35 @@ +%{ +#include +#include + +#include "command.tab.h" +%} + +WORD [a-z][-_a-z0-9]+ +IPV4 A\.B\.C\.D +IPV4_PREFIX A\.B\.C\.D\/M +IPV6 X:X::X:X +IPV6_PREFIX X:X::X:X\/M +VARIABLE [A-Z][A-Z_]+ +NUMBER [0-9]{1,20} +RANGE \({NUMBER}\-{NUMBER}\) + +/* yytext shall be a pointer */ +%pointer +%option noyywrap + +%% +"<" return '<'; +">" return '>'; + +[ /t] /* ignore whitespace */; +{WORD} {yylval.string = strdup(yytext); return WORD;} +{IPV4} {yylval.string = strdup(yytext); return IPV4;} +{IPV4_PREFIX} {yylval.string = strdup(yytext); return IPV4_PREFIX;} +{IPV6} {yylval.string = strdup(yytext); return IPV6;} +{IPV6_PREFIX} {yylval.string = strdup(yytext); return IPV6_PREFIX;} +{VARIABLE} {yylval.string = strdup(yytext); return VARIABLE;} +{NUMBER} {yylval.integer = atoi(yytext); return NUMBER;} +{RANGE} {yylval.string = strdup(yytext); return RANGE;} +. {return yytext[0];} +%% diff --git a/lib/command.y b/lib/command.y new file mode 100644 index 0000000000..9bc45b5419 --- /dev/null +++ b/lib/command.y @@ -0,0 +1,96 @@ +%{ +#include +#include +#include + +extern int yylex(void); +extern void yyerror(const char *); +%} + +%union{ + int integer; + char *string; +} + +%token WORD +%token IPV4 +%token IPV4_PREFIX +%token IPV6 +%token IPV6_PREFIX +%token VARIABLE +%token RANGE +%token NUMBER + +/* grammar proper */ +%% + +start: sentence_root {printf("Matched sentence root\n");} + cmd_token_seq {printf("Matched sentence\n");}; + +sentence_root: WORD {printf("Sentence root: %s\n", $1);}; + +/* valid top level tokens */ +cmd_token: placeholder_token + | literal_token + | selector + | option + ; +cmd_token_seq: /* empty */ + | cmd_token_seq cmd_token; + +placeholder_token: IPV4 {printf("Matched placeholder\n");} + | IPV4_PREFIX {printf("Matched placeholder\n");} + | IPV6 {printf("Matched placeholder\n");} + | IPV6_PREFIX {printf("Matched placeholder\n");} + | VARIABLE {printf("Matched placeholder\n");} + | RANGE {printf("Matched placeholder\n");} + +literal_token: WORD + | NUMBER + ; +/* range: '(' NUMBER '-' NUMBER ')' {printf("Matched range\n");}; */ + + +/* productions */ +selector: '<' selector_part '|' + selector_element '>' {printf("Matched selector\n");}; +selector_part: selector_part '|' + selector_element + | selector_element + {printf("Matched selector part\n");}; +selector_element: WORD + selector_token_seq +selector_token_seq: /* empty */ + | selector_token_seq + selector_token + ; +selector_token: literal_token + | placeholder_token + | option + ; + +/* [option|set] productions */ +option: '[' option_part ']' {printf("Matched option\n");}; +option_part: option_part '|' + option_element_seq + | option_element_seq + ; +option_element_seq: option_token + | option_element_seq + option_token + ; +option_token: literal_token + | placeholder_token + ; +%% + +int +main (void) +{ + return yyparse (); +} + +void yyerror(char const *message) { + printf("Grammar error: %s\n", message); + exit(EXIT_FAILURE); +} From 782d97897eb26c18721d268b7fa22226d170ee0d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 7 Jul 2016 20:35:52 +0000 Subject: [PATCH 004/280] lib: Start implementing DFA Signed-off-by: Quentin Young --- lib/cmdtree.c | 65 ++++++++--------- lib/cmdtree.h | 43 ++++++++++++ lib/command.lex | 2 +- lib/command.y | 182 +++++++++++++++++++++++++++++++++--------------- 4 files changed, 202 insertions(+), 90 deletions(-) create mode 100644 lib/cmdtree.h diff --git a/lib/cmdtree.c b/lib/cmdtree.c index 921c6d9cc6..5bb76cce3a 100644 --- a/lib/cmdtree.c +++ b/lib/cmdtree.c @@ -1,41 +1,44 @@ -#include -#include +/* + * Command DFA module. + * Provides a DFA data structure and associated functions for manipulating it. + * Used to match user command line input. + * + * @author Quentin Young + */ -enum tree_node_type +#include "memory.h" +#include "cmdtree.h" + +struct graph_node * +add_node(struct graph_node *parent, struct graph_node *child) { - WORD_TN, - IPV4_TN, - IPV4_PREFIX_TN, - IPV6_TN, - IPV6_PREFIX_TN, - VARIABLE_TN, - RANGE_TN, - NUMBER_TN, - SELECTOR_TN, - OPTION_TN + int index; + struct graph_node *p_child; + + for (index = 0; index < vector_active(parent->children); index++) + { + *p_child = vector_slot(parent->children, index); + if (cmp_node(child, p_child)) + return p_child; + } + vector_set(parent->children, child); + return child; } -struct tree_node +int +cmp_node(struct graph_node *first, struct graph_node *second) { - enum tree_node_type type; - vector children; - int leaf; - (int) (*func(struct cmd_info *, struct vty *, int, const char *[])); } -void add_node(struct tree_node *parent, struct tree_node *child) -{ - -} - -// checks nodes for equivalence; definition of equivalence depends -// on node type (WORD_TN strcmps words, etc) -int cmp_node(struct tree_node *first, struct tree_node *second) -{ - -} - -int merge_tree(struct tree_node *first, struct tree_node *second) +struct graph_node * +new_node(enum graph_node_type type) { + struct graph_node *node = XMALLOC(MTYPE_TMP, sizeof(graph_node)); + node->type = type; + node->children = vector_init(VECTOR_MIN_SIZE); + node->is_leaf = 0; + node->is_root = 0; + node->func = NULL; + return node; } diff --git a/lib/cmdtree.h b/lib/cmdtree.h new file mode 100644 index 0000000000..77d2e0aa34 --- /dev/null +++ b/lib/cmdtree.h @@ -0,0 +1,43 @@ +#include "vector.h" + +enum graph_node_type +{ + WORD_GN, + IPV4_GN, + IPV4_PREFIX_GN, + IPV6_GN, + IPV6_PREFIX_GN, + VARIABLE_GN, + RANGE_GN, + NUMBER_GN, + SELECTOR_GN, + OPTION_GN, + NUL_GN +}; + +struct graph_node +{ + enum graph_node_type type; + vector children; + int is_leaf, is_root; + // int (*func(struct cmd_info *, struct vty *, int, const char *[])); +}; + +/* + * Adds a child to a node. If the node already has the exact same + * child, nothing is done. + */ +struct graph_node * +add_node(struct graph_node *, struct graph_node *); + +/* + * Compares two nodes for equivalence. + * What exactly constitutes two nodes being equal depends on the + * node type. + * @return 0 if equal, nonzero otherwise. + */ +int +cmp_node(struct graph_node *first, struct graph_node *second); + +struct graph_node * +new_node(enum graph_node_type type); diff --git a/lib/command.lex b/lib/command.lex index 35450cd45f..ae97265ff7 100644 --- a/lib/command.lex +++ b/lib/command.lex @@ -2,7 +2,7 @@ #include #include -#include "command.tab.h" +#include "command.h" %} WORD [a-z][-_a-z0-9]+ diff --git a/lib/command.y b/lib/command.y index 9bc45b5419..1394ef4214 100644 --- a/lib/command.y +++ b/lib/command.y @@ -2,95 +2,161 @@ #include #include #include +#include "cmdtree.h" extern int yylex(void); -extern void yyerror(const char *); +void yyerror(const char *); + +// turn on debug +#define YYDEBUG 1 %} %union{ int integer; char *string; + struct graph_node *node; } -%token WORD -%token IPV4 -%token IPV4_PREFIX -%token IPV6 -%token IPV6_PREFIX -%token VARIABLE -%token RANGE -%token NUMBER +%{ +// last top-level node +struct graph_node *topnode, +// + *optnode, + *selnode; +%} + +%token WORD +%token IPV4 +%token IPV4_PREFIX +%token IPV6 +%token IPV6_PREFIX +%token VARIABLE +%token RANGE +%token NUMBER + +%type start +%type sentence_root +%type cmd_token +%type literal_token +%type placeholder_token +%type option_token +%type selector_token +%type option +%type selector +%type selector_token_seq +%type option_token_seq + +%output "command.c" +%defines /* grammar proper */ %% -start: sentence_root {printf("Matched sentence root\n");} - cmd_token_seq {printf("Matched sentence\n");}; +start: sentence_root + cmd_token_seq; -sentence_root: WORD {printf("Sentence root: %s\n", $1);}; +sentence_root: WORD { + currnode = new_node(WORD_GN); + currnode->is_root = 1; + }; /* valid top level tokens */ -cmd_token: placeholder_token - | literal_token - | selector - | option - ; -cmd_token_seq: /* empty */ - | cmd_token_seq cmd_token; +cmd_token: + placeholder_token +| literal_token +| selector +| option +; -placeholder_token: IPV4 {printf("Matched placeholder\n");} - | IPV4_PREFIX {printf("Matched placeholder\n");} - | IPV6 {printf("Matched placeholder\n");} - | IPV6_PREFIX {printf("Matched placeholder\n");} - | VARIABLE {printf("Matched placeholder\n");} - | RANGE {printf("Matched placeholder\n");} +cmd_token_seq: + %empty +| cmd_token_seq cmd_token +; -literal_token: WORD - | NUMBER - ; -/* range: '(' NUMBER '-' NUMBER ')' {printf("Matched range\n");}; */ +placeholder_token: + IPV4 {$$ = new_node(IPV4_GN);} +| IPV4_PREFIX {$$ = new_node(IPV4_PREFIX_GN);} +| IPV6 {$$ = new_node(IPV6_GN);} +| IPV6_PREFIX {$$ = new_node(IPV6_PREFIX_GN);} +| VARIABLE {$$ = new_node(VARIABLE_GN);} +| RANGE {$$ = new_node(RANGE_GN);} +; +literal_token: + WORD {$$ = new_node(WORD_GN);} +| NUMBER {$$ = new_node(NUMBER_GN);} +; /* productions */ -selector: '<' selector_part '|' - selector_element '>' {printf("Matched selector\n");}; -selector_part: selector_part '|' - selector_element - | selector_element - {printf("Matched selector part\n");}; -selector_element: WORD - selector_token_seq -selector_token_seq: /* empty */ - | selector_token_seq - selector_token - ; -selector_token: literal_token - | placeholder_token - | option - ; +selector: + '<' selector_part '|' + selector_element '>' { + //$$ = new_node(SELECTOR_GN); + //add_node($$, $4); + }; + +selector_part: + selector_part '|' selector_element +| selector_element +; + +selector_element: + WORD selector_token_seq; + +selector_token_seq: + %empty +| selector_token_seq selector_token { + //add_node(currnode, $2); + //currnode = $2; + } +; + +selector_token: + literal_token +| placeholder_token +| option +; /* [option|set] productions */ -option: '[' option_part ']' {printf("Matched option\n");}; -option_part: option_part '|' - option_element_seq - | option_element_seq - ; -option_element_seq: option_token - | option_element_seq - option_token - ; -option_token: literal_token - | placeholder_token - ; +option: '[' option_part ']'; + +option_part: + option_part '|' option_token_seq +| option_token_seq +; + +option_token_seq: + option_token +| option_token_seq option_token +; + +option_token: + literal_token +| placeholder_token +; + %% int main (void) { - return yyparse (); + yydebug = 1; + const char* input = "show [random conf NAME] thing"; + printf("Parsing:\n\t%s\n", input); + return cmd_parse_format(input, "description"); } void yyerror(char const *message) { printf("Grammar error: %s\n", message); exit(EXIT_FAILURE); } + +int +cmd_parse_format(const char *string, const char *desc) +{ + yy_scan_string(string); + yyparse(); + return 0; +} + + From bbf5ffa08ddc13339f5dd762f14326f70a576c48 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 11 Jul 2016 19:34:13 +0000 Subject: [PATCH 005/280] lib: Update build config for new parser Signed-off-by: Quentin Young --- configure.ac | 11 +++ lib/Makefile.am | 11 ++- ylwrap | 247 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 266 insertions(+), 3 deletions(-) create mode 100755 ylwrap diff --git a/configure.ac b/configure.ac index 1f7d59d3aa..cb4c8724f1 100755 --- a/configure.ac +++ b/configure.ac @@ -1416,6 +1416,17 @@ AC_CHECK_DECL(CLOCK_MONOTONIC, AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock) ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES]) +dnl -------------------------------------- +dnl checking for flex and bison +dnl -------------------------------------- +AM_PROG_LEX +if test "x$LEX" != xflex; then + LEX="$SHELL $missing_dir/missing flex" + AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy]) + AC_SUBST([LEXLIB], ['']) +fi +AC_PROG_YACC + dnl ------------------- dnl capabilities checks dnl ------------------- diff --git a/lib/Makefile.am b/lib/Makefile.am index ada31a0d21..126303622f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,28 +3,33 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib AM_CFLAGS = $(WERROR) DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" +AM_YFLAGS = -d lib_LTLIBRARIES = libzebra.la libzebra_la_LDFLAGS = -version-info 0:0:0 libzebra_la_SOURCES = \ network.c pid_output.c getopt.c getopt1.c daemon.c \ - checksum.c vector.c linklist.c vty.c command.c \ + checksum.c vector.c linklist.c vty.c \ + cmdtree.c command_parse.y command_lex.l \ + command.c \ sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \ filter.c routemap.c distribute.c stream.c str.c log.c plist.c \ zclient.c sockopt.c smux.c agentx.c snmp.c md5.c if_rmap.c keychain.c privs.c \ sigevent.c pqueue.c jhash.c memtypes.c workqueue.c nexthop.c json.c \ ptm_lib.c csv.c bfd.c vrf.c systemd.c -BUILT_SOURCES = memtypes.h route_types.h gitversion.h +BUILT_SOURCES = memtypes.h route_types.h gitversion.h command_parse.h libzebra_la_DEPENDENCIES = @LIB_REGEX@ libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@ pkginclude_HEADERS = \ - buffer.h checksum.h command.h filter.h getopt.h hash.h \ + buffer.h checksum.h filter.h getopt.h hash.h \ if.h linklist.h log.h \ + cmdtree.h \ + command.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \ plist.h zclient.h sockopt.h smux.h md5.h if_rmap.h keychain.h \ diff --git a/ylwrap b/ylwrap new file mode 100755 index 0000000000..8f072a8e97 --- /dev/null +++ b/ylwrap @@ -0,0 +1,247 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2013-01-12.17; # UTC + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +get_dirname () +{ + case $1 in + */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; + # Otherwise, we want the empty string (not "."). + esac +} + +# guard FILE +# ---------- +# The CPP macro used to guard inclusion of FILE. +guard () +{ + printf '%s\n' "$1" \ + | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ + -e 's/__*/_/g' +} + +# quote_for_sed [STRING] +# ---------------------- +# Return STRING (or stdin) quoted to be used as a sed pattern. +quote_for_sed () +{ + case $# in + 0) cat;; + 1) printf '%s\n' "$1";; + esac \ + | sed -e 's|[][\\.*]|\\&|g' +} + +case "$1" in + '') + echo "$0: No files given. Try '$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input=$1 +shift +# We'll later need for a correct munging of "#line" directives. +input_sub_rx=`get_dirname "$input" | quote_for_sed` +case $input in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input=`pwd`/$input + ;; +esac +input_rx=`get_dirname "$input" | quote_for_sed` + +# Since DOS filename conventions don't allow two dots, +# the DOS version of Bison writes out y_tab.c instead of y.tab.c +# and y_tab.h instead of y.tab.h. Test to see if this is the case. +y_tab_nodot=false +if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot=true +fi + +# The parser itself, the first file, is the destination of the .y.c +# rule in the Makefile. +parser=$1 + +# A sed program to s/FROM/TO/g for all the FROM/TO so that, for +# instance, we rename #include "y.tab.h" into #include "parse.h" +# during the conversion from y.tab.c to parse.c. +sed_fix_filenames= + +# Also rename header guards, as Bison 2.7 for instance uses its header +# guard in its implementation file. +sed_fix_header_guards= + +while test $# -ne 0; do + if test x"$1" = x"--"; then + shift + break + fi + from=$1 + # Handle y_tab.c and y_tab.h output by DOS + if $y_tab_nodot; then + case $from in + "y.tab.c") from=y_tab.c;; + "y.tab.h") from=y_tab.h;; + esac + fi + shift + to=$1 + shift + sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" + sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" +done + +# The program to run. +prog=$1 +shift +# Make any relative path in $prog absolute. +case $prog in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog=`pwd`/$prog ;; +esac + +dirname=ylwrap$$ +do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' +trap "ret=129; $do_exit" 1 +trap "ret=130; $do_exit" 2 +trap "ret=141; $do_exit" 13 +trap "ret=143; $do_exit" 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) "$prog" "$input" ;; + *) "$prog" "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + for from in * + do + to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend '../'. + case $to in + [\\/]* | ?:[\\/]*) target=$to;; + *) target=../$to;; + esac + + # Do not overwrite unchanged header files to avoid useless + # recompilations. Always update the parser itself: it is the + # destination of the .y.c rule in the Makefile. Divert the + # output of all other files to a temporary file so we can + # compare them to existing versions. + if test $from != $parser; then + realtarget=$target + target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` + fi + + # Munge "#line" or "#" directives. Don't let the resulting + # debug information point at an absolute srcdir. Use the real + # output file name, not yy.lex.c for instance. Adjust the + # include guards too. + sed -e "/^#/!b" \ + -e "s|$input_rx|$input_sub_rx|" \ + -e "$sed_fix_filenames" \ + -e "$sed_fix_header_guards" \ + "$from" >"$target" || ret=$? + + # Check whether files must be updated. + if test "$from" != "$parser"; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$to is unchanged" + rm -f "$target" + else + echo "updating $to" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the parser. This is a + # blatant hack to let us support using "yacc -d". If -d is not + # specified, don't fail when the header file is "missing". + if test "$from" = "$parser"; then + ret=1 + fi + fi + done +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: From 2a23ca6e5293281a3c7d4a2fdbc672151ea851ee Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 11 Jul 2016 19:56:07 +0000 Subject: [PATCH 006/280] lib: Change some includes Signed-off-by: Quentin Young --- lib/cmdtree.c | 10 +-- lib/cmdtree.h | 9 +-- lib/{command.lex => command_lex.l} | 17 +++-- lib/{command.y => command_parse.y} | 109 ++++++++++++++++++++--------- 4 files changed, 99 insertions(+), 46 deletions(-) rename lib/{command.lex => command_lex.l} (81%) rename lib/{command.y => command_parse.y} (51%) diff --git a/lib/cmdtree.c b/lib/cmdtree.c index 5bb76cce3a..c7bdf381c7 100644 --- a/lib/cmdtree.c +++ b/lib/cmdtree.c @@ -6,18 +6,19 @@ * @author Quentin Young */ -#include "memory.h" +#include #include "cmdtree.h" +#include "memory.h" struct graph_node * add_node(struct graph_node *parent, struct graph_node *child) { - int index; + unsigned int index; struct graph_node *p_child; for (index = 0; index < vector_active(parent->children); index++) { - *p_child = vector_slot(parent->children, index); + p_child = vector_slot(parent->children, index); if (cmp_node(child, p_child)) return p_child; } @@ -28,12 +29,13 @@ add_node(struct graph_node *parent, struct graph_node *child) int cmp_node(struct graph_node *first, struct graph_node *second) { + return 1; } struct graph_node * new_node(enum graph_node_type type) { - struct graph_node *node = XMALLOC(MTYPE_TMP, sizeof(graph_node)); + struct graph_node *node = malloc(sizeof(struct graph_node)); node->type = type; node->children = vector_init(VECTOR_MIN_SIZE); node->is_leaf = 0; diff --git a/lib/cmdtree.h b/lib/cmdtree.h index 77d2e0aa34..cdcf347006 100644 --- a/lib/cmdtree.h +++ b/lib/cmdtree.h @@ -1,3 +1,4 @@ +#include "vty.h" #include "vector.h" enum graph_node_type @@ -20,14 +21,14 @@ struct graph_node enum graph_node_type type; vector children; int is_leaf, is_root; - // int (*func(struct cmd_info *, struct vty *, int, const char *[])); + int (*func)(struct vty *, int, const char *[]); }; /* * Adds a child to a node. If the node already has the exact same * child, nothing is done. */ -struct graph_node * +extern struct graph_node * add_node(struct graph_node *, struct graph_node *); /* @@ -36,8 +37,8 @@ add_node(struct graph_node *, struct graph_node *); * node type. * @return 0 if equal, nonzero otherwise. */ -int +extern int cmp_node(struct graph_node *first, struct graph_node *second); -struct graph_node * +extern struct graph_node * new_node(enum graph_node_type type); diff --git a/lib/command.lex b/lib/command_lex.l similarity index 81% rename from lib/command.lex rename to lib/command_lex.l index ae97265ff7..45f8f8e636 100644 --- a/lib/command.lex +++ b/lib/command_lex.l @@ -1,8 +1,7 @@ %{ -#include -#include +#include "command_parse.h" -#include "command.h" +extern void set_buffer_string(const char *); %} WORD [a-z][-_a-z0-9]+ @@ -17,11 +16,11 @@ RANGE \({NUMBER}\-{NUMBER}\) /* yytext shall be a pointer */ %pointer %option noyywrap +%option nounput +%option noinput +%option outfile="command_lex.c" %% -"<" return '<'; -">" return '>'; - [ /t] /* ignore whitespace */; {WORD} {yylval.string = strdup(yytext); return WORD;} {IPV4} {yylval.string = strdup(yytext); return IPV4;} @@ -33,3 +32,9 @@ RANGE \({NUMBER}\-{NUMBER}\) {RANGE} {yylval.string = strdup(yytext); return RANGE;} . {return yytext[0];} %% + +void +set_buffer_string(const char *string) +{ + yy_scan_string(string); +} diff --git a/lib/command.y b/lib/command_parse.y similarity index 51% rename from lib/command.y rename to lib/command_parse.y index 1394ef4214..e7efb0d5a8 100644 --- a/lib/command.y +++ b/lib/command_parse.y @@ -1,13 +1,12 @@ %{ -#include -#include -#include #include "cmdtree.h" extern int yylex(void); -void yyerror(const char *); +extern void yyerror(const char *); +extern int cmd_parse_format(const char *, const char *); +extern void set_buffer_string(const char *); -// turn on debug +// compile with debugging facilities #define YYDEBUG 1 %} @@ -19,10 +18,16 @@ void yyerror(const char *); %{ // last top-level node -struct graph_node *topnode, -// - *optnode, - *selnode; +struct graph_node *topnode, // command root node + *currnode; // current node + +struct graph_node *optnode_start, // start node for option set + *optnode_end, // end node for option set + *optnode_el; // start node for an option set element + +struct graph_node *selnode_start, // start node for selector set + *selnode_end, // end node for selector set + *selnode_el; // start node for an selector set element %} %token WORD @@ -36,7 +41,6 @@ struct graph_node *topnode, %type start %type sentence_root -%type cmd_token %type literal_token %type placeholder_token %type option_token @@ -46,8 +50,8 @@ struct graph_node *topnode, %type selector_token_seq %type option_token_seq -%output "command.c" -%defines +%defines "command_parse.h" +%output "command_parse.c" /* grammar proper */ %% @@ -55,17 +59,29 @@ struct graph_node *topnode, start: sentence_root cmd_token_seq; -sentence_root: WORD { - currnode = new_node(WORD_GN); - currnode->is_root = 1; - }; +sentence_root: WORD + { + currnode = new_node(WORD_GN); + currnode->is_root = 1; + add_node(topnode, currnode); + }; /* valid top level tokens */ cmd_token: placeholder_token + { currnode = add_node(currnode, $1); } | literal_token + { currnode = add_node(currnode, $1); } | selector + { + add_node(currnode, selnode_start); + currnode = selnode_end; + } | option + { + add_node(currnode, optnode_start); + currnode = optnode_end; + } ; cmd_token_seq: @@ -90,13 +106,14 @@ literal_token: /* productions */ selector: '<' selector_part '|' - selector_element '>' { - //$$ = new_node(SELECTOR_GN); - //add_node($$, $4); - }; + selector_element '>' +{ + $$ = new_node(SELECTOR_GN); + // attach subtree here +}; selector_part: - selector_part '|' selector_element + selector_part '|' selector_element | selector_element ; @@ -104,11 +121,11 @@ selector_element: WORD selector_token_seq; selector_token_seq: - %empty -| selector_token_seq selector_token { - //add_node(currnode, $2); - //currnode = $2; - } + %empty {$$ = NULL;} +| selector_token_seq selector_token +{ + currnode = add_node(currnode, $2); +} ; selector_token: @@ -118,7 +135,11 @@ selector_token: ; /* [option|set] productions */ -option: '[' option_part ']'; +option: '[' option_part ']' +{ + $$ = new_node(OPTION_GN); + // attach subtree here +}; option_part: option_part '|' option_token_seq @@ -126,13 +147,34 @@ option_part: ; option_token_seq: - option_token -| option_token_seq option_token + option_token_seq option_token +| option_token +{ + printf("Matched singular option token in sequence, type: %d\n", $1->type); +} ; option_token: literal_token +{ + // optnode_el points to root of option element + if (optnode_el == NULL) { + optnode_el = $1; + currnode = $1; + } + else + add_node(currnode, $1); +} | placeholder_token +{ + // optnode_el points to root of option element + if (optnode_el == NULL) { + optnode_el = $1; + currnode = $1; + } + else + add_node(currnode, $1); +} ; %% @@ -154,9 +196,12 @@ void yyerror(char const *message) { int cmd_parse_format(const char *string, const char *desc) { - yy_scan_string(string); + // make flex read from a string + set_buffer_string(string); + // initialize the start node of this command dfa + topnode = new_node(NUL_GN); + // parse command into DFA yyparse(); + // topnode points to command DFA return 0; } - - From 071b077cad5af4e55b4a0c479ed0e7912e8964ad Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 12 Jul 2016 14:03:15 +0000 Subject: [PATCH 007/280] lib: Add generated parser files to .gitignore Signed-off-by: Quentin Young --- lib/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/.gitignore b/lib/.gitignore index 02aa432ce1..ca49c1b6a3 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -16,3 +16,6 @@ gitversion.h.tmp *.loT memtypes.h route_types.h +command_lex.c +command_parse.c +command_parse.h From 478bdaeb3b9699d2ceaa9607ef37166e7ca69faf Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 17 Jul 2016 21:49:16 +0000 Subject: [PATCH 008/280] lib: Finish implementing grammar, DFA construction Signed-off-by: Quentin Young --- lib/cmdtree.h | 13 ++- lib/command_parse.y | 238 ++++++++++++++++++++++++++---------------- lib/grammar_sandbox.c | 56 ++++------ 3 files changed, 178 insertions(+), 129 deletions(-) diff --git a/lib/cmdtree.h b/lib/cmdtree.h index cdcf347006..e9a10d7ec5 100644 --- a/lib/cmdtree.h +++ b/lib/cmdtree.h @@ -20,13 +20,24 @@ struct graph_node { enum graph_node_type type; vector children; - int is_leaf, is_root; + int is_root; // true if first token in command + int is_leaf; // true if last token in command + int (*func)(struct vty *, int, const char *[]); + + /* various data fields for nodes */ + char* text; // for words and variables + int value; // for numbers + int start, end; // for ranges }; /* * Adds a child to a node. If the node already has the exact same * child, nothing is done. + * @param[in] parent node + * @param[in] child node + * @return the new child, or the existing child if the parent already has the + * new child */ extern struct graph_node * add_node(struct graph_node *, struct graph_node *); diff --git a/lib/command_parse.y b/lib/command_parse.y index e7efb0d5a8..1f519e27fa 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -3,12 +3,14 @@ extern int yylex(void); extern void yyerror(const char *); -extern int cmd_parse_format(const char *, const char *); -extern void set_buffer_string(const char *); // compile with debugging facilities #define YYDEBUG 1 %} +%code provides { +extern struct graph_node *cmd_parse_format_new(const char *, const char *); +extern void set_buffer_string(const char *); +} %union{ int integer; @@ -18,37 +20,39 @@ extern void set_buffer_string(const char *); %{ // last top-level node -struct graph_node *topnode, // command root node - *currnode; // current node +struct graph_node *startnode, // command root node + *currnode, // current node + *tmpnode, // temp node pointer + *seqhead; // sequence head -struct graph_node *optnode_start, // start node for option set - *optnode_end, // end node for option set - *optnode_el; // start node for an option set element -struct graph_node *selnode_start, // start node for selector set - *selnode_end, // end node for selector set - *selnode_el; // start node for an selector set element +struct graph_node *optnode_start = NULL, // start node for option set + *optnode_end = NULL; // end node for option set + +struct graph_node *selnode_start = NULL, // start node for selector set + *selnode_end = NULL; // end node for selector set %} -%token WORD -%token IPV4 -%token IPV4_PREFIX -%token IPV6 -%token IPV6_PREFIX -%token VARIABLE -%token RANGE -%token NUMBER +%token WORD +%token IPV4 +%token IPV4_PREFIX +%token IPV6 +%token IPV6_PREFIX +%token VARIABLE +%token RANGE +%token NUMBER %type start %type sentence_root %type literal_token %type placeholder_token -%type option_token -%type selector_token %type option -%type selector -%type selector_token_seq +%type option_token %type option_token_seq +%type selector +%type selector_root +%type selector_token +%type selector_token_seq %defines "command_parse.h" %output "command_parse.c" @@ -60,28 +64,31 @@ start: sentence_root cmd_token_seq; sentence_root: WORD - { - currnode = new_node(WORD_GN); - currnode->is_root = 1; - add_node(topnode, currnode); - }; +{ + currnode = new_node(WORD_GN); + currnode->is_root = 1; + add_node(startnode, currnode); +}; /* valid top level tokens */ cmd_token: placeholder_token - { currnode = add_node(currnode, $1); } +{ currnode = add_node(currnode, $1); } | literal_token - { currnode = add_node(currnode, $1); } +{ currnode = add_node(currnode, $1); } +/* selectors and options are subgraphs with start and end nodes */ | selector - { - add_node(currnode, selnode_start); - currnode = selnode_end; - } +{ + add_node(currnode, $1); + currnode = selnode_end; + selnode_start = selnode_end = NULL; +} | option - { - add_node(currnode, optnode_start); - currnode = optnode_end; - } +{ + add_node(currnode, $1); + currnode = optnode_end; + optnode_start = optnode_end = NULL; +} ; cmd_token_seq: @@ -90,26 +97,52 @@ cmd_token_seq: ; placeholder_token: - IPV4 {$$ = new_node(IPV4_GN);} -| IPV4_PREFIX {$$ = new_node(IPV4_PREFIX_GN);} -| IPV6 {$$ = new_node(IPV6_GN);} -| IPV6_PREFIX {$$ = new_node(IPV6_PREFIX_GN);} -| VARIABLE {$$ = new_node(VARIABLE_GN);} -| RANGE {$$ = new_node(RANGE_GN);} + IPV4 +{ $$ = new_node(IPV4_GN); } +| IPV4_PREFIX +{ $$ = new_node(IPV4_PREFIX_GN); } +| IPV6 +{ $$ = new_node(IPV6_GN); } +| IPV6_PREFIX +{ $$ = new_node(IPV6_PREFIX_GN); } +| VARIABLE +{ $$ = new_node(VARIABLE_GN); } +| RANGE +{ + $$ = new_node(RANGE_GN); + + // get the numbers out + strsep(&yylval.string, "(-)"); + $$->start = atoi( strsep(&yylval.string, "(-)") ); + strsep(&yylval.string, "(-)"); + $$->end = atoi( strsep(&yylval.string, "(-)") ); + + // we could do this a variety of ways with either + // the lexer or the parser, but this is the simplest + // and involves the least amount of free() +} ; literal_token: - WORD {$$ = new_node(WORD_GN);} -| NUMBER {$$ = new_node(NUMBER_GN);} + WORD +{ + $$ = new_node(WORD_GN); + $$->text = strdup(yylval.string); +} +| NUMBER +{ + $$ = new_node(NUMBER_GN); + $$->value = yylval.integer; +} ; /* productions */ selector: - '<' selector_part '|' - selector_element '>' + '<' selector_part '|' selector_element '>' { - $$ = new_node(SELECTOR_GN); - // attach subtree here + // all the graph building is done in selector_element, + // so just return the selector subgraph head + $$ = selnode_start; }; selector_part: @@ -118,90 +151,115 @@ selector_part: ; selector_element: - WORD selector_token_seq; + selector_root selector_token_seq +{ + // if the selector start and end do not exist, create them + if (!selnode_start || !selnode_end) { // if one is null + assert(!selnode_start && !selnode_end); // both should be null + selnode_start = new_node(SELECTOR_GN); // diverging node + selnode_end = new_node(NUL_GN); // converging node + } + + // add element head as a child of the selector + add_node(selnode_start, $1); + + if ($2->type != NUL_GN) { + add_node($1, seqhead); + add_node($2, selnode_end); + } + else + add_node($1, selnode_end); + + seqhead = NULL; +} selector_token_seq: - %empty {$$ = NULL;} + %empty { $$ = new_node(NUL_GN); } | selector_token_seq selector_token { - currnode = add_node(currnode, $2); + // if the sequence component is NUL_GN, this is a sequence start + if ($1->type == NUL_GN) { + assert(!seqhead); // sequence head should always be null here + seqhead = $2; + } + else // chain on new node + add_node($1, $2); + + $$ = $2; } ; -selector_token: +selector_root: literal_token | placeholder_token +; + +selector_token: + selector_root | option ; /* [option|set] productions */ option: '[' option_part ']' -{ - $$ = new_node(OPTION_GN); - // attach subtree here -}; +{ $$ = optnode_start; }; option_part: - option_part '|' option_token_seq -| option_token_seq + option_part '|' option_element +| option_element ; -option_token_seq: - option_token_seq option_token -| option_token +option_element: + option_token_seq { - printf("Matched singular option token in sequence, type: %d\n", $1->type); + if (!optnode_start || !optnode_end) { + assert(!optnode_start && !optnode_end); + optnode_start = new_node(OPTION_GN); + optnode_end = new_node(NUL_GN); + } + + add_node(optnode_start, seqhead); + add_node($1, optnode_end); } + +option_token_seq: + option_token +{ $$ = seqhead = $1; } +| option_token_seq option_token +{ $$ = add_node($1, $2); } ; option_token: literal_token -{ - // optnode_el points to root of option element - if (optnode_el == NULL) { - optnode_el = $1; - currnode = $1; - } - else - add_node(currnode, $1); -} | placeholder_token -{ - // optnode_el points to root of option element - if (optnode_el == NULL) { - optnode_el = $1; - currnode = $1; - } - else - add_node(currnode, $1); -} ; %% - +/* int main (void) { - yydebug = 1; const char* input = "show [random conf NAME] thing"; printf("Parsing:\n\t%s\n", input); - return cmd_parse_format(input, "description"); + return cmd_parse_format_new(input, "description"); } - +*/ void yyerror(char const *message) { printf("Grammar error: %s\n", message); exit(EXIT_FAILURE); } -int -cmd_parse_format(const char *string, const char *desc) +struct graph_node * +cmd_parse_format_new(const char *string, const char *desc) { + fprintf(stderr, "parsing: %s\n", string); + + yydebug = 1; // make flex read from a string set_buffer_string(string); // initialize the start node of this command dfa - topnode = new_node(NUL_GN); + startnode = new_node(NUL_GN); // parse command into DFA yyparse(); - // topnode points to command DFA - return 0; + // startnode points to command DFA + return startnode; } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index c19be7f934..fd0eec02d6 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -1,53 +1,33 @@ #include "command.h" +#include "command_parse.h" #define GRAMMAR_STR "CLI grammar sandbox\n" -DEFUN (grammar_midkey_test, - grammar_midkey_test_cmd, - "grammar {one|two} test", +DEFUN (grammar_test, + grammar_test_cmd, + "grammar .COMMAND", GRAMMAR_STR - "First option\n" - "Second option\n" - "Test parameter to end string\n") + "command to pass to new parser\n") { - return CMD_SUCCESS; -} + size_t linesize = 0; + for (int i = 0; i < argc; i++) + linesize += strlen(argv[i]) + 1; -DEFUN (grammar_onemidkey_test, - grammar_onemidkey_test_cmd, - "grammar {onekey} test", - GRAMMAR_STR - "First option\n" - "Test parameter to end string\n") -{ - return CMD_SUCCESS; -} + char* cat = malloc(linesize); + cat[0] = '\0'; + for (int i = 0; i < argc; i++) { + strcat(cat, argv[i]); + if (i != argc) + strcat(cat, " "); + } -DEFUN (grammar_smashmouth_test, - grammar_smashmouth_test_cmd, - "grammar {smash MOUTH} test", - GRAMMAR_STR - "It ain't easy bein' cheesy\n" - "Test parameter to end string\n") -{ - return CMD_SUCCESS; -} + cmd_parse_format_new((const char*) cat, "lol"); -DEFUN (grammar_midopt_test, - grammar_midopt_test_cmd, - "grammar [option] test", - GRAMMAR_STR - "optional argument\n" - "Test parameter to end string\n") -{ - return CMD_SUCCESS; + return CMD_SUCCESS; } void grammar_sandbox_init(void); void grammar_sandbox_init() { - install_element (ENABLE_NODE, &grammar_midkey_test_cmd); - install_element (ENABLE_NODE, &grammar_onemidkey_test_cmd); - install_element (ENABLE_NODE, &grammar_midopt_test_cmd); - install_element (ENABLE_NODE, &grammar_smashmouth_test_cmd); + install_element (ENABLE_NODE, &grammar_test_cmd); } From 4b0abf2434806d5243527b5c75b8bfdcc311edd7 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 18 Jul 2016 16:16:36 +0000 Subject: [PATCH 009/280] lib: Fix some DFA construction bugs Options get null paths, parser state is properly cleaned up, caller passes start node Signed-off-by: Quentin Young --- lib/cmdtree.c | 54 +++++++++++++++++++++++++++++- lib/cmdtree.h | 3 ++ lib/command_parse.y | 78 ++++++++++++++++++++++++++++--------------- lib/grammar_sandbox.c | 9 +++-- 4 files changed, 115 insertions(+), 29 deletions(-) diff --git a/lib/cmdtree.c b/lib/cmdtree.c index c7bdf381c7..da647a7ae3 100644 --- a/lib/cmdtree.c +++ b/lib/cmdtree.c @@ -29,7 +29,7 @@ add_node(struct graph_node *parent, struct graph_node *child) int cmp_node(struct graph_node *first, struct graph_node *second) { - return 1; + return 0; } struct graph_node * @@ -44,3 +44,55 @@ new_node(enum graph_node_type type) return node; } + +void +walk_graph(struct graph_node *start, int level) +{ + // print this node + switch (start->type) { + case WORD_GN: + case IPV4_GN: + case IPV4_PREFIX_GN: + case IPV6_GN: + case IPV6_PREFIX_GN: + case VARIABLE_GN: + case RANGE_GN: + fprintf(stderr, "%s", start->text); + break; + case NUMBER_GN: + fprintf(stderr, "%d", start->value); + break; + case SELECTOR_GN: + fprintf(stderr, "<>"); + break; + case OPTION_GN: + fprintf(stderr, "[]"); + break; + case NUL_GN: + fprintf(stderr, "NUL"); + break; + default: + fprintf(stderr, "ERROR"); + } + fprintf(stderr, "[%d] ", vector_active(start->children)); + + if (vector_active(start->children)) + for (unsigned int i = 0; i < vector_active(start->children); i++) { + struct graph_node *r = vector_slot(start->children, i); + if (!r) { + fprintf(stderr, "Child seems null?\n"); + break; + } + else { + if (start->type == OPTION_GN || start->type == SELECTOR_GN) { + fprintf(stderr, "\n"); + for (int i = 0; i < level+1; i++) + fprintf(stderr, "\t"); + } + walk_graph(r, level+1); + } + } + else { + fprintf(stderr, "\n"); + } +} diff --git a/lib/cmdtree.h b/lib/cmdtree.h index e9a10d7ec5..9b512e3bb9 100644 --- a/lib/cmdtree.h +++ b/lib/cmdtree.h @@ -53,3 +53,6 @@ cmp_node(struct graph_node *first, struct graph_node *second); extern struct graph_node * new_node(enum graph_node_type type); + +extern void +walk_graph(struct graph_node *, int); diff --git a/lib/command_parse.y b/lib/command_parse.y index 1f519e27fa..7bdec6dca1 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -8,7 +8,7 @@ extern void yyerror(const char *); #define YYDEBUG 1 %} %code provides { -extern struct graph_node *cmd_parse_format_new(const char *, const char *); +extern struct graph_node *cmd_parse_format_new(const char *, const char *, struct graph_node *); extern void set_buffer_string(const char *); } @@ -19,18 +19,16 @@ extern void set_buffer_string(const char *); } %{ -// last top-level node struct graph_node *startnode, // command root node *currnode, // current node - *tmpnode, // temp node pointer *seqhead; // sequence head -struct graph_node *optnode_start = NULL, // start node for option set - *optnode_end = NULL; // end node for option set +struct graph_node *optnode_start, // start node for option set + *optnode_end; // end node for option set -struct graph_node *selnode_start = NULL, // start node for selector set - *selnode_end = NULL; // end node for selector set +struct graph_node *selnode_start, // start node for selector set + *selnode_end; // end node for selector set %} %token WORD @@ -65,7 +63,12 @@ start: sentence_root sentence_root: WORD { - currnode = new_node(WORD_GN); + $$ = new_node(WORD_GN); + $$->text = strdup(yylval.string); + fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); + fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); + + currnode = $$; currnode->is_root = 1; add_node(startnode, currnode); }; @@ -98,18 +101,34 @@ cmd_token_seq: placeholder_token: IPV4 -{ $$ = new_node(IPV4_GN); } +{ + $$ = new_node(IPV4_GN); + $$->text = strdup(yylval.string); +} | IPV4_PREFIX -{ $$ = new_node(IPV4_PREFIX_GN); } +{ + $$ = new_node(IPV4_PREFIX_GN); + $$->text = strdup(yylval.string); +} | IPV6 -{ $$ = new_node(IPV6_GN); } +{ + $$ = new_node(IPV6_GN); + $$->text = strdup(yylval.string); +} | IPV6_PREFIX -{ $$ = new_node(IPV6_PREFIX_GN); } +{ + $$ = new_node(IPV6_PREFIX_GN); + $$->text = strdup(yylval.string); +} | VARIABLE -{ $$ = new_node(VARIABLE_GN); } +{ + $$ = new_node(VARIABLE_GN); + $$->text = strdup(yylval.string); +} | RANGE { $$ = new_node(RANGE_GN); + $$->text = strdup(yylval.string); // get the numbers out strsep(&yylval.string, "(-)"); @@ -128,6 +147,8 @@ literal_token: { $$ = new_node(WORD_GN); $$->text = strdup(yylval.string); + fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); + fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); } | NUMBER { @@ -136,7 +157,7 @@ literal_token: } ; -/* productions */ +/* productions */ selector: '<' selector_part '|' selector_element '>' { @@ -201,7 +222,14 @@ selector_token: /* [option|set] productions */ option: '[' option_part ']' -{ $$ = optnode_start; }; +{ + // add null path + struct graph_node *nullpath = new_node(NUL_GN); + add_node(optnode_start, nullpath); + add_node(nullpath, optnode_end); + + $$ = optnode_start; +}; option_part: option_part '|' option_element @@ -234,30 +262,28 @@ option_token: ; %% -/* -int -main (void) -{ - const char* input = "show [random conf NAME] thing"; - printf("Parsing:\n\t%s\n", input); - return cmd_parse_format_new(input, "description"); -} -*/ + void yyerror(char const *message) { printf("Grammar error: %s\n", message); exit(EXIT_FAILURE); } struct graph_node * -cmd_parse_format_new(const char *string, const char *desc) +cmd_parse_format_new(const char *string, const char *desc, struct graph_node *start) { fprintf(stderr, "parsing: %s\n", string); + /* clear state pointers */ + startnode = currnode = seqhead = NULL; + selnode_start = selnode_end = NULL; + optnode_start = optnode_end = NULL; + + // trace parser yydebug = 1; // make flex read from a string set_buffer_string(string); // initialize the start node of this command dfa - startnode = new_node(NUL_GN); + startnode = start; // parse command into DFA yyparse(); // startnode points to command DFA diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index fd0eec02d6..0cc6896d8e 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -1,5 +1,6 @@ #include "command.h" #include "command_parse.h" +#include "cmdtree.h" #define GRAMMAR_STR "CLI grammar sandbox\n" @@ -21,8 +22,12 @@ DEFUN (grammar_test, strcat(cat, " "); } - cmd_parse_format_new((const char*) cat, "lol"); - + struct graph_node *result = new_node(NUL_GN); + /* cmd_parse_format_new((const char*) cat, "lol", result);*/ + cmd_parse_format_new ("test lol", "lol", result); + cmd_parse_format_new ("test lol", "lol", result); + walk_graph(result, 0); + return CMD_SUCCESS; } From 340a2b4ac0bcc737e24aa6c0e383f1188aaaaf61 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 19 Jul 2016 17:06:11 +0000 Subject: [PATCH 010/280] lib: Implement node comparison function Implement comparator for nodes, some miscellaneous cleanup. Signed-off-by: Quentin Young --- lib/cmdtree.c | 55 +++++++++++++++++++++++++++++++++++-------- lib/cmdtree.h | 44 +++++++++++++++++++++++++--------- lib/command_parse.y | 25 ++++++++++---------- lib/grammar_sandbox.c | 27 +++++++++++++++------ 4 files changed, 111 insertions(+), 40 deletions(-) diff --git a/lib/cmdtree.c b/lib/cmdtree.c index da647a7ae3..38632dca40 100644 --- a/lib/cmdtree.c +++ b/lib/cmdtree.c @@ -13,12 +13,11 @@ struct graph_node * add_node(struct graph_node *parent, struct graph_node *child) { - unsigned int index; struct graph_node *p_child; - for (index = 0; index < vector_active(parent->children); index++) + for (unsigned int i = 0; i < vector_active(parent->children); i++) { - p_child = vector_slot(parent->children, index); + p_child = vector_slot(parent->children, i); if (cmp_node(child, p_child)) return p_child; } @@ -29,7 +28,36 @@ add_node(struct graph_node *parent, struct graph_node *child) int cmp_node(struct graph_node *first, struct graph_node *second) { - return 0; + // compare types + if (first->type != second->type) return 0; + + switch (first->type) { + case WORD_GN: // words and variables are equal if their + case VARIABLE_GN: // text value is equal + if (first->text && second->text) { + if (strcmp(first->text, second->text)) return 0; + } + else if (first->text != second->text) return 0; + break; + case RANGE_GN: // ranges are equal if their bounds are equal + if (first->min != second->min || first->max != second->max) + return 0; + break; + case NUMBER_GN: // numbers are equal if their values are equal + if (first->value != second->value) return 0; + break; + /* selectors and options should be equal if all paths are equal, + * but the graph isomorphism problem is not solvable in polynomial + * time so we consider selectors and options inequal in all cases + */ + case SELECTOR_GN: + case OPTION_GN: + return 0; + default: + break; + } + + return 1; } struct graph_node * @@ -40,6 +68,11 @@ new_node(enum graph_node_type type) node->children = vector_init(VECTOR_MIN_SIZE); node->is_leaf = 0; node->is_root = 0; + node->end = NULL; + node->text = NULL; + node->value = 0; + node->min = 0; + node->max = 0; node->func = NULL; return node; @@ -77,22 +110,24 @@ walk_graph(struct graph_node *start, int level) fprintf(stderr, "[%d] ", vector_active(start->children)); if (vector_active(start->children)) - for (unsigned int i = 0; i < vector_active(start->children); i++) { + for (unsigned int i = 0; i < vector_active(start->children); i++) + { struct graph_node *r = vector_slot(start->children, i); if (!r) { fprintf(stderr, "Child seems null?\n"); break; } else { - if (start->type == OPTION_GN || start->type == SELECTOR_GN) { + if (vector_active(start->children) > 1) { fprintf(stderr, "\n"); for (int i = 0; i < level+1; i++) - fprintf(stderr, "\t"); + fprintf(stderr, " "); + walk_graph(r, level+1); } - walk_graph(r, level+1); + else + walk_graph(r, level); } } - else { + if (level == 0) fprintf(stderr, "\n"); - } } diff --git a/lib/cmdtree.h b/lib/cmdtree.h index 9b512e3bb9..3d2366b008 100644 --- a/lib/cmdtree.h +++ b/lib/cmdtree.h @@ -20,20 +20,23 @@ struct graph_node { enum graph_node_type type; vector children; - int is_root; // true if first token in command - int is_leaf; // true if last token in command + int is_root; // true if first token in command + int is_leaf; // true if last token in command + struct graph_node * end; // pointer to end for selector & option int (*func)(struct vty *, int, const char *[]); /* various data fields for nodes */ char* text; // for words and variables int value; // for numbers - int start, end; // for ranges + int min, max; // for ranges }; /* - * Adds a child to a node. If the node already has the exact same - * child, nothing is done. + * Adds a child to a node. + * If the node already has the exact same child, nothing is done. This is + * decided with cmp_node. + * * @param[in] parent node * @param[in] child node * @return the new child, or the existing child if the parent already has the @@ -43,16 +46,35 @@ extern struct graph_node * add_node(struct graph_node *, struct graph_node *); /* - * Compares two nodes for equivalence. - * What exactly constitutes two nodes being equal depends on the - * node type. - * @return 0 if equal, nonzero otherwise. + * Compares two nodes for parsing equivalence. + * Equivalence in this case means that a single user input token + * should be able to unambiguously match one of the two nodes. + * For example, two nodes which have all fields equal except their + * function pointers would be considered equal. + * + * @param[in] first node to compare + * @param[in] second node to compare + * @return 1 if equal, zero otherwise. */ extern int -cmp_node(struct graph_node *first, struct graph_node *second); +cmp_node(struct graph_node *, struct graph_node *); +/* + * Create a new node. + * Initializes all fields to default values and sets the node type. + * + * @param[in] node type + * @return pointer to the newly allocated node + */ extern struct graph_node * -new_node(enum graph_node_type type); +new_node(enum graph_node_type); +/** + * Walks a command DFA, printing structure to stdout. + * For debugging. + * + * @param[in] start node of graph to walk + * @param[in] graph depth for recursion, caller passes 0 + */ extern void walk_graph(struct graph_node *, int); diff --git a/lib/command_parse.y b/lib/command_parse.y index 7bdec6dca1..cf2cd95bdd 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -48,7 +48,7 @@ struct graph_node *selnode_start, // start node for selector set %type option_token %type option_token_seq %type selector -%type selector_root +%type selector_element_root %type selector_token %type selector_token_seq @@ -70,7 +70,7 @@ sentence_root: WORD currnode = $$; currnode->is_root = 1; - add_node(startnode, currnode); + currnode = add_node(startnode, currnode); }; /* valid top level tokens */ @@ -106,22 +106,22 @@ placeholder_token: $$->text = strdup(yylval.string); } | IPV4_PREFIX -{ +{ $$ = new_node(IPV4_PREFIX_GN); $$->text = strdup(yylval.string); } | IPV6 -{ +{ $$ = new_node(IPV6_GN); $$->text = strdup(yylval.string); } | IPV6_PREFIX -{ +{ $$ = new_node(IPV6_PREFIX_GN); $$->text = strdup(yylval.string); } | VARIABLE -{ +{ $$ = new_node(VARIABLE_GN); $$->text = strdup(yylval.string); } @@ -132,9 +132,9 @@ placeholder_token: // get the numbers out strsep(&yylval.string, "(-)"); - $$->start = atoi( strsep(&yylval.string, "(-)") ); + $$->min = atoi( strsep(&yylval.string, "(-)") ); strsep(&yylval.string, "(-)"); - $$->end = atoi( strsep(&yylval.string, "(-)") ); + $$->max = atoi( strsep(&yylval.string, "(-)") ); // we could do this a variety of ways with either // the lexer or the parser, but this is the simplest @@ -148,7 +148,7 @@ literal_token: $$ = new_node(WORD_GN); $$->text = strdup(yylval.string); fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); - fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); + fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); } | NUMBER { @@ -172,13 +172,14 @@ selector_part: ; selector_element: - selector_root selector_token_seq + selector_element_root selector_token_seq { // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { // if one is null assert(!selnode_start && !selnode_end); // both should be null selnode_start = new_node(SELECTOR_GN); // diverging node selnode_end = new_node(NUL_GN); // converging node + selnode_start->end = selnode_end; // duh } // add element head as a child of the selector @@ -210,13 +211,13 @@ selector_token_seq: } ; -selector_root: +selector_element_root: literal_token | placeholder_token ; selector_token: - selector_root + selector_element_root | option ; diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 0cc6896d8e..807ada9d98 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -4,9 +4,11 @@ #define GRAMMAR_STR "CLI grammar sandbox\n" +struct graph_node * nodegraph; + DEFUN (grammar_test, grammar_test_cmd, - "grammar .COMMAND", + "grammar parse .COMMAND", GRAMMAR_STR "command to pass to new parser\n") { @@ -22,17 +24,28 @@ DEFUN (grammar_test, strcat(cat, " "); } - struct graph_node *result = new_node(NUL_GN); - /* cmd_parse_format_new((const char*) cat, "lol", result);*/ - cmd_parse_format_new ("test lol", "lol", result); - cmd_parse_format_new ("test lol", "lol", result); - walk_graph(result, 0); - + //struct graph_node *result = new_node(NUL_GN); + cmd_parse_format_new((const char*) cat, "lol", nodegraph); + walk_graph(nodegraph, 0); + return CMD_SUCCESS; } +DEFUN (grammar_test_show, + grammar_test_show_cmd, + "grammar tree", + GRAMMAR_STR + "print current accumulated DFA\n") +{ + walk_graph(nodegraph, 0); + return CMD_SUCCESS; +} + void grammar_sandbox_init(void); void grammar_sandbox_init() { + fprintf(stderr, "reinitializing graph\n"); + nodegraph = new_node(NUL_GN); install_element (ENABLE_NODE, &grammar_test_cmd); + install_element (ENABLE_NODE, &grammar_test_show_cmd); } From 9d0662e009c0cf4532b88c9a1fb0f7c0dc174584 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 19 Jul 2016 21:14:27 +0000 Subject: [PATCH 011/280] lib: Break up functions, begin matcher Moved test hook out of command.c into vtysh.c, renamed graph modules, added matching code Signed-off-by: Quentin Young --- lib/Makefile.am | 4 +- lib/command.c | 6 - lib/{cmdtree.c => command_graph.c} | 2 +- lib/{cmdtree.h => command_graph.h} | 5 + lib/command_match.c | 174 +++++++++++++++++++++++++++++ lib/command_match.h | 69 ++++++++++++ lib/command_parse.y | 26 ++++- lib/grammar_sandbox.c | 43 +++++-- lib/grammar_sandbox.h | 2 + vtysh/vtysh.c | 4 + 10 files changed, 310 insertions(+), 25 deletions(-) rename lib/{cmdtree.c => command_graph.c} (99%) rename lib/{cmdtree.h => command_graph.h} (97%) create mode 100644 lib/command_match.c create mode 100644 lib/command_match.h create mode 100644 lib/grammar_sandbox.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 126303622f..2df5ed61f4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,7 +11,7 @@ libzebra_la_LDFLAGS = -version-info 0:0:0 libzebra_la_SOURCES = \ network.c pid_output.c getopt.c getopt1.c daemon.c \ checksum.c vector.c linklist.c vty.c \ - cmdtree.c command_parse.y command_lex.l \ + command_graph.c command_parse.y command_lex.l command_match.c grammar_sandbox.c \ command.c \ sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \ filter.c routemap.c distribute.c stream.c str.c log.c plist.c \ @@ -28,7 +28,7 @@ libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@ pkginclude_HEADERS = \ buffer.h checksum.h filter.h getopt.h hash.h \ if.h linklist.h log.h \ - cmdtree.h \ + command_graph.h command_match.h grammar_sandbox.h \ command.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \ diff --git a/lib/command.c b/lib/command.c index 4b571ba75d..490c2a0690 100644 --- a/lib/command.c +++ b/lib/command.c @@ -34,8 +34,6 @@ Boston, MA 02111-1307, USA. */ #include "workqueue.h" #include "vrf.h" -#include "grammar_sandbox.c" - /* Command vector which includes some level of command lists. Normally each daemon maintains each own cmdvec. */ vector cmdvec = NULL; @@ -4077,10 +4075,6 @@ cmd_init (int terminal) install_element (ENABLE_NODE, &show_version_cmd); install_element (ENABLE_NODE, &show_commandtree_cmd); - /**/ - grammar_sandbox_init(); - /**/ - if (terminal) { install_element (ENABLE_NODE, &config_terminal_length_cmd); diff --git a/lib/cmdtree.c b/lib/command_graph.c similarity index 99% rename from lib/cmdtree.c rename to lib/command_graph.c index 38632dca40..9b91eaf242 100644 --- a/lib/cmdtree.c +++ b/lib/command_graph.c @@ -7,7 +7,7 @@ */ #include -#include "cmdtree.h" +#include "command_graph.h" #include "memory.h" struct graph_node * diff --git a/lib/cmdtree.h b/lib/command_graph.h similarity index 97% rename from lib/cmdtree.h rename to lib/command_graph.h index 3d2366b008..8d23577d37 100644 --- a/lib/cmdtree.h +++ b/lib/command_graph.h @@ -1,3 +1,6 @@ +#ifndef COMMAND_GRAPH_H +#define COMMAND_GRAPH_H + #include "vty.h" #include "vector.h" @@ -78,3 +81,5 @@ new_node(enum graph_node_type); */ extern void walk_graph(struct graph_node *, int); + +#endif diff --git a/lib/command_match.c b/lib/command_match.c new file mode 100644 index 0000000000..bcc28bdc5b --- /dev/null +++ b/lib/command_match.c @@ -0,0 +1,174 @@ +#include +#include "memory.h" +#include "command_match.h" + +enum match_type +match_command (struct graph_node *start, enum filter_type filter, const char *input) +{ + // match input on DFA + return exact_match; +} + + +#define IPV4_ADDR_STR "0123456789." +#define IPV4_PREFIX_STR "0123456789./" + +enum match_type +cmd_ipv4_match (const char *str) +{ + struct sockaddr_in sin_dummy; + + if (str == NULL) + return partly_match; + + if (strspn (str, IPV4_ADDR_STR) != strlen (str)) + return no_match; + + if (inet_pton(AF_INET, str, &sin_dummy.sin_addr) != 1) + return no_match; + + return exact_match; +} + +enum match_type +cmd_ipv4_prefix_match (const char *str) +{ + struct sockaddr_in sin_dummy; + const char *delim = "/\0"; + char *dupe, *prefix, *mask, *context, *endptr; + int nmask = -1; + + if (str == NULL) + return partly_match; + + if (strspn (str, IPV4_PREFIX_STR) != strlen (str)) + return no_match; + + /* tokenize to address + mask */ + dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); + strncpy(dupe, str, strlen(str)+1); + prefix = strtok_r(dupe, delim, &context); + mask = strtok_r(NULL, delim, &context); + + if (!mask) + return partly_match; + + /* validate prefix */ + if (inet_pton(AF_INET, prefix, &sin_dummy.sin_addr) != 1) + return no_match; + + /* validate mask */ + nmask = strtol (mask, &endptr, 10); + if (*endptr != '\0' || nmask < 0 || nmask > 32) + return no_match; + + XFREE(MTYPE_TMP, dupe); + + return exact_match; +} + +#define IPV6_ADDR_STR "0123456789abcdefABCDEF:." +#define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./" + +#ifdef HAVE_IPV6 +enum match_type +cmd_ipv6_match (const char *str) +{ + struct sockaddr_in6 sin6_dummy; + int ret; + + if (str == NULL) + return partly_match; + + if (strspn (str, IPV6_ADDR_STR) != strlen (str)) + return no_match; + + ret = inet_pton(AF_INET6, str, &sin6_dummy.sin6_addr); + + if (ret == 1) + return exact_match; + + return no_match; +} + +enum match_type +cmd_ipv6_prefix_match (const char *str) +{ + struct sockaddr_in6 sin6_dummy; + const char *delim = "/\0"; + char *dupe, *prefix, *mask, *context, *endptr; + int nmask = -1; + + if (str == NULL) + return partly_match; + + if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) + return no_match; + + /* tokenize to address + mask */ + dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); + strncpy(dupe, str, strlen(str)+1); + prefix = strtok_r(dupe, delim, &context); + mask = strtok_r(NULL, delim, &context); + + if (!mask) + return partly_match; + + /* validate prefix */ + if (inet_pton(AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) + return no_match; + + /* validate mask */ + nmask = strtol (mask, &endptr, 10); + if (*endptr != '\0' || nmask < 0 || nmask > 128) + return no_match; + + XFREE(MTYPE_TMP, dupe); + + return exact_match; +} +#endif + +enum match_type +cmd_range_match (struct graph_node *rangenode, const char *str) +{ + char *endptr = NULL; + signed long long val; + + if (str == NULL) + return 1; + + val = strtoll (str, &endptr, 10); + if (*endptr != '\0') + return 0; + val = llabs(val); + + if (val < rangenode->min || val > rangenode->max) + return no_match; + else + return exact_match; +} + +enum match_type +cmd_word_match(struct graph_node *wordnode, + enum filter_type filter, + const char *word) +{ + if (filter == FILTER_RELAXED) + if (!word || !strlen(word)) + return partly_match; + + if (!word) + return no_match; + + if (filter == FILTER_RELAXED && !strncmp(wordnode->text, word, strlen(word))) + { + if (!strcmp(wordnode->text, word)) + return exact_match; + return partly_match; + } + if (filter == FILTER_STRICT && !strcmp(wordnode->text, word)) + return exact_match; + + return no_match; +} diff --git a/lib/command_match.h b/lib/command_match.h new file mode 100644 index 0000000000..cddeb08af7 --- /dev/null +++ b/lib/command_match.h @@ -0,0 +1,69 @@ +#ifndef COMMAND_MATCH_H +#define COMMAND_MATCH_H + +#include "command_graph.h" + +/** + * Filter types. These tell the parser whether to allow + * partial matching on tokens. + */ +enum filter_type +{ + FILTER_RELAXED, + FILTER_STRICT +}; + +/** + * Command matcher result value. + */ +enum matcher_rv +{ + MATCHER_OK, + MATCHER_COMPLETE, + MATCHER_INCOMPLETE, + MATCHER_NO_MATCH, + MATCHER_AMBIGUOUS, + MATCHER_EXCEED_ARGC_MAX +}; + +/* Completion match types. */ +enum match_type +{ + no_match, + partly_match, + exact_match +}; +/** + * Defines which matcher_rv values constitute + * an error. Should be used against matcher_rv + * return values to do basic error checking. + */ +#define MATCHER_ERROR(matcher_rv) \ + ( (matcher_rv) == MATCHER_INCOMPLETE \ + || (matcher_rv) == MATCHER_NO_MATCH \ + || (matcher_rv) == MATCHER_AMBIGUOUS \ + || (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \ + ) + +enum match_type +cmd_ipv4_match (const char *); + +enum match_type +cmd_ipv4_prefix_match (const char *); + +enum match_type +cmd_ipv6_match (const char *); + +enum match_type +cmd_ipv6_prefix_match (const char *); + +enum match_type +cmd_range_match (struct graph_node *, const char *str); + +enum match_type +cmd_word_match (struct graph_node *, enum filter_type, const char *); + +enum match_type +match_command (struct graph_node *, enum filter_type, const char *); + +#endif diff --git a/lib/command_parse.y b/lib/command_parse.y index cf2cd95bdd..80487af7cd 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -1,5 +1,15 @@ +/* + * Command format string parser. + * + * Turns a command definition into a DFA that together with the functions + * provided in command_match.c may be used to map command line input to a + * function. + * + * @author Quentin Young + */ + %{ -#include "cmdtree.h" +#include "command_graph.h" extern int yylex(void); extern void yyerror(const char *); @@ -8,16 +18,22 @@ extern void yyerror(const char *); #define YYDEBUG 1 %} %code provides { -extern struct graph_node *cmd_parse_format_new(const char *, const char *, struct graph_node *); -extern void set_buffer_string(const char *); +extern struct +graph_node *cmd_parse_format(const char *, + const char *, + struct graph_node *); +extern void +set_buffer_string(const char *); } +/* valid types for tokens */ %union{ int integer; char *string; struct graph_node *node; } +/* some helpful state variables */ %{ struct graph_node *startnode, // command root node *currnode, // current node @@ -66,7 +82,7 @@ sentence_root: WORD $$ = new_node(WORD_GN); $$->text = strdup(yylval.string); fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); - fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); + fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); currnode = $$; currnode->is_root = 1; @@ -270,7 +286,7 @@ void yyerror(char const *message) { } struct graph_node * -cmd_parse_format_new(const char *string, const char *desc, struct graph_node *start) +cmd_parse_format(const char *string, const char *desc, struct graph_node *start) { fprintf(stderr, "parsing: %s\n", string); diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 807ada9d98..1e6a76c69c 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -1,17 +1,14 @@ #include "command.h" +#include "command_graph.h" #include "command_parse.h" -#include "cmdtree.h" +#include "command_match.h" #define GRAMMAR_STR "CLI grammar sandbox\n" struct graph_node * nodegraph; -DEFUN (grammar_test, - grammar_test_cmd, - "grammar parse .COMMAND", - GRAMMAR_STR - "command to pass to new parser\n") -{ +/* +char* combine_vararg(char* argv, int argc) { size_t linesize = 0; for (int i = 0; i < argc; i++) linesize += strlen(argv[i]) + 1; @@ -24,8 +21,19 @@ DEFUN (grammar_test, strcat(cat, " "); } - //struct graph_node *result = new_node(NUL_GN); - cmd_parse_format_new((const char*) cat, "lol", nodegraph); + return cat; +} +*/ + +DEFUN (grammar_test, + grammar_test_cmd, + "grammar parse .COMMAND", + GRAMMAR_STR + "command to pass to new parser\n") +{ + + const char* command = argv_concat(argv, argc, 0); + cmd_parse_format(command, "lol", nodegraph); walk_graph(nodegraph, 0); return CMD_SUCCESS; @@ -37,8 +45,20 @@ DEFUN (grammar_test_show, GRAMMAR_STR "print current accumulated DFA\n") { - walk_graph(nodegraph, 0); - return CMD_SUCCESS; + walk_graph(nodegraph, 0); + return CMD_SUCCESS; +} + +DEFUN (grammar_test_match, + grammar_test_match_cmd, + "grammar match .COMMAND", + GRAMMAR_STR + "attempt to match input on DFA\n" + "command to match") +{ + const char* command = argv_concat(argv, argc, 0); + match_command(nodegraph, FILTER_STRICT, command); + return CMD_SUCCESS; } @@ -48,4 +68,5 @@ void grammar_sandbox_init() { nodegraph = new_node(NUL_GN); install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); + install_element (ENABLE_NODE, &grammar_test_match_cmd); } diff --git a/lib/grammar_sandbox.h b/lib/grammar_sandbox.h new file mode 100644 index 0000000000..2b2c742461 --- /dev/null +++ b/lib/grammar_sandbox.h @@ -0,0 +1,2 @@ +void +grammar_sandbox_init(void); diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ecb6c5c6ac..9d4061cfcf 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -42,6 +42,8 @@ #include "bgpd/bgp_vty.h" #include "vrf.h" +#include "lib/grammar_sandbox.h" + /* Struct VTY. */ struct vty *vty; @@ -3076,4 +3078,6 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &vtysh_enable_password_text_cmd); install_element (CONFIG_NODE, &no_vtysh_enable_password_cmd); + /* grammar sandbox */ + grammar_sandbox_init(); } From 18be0e599d1ba666e59a3d027e973eb41798f46f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 21 Jul 2016 21:38:03 +0000 Subject: [PATCH 012/280] lib: Mostly complete matcher Input matching and completions works. Still some rough edges. Signed-off-by: Quentin Young --- lib/command_graph.c | 66 ++++++++------- lib/command_graph.h | 7 ++ lib/command_match.c | 181 +++++++++++++++++++++++++++++++++++++++++- lib/command_match.h | 7 +- lib/command_parse.y | 4 +- lib/grammar_sandbox.c | 40 +++++----- 6 files changed, 249 insertions(+), 56 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 9b91eaf242..4e99884dc8 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -78,11 +78,19 @@ new_node(enum graph_node_type type) return node; } -void -walk_graph(struct graph_node *start, int level) +const char * +describe_node(struct graph_node *node) { + const char *desc = NULL; + char num[21]; + + if (node == NULL) { + desc = "(null node)"; + return desc; + } + // print this node - switch (start->type) { + switch (node->type) { case WORD_GN: case IPV4_GN: case IPV4_PREFIX_GN: @@ -90,44 +98,46 @@ walk_graph(struct graph_node *start, int level) case IPV6_PREFIX_GN: case VARIABLE_GN: case RANGE_GN: - fprintf(stderr, "%s", start->text); + desc = node->text; break; case NUMBER_GN: - fprintf(stderr, "%d", start->value); + sprintf(num, "%d", node->value); break; case SELECTOR_GN: - fprintf(stderr, "<>"); + desc = "<>"; break; case OPTION_GN: - fprintf(stderr, "[]"); + desc = "[]"; break; case NUL_GN: - fprintf(stderr, "NUL"); + desc = "NUL"; break; default: - fprintf(stderr, "ERROR"); + desc = "ERROR"; } - fprintf(stderr, "[%d] ", vector_active(start->children)); + return desc; +} - if (vector_active(start->children)) - for (unsigned int i = 0; i < vector_active(start->children); i++) - { - struct graph_node *r = vector_slot(start->children, i); - if (!r) { - fprintf(stderr, "Child seems null?\n"); - break; - } - else { - if (vector_active(start->children) > 1) { - fprintf(stderr, "\n"); - for (int i = 0; i < level+1; i++) - fprintf(stderr, " "); - walk_graph(r, level+1); - } - else - walk_graph(r, level); + +void +walk_graph(struct graph_node *start, int level) +{ + // print this node + fprintf(stderr, "%s[%d] ", describe_node(start), vector_active(start->children)); + + if (vector_active(start->children)) { + if (vector_active(start->children) == 1) + walk_graph(vector_slot(start->children, 0), level); + else { + fprintf(stderr, "\n"); + for (unsigned int i = 0; i < vector_active(start->children); i++) { + struct graph_node *r = vector_slot(start->children, i); + for (int j = 0; j < level+1; j++) + fprintf(stderr, " "); + walk_graph(r, level+1); } } - if (level == 0) + } + else fprintf(stderr, "\n"); } diff --git a/lib/command_graph.h b/lib/command_graph.h index 8d23577d37..081ecaac4c 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -82,4 +82,11 @@ new_node(enum graph_node_type); extern void walk_graph(struct graph_node *, int); +/** + * Returns a string representation of the given node. + * @param[in] the node to describe + * @return pointer to description string + */ +extern const char * +describe_node(struct graph_node *); #endif diff --git a/lib/command_match.c b/lib/command_match.c index bcc28bdc5b..f7e2789253 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -1,12 +1,187 @@ #include #include "memory.h" +#include "vector.h" #include "command_match.h" -enum match_type +static enum match_type +match_token (struct graph_node *node, char *token, enum filter_type filter) +{ + switch (node->type) { + case WORD_GN: + return cmd_word_match (node, filter, token); + case IPV4_GN: + return cmd_ipv4_match (token); + case IPV4_PREFIX_GN: + return cmd_ipv4_prefix_match (token); + case IPV6_GN: + return cmd_ipv6_match (token); + case IPV6_PREFIX_GN: + return cmd_ipv6_prefix_match (token); + case RANGE_GN: + return cmd_range_match (node, token); + case NUMBER_GN: + return node->value == atoi(token); + case VARIABLE_GN: + default: + return no_match; + } +} + +/* Breaking up string into each command piece. I assume given + character is separated by a space character. Return value is a + vector which includes char ** data element. */ +static vector +cmd_make_strvec (const char *string) +{ + const char *cp, *start; + char *token; + int strlen; + vector strvec; + + if (string == NULL) + return NULL; + + cp = string; + + /* Skip white spaces. */ + while (isspace ((int) *cp) && *cp != '\0') + cp++; + + /* Return if there is only white spaces */ + if (*cp == '\0') + return NULL; + + if (*cp == '!' || *cp == '#') + return NULL; + + /* Prepare return vector. */ + strvec = vector_init (VECTOR_MIN_SIZE); + + /* Copy each command piece and set into vector. */ + while (1) + { + start = cp; + while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && + *cp != '\0') + cp++; + strlen = cp - start; + token = XMALLOC (MTYPE_STRVEC, strlen + 1); + memcpy (token, start, strlen); + *(token + strlen) = '\0'; + vector_set (strvec, token); + + while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && + *cp != '\0') + cp++; + + if (*cp == '\0') + return strvec; + } +} + +/** + * Adds all children that are reachable by one parser hop + * to the given list. NUL_GN, SELECTOR_GN, and OPTION_GN + * nodes are treated as though their children are attached + * to their parent. + * + * @param[out] l the list to add the children to + * @param[in] node the node to get the children of + * @return the number of children added to the list + */ +static int +add_nexthops(struct list *l, struct graph_node *node) +{ + int added = 0; + struct graph_node *child; + for (unsigned int i = 0; i < vector_active(node->children); i++) + { + child = vector_slot(node->children, i); + if (child->type == OPTION_GN || child->type == SELECTOR_GN || child->type == NUL_GN) + added += add_nexthops(l, child); + else { + listnode_add(l, child); + added++; + } + } + return added; +} + +/** + * Compiles matches or next-hops for a given line of user input. + * + * Given a string of input and a start node for a matching DFA, runs the input + * against the DFA until the input is exhausted, there are no possible + * transitions, or both. + * If there are no further state transitions available, one of two scenarios is possible: + * - The end of input has been reached. This indicates a valid command. + * - The end of input has not yet been reached. The input does not match any command. + * If there are further transitions available, one of two scenarios is possible: + * - The current input is a valid prefix to a longer command + * - The current input matches a command + * - The current input matches a command, and is also a valid prefix to a longer command + * + * Any other states indicate a programming error. + * + * @param[in] start the start node of the DFA to match against + * @param[in] filter the filtering method + * @param[in] input the input string + * @return an array with two lists. The first list is + */ +struct list** match_command (struct graph_node *start, enum filter_type filter, const char *input) { - // match input on DFA - return exact_match; + // break command + vector command = cmd_make_strvec (input); + + // pointer to next input token to match + char *token; + + struct list *current = list_new(), // current nodes to match input token against + *matched = list_new(), // current nodes that match the input token + *next = list_new(); // possible next hops to current input token + + // pointers used for iterating lists + struct graph_node *cnode; + struct listnode *node; + + // add all children of start node to list + add_nexthops(next, start); + + unsigned int idx; + for (idx = 0; idx < vector_active(command) && next->count > 0; idx++) + { + list_free (current); + current = next; + next = list_new(); + + token = vector_slot(command, idx); + + list_delete_all_node(matched); + + for (ALL_LIST_ELEMENTS_RO(current,node,cnode)) + { + if (match_token(cnode, token, filter) == exact_match) { + listnode_add(matched, cnode); + add_nexthops(next, cnode); + } + } + } + + /* Variable summary + * ----------------------------------------------------------------- + * token = last input token processed + * idx = index in `command` of last token processed + * current = set of all transitions from the previous input token + * matched = set of all nodes reachable with current input + * next = set of all nodes reachable from all nodes in `matched` + */ + + struct list **result = malloc( 2 * sizeof(struct list *) ); + result[0] = matched; + result[1] = next; + + return result; } diff --git a/lib/command_match.h b/lib/command_match.h index cddeb08af7..4fc0995940 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -2,6 +2,7 @@ #define COMMAND_MATCH_H #include "command_graph.h" +#include "linklist.h" /** * Filter types. These tell the parser whether to allow @@ -27,11 +28,11 @@ enum matcher_rv }; /* Completion match types. */ -enum match_type +enum match_type { no_match, partly_match, - exact_match + exact_match }; /** * Defines which matcher_rv values constitute @@ -63,7 +64,7 @@ cmd_range_match (struct graph_node *, const char *str); enum match_type cmd_word_match (struct graph_node *, enum filter_type, const char *); -enum match_type +struct list** match_command (struct graph_node *, enum filter_type, const char *); #endif diff --git a/lib/command_parse.y b/lib/command_parse.y index 80487af7cd..9c1b3fff24 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -19,9 +19,7 @@ extern void yyerror(const char *); %} %code provides { extern struct -graph_node *cmd_parse_format(const char *, - const char *, - struct graph_node *); +graph_node *cmd_parse_format(const char *, const char *, struct graph_node *); extern void set_buffer_string(const char *); } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 1e6a76c69c..fab78f3e21 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -2,29 +2,12 @@ #include "command_graph.h" #include "command_parse.h" #include "command_match.h" +#include "linklist.h" #define GRAMMAR_STR "CLI grammar sandbox\n" struct graph_node * nodegraph; -/* -char* combine_vararg(char* argv, int argc) { - size_t linesize = 0; - for (int i = 0; i < argc; i++) - linesize += strlen(argv[i]) + 1; - - char* cat = malloc(linesize); - cat[0] = '\0'; - for (int i = 0; i < argc; i++) { - strcat(cat, argv[i]); - if (i != argc) - strcat(cat, " "); - } - - return cat; -} -*/ - DEFUN (grammar_test, grammar_test_cmd, "grammar parse .COMMAND", @@ -57,7 +40,26 @@ DEFUN (grammar_test_match, "command to match") { const char* command = argv_concat(argv, argc, 0); - match_command(nodegraph, FILTER_STRICT, command); + struct list **result = match_command(nodegraph, FILTER_STRICT, command); + struct list *matched = result[0]; + struct list *next = result[1]; + + if (matched->count == 0) // the last token tried yielded no matches + fprintf(stderr, "%% Unknown command\n"); + else + { + fprintf(stderr, "%% Matched full input, possible completions:\n"); + struct listnode *node; + struct graph_node *cnode; + // iterate through currently matched nodes to see if any are leaves + for (ALL_LIST_ELEMENTS_RO(matched,node,cnode)) + if (cnode->is_leaf) + fprintf(stderr, "\n"); + // print possible next hops, if any + for (ALL_LIST_ELEMENTS_RO(next,node,cnode)) + fprintf(stderr, "%s\n",describe_node(cnode)); + } + return CMD_SUCCESS; } From 880e24a1e4cc78cb23ebdd72f2e5cea861cf8be2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 22 Jul 2016 19:04:16 +0000 Subject: [PATCH 013/280] lib: Reorganize some matching stuff Introduce new node type, END_GN, and remove is_leaf flags. Reorganize command_match.c & remove internal functions from command_match.h. Start rewriting command.h in command_new.h with changes for new backend. Signed-off-by: Quentin Young --- lib/command_graph.c | 39 ++-- lib/command_graph.h | 20 +- lib/command_match.c | 262 ++++++++++++++----------- lib/command_match.h | 20 +- lib/command_new.h | 439 ++++++++++++++++++++++++++++++++++++++++++ lib/command_parse.y | 25 ++- lib/grammar_sandbox.c | 21 +- 7 files changed, 654 insertions(+), 172 deletions(-) create mode 100644 lib/command_new.h diff --git a/lib/command_graph.c b/lib/command_graph.c index 4e99884dc8..b81e35ac9a 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -53,6 +53,9 @@ cmp_node(struct graph_node *first, struct graph_node *second) case SELECTOR_GN: case OPTION_GN: return 0; + // end nodes are always considered equal, since each node may only + // have one at a time + case END_GN: default: break; } @@ -66,27 +69,23 @@ new_node(enum graph_node_type type) struct graph_node *node = malloc(sizeof(struct graph_node)); node->type = type; node->children = vector_init(VECTOR_MIN_SIZE); - node->is_leaf = 0; node->is_root = 0; node->end = NULL; node->text = NULL; node->value = 0; node->min = 0; node->max = 0; - node->func = NULL; + node->element = NULL; return node; } -const char * -describe_node(struct graph_node *node) +char * +describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) { - const char *desc = NULL; - char num[21]; - if (node == NULL) { - desc = "(null node)"; - return desc; + snprintf(buffer, bufsize, "(null node)"); + return buffer; } // print this node @@ -98,32 +97,38 @@ describe_node(struct graph_node *node) case IPV6_PREFIX_GN: case VARIABLE_GN: case RANGE_GN: - desc = node->text; + snprintf(buffer, bufsize, node->text); break; case NUMBER_GN: - sprintf(num, "%d", node->value); + snprintf(buffer, bufsize, "%d", node->value); break; case SELECTOR_GN: - desc = "<>"; + snprintf(buffer, bufsize, "<>"); break; case OPTION_GN: - desc = "[]"; + snprintf(buffer, bufsize, "[]"); break; case NUL_GN: - desc = "NUL"; + snprintf(buffer, bufsize, "NUL"); + break; + case END_GN: + snprintf(buffer, bufsize, "END"); break; default: - desc = "ERROR"; + snprintf(buffer, bufsize, "ERROR"); } - return desc; + + return buffer; } void walk_graph(struct graph_node *start, int level) { + char* desc = malloc(50); // print this node - fprintf(stderr, "%s[%d] ", describe_node(start), vector_active(start->children)); + fprintf(stderr, "%s[%d] ", describe_node(start, desc, 50), vector_active(start->children)); + free(desc); if (vector_active(start->children)) { if (vector_active(start->children) == 1) diff --git a/lib/command_graph.h b/lib/command_graph.h index 081ecaac4c..ce458d0b29 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -16,7 +16,8 @@ enum graph_node_type NUMBER_GN, SELECTOR_GN, OPTION_GN, - NUL_GN + NUL_GN, + END_GN }; struct graph_node @@ -24,15 +25,15 @@ struct graph_node enum graph_node_type type; vector children; int is_root; // true if first token in command - int is_leaf; // true if last token in command - struct graph_node * end; // pointer to end for selector & option + struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - int (*func)(struct vty *, int, const char *[]); + // cmd_element struct pointer, only valid for END_GN + struct cmd_element *element; /* various data fields for nodes */ - char* text; // for words and variables - int value; // for numbers - int min, max; // for ranges + char* text; // for WORD_GN and VARIABLE_GN + int value; // for NUMBER_GN + int min, max; // for RANGE_GN }; /* @@ -85,8 +86,9 @@ walk_graph(struct graph_node *, int); /** * Returns a string representation of the given node. * @param[in] the node to describe + * @param[out] the buffer to write the description into * @return pointer to description string */ -extern const char * -describe_node(struct graph_node *); +extern char * +describe_node(struct graph_node *, char *, unsigned int); #endif diff --git a/lib/command_match.c b/lib/command_match.c index f7e2789253..dbf9984ca8 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -3,6 +3,145 @@ #include "vector.h" #include "command_match.h" +/* prototypes */ +static int +add_nexthops(struct list *, struct graph_node *); + +static enum match_type +cmd_ipv4_match (const char *); + +static enum match_type +cmd_ipv4_prefix_match (const char *); + +static enum match_type +cmd_ipv6_match (const char *); + +static enum match_type +cmd_ipv6_prefix_match (const char *); + +static enum match_type +cmd_range_match (struct graph_node *, const char *str); + +static enum match_type +cmd_word_match (struct graph_node *, enum filter_type, const char *); + +static vector +cmd_make_strvec (const char *); + +static enum match_type +match_token (struct graph_node *, char *, enum filter_type); + +static vector +cmd_make_strvec (const char *); + +/* matching functions */ + +/** + * Compiles matches or next-hops for a given line of user input. + * + * Given a string of input and a start node for a matching DFA, runs the input + * against the DFA until the input is exhausted or a mismatch is encountered. + * + * This function returns all valid next hops away from the current node. + * - If the input is a valid prefix to a longer command(s), the set of next + * hops determines what tokens are valid to follow the prefix. In other words, + * the returned list is a list of possible completions. + * - If the input matched a full command, exactly one of the next hops will be + * a node of type END_GN and its function pointer will be set. + * - If the input did not match any valid token sequence, the returned list + * will be empty (there are no transitions away from a nonexistent state). + * + * @param[in] start the start node of the DFA to match against + * @param[in] filter the filtering method + * @param[in] input the input string + * @return pointer to linked list with all possible next hops from the last + * matched token. If this is empty, the input did not match any command. + */ +struct list * +match_command (struct graph_node *start, enum filter_type filter, const char *input) +{ + // break command + vector command = cmd_make_strvec (input); + + // pointer to next input token to match + char *token; + + struct list *current = list_new(), // current nodes to match input token against + *matched = list_new(), // current nodes that match the input token + *next = list_new(); // possible next hops to current input token + + // pointers used for iterating lists + struct graph_node *cnode; + struct listnode *node; + + // add all children of start node to list + add_nexthops(next, start); + + unsigned int idx; + for (idx = 0; idx < vector_active(command) && next->count > 0; idx++) + { + list_free (current); + current = next; + next = list_new(); + + token = vector_slot(command, idx); + + list_delete_all_node(matched); + + for (ALL_LIST_ELEMENTS_RO(current,node,cnode)) + { + if (match_token(cnode, token, filter) == exact_match) { + listnode_add(matched, cnode); + add_nexthops(next, cnode); + } + } + } + + /* Variable summary + * ----------------------------------------------------------------- + * token = last input token processed + * idx = index in `command` of last token processed + * current = set of all transitions from the previous input token + * matched = set of all nodes reachable with current input + * next = set of all nodes reachable from all nodes in `matched` + */ + list_free (current); + list_free (matched); + + return next; +} + +/** + * Adds all children that are reachable by one parser hop + * to the given list. NUL_GN, SELECTOR_GN, and OPTION_GN + * nodes are treated as though their children are attached + * to their parent. + * + * @param[out] l the list to add the children to + * @param[in] node the node to get the children of + * @return the number of children added to the list + */ +static int +add_nexthops(struct list *l, struct graph_node *node) +{ + int added = 0; + struct graph_node *child; + for (unsigned int i = 0; i < vector_active(node->children); i++) + { + child = vector_slot(node->children, i); + if (child->type == OPTION_GN || child->type == SELECTOR_GN || child->type == NUL_GN) + added += add_nexthops(l, child); + else { + listnode_add(l, child); + added++; + } + } + return added; +} + + +/* matching utility functions */ + static enum match_type match_token (struct graph_node *node, char *token, enum filter_type filter) { @@ -21,15 +160,14 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) return cmd_range_match (node, token); case NUMBER_GN: return node->value == atoi(token); + case NUL_GN: + return exact_match; case VARIABLE_GN: default: return no_match; } } -/* Breaking up string into each command piece. I assume given - character is separated by a space character. Return value is a - vector which includes char ** data element. */ static vector cmd_make_strvec (const char *string) { @@ -79,116 +217,10 @@ cmd_make_strvec (const char *string) } } -/** - * Adds all children that are reachable by one parser hop - * to the given list. NUL_GN, SELECTOR_GN, and OPTION_GN - * nodes are treated as though their children are attached - * to their parent. - * - * @param[out] l the list to add the children to - * @param[in] node the node to get the children of - * @return the number of children added to the list - */ -static int -add_nexthops(struct list *l, struct graph_node *node) -{ - int added = 0; - struct graph_node *child; - for (unsigned int i = 0; i < vector_active(node->children); i++) - { - child = vector_slot(node->children, i); - if (child->type == OPTION_GN || child->type == SELECTOR_GN || child->type == NUL_GN) - added += add_nexthops(l, child); - else { - listnode_add(l, child); - added++; - } - } - return added; -} - -/** - * Compiles matches or next-hops for a given line of user input. - * - * Given a string of input and a start node for a matching DFA, runs the input - * against the DFA until the input is exhausted, there are no possible - * transitions, or both. - * If there are no further state transitions available, one of two scenarios is possible: - * - The end of input has been reached. This indicates a valid command. - * - The end of input has not yet been reached. The input does not match any command. - * If there are further transitions available, one of two scenarios is possible: - * - The current input is a valid prefix to a longer command - * - The current input matches a command - * - The current input matches a command, and is also a valid prefix to a longer command - * - * Any other states indicate a programming error. - * - * @param[in] start the start node of the DFA to match against - * @param[in] filter the filtering method - * @param[in] input the input string - * @return an array with two lists. The first list is - */ -struct list** -match_command (struct graph_node *start, enum filter_type filter, const char *input) -{ - // break command - vector command = cmd_make_strvec (input); - - // pointer to next input token to match - char *token; - - struct list *current = list_new(), // current nodes to match input token against - *matched = list_new(), // current nodes that match the input token - *next = list_new(); // possible next hops to current input token - - // pointers used for iterating lists - struct graph_node *cnode; - struct listnode *node; - - // add all children of start node to list - add_nexthops(next, start); - - unsigned int idx; - for (idx = 0; idx < vector_active(command) && next->count > 0; idx++) - { - list_free (current); - current = next; - next = list_new(); - - token = vector_slot(command, idx); - - list_delete_all_node(matched); - - for (ALL_LIST_ELEMENTS_RO(current,node,cnode)) - { - if (match_token(cnode, token, filter) == exact_match) { - listnode_add(matched, cnode); - add_nexthops(next, cnode); - } - } - } - - /* Variable summary - * ----------------------------------------------------------------- - * token = last input token processed - * idx = index in `command` of last token processed - * current = set of all transitions from the previous input token - * matched = set of all nodes reachable with current input - * next = set of all nodes reachable from all nodes in `matched` - */ - - struct list **result = malloc( 2 * sizeof(struct list *) ); - result[0] = matched; - result[1] = next; - - return result; -} - - #define IPV4_ADDR_STR "0123456789." #define IPV4_PREFIX_STR "0123456789./" -enum match_type +static enum match_type cmd_ipv4_match (const char *str) { struct sockaddr_in sin_dummy; @@ -205,7 +237,7 @@ cmd_ipv4_match (const char *str) return exact_match; } -enum match_type +static enum match_type cmd_ipv4_prefix_match (const char *str) { struct sockaddr_in sin_dummy; @@ -246,7 +278,7 @@ cmd_ipv4_prefix_match (const char *str) #define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./" #ifdef HAVE_IPV6 -enum match_type +static enum match_type cmd_ipv6_match (const char *str) { struct sockaddr_in6 sin6_dummy; @@ -266,7 +298,7 @@ cmd_ipv6_match (const char *str) return no_match; } -enum match_type +static enum match_type cmd_ipv6_prefix_match (const char *str) { struct sockaddr_in6 sin6_dummy; @@ -304,7 +336,7 @@ cmd_ipv6_prefix_match (const char *str) } #endif -enum match_type +static enum match_type cmd_range_match (struct graph_node *rangenode, const char *str) { char *endptr = NULL; @@ -324,7 +356,7 @@ cmd_range_match (struct graph_node *rangenode, const char *str) return exact_match; } -enum match_type +static enum match_type cmd_word_match(struct graph_node *wordnode, enum filter_type filter, const char *word) diff --git a/lib/command_match.h b/lib/command_match.h index 4fc0995940..695dda2827 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -46,25 +46,7 @@ enum match_type || (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \ ) -enum match_type -cmd_ipv4_match (const char *); - -enum match_type -cmd_ipv4_prefix_match (const char *); - -enum match_type -cmd_ipv6_match (const char *); - -enum match_type -cmd_ipv6_prefix_match (const char *); - -enum match_type -cmd_range_match (struct graph_node *, const char *str); - -enum match_type -cmd_word_match (struct graph_node *, enum filter_type, const char *); - -struct list** +struct list * match_command (struct graph_node *, enum filter_type, const char *); #endif diff --git a/lib/command_new.h b/lib/command_new.h new file mode 100644 index 0000000000..972b420ae3 --- /dev/null +++ b/lib/command_new.h @@ -0,0 +1,439 @@ +/* + * Zebra configuration command interface routine + * Copyright (C) 1997, 98 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ZEBRA_COMMAND_H +#define _ZEBRA_COMMAND_H + +#include "vector.h" +#include "vty.h" +#include "lib/route_types.h" + +/* Host configuration variable */ +struct host +{ + /* Host name of this router. */ + char *name; + + /* Password for vty interface. */ + char *password; + char *password_encrypt; + + /* Enable password */ + char *enable; + char *enable_encrypt; + + /* System wide terminal lines. */ + int lines; + + /* Log filename. */ + char *logfile; + + /* config file name of this host */ + char *config; + + /* Flags for services */ + int advanced; + int encrypt; + + /* Banner configuration. */ + const char *motd; + char *motdfile; +}; + +/* There are some command levels which called from command node. */ +enum node_type +{ + AUTH_NODE, /* Authentication mode of vty interface. */ + RESTRICTED_NODE, /* Restricted view mode */ + VIEW_NODE, /* View node. Default mode of vty interface. */ + AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ + ENABLE_NODE, /* Enable node. */ + CONFIG_NODE, /* Config node. Default mode of config file. */ + SERVICE_NODE, /* Service node. */ + DEBUG_NODE, /* Debug node. */ + VRF_DEBUG_NODE, /* Vrf Debug node. */ + AAA_NODE, /* AAA node. */ + KEYCHAIN_NODE, /* Key-chain node. */ + KEYCHAIN_KEY_NODE, /* Key-chain key node. */ + VRF_NODE, /* VRF mode node. */ + INTERFACE_NODE, /* Interface mode node. */ + ZEBRA_NODE, /* zebra connection node. */ + TABLE_NODE, /* rtm_table selection node. */ + RIP_NODE, /* RIP protocol mode node. */ + RIPNG_NODE, /* RIPng protocol mode node. */ + BGP_NODE, /* BGP protocol mode which includes BGP4+ */ + BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ + BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ + BGP_IPV6_NODE, /* BGP IPv6 address family */ + BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ + BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ + BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ + OSPF_NODE, /* OSPF protocol mode */ + OSPF6_NODE, /* OSPF protocol for IPv6 mode */ + ISIS_NODE, /* ISIS protocol mode */ + PIM_NODE, /* PIM protocol mode */ + MASC_NODE, /* MASC for multicast. */ + IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ + IP_NODE, /* Static ip route node. */ + ACCESS_NODE, /* Access list node. */ + PREFIX_NODE, /* Prefix list node. */ + ACCESS_IPV6_NODE, /* Access list node. */ + PREFIX_IPV6_NODE, /* Prefix list node. */ + AS_LIST_NODE, /* AS list node. */ + COMMUNITY_LIST_NODE, /* Community list node. */ + RMAP_NODE, /* Route map node. */ + SMUX_NODE, /* SNMP configuration node. */ + DUMP_NODE, /* Packet dump node. */ + FORWARDING_NODE, /* IP forwarding node. */ + PROTOCOL_NODE, /* protocol filtering node */ + VTY_NODE, /* Vty node. */ +}; + +/* Node which has some commands and prompt string and configuration + function pointer . */ +struct cmd_node +{ + /* Node index. */ + enum node_type node; + + /* Prompt character at vty interface. */ + const char *prompt; + + /* Is this node's configuration goes to vtysh ? */ + int vtysh; + + /* Node's configuration write function */ + int (*func) (struct vty *); + + /* Start of this node's command graph */ + struct graph_node * commands; + /* Vector of this node's command list. + vector cmd_vector;*/ +}; + +enum +{ + CMD_ATTR_DEPRECATED = 1, + CMD_ATTR_HIDDEN, +}; + +/* Structure of command element. */ +struct cmd_element +{ + const char *string; // command format string + const char *doc; // command doc string + int daemon; // daemon associated with command + u_char attr; // Command attributes + + // function for this command + int (*func) (struct cmd_element *, struct vty *, int, const char *[]); +}; + +/* argument to be recorded on argv[] if it's not a literal */ +#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION) + +/* Return value of the commands. */ +#define CMD_SUCCESS 0 +#define CMD_WARNING 1 +#define CMD_ERR_NO_MATCH 2 +#define CMD_ERR_AMBIGUOUS 3 +#define CMD_ERR_INCOMPLETE 4 +#define CMD_ERR_EXEED_ARGC_MAX 5 +#define CMD_ERR_NOTHING_TODO 6 +#define CMD_COMPLETE_FULL_MATCH 7 +#define CMD_COMPLETE_MATCH 8 +#define CMD_COMPLETE_LIST_MATCH 9 +#define CMD_SUCCESS_DAEMON 10 +#define CMD_ERR_NO_FILE 11 + +/* Argc max counts. */ +#define CMD_ARGC_MAX 25 + +/* Turn off these macros when uisng cpp with extract.pl */ +#ifndef VTYSH_EXTRACT_PL + +/* helper defines for end-user DEFUN* macros */ +#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ + struct cmd_element cmdname = \ + { \ + .string = cmdstr, \ + .doc = helpstr, \ + .daemon = dnum, \ + .attr = attrs, \ + .func = funcname, \ + }; + +#define DEFUN_CMD_FUNC_DECL(funcname) \ + static int funcname (struct cmd_element *, struct vty *, int, const char *[]); + +#define DEFUN_CMD_FUNC_TEXT(funcname) \ + static int funcname \ + (struct cmd_element *self __attribute__ ((unused)), \ + struct vty *vty __attribute__ ((unused)), \ + int argc __attribute__ ((unused)), \ + const char *argv[] __attribute__ ((unused)) ) + +/* DEFUN for vty command interface. + * + * DEFUN(funcname, cmdname, cmdstr, helpstr) + * + * funcname + * ======== + * Name of the function that will be defined. + * + * cmdname + * ======= + * Name of the struct that will be defined for the command. + * + * cmdstr + * ====== + * The cmdstr defines the command syntax. It is used by the vty subsystem + * and vtysh to perform matching and completion in the CLI. + * + * Syntax Summary + * ---------------- + * + * + * Abbreviated BNF + * ---------------- + * + * + * + * helpstr + * ======= + * + * The helpstr is used to show a short explantion for the commands that + * are available when the user presses '?' on the CLI. It is the concatenation + * of the helpstrings for all the tokens that make up the command. + * + * There should be one helpstring for each token in the cmdstr except those + * containing other tokens, like Multiple or Keyword Tokens. For those, there + * will only be the helpstrings of the contained tokens. + * + * The individual helpstrings are expected to be in the same order as their + * respective Tokens appear in the cmdstr. They should each be terminated with + * a linefeed. The last helpstring should be terminated with a linefeed as well. + * + * Care should also be taken to avoid having similar tokens with different + * helpstrings. Imagine e.g. the commands "show ip ospf" and "show ip bgp". + * they both contain a helpstring for "show", but only one will be displayed + * when the user enters "sh?". If those two helpstrings differ, it is not + * defined which one will be shown and the behavior is therefore unpredictable. + */ +#define DEFUN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) + +#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) \ + +/* DEFUN_NOSH for commands that vtysh should ignore */ +#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ + DEFUN(funcname, cmdname, cmdstr, helpstr) + +/* DEFSH for vtysh. */ +#define DEFSH(daemon, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) \ + +#define DEFSH_HIDDEN(daemon, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) \ + +/* DEFUN + DEFSH */ +#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +/* DEFUN + DEFSH with attributes */ +#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) + +#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) + +/* ALIAS macro which define existing command's alias. */ +#define ALIAS(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) + +#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) + +#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0) + +#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0) + +#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) + +#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) + +#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon) + +#endif /* VTYSH_EXTRACT_PL */ + +/* Some macroes */ + +/* + * Sometimes #defines create maximum values that + * need to have strings created from them that + * allow the parser to match against them. + * These macros allow that. + */ +#define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s) +#define CMD_CREATE_STR_HELPER(s) #s +#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">" + +/* Common descriptions. */ +#define SHOW_STR "Show running system information\n" +#define IP_STR "IP information\n" +#define IPV6_STR "IPv6 information\n" +#define NO_STR "Negate a command or set its defaults\n" +#define REDIST_STR "Redistribute information from another routing protocol\n" +#define CLEAR_STR "Reset functions\n" +#define RIP_STR "RIP information\n" +#define BGP_STR "BGP information\n" +#define BGP_SOFT_STR "Soft reconfig inbound and outbound updates\n" +#define BGP_SOFT_IN_STR "Send route-refresh unless using 'soft-reconfiguration inbound'\n" +#define BGP_SOFT_OUT_STR "Resend all outbound updates\n" +#define BGP_SOFT_RSCLIENT_RIB_STR "Soft reconfig for rsclient RIB\n" +#define OSPF_STR "OSPF information\n" +#define NEIGHBOR_STR "Specify neighbor router\n" +#define DEBUG_STR "Debugging functions (see also 'undebug')\n" +#define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n" +#define ROUTER_STR "Enable a routing process\n" +#define AS_STR "AS number\n" +#define MBGP_STR "MBGP information\n" +#define MATCH_STR "Match values from routing table\n" +#define SET_STR "Set values in destination routing protocol\n" +#define OUT_STR "Filter outgoing routing updates\n" +#define IN_STR "Filter incoming routing updates\n" +#define V4NOTATION_STR "specify by IPv4 address notation(e.g. 0.0.0.0)\n" +#define OSPF6_NUMBER_STR "Specify by number\n" +#define INTERFACE_STR "Interface infomation\n" +#define IFNAME_STR "Interface name(e.g. ep0)\n" +#define IP6_STR "IPv6 Information\n" +#define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" +#define OSPF6_ROUTER_STR "Enable a routing process\n" +#define OSPF6_INSTANCE_STR "<1-65535> Instance ID\n" +#define SECONDS_STR "<1-65535> Seconds\n" +#define ROUTE_STR "Routing Table\n" +#define PREFIX_LIST_STR "Build a prefix list\n" +#define OSPF6_DUMP_TYPE_LIST \ +"(neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr)" +#define ISIS_STR "IS-IS information\n" +#define AREA_TAG_STR "[area tag]\n" +#define COMMUNITY_AANN_STR "Community number where AA and NN are <0-65535>\n" +#define COMMUNITY_VAL_STR "Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive\n" + +#define CONF_BACKUP_EXT ".sav" + +/* IPv4 only machine should not accept IPv6 address for peer's IP + address. So we replace VTY command string like below. */ +#ifdef HAVE_IPV6 +#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " +#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " +#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" +#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " +#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " +#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" +#define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" +#else +#define NEIGHBOR_CMD "neighbor A.B.C.D " +#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " +#define NEIGHBOR_ADDR_STR "Neighbor address\n" +#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " +#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " +#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" +#endif /* HAVE_IPV6 */ + +/* Dynamic neighbor (listen range) configuration */ +#ifdef HAVE_IPV6 +#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) " +#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" +#else +#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " +#define LISTEN_RANGE_ADDR_STR "Neighbor address\n" +#endif /* HAVE_IPV6 */ + +/* Prototypes. */ +extern void install_node (struct cmd_node *, int (*) (struct vty *)); +extern void install_default (enum node_type); +extern void install_element (enum node_type, struct cmd_element *); + +/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated + string with a space between each element (allocated using + XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ +extern char *argv_concat (const char **argv, int argc, int shift); + +extern vector cmd_make_strvec (const char *); +extern void cmd_free_strvec (vector); +extern vector cmd_describe_command (vector, struct vty *, int *status); +extern char **cmd_complete_command (vector, struct vty *, int *status); +extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib); +extern const char *cmd_prompt (enum node_type); +extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node); +extern int config_from_file (struct vty *, FILE *, unsigned int *line_num); +extern enum node_type node_parent (enum node_type); +extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int); +extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **); +extern void cmd_init (int); +extern void cmd_terminate (void); + +/* Export typical functions. */ +extern struct cmd_element config_end_cmd; +extern struct cmd_element config_exit_cmd; +extern struct cmd_element config_quit_cmd; +extern struct cmd_element config_help_cmd; +extern struct cmd_element config_list_cmd; +extern char *host_config_file (void); +extern void host_config_set (const char *); + +extern void print_version (const char *); + +extern int cmd_banner_motd_file (const char *); + +/* struct host global, ick */ +extern struct host host; + +/* "" global */ +extern char *command_cr; +#endif /* _ZEBRA_COMMAND_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index 9c1b3fff24..9f28391748 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -43,6 +43,8 @@ struct graph_node *optnode_start, // start node for option set struct graph_node *selnode_start, // start node for selector set *selnode_end; // end node for selector set + +const char *input; %} %token WORD @@ -73,7 +75,24 @@ struct graph_node *selnode_start, // start node for selector set %% start: sentence_root - cmd_token_seq; + cmd_token_seq +{ + // this should never happen... + if (currnode->type == END_GN) + yyerror("Unexpected leaf\n"); + + // create function pointer node + struct graph_node *end = new_node(END_GN); + + // set cmd_element + // + + // add node + add_node(currnode, end); + + // check that we did not get back an existing node + // +} sentence_root: WORD { @@ -279,6 +298,7 @@ option_token: %% void yyerror(char const *message) { + // fail on bad parse printf("Grammar error: %s\n", message); exit(EXIT_FAILURE); } @@ -296,7 +316,8 @@ cmd_parse_format(const char *string, const char *desc, struct graph_node *start) // trace parser yydebug = 1; // make flex read from a string - set_buffer_string(string); + input = string; + set_buffer_string(input); // initialize the start node of this command dfa startnode = start; // parse command into DFA diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index fab78f3e21..24f882c89f 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -40,25 +40,26 @@ DEFUN (grammar_test_match, "command to match") { const char* command = argv_concat(argv, argc, 0); - struct list **result = match_command(nodegraph, FILTER_STRICT, command); - struct list *matched = result[0]; - struct list *next = result[1]; + struct list *result = match_command(nodegraph, FILTER_STRICT, command); - if (matched->count == 0) // the last token tried yielded no matches + if (result->count == 0) // invalid command fprintf(stderr, "%% Unknown command\n"); else { fprintf(stderr, "%% Matched full input, possible completions:\n"); + char* desc = malloc(50); struct listnode *node; struct graph_node *cnode; - // iterate through currently matched nodes to see if any are leaves - for (ALL_LIST_ELEMENTS_RO(matched,node,cnode)) - if (cnode->is_leaf) - fprintf(stderr, "\n"); // print possible next hops, if any - for (ALL_LIST_ELEMENTS_RO(next,node,cnode)) - fprintf(stderr, "%s\n",describe_node(cnode)); + for (ALL_LIST_ELEMENTS_RO(result,node,cnode)) { + if (cnode->type == END_GN) + fprintf(stderr, ""); + else + fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); + } + free(desc); } + list_free(result); return CMD_SUCCESS; } From a53fbbf5f0e52793c262f9326340a606cf37500f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 26 Jul 2016 14:02:36 +0000 Subject: [PATCH 014/280] lib: Incremental matching improvement Shotgun changes to matching system Signed-off-by: Quentin Young --- lib/command_graph.h | 4 +- lib/command_match.c | 215 ++++++++++++++++++++++++++++---------------- lib/command_new.h | 6 +- lib/command_parse.y | 19 ++-- 4 files changed, 151 insertions(+), 93 deletions(-) diff --git a/lib/command_graph.h b/lib/command_graph.h index ce458d0b29..e57c078688 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -32,8 +32,8 @@ struct graph_node /* various data fields for nodes */ char* text; // for WORD_GN and VARIABLE_GN - int value; // for NUMBER_GN - int min, max; // for RANGE_GN + long value; // for NUMBER_GN + long min, max; // for RANGE_GN }; /* diff --git a/lib/command_match.c b/lib/command_match.c index dbf9984ca8..fd51572652 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -37,7 +37,30 @@ cmd_make_strvec (const char *); /* matching functions */ /** - * Compiles matches or next-hops for a given line of user input. + * Attempt to find an exact command match for a line of user input. + * + * @return cmd_element found, or NULL if there is no match. + */ +struct cmd_element +match_command (struct graph_node *start, vector *command, enum filter_type filter) +{ + // get all possible completions + struct list completions = match_command_complete (start, command, filter); + + // one of them should be END_GN if this command matches + struct graph_node *gn; + struct listnode *node; + for (ALL_LIST_ELEMENTS_RO(current,node,gn)) + { + if (gn->type == END_GN) + break; + gn = NULL; + } + return gn ? gn->element : NULL; +} + +/** + * Compiles next-hops for a given line of user input. * * Given a string of input and a start node for a matching DFA, runs the input * against the DFA until the input is exhausted or a mismatch is encountered. @@ -58,7 +81,7 @@ cmd_make_strvec (const char *); * matched token. If this is empty, the input did not match any command. */ struct list * -match_command (struct graph_node *start, enum filter_type filter, const char *input) +match_command_complete (struct graph_node *start, const char *input, enum filter_type filter) { // break command vector command = cmd_make_strvec (input); @@ -71,7 +94,7 @@ match_command (struct graph_node *start, enum filter_type filter, const char *in *next = list_new(); // possible next hops to current input token // pointers used for iterating lists - struct graph_node *cnode; + struct graph_node *gn; struct listnode *node; // add all children of start node to list @@ -88,11 +111,11 @@ match_command (struct graph_node *start, enum filter_type filter, const char *in list_delete_all_node(matched); - for (ALL_LIST_ELEMENTS_RO(current,node,cnode)) + for (ALL_LIST_ELEMENTS_RO(current,node,gn)) { - if (match_token(cnode, token, filter) == exact_match) { - listnode_add(matched, cnode); - add_nexthops(next, cnode); + if (match_token(gn, token, filter) == exact_match) { + listnode_add(matched, gn); + add_nexthops(next, gn); } } } @@ -129,16 +152,38 @@ add_nexthops(struct list *l, struct graph_node *node) for (unsigned int i = 0; i < vector_active(node->children); i++) { child = vector_slot(node->children, i); - if (child->type == OPTION_GN || child->type == SELECTOR_GN || child->type == NUL_GN) - added += add_nexthops(l, child); - else { - listnode_add(l, child); - added++; + switch (child->type) { + case OPTION_GN: + case SELECTOR_GN: + case NUL_GN: + added += add_nexthops(l, child); + break; + default: + listnode_add(l, child); + added++; } } return added; } +/** + * Build the appropriate argv for a matched command. + * + * @param[in] command the command element + * @param[in] the input line matching this command + * @param[out] argv + * @return argc + * +int +match_build_argv (struct cmd_element *command, vector *input, char *argv) +{ + // build individual command graph + struct graph_node *start = new_node(NUL_GN); + cmd_parse_format(start, command->string); + +} +*/ + /* matching utility functions */ @@ -159,64 +204,14 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) case RANGE_GN: return cmd_range_match (node, token); case NUMBER_GN: - return node->value == atoi(token); - case NUL_GN: - return exact_match; + return cmd_number_match (node, token); case VARIABLE_GN: + return cmd_variable_match (node, token); default: return no_match; } } -static vector -cmd_make_strvec (const char *string) -{ - const char *cp, *start; - char *token; - int strlen; - vector strvec; - - if (string == NULL) - return NULL; - - cp = string; - - /* Skip white spaces. */ - while (isspace ((int) *cp) && *cp != '\0') - cp++; - - /* Return if there is only white spaces */ - if (*cp == '\0') - return NULL; - - if (*cp == '!' || *cp == '#') - return NULL; - - /* Prepare return vector. */ - strvec = vector_init (VECTOR_MIN_SIZE); - - /* Copy each command piece and set into vector. */ - while (1) - { - start = cp; - while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && - *cp != '\0') - cp++; - strlen = cp - start; - token = XMALLOC (MTYPE_STRVEC, strlen + 1); - memcpy (token, start, strlen); - *(token + strlen) = '\0'; - vector_set (strvec, token); - - while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && - *cp != '\0') - cp++; - - if (*cp == '\0') - return strvec; - } -} - #define IPV4_ADDR_STR "0123456789." #define IPV4_PREFIX_STR "0123456789./" @@ -274,10 +269,10 @@ cmd_ipv4_prefix_match (const char *str) return exact_match; } +#ifdef HAVE_IPV6 #define IPV6_ADDR_STR "0123456789abcdefABCDEF:." #define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./" -#ifdef HAVE_IPV6 static enum match_type cmd_ipv6_match (const char *str) { @@ -361,21 +356,85 @@ cmd_word_match(struct graph_node *wordnode, enum filter_type filter, const char *word) { + if (filter == FILTER_RELAXED) + { if (!word || !strlen(word)) return partly_match; - - if (!word) - return no_match; - - if (filter == FILTER_RELAXED && !strncmp(wordnode->text, word, strlen(word))) - { - if (!strcmp(wordnode->text, word)) - return exact_match; - return partly_match; + else if (!strncmp(wordnode->text, word, strlen(word))) + return !strcmp(wordnode->text, word) ? exact_match : partly_match; + else + return no_match; + } + else + { + if (!word) + return no_match; + else + return !strcmp(wordnode->text, word) ? exact_match : no_match; } - if (filter == FILTER_STRICT && !strcmp(wordnode->text, word)) - return exact_match; - - return no_match; +} + +cmd_number_match(struct graph_node *numnode, const char *word) +{ + if (!strcmp("\0", word)) return no_match; + char *endptr; + long num = strtol(word, &endptr, 10); + if (endptr != '\0') return no_match; + return num == numnode->value ? exact_match : no_match; +} + +cmd_variable_match(struct graph_node *varnode, const char *word) +{ + // I guess this matches whatever? + return exact_match; +} + +static vector +cmd_make_strvec (const char *string) +{ + const char *cp, *start; + char *token; + int strlen; + vector strvec; + + if (string == NULL) + return NULL; + + cp = string; + + /* Skip white spaces. */ + while (isspace ((int) *cp) && *cp != '\0') + cp++; + + /* Return if there is only white spaces */ + if (*cp == '\0') + return NULL; + + if (*cp == '!' || *cp == '#') + return NULL; + + /* Prepare return vector. */ + strvec = vector_init (VECTOR_MIN_SIZE); + + /* Copy each command piece and set into vector. */ + while (1) + { + start = cp; + while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && + *cp != '\0') + cp++; + strlen = cp - start; + token = XMALLOC (MTYPE_STRVEC, strlen + 1); + memcpy (token, start, strlen); + *(token + strlen) = '\0'; + vector_set (strvec, token); + + while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && + *cp != '\0') + cp++; + + if (*cp == '\0') + return strvec; + } } diff --git a/lib/command_new.h b/lib/command_new.h index 972b420ae3..87f453d85a 100644 --- a/lib/command_new.h +++ b/lib/command_new.h @@ -127,9 +127,7 @@ struct cmd_node int (*func) (struct vty *); /* Start of this node's command graph */ - struct graph_node * commands; - /* Vector of this node's command list. - vector cmd_vector;*/ + struct graph_node * cmd_graph; }; enum @@ -209,7 +207,7 @@ struct cmd_element * cmdstr * ====== * The cmdstr defines the command syntax. It is used by the vty subsystem - * and vtysh to perform matching and completion in the CLI. + * and vtysh to perform matching and completion in the CLI. * * Syntax Summary * ---------------- diff --git a/lib/command_parse.y b/lib/command_parse.y index 9f28391748..1cef6766ae 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -10,6 +10,7 @@ %{ #include "command_graph.h" +#include "command_new.h" extern int yylex(void); extern void yyerror(const char *); @@ -44,7 +45,7 @@ struct graph_node *optnode_start, // start node for option set struct graph_node *selnode_start, // start node for selector set *selnode_end; // end node for selector set -const char *input; +const struct cmd_element *command; // command we're parsing %} %token WORD @@ -79,19 +80,18 @@ start: sentence_root { // this should never happen... if (currnode->type == END_GN) - yyerror("Unexpected leaf\n"); + yyerror("Unexpected leaf"); // create function pointer node struct graph_node *end = new_node(END_GN); - - // set cmd_element - // + end->element = command; // add node - add_node(currnode, end); + end = add_node(currnode, end); // check that we did not get back an existing node - // + if (!strcmp(command->string, end->element->string) + yyerror("Duplicate command."); } sentence_root: WORD @@ -304,7 +304,7 @@ void yyerror(char const *message) { } struct graph_node * -cmd_parse_format(const char *string, const char *desc, struct graph_node *start) +cmd_parse_format(struct graph_node *start, struct cmd_element *cmd) { fprintf(stderr, "parsing: %s\n", string); @@ -315,8 +315,9 @@ cmd_parse_format(const char *string, const char *desc, struct graph_node *start) // trace parser yydebug = 1; + // command string + command = cmd; // make flex read from a string - input = string; set_buffer_string(input); // initialize the start node of this command dfa startnode = start; From eceb106640e0279ed89e476c25f37f3b2da860fc Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 27 Jul 2016 01:35:46 +0000 Subject: [PATCH 015/280] lib: Add matching and argv support Queries may be run against DFA's to find matching cmd_element, and argument lists may be constructed. Signed-off-by: Quentin Young --- lib/command_graph.c | 4 +- lib/command_graph.h | 29 +-- lib/command_match.c | 259 ++++++++++++------------- lib/command_match.h | 58 +++++- lib/command_new.h | 437 ------------------------------------------ lib/command_parse.y | 43 +++-- lib/grammar_sandbox.c | 56 ++++-- 7 files changed, 256 insertions(+), 630 deletions(-) delete mode 100644 lib/command_new.h diff --git a/lib/command_graph.c b/lib/command_graph.c index b81e35ac9a..38baa802c3 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -6,8 +6,8 @@ * @author Quentin Young */ -#include #include "command_graph.h" +#include #include "memory.h" struct graph_node * @@ -100,7 +100,7 @@ describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) snprintf(buffer, bufsize, node->text); break; case NUMBER_GN: - snprintf(buffer, bufsize, "%d", node->value); + snprintf(buffer, bufsize, "%ld", node->value); break; case SELECTOR_GN: snprintf(buffer, bufsize, "<>"); diff --git a/lib/command_graph.h b/lib/command_graph.h index e57c078688..f0ded21262 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -1,8 +1,7 @@ #ifndef COMMAND_GRAPH_H #define COMMAND_GRAPH_H -#include "vty.h" -#include "vector.h" +#include "command.h" enum graph_node_type { @@ -22,18 +21,19 @@ enum graph_node_type struct graph_node { - enum graph_node_type type; - vector children; - int is_root; // true if first token in command + enum graph_node_type type;// data type this node matches or holds + int is_start; // whether this node is a start node + vector children; // this node's children struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - // cmd_element struct pointer, only valid for END_GN - struct cmd_element *element; - - /* various data fields for nodes */ char* text; // for WORD_GN and VARIABLE_GN - long value; // for NUMBER_GN - long min, max; // for RANGE_GN + long value; // for NUMBER_GN + long min, max; // for RANGE_GN + + /* cmd_element struct pointer, only valid for END_GN */ + struct cmd_element *element; + /* used for passing arguments to command functions */ + char *arg; }; /* @@ -91,4 +91,11 @@ walk_graph(struct graph_node *, int); */ extern char * describe_node(struct graph_node *, char *, unsigned int); + +/** + * Frees the data associated with a graph_node. + * @param[out] pointer to graph_node to free + */ +void +free_node(struct graph_node *); #endif diff --git a/lib/command_match.c b/lib/command_match.c index fd51572652..dc44f1b824 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -1,56 +1,55 @@ +#include "command_match.h" +#include "command_parse.h" #include #include "memory.h" -#include "vector.h" -#include "command_match.h" -/* prototypes */ +/* matcher helper prototypes */ static int add_nexthops(struct list *, struct graph_node *); +static struct list * +match_build_argv_r (struct graph_node *start, vector vline, unsigned int n); + +/* token matcher prototypes */ static enum match_type -cmd_ipv4_match (const char *); +match_ipv4 (const char *); static enum match_type -cmd_ipv4_prefix_match (const char *); +match_ipv4_prefix (const char *); static enum match_type -cmd_ipv6_match (const char *); +match_ipv6 (const char *); static enum match_type -cmd_ipv6_prefix_match (const char *); +match_ipv6_prefix (const char *); static enum match_type -cmd_range_match (struct graph_node *, const char *str); +match_range (struct graph_node *, const char *str); static enum match_type -cmd_word_match (struct graph_node *, enum filter_type, const char *); +match_word (struct graph_node *, enum filter_type, const char *); -static vector -cmd_make_strvec (const char *); +static enum match_type +match_number (struct graph_node *, const char *); + +static enum match_type +match_variable (struct graph_node *, const char *); static enum match_type match_token (struct graph_node *, char *, enum filter_type); -static vector -cmd_make_strvec (const char *); - /* matching functions */ -/** - * Attempt to find an exact command match for a line of user input. - * - * @return cmd_element found, or NULL if there is no match. - */ -struct cmd_element -match_command (struct graph_node *start, vector *command, enum filter_type filter) +struct cmd_element * +match_command (struct graph_node *start, const char *line, enum filter_type filter) { // get all possible completions - struct list completions = match_command_complete (start, command, filter); + struct list *completions = match_command_complete (start, line, filter); // one of them should be END_GN if this command matches struct graph_node *gn; struct listnode *node; - for (ALL_LIST_ELEMENTS_RO(current,node,gn)) + for (ALL_LIST_ELEMENTS_RO(completions,node,gn)) { if (gn->type == END_GN) break; @@ -59,32 +58,11 @@ match_command (struct graph_node *start, vector *command, enum filter_type filte return gn ? gn->element : NULL; } -/** - * Compiles next-hops for a given line of user input. - * - * Given a string of input and a start node for a matching DFA, runs the input - * against the DFA until the input is exhausted or a mismatch is encountered. - * - * This function returns all valid next hops away from the current node. - * - If the input is a valid prefix to a longer command(s), the set of next - * hops determines what tokens are valid to follow the prefix. In other words, - * the returned list is a list of possible completions. - * - If the input matched a full command, exactly one of the next hops will be - * a node of type END_GN and its function pointer will be set. - * - If the input did not match any valid token sequence, the returned list - * will be empty (there are no transitions away from a nonexistent state). - * - * @param[in] start the start node of the DFA to match against - * @param[in] filter the filtering method - * @param[in] input the input string - * @return pointer to linked list with all possible next hops from the last - * matched token. If this is empty, the input did not match any command. - */ struct list * -match_command_complete (struct graph_node *start, const char *input, enum filter_type filter) +match_command_complete (struct graph_node *start, const char *line, enum filter_type filter) { - // break command - vector command = cmd_make_strvec (input); + // vectorize command line + vector vline = cmd_make_strvec (line); // pointer to next input token to match char *token; @@ -101,13 +79,13 @@ match_command_complete (struct graph_node *start, const char *input, enum filter add_nexthops(next, start); unsigned int idx; - for (idx = 0; idx < vector_active(command) && next->count > 0; idx++) + for (idx = 0; idx < vector_active(vline) && next->count > 0; idx++) { list_free (current); current = next; next = list_new(); - token = vector_slot(command, idx); + token = vector_slot(vline, idx); list_delete_all_node(matched); @@ -131,14 +109,15 @@ match_command_complete (struct graph_node *start, const char *input, enum filter list_free (current); list_free (matched); + cmd_free_strvec(vline); + return next; } /** * Adds all children that are reachable by one parser hop * to the given list. NUL_GN, SELECTOR_GN, and OPTION_GN - * nodes are treated as though their children are attached - * to their parent. + * nodes are treated as transparent. * * @param[out] l the list to add the children to * @param[in] node the node to get the children of @@ -166,24 +145,73 @@ add_nexthops(struct list *l, struct graph_node *node) return added; } -/** - * Build the appropriate argv for a matched command. - * - * @param[in] command the command element - * @param[in] the input line matching this command - * @param[out] argv - * @return argc - * -int -match_build_argv (struct cmd_element *command, vector *input, char *argv) +struct list * +match_build_argv (const char *line, struct cmd_element *element) { - // build individual command graph - struct graph_node *start = new_node(NUL_GN); - cmd_parse_format(start, command->string); - -} -*/ + struct list *argv = NULL; + // parse command + struct graph_node *start = new_node(NUL_GN); + parse_command_format(start, element); + + vector vline = cmd_make_strvec (line); + + for (unsigned int i = 0; i < vector_active(start->children); i++) + { + // call recursive builder on each starting child + argv = match_build_argv_r (vector_slot(start->children, i), vline, 0); + // if any of them succeed, return their argv (there should only be one) + if (argv) break; + } + + return argv; +} + +static struct list * +match_build_argv_r (struct graph_node *start, vector vline, unsigned int n) +{ + // if we don't match this node, die + if (match_token(start, vector_slot(vline, n), FILTER_STRICT) == no_match) + return NULL; + + // some stuffs we need + struct list *argv = list_new(); + struct graph_node *gn; + struct listnode *ln; + + // append current arg + start->arg = strdup(vector_slot(vline, n)); + listnode_add(argv, start); + + // get all possible nexthops + struct list *next = list_new(); + add_nexthops(next, start); + + // check if one of them is END_GN + for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) + { + if (gn->type == END_GN){ + fprintf(stderr, "Hit END_GN while searching next set of node with text %s\n", start->text); + return argv; + } + } + + // if we have no more input, why even live? + if (n+1 >= vector_active(vline)) return NULL; + + // otherwise recurse on all nexthops + for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) + { + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); + struct list *result = match_build_argv_r (gn, vline, n+1); + if (result != NULL) { + list_add_list (argv, result); + return argv; + } + } + return NULL; +} /* matching utility functions */ @@ -192,21 +220,22 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) { switch (node->type) { case WORD_GN: - return cmd_word_match (node, filter, token); + return match_word (node, filter, token); case IPV4_GN: - return cmd_ipv4_match (token); + return match_ipv4 (token); case IPV4_PREFIX_GN: - return cmd_ipv4_prefix_match (token); + return match_ipv4_prefix (token); case IPV6_GN: - return cmd_ipv6_match (token); + return match_ipv6 (token); case IPV6_PREFIX_GN: - return cmd_ipv6_prefix_match (token); + return match_ipv6_prefix (token); case RANGE_GN: - return cmd_range_match (node, token); + return match_range (node, token); case NUMBER_GN: - return cmd_number_match (node, token); + return match_number (node, token); case VARIABLE_GN: - return cmd_variable_match (node, token); + return match_variable (node, token); + case END_GN: default: return no_match; } @@ -216,7 +245,7 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) #define IPV4_PREFIX_STR "0123456789./" static enum match_type -cmd_ipv4_match (const char *str) +match_ipv4 (const char *str) { struct sockaddr_in sin_dummy; @@ -233,7 +262,7 @@ cmd_ipv4_match (const char *str) } static enum match_type -cmd_ipv4_prefix_match (const char *str) +match_ipv4_prefix (const char *str) { struct sockaddr_in sin_dummy; const char *delim = "/\0"; @@ -274,7 +303,7 @@ cmd_ipv4_prefix_match (const char *str) #define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./" static enum match_type -cmd_ipv6_match (const char *str) +match_ipv6 (const char *str) { struct sockaddr_in6 sin6_dummy; int ret; @@ -294,7 +323,7 @@ cmd_ipv6_match (const char *str) } static enum match_type -cmd_ipv6_prefix_match (const char *str) +match_ipv6_prefix (const char *str) { struct sockaddr_in6 sin6_dummy; const char *delim = "/\0"; @@ -332,10 +361,10 @@ cmd_ipv6_prefix_match (const char *str) #endif static enum match_type -cmd_range_match (struct graph_node *rangenode, const char *str) +match_range (struct graph_node *rangenode, const char *str) { char *endptr = NULL; - signed long long val; + signed long val; if (str == NULL) return 1; @@ -352,11 +381,10 @@ cmd_range_match (struct graph_node *rangenode, const char *str) } static enum match_type -cmd_word_match(struct graph_node *wordnode, - enum filter_type filter, - const char *word) +match_word(struct graph_node *wordnode, + enum filter_type filter, + const char *word) { - if (filter == FILTER_RELAXED) { if (!word || !strlen(word)) @@ -375,7 +403,8 @@ cmd_word_match(struct graph_node *wordnode, } } -cmd_number_match(struct graph_node *numnode, const char *word) +static enum match_type +match_number(struct graph_node *numnode, const char *word) { if (!strcmp("\0", word)) return no_match; char *endptr; @@ -384,57 +413,11 @@ cmd_number_match(struct graph_node *numnode, const char *word) return num == numnode->value ? exact_match : no_match; } -cmd_variable_match(struct graph_node *varnode, const char *word) +#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" + +static enum match_type +match_variable(struct graph_node *varnode, const char *word) { - // I guess this matches whatever? - return exact_match; -} - -static vector -cmd_make_strvec (const char *string) -{ - const char *cp, *start; - char *token; - int strlen; - vector strvec; - - if (string == NULL) - return NULL; - - cp = string; - - /* Skip white spaces. */ - while (isspace ((int) *cp) && *cp != '\0') - cp++; - - /* Return if there is only white spaces */ - if (*cp == '\0') - return NULL; - - if (*cp == '!' || *cp == '#') - return NULL; - - /* Prepare return vector. */ - strvec = vector_init (VECTOR_MIN_SIZE); - - /* Copy each command piece and set into vector. */ - while (1) - { - start = cp; - while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && - *cp != '\0') - cp++; - strlen = cp - start; - token = XMALLOC (MTYPE_STRVEC, strlen + 1); - memcpy (token, start, strlen); - *(token + strlen) = '\0'; - vector_set (strvec, token); - - while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && - *cp != '\0') - cp++; - - if (*cp == '\0') - return strvec; - } + return strlen(word) == strspn(word, VARIABLE_ALPHABET) && isalpha(word[0]) ? + exact_match : no_match; } diff --git a/lib/command_match.h b/lib/command_match.h index 695dda2827..24cd1287e6 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -1,22 +1,21 @@ #ifndef COMMAND_MATCH_H #define COMMAND_MATCH_H +#include "command.h" #include "command_graph.h" #include "linklist.h" -/** - * Filter types. These tell the parser whether to allow - * partial matching on tokens. - */ + +/** These definitions exist in command.c in + * the current engine but will be relocated + * here in the new engine*/ enum filter_type { FILTER_RELAXED, FILTER_STRICT }; -/** - * Command matcher result value. - */ +/* matcher result value. */ enum matcher_rv { MATCHER_OK, @@ -34,8 +33,8 @@ enum match_type partly_match, exact_match }; -/** - * Defines which matcher_rv values constitute + +/* Defines which matcher_rv values constitute * an error. Should be used against matcher_rv * return values to do basic error checking. */ @@ -46,7 +45,46 @@ enum match_type || (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \ ) +/** + * Attempt to find an exact command match for a line of user input. + * + * @return cmd_element found, or NULL if there is no match. + */ +struct cmd_element * +match_command (struct graph_node *, const char *, enum filter_type); + +/** + * Compiles next-hops for a given line of user input. + * + * Given a string of input and a start node for a matching DFA, runs the input + * against the DFA until the input is exhausted or a mismatch is encountered. + * + * This function returns all valid next hops away from the current node. + * - If the input is a valid prefix to a longer command(s), the set of next + * hops determines what tokens are valid to follow the prefix. In other words, + * the returned list is a list of possible completions. + * - If the input matched a full command, exactly one of the next hops will be + * a node of type END_GN and its function pointer will be set. + * - If the input did not match any valid token sequence, the returned list + * will be empty (there are no transitions away from a nonexistent state). + * + * @param[in] start the start node of the DFA to match against + * @param[in] filter the filtering method + * @param[in] input the input string + * @return pointer to linked list with all possible next hops from the last + * matched token. If this is empty, the input did not match any command. + */ struct list * -match_command (struct graph_node *, enum filter_type, const char *); +match_command_complete (struct graph_node *, const char *, enum filter_type); + +/** + * Builds an argument list given a cmd_element and a matching input line. + * + * @param[in] input line + * @param[in] cmd_element struct + * @return pointer to argument linked list + */ +struct list * +match_build_argv (const char *, struct cmd_element *); #endif diff --git a/lib/command_new.h b/lib/command_new.h deleted file mode 100644 index 87f453d85a..0000000000 --- a/lib/command_new.h +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Zebra configuration command interface routine - * Copyright (C) 1997, 98 Kunihiro Ishiguro - * - * This file is part of GNU Zebra. - * - * GNU Zebra is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * GNU Zebra is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _ZEBRA_COMMAND_H -#define _ZEBRA_COMMAND_H - -#include "vector.h" -#include "vty.h" -#include "lib/route_types.h" - -/* Host configuration variable */ -struct host -{ - /* Host name of this router. */ - char *name; - - /* Password for vty interface. */ - char *password; - char *password_encrypt; - - /* Enable password */ - char *enable; - char *enable_encrypt; - - /* System wide terminal lines. */ - int lines; - - /* Log filename. */ - char *logfile; - - /* config file name of this host */ - char *config; - - /* Flags for services */ - int advanced; - int encrypt; - - /* Banner configuration. */ - const char *motd; - char *motdfile; -}; - -/* There are some command levels which called from command node. */ -enum node_type -{ - AUTH_NODE, /* Authentication mode of vty interface. */ - RESTRICTED_NODE, /* Restricted view mode */ - VIEW_NODE, /* View node. Default mode of vty interface. */ - AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ - ENABLE_NODE, /* Enable node. */ - CONFIG_NODE, /* Config node. Default mode of config file. */ - SERVICE_NODE, /* Service node. */ - DEBUG_NODE, /* Debug node. */ - VRF_DEBUG_NODE, /* Vrf Debug node. */ - AAA_NODE, /* AAA node. */ - KEYCHAIN_NODE, /* Key-chain node. */ - KEYCHAIN_KEY_NODE, /* Key-chain key node. */ - VRF_NODE, /* VRF mode node. */ - INTERFACE_NODE, /* Interface mode node. */ - ZEBRA_NODE, /* zebra connection node. */ - TABLE_NODE, /* rtm_table selection node. */ - RIP_NODE, /* RIP protocol mode node. */ - RIPNG_NODE, /* RIPng protocol mode node. */ - BGP_NODE, /* BGP protocol mode which includes BGP4+ */ - BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ - BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ - BGP_IPV6_NODE, /* BGP IPv6 address family */ - BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ - BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ - BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ - OSPF_NODE, /* OSPF protocol mode */ - OSPF6_NODE, /* OSPF protocol for IPv6 mode */ - ISIS_NODE, /* ISIS protocol mode */ - PIM_NODE, /* PIM protocol mode */ - MASC_NODE, /* MASC for multicast. */ - IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ - IP_NODE, /* Static ip route node. */ - ACCESS_NODE, /* Access list node. */ - PREFIX_NODE, /* Prefix list node. */ - ACCESS_IPV6_NODE, /* Access list node. */ - PREFIX_IPV6_NODE, /* Prefix list node. */ - AS_LIST_NODE, /* AS list node. */ - COMMUNITY_LIST_NODE, /* Community list node. */ - RMAP_NODE, /* Route map node. */ - SMUX_NODE, /* SNMP configuration node. */ - DUMP_NODE, /* Packet dump node. */ - FORWARDING_NODE, /* IP forwarding node. */ - PROTOCOL_NODE, /* protocol filtering node */ - VTY_NODE, /* Vty node. */ -}; - -/* Node which has some commands and prompt string and configuration - function pointer . */ -struct cmd_node -{ - /* Node index. */ - enum node_type node; - - /* Prompt character at vty interface. */ - const char *prompt; - - /* Is this node's configuration goes to vtysh ? */ - int vtysh; - - /* Node's configuration write function */ - int (*func) (struct vty *); - - /* Start of this node's command graph */ - struct graph_node * cmd_graph; -}; - -enum -{ - CMD_ATTR_DEPRECATED = 1, - CMD_ATTR_HIDDEN, -}; - -/* Structure of command element. */ -struct cmd_element -{ - const char *string; // command format string - const char *doc; // command doc string - int daemon; // daemon associated with command - u_char attr; // Command attributes - - // function for this command - int (*func) (struct cmd_element *, struct vty *, int, const char *[]); -}; - -/* argument to be recorded on argv[] if it's not a literal */ -#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION) - -/* Return value of the commands. */ -#define CMD_SUCCESS 0 -#define CMD_WARNING 1 -#define CMD_ERR_NO_MATCH 2 -#define CMD_ERR_AMBIGUOUS 3 -#define CMD_ERR_INCOMPLETE 4 -#define CMD_ERR_EXEED_ARGC_MAX 5 -#define CMD_ERR_NOTHING_TODO 6 -#define CMD_COMPLETE_FULL_MATCH 7 -#define CMD_COMPLETE_MATCH 8 -#define CMD_COMPLETE_LIST_MATCH 9 -#define CMD_SUCCESS_DAEMON 10 -#define CMD_ERR_NO_FILE 11 - -/* Argc max counts. */ -#define CMD_ARGC_MAX 25 - -/* Turn off these macros when uisng cpp with extract.pl */ -#ifndef VTYSH_EXTRACT_PL - -/* helper defines for end-user DEFUN* macros */ -#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ - struct cmd_element cmdname = \ - { \ - .string = cmdstr, \ - .doc = helpstr, \ - .daemon = dnum, \ - .attr = attrs, \ - .func = funcname, \ - }; - -#define DEFUN_CMD_FUNC_DECL(funcname) \ - static int funcname (struct cmd_element *, struct vty *, int, const char *[]); - -#define DEFUN_CMD_FUNC_TEXT(funcname) \ - static int funcname \ - (struct cmd_element *self __attribute__ ((unused)), \ - struct vty *vty __attribute__ ((unused)), \ - int argc __attribute__ ((unused)), \ - const char *argv[] __attribute__ ((unused)) ) - -/* DEFUN for vty command interface. - * - * DEFUN(funcname, cmdname, cmdstr, helpstr) - * - * funcname - * ======== - * Name of the function that will be defined. - * - * cmdname - * ======= - * Name of the struct that will be defined for the command. - * - * cmdstr - * ====== - * The cmdstr defines the command syntax. It is used by the vty subsystem - * and vtysh to perform matching and completion in the CLI. - * - * Syntax Summary - * ---------------- - * - * - * Abbreviated BNF - * ---------------- - * - * - * - * helpstr - * ======= - * - * The helpstr is used to show a short explantion for the commands that - * are available when the user presses '?' on the CLI. It is the concatenation - * of the helpstrings for all the tokens that make up the command. - * - * There should be one helpstring for each token in the cmdstr except those - * containing other tokens, like Multiple or Keyword Tokens. For those, there - * will only be the helpstrings of the contained tokens. - * - * The individual helpstrings are expected to be in the same order as their - * respective Tokens appear in the cmdstr. They should each be terminated with - * a linefeed. The last helpstring should be terminated with a linefeed as well. - * - * Care should also be taken to avoid having similar tokens with different - * helpstrings. Imagine e.g. the commands "show ip ospf" and "show ip bgp". - * they both contain a helpstring for "show", but only one will be displayed - * when the user enters "sh?". If those two helpstrings differ, it is not - * defined which one will be shown and the behavior is therefore unpredictable. - */ -#define DEFUN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) - -#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) \ - -/* DEFUN_NOSH for commands that vtysh should ignore */ -#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ - DEFUN(funcname, cmdname, cmdstr, helpstr) - -/* DEFSH for vtysh. */ -#define DEFSH(daemon, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) \ - -#define DEFSH_HIDDEN(daemon, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) \ - -/* DEFUN + DEFSH */ -#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -/* DEFUN + DEFSH with attributes */ -#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) - -#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) - -/* ALIAS macro which define existing command's alias. */ -#define ALIAS(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) - -#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) - -#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0) - -#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0) - -#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) - -#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) - -#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon) - -#endif /* VTYSH_EXTRACT_PL */ - -/* Some macroes */ - -/* - * Sometimes #defines create maximum values that - * need to have strings created from them that - * allow the parser to match against them. - * These macros allow that. - */ -#define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s) -#define CMD_CREATE_STR_HELPER(s) #s -#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">" - -/* Common descriptions. */ -#define SHOW_STR "Show running system information\n" -#define IP_STR "IP information\n" -#define IPV6_STR "IPv6 information\n" -#define NO_STR "Negate a command or set its defaults\n" -#define REDIST_STR "Redistribute information from another routing protocol\n" -#define CLEAR_STR "Reset functions\n" -#define RIP_STR "RIP information\n" -#define BGP_STR "BGP information\n" -#define BGP_SOFT_STR "Soft reconfig inbound and outbound updates\n" -#define BGP_SOFT_IN_STR "Send route-refresh unless using 'soft-reconfiguration inbound'\n" -#define BGP_SOFT_OUT_STR "Resend all outbound updates\n" -#define BGP_SOFT_RSCLIENT_RIB_STR "Soft reconfig for rsclient RIB\n" -#define OSPF_STR "OSPF information\n" -#define NEIGHBOR_STR "Specify neighbor router\n" -#define DEBUG_STR "Debugging functions (see also 'undebug')\n" -#define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n" -#define ROUTER_STR "Enable a routing process\n" -#define AS_STR "AS number\n" -#define MBGP_STR "MBGP information\n" -#define MATCH_STR "Match values from routing table\n" -#define SET_STR "Set values in destination routing protocol\n" -#define OUT_STR "Filter outgoing routing updates\n" -#define IN_STR "Filter incoming routing updates\n" -#define V4NOTATION_STR "specify by IPv4 address notation(e.g. 0.0.0.0)\n" -#define OSPF6_NUMBER_STR "Specify by number\n" -#define INTERFACE_STR "Interface infomation\n" -#define IFNAME_STR "Interface name(e.g. ep0)\n" -#define IP6_STR "IPv6 Information\n" -#define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" -#define OSPF6_ROUTER_STR "Enable a routing process\n" -#define OSPF6_INSTANCE_STR "<1-65535> Instance ID\n" -#define SECONDS_STR "<1-65535> Seconds\n" -#define ROUTE_STR "Routing Table\n" -#define PREFIX_LIST_STR "Build a prefix list\n" -#define OSPF6_DUMP_TYPE_LIST \ -"(neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr)" -#define ISIS_STR "IS-IS information\n" -#define AREA_TAG_STR "[area tag]\n" -#define COMMUNITY_AANN_STR "Community number where AA and NN are <0-65535>\n" -#define COMMUNITY_VAL_STR "Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive\n" - -#define CONF_BACKUP_EXT ".sav" - -/* IPv4 only machine should not accept IPv6 address for peer's IP - address. So we replace VTY command string like below. */ -#ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " -#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " -#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " -#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" -#define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" -#else -#define NEIGHBOR_CMD "neighbor A.B.C.D " -#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " -#define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " -#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" -#endif /* HAVE_IPV6 */ - -/* Dynamic neighbor (listen range) configuration */ -#ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) " -#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" -#else -#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " -#define LISTEN_RANGE_ADDR_STR "Neighbor address\n" -#endif /* HAVE_IPV6 */ - -/* Prototypes. */ -extern void install_node (struct cmd_node *, int (*) (struct vty *)); -extern void install_default (enum node_type); -extern void install_element (enum node_type, struct cmd_element *); - -/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated - string with a space between each element (allocated using - XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ -extern char *argv_concat (const char **argv, int argc, int shift); - -extern vector cmd_make_strvec (const char *); -extern void cmd_free_strvec (vector); -extern vector cmd_describe_command (vector, struct vty *, int *status); -extern char **cmd_complete_command (vector, struct vty *, int *status); -extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib); -extern const char *cmd_prompt (enum node_type); -extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node); -extern int config_from_file (struct vty *, FILE *, unsigned int *line_num); -extern enum node_type node_parent (enum node_type); -extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int); -extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **); -extern void cmd_init (int); -extern void cmd_terminate (void); - -/* Export typical functions. */ -extern struct cmd_element config_end_cmd; -extern struct cmd_element config_exit_cmd; -extern struct cmd_element config_quit_cmd; -extern struct cmd_element config_help_cmd; -extern struct cmd_element config_list_cmd; -extern char *host_config_file (void); -extern void host_config_set (const char *); - -extern void print_version (const char *); - -extern int cmd_banner_motd_file (const char *); - -/* struct host global, ick */ -extern struct host host; - -/* "" global */ -extern char *command_cr; -#endif /* _ZEBRA_COMMAND_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index 1cef6766ae..7b56aec952 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -9,21 +9,23 @@ */ %{ -#include "command_graph.h" -#include "command_new.h" - extern int yylex(void); extern void yyerror(const char *); // compile with debugging facilities #define YYDEBUG 1 %} -%code provides { -extern struct -graph_node *cmd_parse_format(const char *, const char *, struct graph_node *); -extern void -set_buffer_string(const char *); +%code requires { + #include "command.h" + #include "command_graph.h" } +%code provides { + extern void + set_buffer_string(const char *); + struct graph_node * + parse_command_format(struct graph_node *, struct cmd_element *); +} + /* valid types for tokens */ %union{ @@ -45,7 +47,7 @@ struct graph_node *optnode_start, // start node for option set struct graph_node *selnode_start, // start node for selector set *selnode_end; // end node for selector set -const struct cmd_element *command; // command we're parsing +struct cmd_element *command; // command we're parsing %} %token WORD @@ -86,12 +88,16 @@ start: sentence_root struct graph_node *end = new_node(END_GN); end->element = command; + // ensure there are no END_GN children + for (unsigned int i = 0; i < vector_active(currnode->children); i++) + { + struct graph_node *child = vector_slot(currnode->children, i); + if (child->type == END_GN) + yyerror("Duplicate command."); + } + // add node end = add_node(currnode, end); - - // check that we did not get back an existing node - if (!strcmp(command->string, end->element->string) - yyerror("Duplicate command."); } sentence_root: WORD @@ -166,12 +172,7 @@ placeholder_token: // get the numbers out strsep(&yylval.string, "(-)"); $$->min = atoi( strsep(&yylval.string, "(-)") ); - strsep(&yylval.string, "(-)"); $$->max = atoi( strsep(&yylval.string, "(-)") ); - - // we could do this a variety of ways with either - // the lexer or the parser, but this is the simplest - // and involves the least amount of free() } ; @@ -304,9 +305,9 @@ void yyerror(char const *message) { } struct graph_node * -cmd_parse_format(struct graph_node *start, struct cmd_element *cmd) +parse_command_format(struct graph_node *start, struct cmd_element *cmd) { - fprintf(stderr, "parsing: %s\n", string); + fprintf(stderr, "parsing: %s\n", cmd->string); /* clear state pointers */ startnode = currnode = seqhead = NULL; @@ -318,7 +319,7 @@ cmd_parse_format(struct graph_node *start, struct cmd_element *cmd) // command string command = cmd; // make flex read from a string - set_buffer_string(input); + set_buffer_string(command->string); // initialize the start node of this command dfa startnode = start; // parse command into DFA diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 24f882c89f..6eee9c8b65 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -14,11 +14,11 @@ DEFUN (grammar_test, GRAMMAR_STR "command to pass to new parser\n") { - - const char* command = argv_concat(argv, argc, 0); - cmd_parse_format(command, "lol", nodegraph); + char* command = argv_concat(argv, argc, 0); + struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); + cmd->string = command; + parse_command_format(nodegraph, cmd); walk_graph(nodegraph, 0); - return CMD_SUCCESS; } @@ -32,15 +32,15 @@ DEFUN (grammar_test_show, return CMD_SUCCESS; } -DEFUN (grammar_test_match, - grammar_test_match_cmd, - "grammar match .COMMAND", +DEFUN (grammar_test_complete, + grammar_test_complete_cmd, + "grammar complete .COMMAND", GRAMMAR_STR - "attempt to match input on DFA\n" - "command to match") + "attempt to complete input on DFA\n" + "command to complete") { const char* command = argv_concat(argv, argc, 0); - struct list *result = match_command(nodegraph, FILTER_STRICT, command); + struct list *result = match_command_complete (nodegraph, command, FILTER_STRICT); if (result->count == 0) // invalid command fprintf(stderr, "%% Unknown command\n"); @@ -53,7 +53,7 @@ DEFUN (grammar_test_match, // print possible next hops, if any for (ALL_LIST_ELEMENTS_RO(result,node,cnode)) { if (cnode->type == END_GN) - fprintf(stderr, ""); + fprintf(stderr, "\n"); else fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); } @@ -64,6 +64,39 @@ DEFUN (grammar_test_match, return CMD_SUCCESS; } +DEFUN (grammar_test_match, + grammar_test_match_cmd, + "grammar match .COMMAND", + GRAMMAR_STR + "attempt to match input on DFA\n" + "command to match") +{ + const char* command = argv_concat(argv, argc, 0); + struct cmd_element *element = match_command (nodegraph, command, FILTER_STRICT); + + if (element) + fprintf(stderr, "Matched: %s\n", element->string); + else { + fprintf(stderr, "Returned NULL\n"); + return CMD_SUCCESS; + } + + struct list *argvv = match_build_argv (command, element); + fprintf(stderr, "num args: %d\n", argvv->count); + + struct listnode *ln; + struct graph_node *gn; + for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) { + fprintf(stderr, "node text: %s\n", gn->text); + if (gn->arg) + fprintf(stderr, "node arg: %s\n", gn->arg); + else + fprintf(stderr, "No arg.\n"); + } + + return CMD_SUCCESS; +} + void grammar_sandbox_init(void); void grammar_sandbox_init() { @@ -72,4 +105,5 @@ void grammar_sandbox_init() { install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); install_element (ENABLE_NODE, &grammar_test_match_cmd); + install_element (ENABLE_NODE, &grammar_test_complete_cmd); } From 5a5d576b346b03888636bcb0af31efb8a1e43cc2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 27 Jul 2016 04:17:51 +0000 Subject: [PATCH 016/280] lib: Cleanup parser memory management Free as appropriate. Additionally add new type of node to demark graph head (START_GN). Signed-off-by: Quentin Young --- lib/command_graph.c | 48 +++++++++++++++------- lib/command_graph.h | 17 ++++---- lib/command_parse.y | 96 +++++++++++++++++++++++-------------------- lib/grammar_sandbox.c | 2 +- 4 files changed, 95 insertions(+), 68 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 38baa802c3..a5880f34a6 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -32,18 +32,18 @@ cmp_node(struct graph_node *first, struct graph_node *second) if (first->type != second->type) return 0; switch (first->type) { - case WORD_GN: // words and variables are equal if their - case VARIABLE_GN: // text value is equal + case WORD_GN: + case VARIABLE_GN: if (first->text && second->text) { if (strcmp(first->text, second->text)) return 0; } else if (first->text != second->text) return 0; break; - case RANGE_GN: // ranges are equal if their bounds are equal + case RANGE_GN: if (first->min != second->min || first->max != second->max) return 0; break; - case NUMBER_GN: // numbers are equal if their values are equal + case NUMBER_GN: if (first->value != second->value) return 0; break; /* selectors and options should be equal if all paths are equal, @@ -53,8 +53,10 @@ cmp_node(struct graph_node *first, struct graph_node *second) case SELECTOR_GN: case OPTION_GN: return 0; - // end nodes are always considered equal, since each node may only - // have one at a time + /* end nodes are always considered equal, since each node may only + * have one at a time + */ + case START_GN: case END_GN: default: break; @@ -66,20 +68,34 @@ cmp_node(struct graph_node *first, struct graph_node *second) struct graph_node * new_node(enum graph_node_type type) { - struct graph_node *node = malloc(sizeof(struct graph_node)); + struct graph_node *node = + XMALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); + node->type = type; node->children = vector_init(VECTOR_MIN_SIZE); - node->is_root = 0; - node->end = NULL; - node->text = NULL; - node->value = 0; - node->min = 0; - node->max = 0; - node->element = NULL; + node->is_start = 0; + node->end = NULL; + node->text = NULL; + node->value = 0; + node->min = 0; + node->max = 0; + node->element = NULL; return node; } +void +free_node (struct graph_node *node) +{ + if (!node) return; + free_node (node->end); + vector_free (node->children); + free (node->text); + free (node->arg); + free (node->element); + free (node); +} + char * describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) { @@ -114,6 +130,9 @@ describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) case END_GN: snprintf(buffer, bufsize, "END"); break; + case START_GN: + snprintf(buffer, bufsize, "START"); + break; default: snprintf(buffer, bufsize, "ERROR"); } @@ -146,3 +165,4 @@ walk_graph(struct graph_node *start, int level) else fprintf(stderr, "\n"); } + diff --git a/lib/command_graph.h b/lib/command_graph.h index f0ded21262..f82bbd052b 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -16,6 +16,7 @@ enum graph_node_type SELECTOR_GN, OPTION_GN, NUL_GN, + START_GN, END_GN }; @@ -26,9 +27,9 @@ struct graph_node vector children; // this node's children struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - char* text; // for WORD_GN and VARIABLE_GN - long value; // for NUMBER_GN - long min, max; // for RANGE_GN + char* text; // for WORD_GN and VARIABLE_GN + long value; // for NUMBER_GN + long min, max; // for RANGE_GN /* cmd_element struct pointer, only valid for END_GN */ struct cmd_element *element; @@ -37,14 +38,14 @@ struct graph_node }; /* - * Adds a child to a node. - * If the node already has the exact same child, nothing is done. This is - * decided with cmp_node. + * Adds a node as a child of another node. + * If the new parent has a child that is equal to the prospective child, as + * determined by cmp_node, then a pointer to the existing node is returned and + * the prospective child is not added. Otherwise the return value is NULL. * * @param[in] parent node * @param[in] child node - * @return the new child, or the existing child if the parent already has the - * new child + * @return pointer to child if it is added, pointer to existing child otherwise */ extern struct graph_node * add_node(struct graph_node *, struct graph_node *); diff --git a/lib/command_parse.y b/lib/command_parse.y index 7b56aec952..8c0584facd 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -18,6 +18,7 @@ extern void yyerror(const char *); %code requires { #include "command.h" #include "command_graph.h" + #include "memory.h" } %code provides { extern void @@ -50,14 +51,14 @@ struct graph_node *selnode_start, // start node for selector set struct cmd_element *command; // command we're parsing %} -%token WORD -%token IPV4 -%token IPV4_PREFIX -%token IPV6 -%token IPV6_PREFIX -%token VARIABLE -%token RANGE -%token NUMBER +%token WORD +%token IPV4 +%token IPV4_PREFIX +%token IPV6 +%token IPV6_PREFIX +%token VARIABLE +%token RANGE +%token NUMBER %type start %type sentence_root @@ -80,44 +81,45 @@ struct cmd_element *command; // command we're parsing start: sentence_root cmd_token_seq { - // this should never happen... - if (currnode->type == END_GN) - yyerror("Unexpected leaf"); - - // create function pointer node + // create leaf node struct graph_node *end = new_node(END_GN); end->element = command; - // ensure there are no END_GN children - for (unsigned int i = 0; i < vector_active(currnode->children); i++) - { - struct graph_node *child = vector_slot(currnode->children, i); - if (child->type == END_GN) - yyerror("Duplicate command."); - } - // add node - end = add_node(currnode, end); + if (add_node(currnode, end) != end) + { + yyerror("Duplicate command."); + YYABORT; + } } sentence_root: WORD { - $$ = new_node(WORD_GN); - $$->text = strdup(yylval.string); - fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); - fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); + struct graph_node *root = new_node(WORD_GN); + root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - currnode = $$; - currnode->is_root = 1; - currnode = add_node(startnode, currnode); + currnode = add_node(startnode, root); + if (currnode != root) + free (root); + + free ($1); + $$ = currnode; }; /* valid top level tokens */ cmd_token: placeholder_token -{ currnode = add_node(currnode, $1); } +{ + currnode = add_node(currnode, $1); + if (currnode != $1) + free_node ($1); +} | literal_token -{ currnode = add_node(currnode, $1); } +{ + currnode = add_node(currnode, $1); + if (currnode != $1) + free_node ($1); +} /* selectors and options are subgraphs with start and end nodes */ | selector { @@ -142,37 +144,44 @@ placeholder_token: IPV4 { $$ = new_node(IPV4_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | IPV4_PREFIX { $$ = new_node(IPV4_PREFIX_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | IPV6 { $$ = new_node(IPV6_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | IPV6_PREFIX { $$ = new_node(IPV6_PREFIX_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | VARIABLE { $$ = new_node(VARIABLE_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | RANGE { $$ = new_node(RANGE_GN); - $$->text = strdup(yylval.string); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); // get the numbers out strsep(&yylval.string, "(-)"); $$->min = atoi( strsep(&yylval.string, "(-)") ); $$->max = atoi( strsep(&yylval.string, "(-)") ); + + free ($1); } ; @@ -180,9 +189,8 @@ literal_token: WORD { $$ = new_node(WORD_GN); - $$->text = strdup(yylval.string); - fprintf(stderr, ">>>>>>>> YYLVAL.STRING: %s\n", yylval.string); - fprintf(stderr, ">>>>>>>> TEXT: %s\n", $$->text); + $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + free ($1); } | NUMBER { @@ -300,8 +308,7 @@ option_token: void yyerror(char const *message) { // fail on bad parse - printf("Grammar error: %s\n", message); - exit(EXIT_FAILURE); + fprintf(stderr, "Grammar error: %s\n", message); } struct graph_node * @@ -310,7 +317,8 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) fprintf(stderr, "parsing: %s\n", cmd->string); /* clear state pointers */ - startnode = currnode = seqhead = NULL; + startnode = start; + currnode = seqhead = NULL; selnode_start = selnode_end = NULL; optnode_start = optnode_end = NULL; @@ -320,8 +328,6 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) command = cmd; // make flex read from a string set_buffer_string(command->string); - // initialize the start node of this command dfa - startnode = start; // parse command into DFA yyparse(); // startnode points to command DFA diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 6eee9c8b65..f78ba060a6 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -101,7 +101,7 @@ DEFUN (grammar_test_match, void grammar_sandbox_init(void); void grammar_sandbox_init() { fprintf(stderr, "reinitializing graph\n"); - nodegraph = new_node(NUL_GN); + nodegraph = new_node(START_GN); install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); install_element (ENABLE_NODE, &grammar_test_match_cmd); From 76699ae7e0358c57a1186b88962d7233a7057d76 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 27 Jul 2016 23:30:21 +0000 Subject: [PATCH 017/280] lib: Improve argv construction Fixed a variety of failure cases and wrote a nice doc string. Reverted add_node doc string to correct explanation of procedure. Signed-off-by: Quentin Young --- lib/command_graph.h | 6 +- lib/command_match.c | 167 ++++++++++++++++++++++++++++++++++++------ lib/grammar_sandbox.c | 17 ++--- 3 files changed, 154 insertions(+), 36 deletions(-) diff --git a/lib/command_graph.h b/lib/command_graph.h index f82bbd052b..a9ffe0f7b6 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -5,14 +5,14 @@ enum graph_node_type { - WORD_GN, IPV4_GN, IPV4_PREFIX_GN, IPV6_GN, IPV6_PREFIX_GN, - VARIABLE_GN, + WORD_GN, RANGE_GN, NUMBER_GN, + VARIABLE_GN, SELECTOR_GN, OPTION_GN, NUL_GN, @@ -41,7 +41,7 @@ struct graph_node * Adds a node as a child of another node. * If the new parent has a child that is equal to the prospective child, as * determined by cmp_node, then a pointer to the existing node is returned and - * the prospective child is not added. Otherwise the return value is NULL. + * the prospective child is not added. Otherwise the child node is returned. * * @param[in] parent node * @param[in] child node diff --git a/lib/command_match.c b/lib/command_match.c index dc44f1b824..023faafade 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -8,7 +8,10 @@ static int add_nexthops(struct list *, struct graph_node *); static struct list * -match_build_argv_r (struct graph_node *start, vector vline, unsigned int n); +match_build_argv_r (struct graph_node *, vector, unsigned int); + +static int +score_precedence (struct graph_node *); /* token matcher prototypes */ static enum match_type @@ -160,61 +163,181 @@ match_build_argv (const char *line, struct cmd_element *element) { // call recursive builder on each starting child argv = match_build_argv_r (vector_slot(start->children, i), vline, 0); - // if any of them succeed, return their argv (there should only be one) + // if any of them succeed, return their argv + // since all command DFA's must begin with a word and these are deduplicated, + // no need to check precedence if (argv) break; } return argv; } +/** + * Builds an argument list given a DFA and a matching input line. + * This function should be passed the start node of the DFA, a matching + * input line, and the index of the first input token in the input line. + * + * First the function determines if the node it is passed matches the + * first token of input. If it does not, it returns NULL. If it does + * match, then it saves the input token as the head of an argument list. + * + * The next step is to see if there is further input in the input line. + * If there is not, the current node's children are searched to see if + * any of them are leaves (type END_GN). If this is the case, then the + * bottom of the recursion stack has been reached, and the argument list + * (with one node) is returned. If it is not the case, NULL is returned, + * indicating that there is no match for the input along this path. + * + * If there is further input, then the function recurses on each of the + * current node's children, passing them the input line minus the token + * that was just matched. For each child, the return value of the recursive + * call is inspected. If it is null, then there is no match for the input along + * the subgraph headed by that child. If it is not null, then there is at least + * one input match in that subgraph (more on this in a moment). + * + * If a recursive call on a child returns a non-null value, then it has matched + * the input given it on the subgraph that starts with that child. However, due + * to the flexibility of the grammar, it is sometimes the case that two or more + * child graphs match the same input (two or more of the recursive calls have + * non-NULL return values). This is not a valid state, since only one + * true match is possible. In order to resolve this conflict, the function + * keeps a reference to the child node that most specifically matches the + * input. This is done by assigning each node type a precedence. If a child is + * found to match the remaining input, then the precedence values of the + * current best-matching child and this new match are compared. The node with + * higher precedence is kept, and the other match is discarded. Due to the + * recursive nature of this function, it is only necessary to compare the + * precedence of immediate children, since all subsequent children will already + * have been disambiguated in this way. + * + * In the event that two children are found to match with the same precedence, + * then this command is totally ambiguous (how did you even match it in the first + * place?) and NULL is returned. + * + * The ultimate return value is an ordered linked list of nodes that comprise + * the best match for the command, each with their `arg` fields pointing to the + * matching token string. + * + * @param[out] start the start node. + * @param[in] vline the vectorized input line. + * @param[in] n the index of the first input token. Should be 0 for external + * callers. + */ static struct list * match_build_argv_r (struct graph_node *start, vector vline, unsigned int n) { // if we don't match this node, die - if (match_token(start, vector_slot(vline, n), FILTER_STRICT) == no_match) + if (match_token(start, vector_slot(vline, n), FILTER_STRICT) != exact_match) return NULL; - // some stuffs we need + // arg list for this subgraph struct list *argv = list_new(); + + // pointers for iterating linklist struct graph_node *gn; struct listnode *ln; // append current arg - start->arg = strdup(vector_slot(vline, n)); listnode_add(argv, start); // get all possible nexthops struct list *next = list_new(); add_nexthops(next, start); - // check if one of them is END_GN - for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) - { - if (gn->type == END_GN){ - fprintf(stderr, "Hit END_GN while searching next set of node with text %s\n", start->text); - return argv; + // if we're at the end of input, need END_GN or no match + if (n+1 == vector_active (vline)) { + for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { + if (gn->type == END_GN) { + list_delete (next); + start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + if (start->type == VARIABLE_GN) + fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); + return argv; + } } + list_free (next); + return NULL; } - // if we have no more input, why even live? - if (n+1 >= vector_active(vline)) return NULL; - // otherwise recurse on all nexthops + struct list *bestmatch = NULL; for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) - { - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); - struct list *result = match_build_argv_r (gn, vline, n+1); - if (result != NULL) { - list_add_list (argv, result); - return argv; + { + if (gn->type == END_GN) // skip END_GN since we aren't at end of input + continue; + + // get the result of the next node + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); + struct list *result = match_build_argv_r (gn, vline, n+1); + + // compare to our current best match, and save if it's better + if (result) { + if (bestmatch) { + int currprec = score_precedence (listgetdata(listhead(bestmatch))); + int rsltprec = score_precedence (gn); + if (currprec < rsltprec) + list_delete (result); + if (currprec > rsltprec) { + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, ">> Overwriting bestmatch with: %s\n", gn->text); + list_delete (bestmatch); + bestmatch = result; + } + if (currprec == rsltprec) { + fprintf(stderr, ">> Ambiguous match. Abort.\n"); + list_delete (bestmatch); + list_delete (result); + list_delete (argv); + return NULL; + } + } + else { + bestmatch = result; + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, ">> Setting bestmatch with: %s\n", gn->text); + } + } } + + if (bestmatch) { + list_add_list(argv, bestmatch); + list_delete (bestmatch); + start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + if (start->type == VARIABLE_GN) + fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); + return argv; + } + else { + list_delete (argv); + return NULL; } - return NULL; } /* matching utility functions */ +static int +score_precedence (struct graph_node *node) +{ + switch (node->type) + { + // these should be mutually exclusive + case IPV4_GN: + case IPV4_PREFIX_GN: + case IPV6_GN: + case IPV6_PREFIX_GN: + case RANGE_GN: + case NUMBER_GN: + return 1; + case WORD_GN: + return 2; + case VARIABLE_GN: + return 3; + default: + return 10; + } +} + static enum match_type match_token (struct graph_node *node, char *token, enum filter_type filter) { diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index f78ba060a6..e4617969af 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -82,18 +82,13 @@ DEFUN (grammar_test_match, } struct list *argvv = match_build_argv (command, element); - fprintf(stderr, "num args: %d\n", argvv->count); - - struct listnode *ln; - struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) { - fprintf(stderr, "node text: %s\n", gn->text); - if (gn->arg) - fprintf(stderr, "node arg: %s\n", gn->arg); - else - fprintf(stderr, "No arg.\n"); + if (!argvv) fprintf(stderr, "Failed to build argv.\n"); + else { + struct listnode *ln; + struct graph_node *gn; + for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) + fprintf(stderr, "%s -- %s\n", gn->text, gn->arg); } - return CMD_SUCCESS; } From de9d7e4f3ccb1b199602c1a1ce884df37e54f834 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 29 Jul 2016 15:54:03 +0000 Subject: [PATCH 018/280] lib: Cleanup some memory issues in CLI Various memory leaks have been fixed and the quagga memory macros are in use. Also consolidated the argv and matching code into one graph traversal. Signed-off-by: Quentin Young --- lib/command.c | 24 +++ lib/command.h | 6 + lib/command_graph.c | 57 ++++++- lib/command_graph.h | 46 ++++-- lib/command_lex.l | 14 +- lib/command_match.c | 366 +++++++++++++++++++++--------------------- lib/command_match.h | 15 +- lib/command_parse.y | 3 +- lib/grammar_sandbox.c | 27 ++-- 9 files changed, 332 insertions(+), 226 deletions(-) diff --git a/lib/command.c b/lib/command.c index 490c2a0690..d3c6771248 100644 --- a/lib/command.c +++ b/lib/command.c @@ -4190,6 +4190,30 @@ cmd_terminate_element(struct cmd_element *cmd) cmd->tokens = NULL; } +void +free_cmd_element(struct cmd_element *cmd) +{ + if (!cmd) return; + free ((char*) cmd->string); + free ((char*) cmd->doc); + cmd_terminate_element(cmd); + free (cmd); +} + +struct cmd_element * +copy_cmd_element(struct cmd_element *cmd) +{ + struct cmd_element *el = XMALLOC(MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); + el->string = cmd->string ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->string) : NULL; + el->func = cmd->func; + el->doc = cmd->doc ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->doc) : NULL; + el->daemon = cmd->daemon; + el->tokens = cmd->tokens ? vector_copy(cmd->tokens) : NULL; + el->attr = cmd->attr; + fprintf(stderr, "successful copy\n"); + return el; +} + void cmd_terminate () { diff --git a/lib/command.h b/lib/command.h index c1ef0e55bd..9a77d3b87c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -571,6 +571,12 @@ extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element extern void cmd_init (int); extern void cmd_terminate (void); +/* memory management for cmd_element */ +void +free_cmd_element(struct cmd_element *); +struct cmd_element * +copy_cmd_element(struct cmd_element *cmd); + /* Export typical functions. */ extern struct cmd_element config_end_cmd; extern struct cmd_element config_exit_cmd; diff --git a/lib/command_graph.c b/lib/command_graph.c index a5880f34a6..7c09a5cd6c 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -22,6 +22,7 @@ add_node(struct graph_node *parent, struct graph_node *child) return p_child; } vector_set(parent->children, child); + child->refs++; return child; } @@ -58,6 +59,7 @@ cmp_node(struct graph_node *first, struct graph_node *second) */ case START_GN: case END_GN: + case NUL_GN: default: break; } @@ -73,29 +75,61 @@ new_node(enum graph_node_type type) node->type = type; node->children = vector_init(VECTOR_MIN_SIZE); - node->is_start = 0; node->end = NULL; node->text = NULL; + node->element = NULL; + node->arg = NULL; + node->is_start = 0; node->value = 0; node->min = 0; node->max = 0; - node->element = NULL; + node->refs = 0; return node; } +struct graph_node * +copy_node (struct graph_node *node) +{ + struct graph_node *new = new_node(node->type); + new->children = vector_copy (node->children); + new->is_start = node->is_start; + new->end = node->end; + new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; + new->value = node->value; + new->min = node->min; + new->max = node->max; + new->element = node->element ? copy_cmd_element(node->element) : NULL; + new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; + new->refs = 0; + return new; +} + void free_node (struct graph_node *node) { if (!node) return; - free_node (node->end); vector_free (node->children); + free_cmd_element (node->element); free (node->text); free (node->arg); - free (node->element); free (node); } +void +free_graph (struct graph_node *start) +{ + if (start && start->children && vector_active(start->children) > 0) { + for (unsigned int i = 0; i < vector_active(start->children); i++) { + free_graph (vector_slot(start->children, i)); + vector_unset(start->children, i); + } + } + + if (--(start->refs) == 0) + free_node (start); +} + char * describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) { @@ -166,3 +200,18 @@ walk_graph(struct graph_node *start, int level) fprintf(stderr, "\n"); } +void +dump_node (struct graph_node *node) +{ + char buf[50]; + describe_node(node, buf, 50); + fprintf(stderr, "%s[%d]\n", buf, node->type); + fprintf(stderr, "\t->text: %s\n", node->text); + fprintf(stderr, "\t->value: %ld\n", node->value); + fprintf(stderr, "\t->is_start: %d\n", node->is_start); + fprintf(stderr, "\t->element: %p\n", node->element); + fprintf(stderr, "\t->min: %ld\n->max: %ld\n", node->min, node->max); + fprintf(stderr, "\t->arg: %s\n", node->arg); + fprintf(stderr, "\t->refs: %d\n", node->refs); + fprintf(stderr, "\tnum children: %d\n", vector_active(node->children)); +} diff --git a/lib/command_graph.h b/lib/command_graph.h index a9ffe0f7b6..dc78475ca6 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -35,6 +35,9 @@ struct graph_node struct cmd_element *element; /* used for passing arguments to command functions */ char *arg; + + /* refcount for node parents */ + int refs; }; /* @@ -47,7 +50,7 @@ struct graph_node * @param[in] child node * @return pointer to child if it is added, pointer to existing child otherwise */ -extern struct graph_node * +struct graph_node * add_node(struct graph_node *, struct graph_node *); /* @@ -61,7 +64,7 @@ add_node(struct graph_node *, struct graph_node *); * @param[in] second node to compare * @return 1 if equal, zero otherwise. */ -extern int +int cmp_node(struct graph_node *, struct graph_node *); /* @@ -71,9 +74,36 @@ cmp_node(struct graph_node *, struct graph_node *); * @param[in] node type * @return pointer to the newly allocated node */ -extern struct graph_node * +struct graph_node * new_node(enum graph_node_type); +/** + * Copies a node. + * The children vector is copied, but the pointers the vector + * holds point to the same data as the original vector. + * The element, if it exists, is copied. + * + * @param[in] pointer to node to copy + * @return pointer to copied node + */ +struct graph_node * +copy_node(struct graph_node *); + +/** + * Frees the data associated with a graph_node. + * @param[out] pointer to graph_node to free + */ +void +free_node(struct graph_node *); + +/** + * Recursively calls free_node on a graph node + * and all its children. + * @param[out] graph to free + */ +void +free_graph(struct graph_node *); + /** * Walks a command DFA, printing structure to stdout. * For debugging. @@ -81,7 +111,7 @@ new_node(enum graph_node_type); * @param[in] start node of graph to walk * @param[in] graph depth for recursion, caller passes 0 */ -extern void +void walk_graph(struct graph_node *, int); /** @@ -90,13 +120,9 @@ walk_graph(struct graph_node *, int); * @param[out] the buffer to write the description into * @return pointer to description string */ -extern char * +char * describe_node(struct graph_node *, char *, unsigned int); -/** - * Frees the data associated with a graph_node. - * @param[out] pointer to graph_node to free - */ void -free_node(struct graph_node *); +dump_node (struct graph_node *); #endif diff --git a/lib/command_lex.l b/lib/command_lex.l index 45f8f8e636..5a0e76d418 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -22,14 +22,14 @@ RANGE \({NUMBER}\-{NUMBER}\) %% [ /t] /* ignore whitespace */; -{WORD} {yylval.string = strdup(yytext); return WORD;} -{IPV4} {yylval.string = strdup(yytext); return IPV4;} -{IPV4_PREFIX} {yylval.string = strdup(yytext); return IPV4_PREFIX;} -{IPV6} {yylval.string = strdup(yytext); return IPV6;} -{IPV6_PREFIX} {yylval.string = strdup(yytext); return IPV6_PREFIX;} -{VARIABLE} {yylval.string = strdup(yytext); return VARIABLE;} +{WORD} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return WORD;} +{IPV4} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4;} +{IPV4_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4_PREFIX;} +{IPV6} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;} +{IPV6_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;} +{VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} {NUMBER} {yylval.integer = atoi(yytext); return NUMBER;} -{RANGE} {yylval.string = strdup(yytext); return RANGE;} +{RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} . {return yytext[0];} %% diff --git a/lib/command_match.c b/lib/command_match.c index 023faafade..91b6069b1a 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -8,7 +8,7 @@ static int add_nexthops(struct list *, struct graph_node *); static struct list * -match_build_argv_r (struct graph_node *, vector, unsigned int); +match_command_r (struct graph_node *, vector, unsigned int); static int score_precedence (struct graph_node *); @@ -43,27 +43,198 @@ match_token (struct graph_node *, char *, enum filter_type); /* matching functions */ -struct cmd_element * -match_command (struct graph_node *start, const char *line, enum filter_type filter) -{ - // get all possible completions - struct list *completions = match_command_complete (start, line, filter); +static void +free_nodelist (void *node) { + free_node ((struct graph_node *) node); +} - // one of them should be END_GN if this command matches - struct graph_node *gn; - struct listnode *node; - for (ALL_LIST_ELEMENTS_RO(completions,node,gn)) +struct cmd_element * +match_command (struct graph_node *start, const char *line, struct list **argv) +{ + // parse command + vector vline = cmd_make_strvec (line); + + for (unsigned int i = 0; i < vector_active(start->children); i++) { - if (gn->type == END_GN) - break; - gn = NULL; + // call recursive builder on each starting child + *argv = match_command_r(vector_slot(start->children, i), vline, 0); + // if any of them succeed, return their argv + // since all command DFA's must begin with a word, there can only be + // one valid return value + if (*argv) break; } - return gn ? gn->element : NULL; + + if (*argv) { + // copy the nodes we need + struct listnode *ln; + struct graph_node *gn; + char buf[50]; + for (ALL_LIST_ELEMENTS_RO(*argv,ln,gn)) { + describe_node(gn, buf, 50); + fprintf(stderr, "%s[%d]\n", buf, gn->type); + if (gn->type == END_GN) + return gn->element; + } + assert(0); + } + + return NULL; +} + +/** + * Matches a given input line against a DFA. + * + * Builds an argument list given a DFA and a matching input line. This function + * should be passed the start node of the DFA, a matching input line, and the + * index of the first token in the input line. + * + * First the function determines if the node it is passed matches the first + * token of input. If it does not, it returns NULL. If it does match, then it + * saves the input token as the head of an argument list. + * + * The next step is to see if there is further input in the input line. If + * there is not, the current node's children are searched to see if any of them + * are leaves (type END_GN). If this is the case, then the bottom of the + * recursion stack has been reached, and the argument list (with one node) is + * returned. If it is not the case, NULL is returned, indicating that there is + * no match for the input along this path. + * + * If there is further input, then the function recurses on each of the current + * node's children, passing them the input line minus the token that was just + * matched. For each child, the return value of the recursive call is + * inspected. If it is null, then there is no match for the input along the + * subgraph headed by that child. If it is not null, then there is at least one + * input match in that subgraph (more on this in a moment). + * + * If a recursive call on a child returns a non-null value, then it has matched + * the input given it on the subgraph that starts with that child. However, due + * to the flexibility of the grammar, it is sometimes the case that two or more + * child graphs match the same input (two or more of the recursive calls have + * non-NULL return values). This is not a valid state, since only one true + * match is possible. In order to resolve this conflict, the function keeps a + * reference to the child node that most specifically matches the input. This + * is done by assigning each node type a precedence. If a child is found to + * match the remaining input, then the precedence values of the current + * best-matching child and this new match are compared. The node with higher + * precedence is kept, and the other match is discarded. Due to the recursive + * nature of this function, it is only necessary to compare the precedence of + * immediate children, since all subsequent children will already have been + * disambiguated in this way. + * + * In the event that two children are found to match with the same precedence, + * then the input is ambiguous for the passed cmd_element and NULL is returned. + * + * The ultimate return value is an ordered linked list of nodes that comprise + * the best match for the command, each with their `arg` fields pointing to the + * matching token string. + * + * @param[out] start the start node. + * @param[in] vline the vectorized input line. + * @param[in] n the index of the first input token. Should be 0 for external + * callers. + */ +static struct list * +match_command_r (struct graph_node *start, vector vline, unsigned int n) +{ + // if we don't match this node, die + if (match_token(start, vector_slot(vline, n), FILTER_STRICT) != exact_match) + return NULL; + + // arg list for this subgraph + struct list *argv; + + // pointers for iterating linklist + struct graph_node *gn; + struct listnode *ln; + + // get all possible nexthops + struct list *next = list_new(); + add_nexthops(next, start); + + // if we're at the end of input, need END_GN or no match + if (n+1 == vector_active (vline)) { + for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { + if (gn->type == END_GN) { + // delete nexthops, we don't need them + list_delete (next); + // dupe current node, set arg field, and return + struct graph_node *curr = copy_node(start); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + fprintf(stderr, ">> Matched END_GN on node %s for token %s\n", curr->text, curr->arg); + // initialize a new argument list + argv = list_new(); + argv->del = &free_nodelist; + listnode_add(argv, curr); + listnode_add(argv, copy_node(gn)); + return argv; + } + } + // no END_GN found, free resources and return null + list_delete (next); + return NULL; + } + + // otherwise recurse on all nexthops + struct list *bestmatch = NULL; + for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) + { + if (gn->type == END_GN) // skip END_GN since we aren't at end of input + continue; + + // get the result of the next node + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); + struct list *result = match_command_r (gn, vline, n+1); + + // compare to our current best match, and save if it's better + if (result) { + if (bestmatch) { + int currprec = score_precedence (listgetdata(listhead(bestmatch))); + int rsltprec = score_precedence (gn); + if (currprec < rsltprec) + list_delete (result); + if (currprec > rsltprec) { + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, ">> Overwriting bestmatch with: %s\n", gn->text); + list_delete (bestmatch); + bestmatch = result; + } + if (currprec == rsltprec) { + fprintf(stderr, ">> Ambiguous match. Abort.\n"); + list_delete (bestmatch); + list_delete (result); + list_delete (next); + return NULL; + } + } + else { + bestmatch = result; + for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); + fprintf(stderr, ">> Setting bestmatch with: %s\n", gn->text); + } + } + } + + if (bestmatch) { + argv = list_new(); + listnode_add(argv, start); + list_add_list(argv, bestmatch); + list_free (bestmatch); + list_delete (next); + start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + if (start->type == VARIABLE_GN) + fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); + return argv; + } + else + return NULL; } struct list * match_command_complete (struct graph_node *start, const char *line, enum filter_type filter) { + enum match_type minmatch = filter + 1; + // vectorize command line vector vline = cmd_make_strvec (line); @@ -94,7 +265,7 @@ match_command_complete (struct graph_node *start, const char *line, enum filter_ for (ALL_LIST_ELEMENTS_RO(current,node,gn)) { - if (match_token(gn, token, filter) == exact_match) { + if (match_token(gn, token, filter) >= minmatch) { listnode_add(matched, gn); add_nexthops(next, gn); } @@ -148,171 +319,6 @@ add_nexthops(struct list *l, struct graph_node *node) return added; } -struct list * -match_build_argv (const char *line, struct cmd_element *element) -{ - struct list *argv = NULL; - - // parse command - struct graph_node *start = new_node(NUL_GN); - parse_command_format(start, element); - - vector vline = cmd_make_strvec (line); - - for (unsigned int i = 0; i < vector_active(start->children); i++) - { - // call recursive builder on each starting child - argv = match_build_argv_r (vector_slot(start->children, i), vline, 0); - // if any of them succeed, return their argv - // since all command DFA's must begin with a word and these are deduplicated, - // no need to check precedence - if (argv) break; - } - - return argv; -} - -/** - * Builds an argument list given a DFA and a matching input line. - * This function should be passed the start node of the DFA, a matching - * input line, and the index of the first input token in the input line. - * - * First the function determines if the node it is passed matches the - * first token of input. If it does not, it returns NULL. If it does - * match, then it saves the input token as the head of an argument list. - * - * The next step is to see if there is further input in the input line. - * If there is not, the current node's children are searched to see if - * any of them are leaves (type END_GN). If this is the case, then the - * bottom of the recursion stack has been reached, and the argument list - * (with one node) is returned. If it is not the case, NULL is returned, - * indicating that there is no match for the input along this path. - * - * If there is further input, then the function recurses on each of the - * current node's children, passing them the input line minus the token - * that was just matched. For each child, the return value of the recursive - * call is inspected. If it is null, then there is no match for the input along - * the subgraph headed by that child. If it is not null, then there is at least - * one input match in that subgraph (more on this in a moment). - * - * If a recursive call on a child returns a non-null value, then it has matched - * the input given it on the subgraph that starts with that child. However, due - * to the flexibility of the grammar, it is sometimes the case that two or more - * child graphs match the same input (two or more of the recursive calls have - * non-NULL return values). This is not a valid state, since only one - * true match is possible. In order to resolve this conflict, the function - * keeps a reference to the child node that most specifically matches the - * input. This is done by assigning each node type a precedence. If a child is - * found to match the remaining input, then the precedence values of the - * current best-matching child and this new match are compared. The node with - * higher precedence is kept, and the other match is discarded. Due to the - * recursive nature of this function, it is only necessary to compare the - * precedence of immediate children, since all subsequent children will already - * have been disambiguated in this way. - * - * In the event that two children are found to match with the same precedence, - * then this command is totally ambiguous (how did you even match it in the first - * place?) and NULL is returned. - * - * The ultimate return value is an ordered linked list of nodes that comprise - * the best match for the command, each with their `arg` fields pointing to the - * matching token string. - * - * @param[out] start the start node. - * @param[in] vline the vectorized input line. - * @param[in] n the index of the first input token. Should be 0 for external - * callers. - */ -static struct list * -match_build_argv_r (struct graph_node *start, vector vline, unsigned int n) -{ - // if we don't match this node, die - if (match_token(start, vector_slot(vline, n), FILTER_STRICT) != exact_match) - return NULL; - - // arg list for this subgraph - struct list *argv = list_new(); - - // pointers for iterating linklist - struct graph_node *gn; - struct listnode *ln; - - // append current arg - listnode_add(argv, start); - - // get all possible nexthops - struct list *next = list_new(); - add_nexthops(next, start); - - // if we're at the end of input, need END_GN or no match - if (n+1 == vector_active (vline)) { - for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { - if (gn->type == END_GN) { - list_delete (next); - start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - if (start->type == VARIABLE_GN) - fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); - return argv; - } - } - list_free (next); - return NULL; - } - - // otherwise recurse on all nexthops - struct list *bestmatch = NULL; - for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) - { - if (gn->type == END_GN) // skip END_GN since we aren't at end of input - continue; - - // get the result of the next node - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); - struct list *result = match_build_argv_r (gn, vline, n+1); - - // compare to our current best match, and save if it's better - if (result) { - if (bestmatch) { - int currprec = score_precedence (listgetdata(listhead(bestmatch))); - int rsltprec = score_precedence (gn); - if (currprec < rsltprec) - list_delete (result); - if (currprec > rsltprec) { - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, ">> Overwriting bestmatch with: %s\n", gn->text); - list_delete (bestmatch); - bestmatch = result; - } - if (currprec == rsltprec) { - fprintf(stderr, ">> Ambiguous match. Abort.\n"); - list_delete (bestmatch); - list_delete (result); - list_delete (argv); - return NULL; - } - } - else { - bestmatch = result; - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, ">> Setting bestmatch with: %s\n", gn->text); - } - } - } - - if (bestmatch) { - list_add_list(argv, bestmatch); - list_delete (bestmatch); - start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - if (start->type == VARIABLE_GN) - fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); - return argv; - } - else { - list_delete (argv); - return NULL; - } -} /* matching utility functions */ diff --git a/lib/command_match.h b/lib/command_match.h index 24cd1287e6..a102ba9484 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -48,10 +48,13 @@ enum match_type /** * Attempt to find an exact command match for a line of user input. * + * @param DFA to match against + * @param input string + * @param pointer to argv pointer * @return cmd_element found, or NULL if there is no match. */ struct cmd_element * -match_command (struct graph_node *, const char *, enum filter_type); +match_command (struct graph_node *, const char *, struct list **); /** * Compiles next-hops for a given line of user input. @@ -77,14 +80,4 @@ match_command (struct graph_node *, const char *, enum filter_type); struct list * match_command_complete (struct graph_node *, const char *, enum filter_type); -/** - * Builds an argument list given a cmd_element and a matching input line. - * - * @param[in] input line - * @param[in] cmd_element struct - * @return pointer to argument linked list - */ -struct list * -match_build_argv (const char *, struct cmd_element *); - #endif diff --git a/lib/command_parse.y b/lib/command_parse.y index 8c0584facd..cf87ca1042 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -91,6 +91,7 @@ start: sentence_root yyerror("Duplicate command."); YYABORT; } + fprintf(stderr, "Added END_GN with active children: %d\n", vector_active(end->children)); } sentence_root: WORD @@ -323,7 +324,7 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) optnode_start = optnode_end = NULL; // trace parser - yydebug = 1; + yydebug = 0; // command string command = cmd; // make flex read from a string diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index e4617969af..2443b8471c 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -18,7 +18,6 @@ DEFUN (grammar_test, struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); cmd->string = command; parse_command_format(nodegraph, cmd); - walk_graph(nodegraph, 0); return CMD_SUCCESS; } @@ -28,6 +27,10 @@ DEFUN (grammar_test_show, GRAMMAR_STR "print current accumulated DFA\n") { + if (!nodegraph) + fprintf(stderr, "!nodegraph\n"); + fprintf(stderr, "trying to print nodegraph->type\n"); + fprintf(stderr, "%d\n", nodegraph->type); walk_graph(nodegraph, 0); return CMD_SUCCESS; } @@ -59,7 +62,7 @@ DEFUN (grammar_test_complete, } free(desc); } - list_free(result); + list_delete(result); return CMD_SUCCESS; } @@ -71,24 +74,22 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match") { - const char* command = argv_concat(argv, argc, 0); - struct cmd_element *element = match_command (nodegraph, command, FILTER_STRICT); + struct list *argvv = NULL; + const char *command = argv_concat(argv, argc, 0); + struct cmd_element *element = match_command (nodegraph, command, &argvv); - if (element) + if (element) { fprintf(stderr, "Matched: %s\n", element->string); - else { - fprintf(stderr, "Returned NULL\n"); - return CMD_SUCCESS; - } - - struct list *argvv = match_build_argv (command, element); - if (!argvv) fprintf(stderr, "Failed to build argv.\n"); - else { struct listnode *ln; struct graph_node *gn; for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) fprintf(stderr, "%s -- %s\n", gn->text, gn->arg); } + else { + fprintf(stderr, "Returned NULL\n"); + return CMD_SUCCESS; + } + return CMD_SUCCESS; } From 0b02e39d9bde4950d20be082d3dbf3d390030719 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 29 Jul 2016 18:27:59 +0000 Subject: [PATCH 019/280] lib: Re-add partial IPV4 matching support Also removed debugging output for matcher. Signed-off-by: Quentin Young --- lib/command_match.c | 171 +++++++++++++++++++++++++++++++------------- 1 file changed, 122 insertions(+), 49 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 91b6069b1a..984813d0db 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -43,6 +43,7 @@ match_token (struct graph_node *, char *, enum filter_type); /* matching functions */ +/* Linked list data deletion callback */ static void free_nodelist (void *node) { free_node ((struct graph_node *) node); @@ -155,17 +156,17 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) if (n+1 == vector_active (vline)) { for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { if (gn->type == END_GN) { - // delete nexthops, we don't need them - list_delete (next); - // dupe current node, set arg field, and return struct graph_node *curr = copy_node(start); curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - fprintf(stderr, ">> Matched END_GN on node %s for token %s\n", curr->text, curr->arg); // initialize a new argument list argv = list_new(); argv->del = &free_nodelist; + // push the currnode listnode_add(argv, curr); + // push the endnode listnode_add(argv, copy_node(gn)); + // clean up + list_delete (next); return argv; } } @@ -182,8 +183,6 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) continue; // get the result of the next node - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, "Recursing on node %s for token %s\n", gn->text, (char*) vector_slot(vline, n+1)); struct list *result = match_command_r (gn, vline, n+1); // compare to our current best match, and save if it's better @@ -194,24 +193,18 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) if (currprec < rsltprec) list_delete (result); if (currprec > rsltprec) { - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, ">> Overwriting bestmatch with: %s\n", gn->text); list_delete (bestmatch); bestmatch = result; } if (currprec == rsltprec) { - fprintf(stderr, ">> Ambiguous match. Abort.\n"); list_delete (bestmatch); list_delete (result); list_delete (next); return NULL; } } - else { + else bestmatch = result; - for (unsigned int i = 0; i < n; i++) fprintf(stderr, "\t"); - fprintf(stderr, ">> Setting bestmatch with: %s\n", gn->text); - } } } @@ -222,8 +215,6 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) list_free (bestmatch); list_delete (next); start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - if (start->type == VARIABLE_GN) - fprintf(stderr, "Setting variable %s->arg with text %s\n", start->text, start->arg); return argv; } else @@ -349,15 +340,15 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) { switch (node->type) { case WORD_GN: - return match_word (node, filter, token); + return match_word (node, token, filter); case IPV4_GN: return match_ipv4 (token); case IPV4_PREFIX_GN: - return match_ipv4_prefix (token); + return match_ipv4_prefix (token, filter); case IPV6_GN: - return match_ipv6 (token); + return match_ipv6 (token, filter); case IPV6_PREFIX_GN: - return match_ipv6_prefix (token); + return match_ipv6_prefix (token, filter); case RANGE_GN: return match_range (node, token); case NUMBER_GN: @@ -376,16 +367,56 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) static enum match_type match_ipv4 (const char *str) { - struct sockaddr_in sin_dummy; + const char *sp; + int dots = 0, nums = 0; + char buf[4]; if (str == NULL) return partly_match; - if (strspn (str, IPV4_ADDR_STR) != strlen (str)) - return no_match; + for (;;) + { + memset (buf, 0, sizeof (buf)); + sp = str; + while (*str != '\0') + { + if (*str == '.') + { + if (dots >= 3) + return no_match; - if (inet_pton(AF_INET, str, &sin_dummy.sin_addr) != 1) - return no_match; + if (*(str + 1) == '.') + return no_match; + + if (*(str + 1) == '\0') + return partly_match; + + dots++; + break; + } + if (!isdigit ((int) *str)) + return no_match; + + str++; + } + + if (str - sp > 3) + return no_match; + + strncpy (buf, sp, str - sp); + if (atoi (buf) > 255) + return no_match; + + nums++; + + if (*str == '\0') + break; + + str++; + } + + if (nums < 4) + return partly_match; return exact_match; } @@ -393,37 +424,79 @@ match_ipv4 (const char *str) static enum match_type match_ipv4_prefix (const char *str) { - struct sockaddr_in sin_dummy; - const char *delim = "/\0"; - char *dupe, *prefix, *mask, *context, *endptr; - int nmask = -1; + const char *sp; + int dots = 0; + char buf[4]; if (str == NULL) return partly_match; - if (strspn (str, IPV4_PREFIX_STR) != strlen (str)) + for (;;) + { + memset (buf, 0, sizeof (buf)); + sp = str; + while (*str != '\0' && *str != '/') + { + if (*str == '.') + { + if (dots == 3) + return no_match; + + if (*(str + 1) == '.' || *(str + 1) == '/') + return no_match; + + if (*(str + 1) == '\0') + return partly_match; + + dots++; + break; + } + + if (!isdigit ((int) *str)) + return no_match; + + str++; + } + + if (str - sp > 3) + return no_match; + + strncpy (buf, sp, str - sp); + if (atoi (buf) > 255) + return no_match; + + if (dots == 3) + { + if (*str == '/') + { + if (*(str + 1) == '\0') + return partly_match; + + str++; + break; + } + else if (*str == '\0') + return partly_match; + } + + if (*str == '\0') + return partly_match; + + str++; + } + + sp = str; + while (*str != '\0') + { + if (!isdigit ((int) *str)) + return no_match; + + str++; + } + + if (atoi (sp) > 32) return no_match; - /* tokenize to address + mask */ - dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); - strncpy(dupe, str, strlen(str)+1); - prefix = strtok_r(dupe, delim, &context); - mask = strtok_r(NULL, delim, &context); - - if (!mask) - return partly_match; - - /* validate prefix */ - if (inet_pton(AF_INET, prefix, &sin_dummy.sin_addr) != 1) - return no_match; - - /* validate mask */ - nmask = strtol (mask, &endptr, 10); - if (*endptr != '\0' || nmask < 0 || nmask > 32) - return no_match; - - XFREE(MTYPE_TMP, dupe); - return exact_match; } From 3a7f5493619d20e7087536edbe694f9f2761ace5 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 29 Jul 2016 18:34:10 +0000 Subject: [PATCH 020/280] lib: Retab command_match.c Signed-off-by: Quentin Young --- lib/command_match.c | 100 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 984813d0db..f02b7c821a 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -379,38 +379,38 @@ match_ipv4 (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0') - { - if (*str == '.') - { - if (dots >= 3) - return no_match; + { + if (*str == '.') + { + if (dots >= 3) + return no_match; - if (*(str + 1) == '.') - return no_match; + if (*(str + 1) == '.') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } - if (!isdigit ((int) *str)) - return no_match; + dots++; + break; + } + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; nums++; if (*str == '\0') - break; + break; str++; } @@ -436,51 +436,51 @@ match_ipv4_prefix (const char *str) memset (buf, 0, sizeof (buf)); sp = str; while (*str != '\0' && *str != '/') - { - if (*str == '.') - { - if (dots == 3) - return no_match; + { + if (*str == '.') + { + if (dots == 3) + return no_match; - if (*(str + 1) == '.' || *(str + 1) == '/') - return no_match; + if (*(str + 1) == '.' || *(str + 1) == '/') + return no_match; - if (*(str + 1) == '\0') - return partly_match; + if (*(str + 1) == '\0') + return partly_match; - dots++; - break; - } + dots++; + break; + } - if (!isdigit ((int) *str)) - return no_match; + if (!isdigit ((int) *str)) + return no_match; - str++; - } + str++; + } if (str - sp > 3) - return no_match; + return no_match; strncpy (buf, sp, str - sp); if (atoi (buf) > 255) - return no_match; + return no_match; if (dots == 3) - { - if (*str == '/') - { - if (*(str + 1) == '\0') - return partly_match; + { + if (*str == '/') + { + if (*(str + 1) == '\0') + return partly_match; - str++; - break; - } - else if (*str == '\0') - return partly_match; - } + str++; + break; + } + else if (*str == '\0') + return partly_match; + } if (*str == '\0') - return partly_match; + return partly_match; str++; } @@ -489,7 +489,7 @@ match_ipv4_prefix (const char *str) while (*str != '\0') { if (!isdigit ((int) *str)) - return no_match; + return no_match; str++; } From 6d53a10e4cf873ff61a3dada644d15be83dd54c0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 1 Aug 2016 13:18:25 +0000 Subject: [PATCH 021/280] lib: Add partial matching support Signed-off-by: Quentin Young --- feed.x | 14 + lib/.command.h.swo | Bin 0 -> 16384 bytes lib/command_graph.c | 2 +- lib/command_lex.l | 2 +- lib/command_match.c | 40 +- lib/grammar_sandbox.c | 2 +- opt.txt | 905 +++++++++++++++++++ quagga_parser_to_network_docopt.py | 1327 ++++++++++++++++++++++++++++ 8 files changed, 2281 insertions(+), 11 deletions(-) create mode 100644 feed.x create mode 100644 lib/.command.h.swo create mode 100644 opt.txt create mode 100755 quagga_parser_to_network_docopt.py diff --git a/feed.x b/feed.x new file mode 100644 index 0000000000..a087987d40 --- /dev/null +++ b/feed.x @@ -0,0 +1,14 @@ +#!/bin/expect + +set f [open "copt.txt"] +set cmds [split [read $f] "\n"] +close $f + +spawn vtysh + +foreach command $cmds { + expect "dell-s6000-16#" + send "$command\r" +} + +interact diff --git a/lib/.command.h.swo b/lib/.command.h.swo new file mode 100644 index 0000000000000000000000000000000000000000..71a42cc20a022a18e2d1af9455f52606f192dfa9 GIT binary patch literal 16384 zcmeHOU5p!76`r<0nwGQ`Jn$od4#~@A@%|;-lx0I<;`Q#1vi4dYdy@?k*6hr+J!CxN z%#6M3Mkye8K_U_e2`W&f_MtqqARgfXBm@Wv34sJWAS6Jdz!QifAt8Q3`Ocj?-m#r* zQuV1~EPdL{z2}~L&UenebMLXUx42`J>52Je4WGv}?bvf)z4ZKt@7KPyp=ox%+xPkr z_Z<0ggy+pg=N1bE5y2>fciB6*WOR&wo_^j_Uu)ME}24zoGhH zndtwQ>VL25Ur`RF`c-rOCubmMAZH+FAZH+FAZH+FAZH+FAZH+FAZOtJk^#%nv>A9V z@6-7HKfV9odQ{VX0z3yi3p@qv180E0JfdkY0XKoq0wv%W@ck2-_9ftpKm|As{P?Y! z_9E~#;054wKm>%q$AB`h2rK|6fct<~AJ(+r06znM3cLtB13V4f00htgJ_MWx-U&Pm zJOupxAx(Q3_&x9);OoFkz~_Na0@r{ZPy?O>3czV#2Kd8qP5UMAbKuKB8<+w9^dNi# zJ_URfSOFdY{&-B&z6;z0Y~XR=LEu+!!JNQ#;3L2Z;MZ>kmw*kN1^)3S_y@cI+yE{D zr+`}zXxcA;XMg}$2i^m`f_laefMo@N&`BD37MoE0-GiQ@GJTW&M3bF-8b#PAFnrLQ$tmg3n>{B9lVWZkCRf_s}gwaZ} zl}vrzn2=1>!i+n~al(xJS8|DgDNkfMPRNPTvbwG}RBMB+nMgLCLJl1taA*_cmv1xI z@?lJ-<{BS7;SVNTCM+6`<`E-zs+F-t!FHCbTjm@(s9GX%V0SFPovwQJjE5{w%yyR{ znY8B###3m&hO1=}eq2Xz<$;!!t_)-4oJxkmW^C*Dq|9 zvf^RfZN}D~Cnyr0uqU^$E2RrHJuCl|*b6P*^89IGqf#%`*7f3O0vK=ju?Sn1jeU>v zHe>frZItAsK9EQ2l;p+IZgEpLDoy+&wFROV#c&RBa(%ighFQ%cc@=>%*^C9cKIR%8 zvs&1`wbF%#ibZN;#?-JyYhth8&W_5ANZuq<5@xBkW279BeA}2J9Jrt;V_R{%vTlr} zK~cVDl+2oFSy+w6a~mkNxMco!c4?PfBu|3h)1`NI?X@Ba#d& zZdZ4W$_9>4MhiGP3J%>8hKu{=b;SR8__*K#yCg~~U1RDZt z1Q}KB?|C=`Zed^aBUZwCZr_=l;sUtmh}d$yNIG6F)$rD+;EiW&;do8Rjdi15!7-QC zw`-(RRj<{JVq;6MQMFO4Zkr`|U@FJpD^GaIsBdmJ>ZDh8>5^WnLErAGWCJHt!bags z8e9?D)1j z+RI08Bzf1s3dDNX`2PPR+?%i9-p#-NPrpC^2JZQnf%Cw-fp-Ca!yW(6zz>0M0-pgs z4cNd6@CfiS?)={dZUSv!75E_V81N|YJIwQ2;Cnz?6ZiuDeE_fxyFmWQ8ORyP8ORyP z8ORyP8ORyP8ORxUqcLzw__*qDF=+Cl&$oGTfXkP!3P-9O)wIJ^u0fnUZ--Bwq_!9A z;dabb2PK`URmg(Hs;q5gTaz&ba_y_xfm~yqx#k9)zM6Y zz;#et#<-@sf6|enTx@D4Ws_!vZ__4)$K1^dCsy!un0?$$HW-EKE((eF6ujpQbe?L&dqavDV zqFFqEq1*Lnd;`DhcnoHiIlsE18{n%m{Eu_1ozN?5zJ~^6Q%7b3TcQepDE7>ZhifF^ z;wwy=LCze8GEF>jAZ(OFkRr11+Jqk{`$Cf}ixo)u#TC8T(bJg!vv*bcnzUhwNIU-r D#5D@v literal 0 HcmV?d00001 diff --git a/lib/command_graph.c b/lib/command_graph.c index 7c09a5cd6c..3e52f42598 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -92,7 +92,7 @@ struct graph_node * copy_node (struct graph_node *node) { struct graph_node *new = new_node(node->type); - new->children = vector_copy (node->children); + new->children = NULL; new->is_start = node->is_start; new->end = node->end; new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; diff --git a/lib/command_lex.l b/lib/command_lex.l index 5a0e76d418..ce09c5bf28 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -9,7 +9,7 @@ IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M -VARIABLE [A-Z][A-Z_]+ +VARIABLE [A-Z][A-Z_:]+ NUMBER [0-9]{1,20} RANGE \({NUMBER}\-{NUMBER}\) diff --git a/lib/command_match.c b/lib/command_match.c index f02b7c821a..7b9c5f15d8 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -13,6 +13,9 @@ match_command_r (struct graph_node *, vector, unsigned int); static int score_precedence (struct graph_node *); +static enum match_type +min_match_level(enum node_type type); + /* token matcher prototypes */ static enum match_type match_ipv4 (const char *); @@ -30,7 +33,7 @@ static enum match_type match_range (struct graph_node *, const char *str); static enum match_type -match_word (struct graph_node *, enum filter_type, const char *); +match_word (struct graph_node *, const char *, enum filter_type); static enum match_type match_number (struct graph_node *, const char *); @@ -137,8 +140,11 @@ match_command (struct graph_node *start, const char *line, struct list **argv) static struct list * match_command_r (struct graph_node *start, vector vline, unsigned int n) { + // get the minimum match level that can count as a full match + enum match_type minmatch = min_match_level(start->type); + // if we don't match this node, die - if (match_token(start, vector_slot(vline, n), FILTER_STRICT) != exact_match) + if (match_token(start, vector_slot(vline, n), FILTER_RELAXED) < minmatch) return NULL; // arg list for this subgraph @@ -313,12 +319,30 @@ add_nexthops(struct list *l, struct graph_node *node) /* matching utility functions */ +/** + * Determines the minimum acceptable matching level + * for a given node type that can be accepted as a + * full match. Used for things like abbreviating + * commands, e.g. `conf t`. + */ +static enum match_type +min_match_level(enum node_type type) +{ + switch (type) { + case WORD_GN: + return partly_match; + default: + return exact_match; + } +} + static int score_precedence (struct graph_node *node) { switch (node->type) { - // these should be mutually exclusive + // these should be mutually exclusive, + // or never compared case IPV4_GN: case IPV4_PREFIX_GN: case IPV6_GN: @@ -344,11 +368,11 @@ match_token (struct graph_node *node, char *token, enum filter_type filter) case IPV4_GN: return match_ipv4 (token); case IPV4_PREFIX_GN: - return match_ipv4_prefix (token, filter); + return match_ipv4_prefix (token); case IPV6_GN: - return match_ipv6 (token, filter); + return match_ipv6 (token); case IPV6_PREFIX_GN: - return match_ipv6_prefix (token, filter); + return match_ipv6_prefix (token); case RANGE_GN: return match_range (node, token); case NUMBER_GN: @@ -584,8 +608,8 @@ match_range (struct graph_node *rangenode, const char *str) static enum match_type match_word(struct graph_node *wordnode, - enum filter_type filter, - const char *word) + const char *word, + enum filter_type filter) { if (filter == FILTER_RELAXED) { diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 2443b8471c..66e530595b 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -56,7 +56,7 @@ DEFUN (grammar_test_complete, // print possible next hops, if any for (ALL_LIST_ELEMENTS_RO(result,node,cnode)) { if (cnode->type == END_GN) - fprintf(stderr, "\n"); + fprintf(stderr, " %p\n", cnode->element->func); else fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); } diff --git a/opt.txt b/opt.txt new file mode 100644 index 0000000000..a63e0b85f2 --- /dev/null +++ b/opt.txt @@ -0,0 +1,905 @@ +address-family encap +address-family encapv4 +address-family encapv6 +address-family ipv4 +address-family ipv4 +address-family ipv6 +address-family ipv6 +address-family vpnv4 +address-family vpnv4 unicast +address-family vpnv6 +address-family vpnv6 unicast +aggregate-address A.B.C.D A.B.C.D +aggregate-address A.B.C.D A.B.C.D as-set +aggregate-address A.B.C.D A.B.C.D as-set summary-only +aggregate-address A.B.C.D A.B.C.D summary-only +aggregate-address A.B.C.D A.B.C.D summary-only as-set +aggregate-address A.B.C.D/M +aggregate-address A.B.C.D/M as-set +aggregate-address A.B.C.D/M as-set summary-only +aggregate-address A.B.C.D/M summary-only +aggregate-address A.B.C.D/M summary-only as-set +aggregate-address X:X::X:X/M +aggregate-address X:X::X:X/M summary-only +bgp always-compare-med +bgp bestpath as-path confed +bgp bestpath as-path ignore +bgp bestpath as-path multipath-relax +bgp bestpath compare-routerid +bgp bestpath med +bgp bestpath med confed missing-as-worst +bgp bestpath med missing-as-worst confed +bgp client-to-client reflection +bgp cluster-id (1-4294967295) +bgp cluster-id A.B.C.D +bgp confederation identifier (1-4294967295) +bgp confederation peers . (1-4294967295) +bgp config-type +bgp dampening +bgp dampening (1-45) +bgp dampening (1-45) (1-20000) (1-20000) (1-255) +bgp default ipv4-unicast +bgp default local-preference (0-4294967295) +bgp default show-hostname +bgp default subgroup-pkt-queue-max (20-100) +bgp deterministic-med +bgp disable-ebgp-connected-route-check +bgp enforce-first-as +bgp fast-external-failover +bgp graceful-restart +bgp graceful-restart stalepath-time (1-3600) +bgp listen limit (1-5000) +bgp listen range peer-group WORD +bgp log-neighbor-changes +bgp max-med administrative +bgp max-med administrative (0-4294967294) +bgp max-med on-startup (5-86400) +bgp max-med on-startup (5-86400) (0-4294967294) +bgp multiple-instance +bgp network import-check +bgp route-map delay-timer (0-600) +bgp route-reflector allow-outbound-policy +bgp router-id A.B.C.D +bgp router-id IFNAME +clear bgp +clear bgp in +clear bgp in prefix-filter +clear bgp out +clear bgp soft +clear bgp soft in +clear bgp soft out +clear bgp * +clear bgp * in +clear bgp * in prefix-filter +clear bgp * out +clear bgp * soft +clear bgp * soft in +clear bgp * soft out +clear bgp (1-4294967295) +clear bgp (1-4294967295) in +clear bgp (1-4294967295) in prefix-filter +clear bgp (1-4294967295) out +clear bgp (1-4294967295) soft +clear bgp (1-4294967295) soft in +clear bgp (1-4294967295) soft out +clear bgp BGP_INSTANCE_CMD +clear bgp BGP_INSTANCE_CMD in +clear bgp BGP_INSTANCE_CMD out +clear bgp BGP_INSTANCE_CMD soft +clear bgp BGP_INSTANCE_CMD soft in +clear bgp BGP_INSTANCE_CMD soft out +clear bgp BGP_INSTANCE_CMD * +clear bgp BGP_INSTANCE_CMD * in +clear bgp BGP_INSTANCE_CMD * out +clear bgp BGP_INSTANCE_CMD * soft +clear bgp BGP_INSTANCE_CMD * soft in +clear bgp BGP_INSTANCE_CMD * soft out +clear bgp BGP_INSTANCE_CMD (1-4294967295) +clear bgp BGP_INSTANCE_CMD (1-4294967295) in +clear bgp BGP_INSTANCE_CMD (1-4294967295) out +clear bgp BGP_INSTANCE_CMD (1-4294967295) soft +clear bgp BGP_INSTANCE_CMD (1-4294967295) soft in +clear bgp BGP_INSTANCE_CMD (1-4294967295) soft out +clear bgp BGP_INSTANCE_CMD external +clear bgp BGP_INSTANCE_CMD external in +clear bgp BGP_INSTANCE_CMD external out +clear bgp BGP_INSTANCE_CMD external soft +clear bgp BGP_INSTANCE_CMD external soft in +clear bgp BGP_INSTANCE_CMD external soft out +clear bgp BGP_INSTANCE_CMD ipv6 +clear bgp BGP_INSTANCE_CMD ipv6 in +clear bgp BGP_INSTANCE_CMD ipv6 out +clear bgp BGP_INSTANCE_CMD ipv6 soft +clear bgp BGP_INSTANCE_CMD ipv6 soft in +clear bgp BGP_INSTANCE_CMD ipv6 soft out +clear bgp BGP_INSTANCE_CMD ipv6 prefix X:X::X:X/M +clear bgp BGP_INSTANCE_CMD ipv6 * +clear bgp BGP_INSTANCE_CMD ipv6 * in +clear bgp BGP_INSTANCE_CMD ipv6 * out +clear bgp BGP_INSTANCE_CMD ipv6 * soft +clear bgp BGP_INSTANCE_CMD ipv6 * soft in +clear bgp BGP_INSTANCE_CMD ipv6 * soft out +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) in +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) out +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft in +clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft out +clear bgp BGP_INSTANCE_CMD ipv6 external +clear bgp BGP_INSTANCE_CMD ipv6 external WORD in +clear bgp BGP_INSTANCE_CMD ipv6 external WORD out +clear bgp BGP_INSTANCE_CMD ipv6 external soft +clear bgp BGP_INSTANCE_CMD ipv6 external soft in +clear bgp BGP_INSTANCE_CMD ipv6 external soft out +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD in +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD out +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft in +clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft out +clear bgp BGP_INSTANCE_CMD peer-group WORD +clear bgp BGP_INSTANCE_CMD peer-group WORD in +clear bgp BGP_INSTANCE_CMD peer-group WORD out +clear bgp BGP_INSTANCE_CMD peer-group WORD soft +clear bgp BGP_INSTANCE_CMD peer-group WORD soft in +clear bgp BGP_INSTANCE_CMD peer-group WORD soft out +clear bgp external +clear bgp external in +clear bgp external in prefix-filter +clear bgp external out +clear bgp external soft +clear bgp external soft in +clear bgp external soft out +clear bgp ipv6 +clear bgp ipv6 in +clear bgp ipv6 in prefix-filter +clear bgp ipv6 out +clear bgp ipv6 soft +clear bgp ipv6 soft in +clear bgp ipv6 soft out +clear bgp ipv6 prefix X:X::X:X/M +clear bgp ipv6 * +clear bgp ipv6 * in +clear bgp ipv6 * in prefix-filter +clear bgp ipv6 * out +clear bgp ipv6 * soft +clear bgp ipv6 * soft in +clear bgp ipv6 * soft out +clear bgp ipv6 (1-4294967295) +clear bgp ipv6 (1-4294967295) in +clear bgp ipv6 (1-4294967295) in prefix-filter +clear bgp ipv6 (1-4294967295) out +clear bgp ipv6 (1-4294967295) soft +clear bgp ipv6 (1-4294967295) soft in +clear bgp ipv6 (1-4294967295) soft out +clear bgp ipv6 external +clear bgp ipv6 external WORD in +clear bgp ipv6 external WORD out +clear bgp ipv6 external in prefix-filter +clear bgp ipv6 external soft +clear bgp ipv6 external soft in +clear bgp ipv6 external soft out +clear bgp ipv6 peer-group WORD +clear bgp ipv6 peer-group WORD in +clear bgp ipv6 peer-group WORD in prefix-filter +clear bgp ipv6 peer-group WORD out +clear bgp ipv6 peer-group WORD soft +clear bgp ipv6 peer-group WORD soft in +clear bgp ipv6 peer-group WORD soft out +clear bgp peer-group WORD +clear bgp peer-group WORD in +clear bgp peer-group WORD in prefix-filter +clear bgp peer-group WORD out +clear bgp peer-group WORD soft +clear bgp peer-group WORD soft in +clear bgp peer-group WORD soft out +clear ip bgp in +clear ip bgp in prefix-filter +clear ip bgp ipv4 in +clear ip bgp ipv4 in prefix-filter +clear ip bgp ipv4 out +clear ip bgp ipv4 soft +clear ip bgp ipv4 soft in +clear ip bgp ipv4 soft out +clear ip bgp out +clear ip bgp soft +clear ip bgp soft in +clear ip bgp soft out +clear ip bgp vpnv4 unicast in +clear ip bgp vpnv4 unicast out +clear ip bgp vpnv4 unicast soft +clear ip bgp vpnv4 unicast soft in +clear ip bgp vpnv4 unicast soft out +clear ip bgp +clear ip bgp * +clear ip bgp * encap unicast in +clear ip bgp * encap unicast out +clear ip bgp * encap unicast soft +clear ip bgp * encap unicast soft in +clear ip bgp * encap unicast soft out +clear ip bgp * in +clear ip bgp * in prefix-filter +clear ip bgp * ipv4 in +clear ip bgp * ipv4 in prefix-filter +clear ip bgp * ipv4 out +clear ip bgp * ipv4 soft +clear ip bgp * ipv4 soft in +clear ip bgp * ipv4 soft out +clear ip bgp * out +clear ip bgp * soft +clear ip bgp * soft in +clear ip bgp * soft out +clear ip bgp * vpnv4 unicast in +clear ip bgp * vpnv4 unicast out +clear ip bgp * vpnv4 unicast soft +clear ip bgp * vpnv4 unicast soft in +clear ip bgp * vpnv4 unicast soft out +clear ip bgp (1-4294967295) +clear ip bgp (1-4294967295) encap unicast in +clear ip bgp (1-4294967295) encap unicast out +clear ip bgp (1-4294967295) encap unicast soft +clear ip bgp (1-4294967295) encap unicast soft in +clear ip bgp (1-4294967295) encap unicast soft out +clear ip bgp (1-4294967295) in +clear ip bgp (1-4294967295) in prefix-filter +clear ip bgp (1-4294967295) ipv4 in +clear ip bgp (1-4294967295) ipv4 in prefix-filter +clear ip bgp (1-4294967295) ipv4 out +clear ip bgp (1-4294967295) ipv4 soft +clear ip bgp (1-4294967295) ipv4 soft in +clear ip bgp (1-4294967295) ipv4 soft out +clear ip bgp (1-4294967295) out +clear ip bgp (1-4294967295) soft +clear ip bgp (1-4294967295) soft in +clear ip bgp (1-4294967295) soft out +clear ip bgp (1-4294967295) vpnv4 unicast in +clear ip bgp (1-4294967295) vpnv4 unicast out +clear ip bgp (1-4294967295) vpnv4 unicast soft +clear ip bgp (1-4294967295) vpnv4 unicast soft in +clear ip bgp (1-4294967295) vpnv4 unicast soft out +clear ip bgp A.B.C.D encap unicast in +clear ip bgp A.B.C.D encap unicast out +clear ip bgp A.B.C.D encap unicast soft +clear ip bgp A.B.C.D encap unicast soft in +clear ip bgp A.B.C.D encap unicast soft out +clear ip bgp BGP_INSTANCE_CMD in +clear ip bgp BGP_INSTANCE_CMD ipv4 in +clear ip bgp BGP_INSTANCE_CMD ipv4 out +clear ip bgp BGP_INSTANCE_CMD ipv4 soft +clear ip bgp BGP_INSTANCE_CMD ipv4 soft in +clear ip bgp BGP_INSTANCE_CMD ipv4 soft out +clear ip bgp BGP_INSTANCE_CMD out +clear ip bgp BGP_INSTANCE_CMD soft +clear ip bgp BGP_INSTANCE_CMD soft in +clear ip bgp BGP_INSTANCE_CMD soft out +clear ip bgp BGP_INSTANCE_CMD +clear ip bgp BGP_INSTANCE_CMD * +clear ip bgp BGP_INSTANCE_CMD * in +clear ip bgp BGP_INSTANCE_CMD * ipv4 in +clear ip bgp BGP_INSTANCE_CMD * ipv4 out +clear ip bgp BGP_INSTANCE_CMD * ipv4 soft +clear ip bgp BGP_INSTANCE_CMD * ipv4 soft in +clear ip bgp BGP_INSTANCE_CMD * ipv4 soft out +clear ip bgp BGP_INSTANCE_CMD * out +clear ip bgp BGP_INSTANCE_CMD * soft +clear ip bgp BGP_INSTANCE_CMD * soft in +clear ip bgp BGP_INSTANCE_CMD * soft out +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) in +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 in +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 out +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft in +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft out +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) out +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft in +clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft out +clear ip bgp BGP_INSTANCE_CMD external +clear ip bgp BGP_INSTANCE_CMD external in +clear ip bgp BGP_INSTANCE_CMD external ipv4 in +clear ip bgp BGP_INSTANCE_CMD external ipv4 out +clear ip bgp BGP_INSTANCE_CMD external ipv4 soft +clear ip bgp BGP_INSTANCE_CMD external ipv4 soft in +clear ip bgp BGP_INSTANCE_CMD external ipv4 soft out +clear ip bgp BGP_INSTANCE_CMD external out +clear ip bgp BGP_INSTANCE_CMD external soft +clear ip bgp BGP_INSTANCE_CMD external soft in +clear ip bgp BGP_INSTANCE_CMD external soft out +clear ip bgp BGP_INSTANCE_CMD peer-group WORD +clear ip bgp BGP_INSTANCE_CMD peer-group WORD in +clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 in +clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 out +clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft +clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft in +clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft out +clear ip bgp BGP_INSTANCE_CMD peer-group WORD out +clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft +clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft in +clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft out +clear ip bgp BGP_INSTANCE_CMD prefix A.B.C.D/M +clear ip bgp dampening +clear ip bgp dampening A.B.C.D +clear ip bgp dampening A.B.C.D A.B.C.D +clear ip bgp dampening A.B.C.D/M +clear ip bgp external +clear ip bgp external in +clear ip bgp external in prefix-filter +clear ip bgp external ipv4 in +clear ip bgp external ipv4 in prefix-filter +clear ip bgp external ipv4 out +clear ip bgp external ipv4 soft +clear ip bgp external ipv4 soft in +clear ip bgp external ipv4 soft out +clear ip bgp external out +clear ip bgp external soft +clear ip bgp external soft in +clear ip bgp external soft out +clear ip bgp peer-group WORD +clear ip bgp peer-group WORD in +clear ip bgp peer-group WORD in prefix-filter +clear ip bgp peer-group WORD ipv4 in +clear ip bgp peer-group WORD ipv4 in prefix-filter +clear ip bgp peer-group WORD ipv4 out +clear ip bgp peer-group WORD ipv4 soft +clear ip bgp peer-group WORD ipv4 soft in +clear ip bgp peer-group WORD ipv4 soft out +clear ip bgp peer-group WORD out +clear ip bgp peer-group WORD soft +clear ip bgp peer-group WORD soft in +clear ip bgp peer-group WORD soft out +clear ip bgp prefix A.B.C.D/M +coalesce-time (0-4294967295) +debug bgp as4 +debug bgp as4 segment +debug bgp bestpath +debug bgp keepalives +debug bgp keepalives +debug bgp neighbor-events +debug bgp neighbor-events +debug bgp nht +debug bgp update-groups +debug bgp updates +debug bgp updates +debug bgp updates +debug bgp updates prefix +debug bgp zebra +debug bgp zebra prefix +distance (1-255) A.B.C.D/M +distance (1-255) A.B.C.D/M WORD +distance bgp (1-255) (1-255) (1-255) +dump bgp PATH [INTERVAL] +exit-address-family +ip community-list (1-99) +ip community-list (1-99) AA:NN +ip community-list (100-500) LINE +ip community-list expanded WORD LINE +ip community-list standard WORD +ip community-list standard WORD AA:NN +ip extcommunity-list (1-99) +ip extcommunity-list (1-99) AA:NN +ip extcommunity-list (100-500) LINE +ip extcommunity-list expanded WORD LINE +ip extcommunity-list standard WORD +ip extcommunity-list standard WORD AA:NN +ipv6 bgp aggregate-address X:X::X:X/M +ipv6 bgp aggregate-address X:X::X:X/M summary-only +ipv6 bgp network X:X::X:X/M +match as-path WORD +match community <(1-99)|(100-500)|WORD> +match community <(1-99)|(100-500)|WORD> exact-match +match extcommunity <(1-99)|(100-500)|WORD> +match interface WORD +match ip address <(1-199)|(1300-2699)|WORD> +match ip address prefix-list WORD +match ip next-hop <(1-199)|(1300-2699)|WORD> +match ip next-hop prefix-list WORD +match ip route-source <(1-199)|(1300-2699)|WORD> +match ip route-source prefix-list WORD +match ipv6 address WORD +match ipv6 address prefix-list WORD +match ipv6 next-hop X:X::X:X +match local-preference (0-4294967295) +match metric (0-4294967295) +match origin +match peer +match peer local +match probability (0-100) +match tag (1-65535) +maximum-paths (1-255) +maximum-paths ibgp (1-255) +maximum-paths ibgp (1-255) equal-cluster-length +neighbor interface WORD +neighbor port (0-65535) +neighbor strict-capability-match +neighbor activate +neighbor addpath-tx-all-paths +neighbor addpath-tx-bestpath-per-AS +neighbor advertisement-interval (0-600) +neighbor allowas-in +neighbor allowas-in (1-10) +neighbor as-override +neighbor attribute-unchanged +neighbor attribute-unchanged +neighbor attribute-unchanged as-path +neighbor attribute-unchanged as-path med next-hop +neighbor attribute-unchanged as-path next-hop med +neighbor attribute-unchanged med +neighbor attribute-unchanged med as-path next-hop +neighbor attribute-unchanged med next-hop as-path +neighbor attribute-unchanged next-hop +neighbor attribute-unchanged next-hop as-path med +neighbor attribute-unchanged next-hop med as-path +neighbor bfd +neighbor bfd (2-255) BFD_CMD_MIN_RX_RANGE (50-60000) +neighbor capability dynamic +neighbor capability extended-nexthop +neighbor capability orf prefix-list +neighbor default-originate +neighbor default-originate route-map WORD +neighbor description LINE +neighbor disable-connected-check +neighbor distribute-list <(1-199)|(1300-2699)|WORD> +neighbor dont-capability-negotiate +neighbor ebgp-multihop +neighbor ebgp-multihop (1-255) +neighbor enforce-multihop +neighbor filter-list WORD +neighbor local-as (1-4294967295) +neighbor local-as (1-4294967295) no-prepend +neighbor local-as (1-4294967295) no-prepend replace-as +neighbor maximum-prefix (1-4294967295) +neighbor maximum-prefix (1-4294967295) (1-100) +neighbor maximum-prefix (1-4294967295) (1-100) restart (1-65535) +neighbor maximum-prefix (1-4294967295) (1-100) warning-only +neighbor maximum-prefix (1-4294967295) restart (1-65535) +neighbor maximum-prefix (1-4294967295) warning-only +neighbor next-hop-self +neighbor next-hop-self force +neighbor nexthop-local unchanged +neighbor override-capability +neighbor passive +neighbor password LINE +neighbor peer-group WORD +neighbor prefix-list WORD +neighbor remote-as <(1-4294967295)|external|internal> +neighbor remove-private-AS +neighbor remove-private-AS all +neighbor remove-private-AS all replace-AS +neighbor remove-private-AS replace-AS +neighbor route-map WORD +neighbor route-reflector-client +neighbor route-server-client +neighbor send-community +neighbor send-community +neighbor shutdown +neighbor soft-reconfiguration inbound +neighbor solo +neighbor timers (0-65535) (0-65535) +neighbor timers connect (1-65535) +neighbor ttl-security hops (1-254) +neighbor unsuppress-map WORD +neighbor update-source +neighbor weight (0-65535) +neighbor WORD interface +neighbor WORD interface peer-group WORD +neighbor WORD interface v6only +neighbor WORD interface v6only peer-group WORD +neighbor WORD peer-group +network A.B.C.D +network A.B.C.D backdoor +network A.B.C.D mask A.B.C.D +network A.B.C.D mask A.B.C.D backdoor +network A.B.C.D mask A.B.C.D route-map WORD +network A.B.C.D route-map WORD +network A.B.C.D/M +network A.B.C.D/M backdoor +network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD +network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD +network A.B.C.D/M route-map WORD +network X:X::X:X/M +network X:X::X:X/M route-map WORD +redistribute +redistribute metric (0-4294967295) +redistribute metric (0-4294967295) route-map WORD +redistribute route-map WORD +redistribute route-map WORD metric (0-4294967295) +redistribute +redistribute metric (0-4294967295) +redistribute metric (0-4294967295) route-map WORD +redistribute route-map WORD +redistribute route-map WORD metric (0-4294967295) +redistribute (1-65535) +redistribute (1-65535) metric (0-4294967295) +redistribute (1-65535) metric (0-4294967295) route-map WORD +redistribute (1-65535) route-map WORD +redistribute (1-65535) route-map WORD metric (0-4294967295) +router bgp +router bgp (1-4294967295) +router bgp (1-4294967295) WORD +set aggregator as (1-4294967295) A.B.C.D +set as-path exclude . (1-4294967295) +set as-path prepend (last-as) (1-10) +set as-path prepend . (1-4294967295) +set atomic-aggregate +set comm-list <(1-99)|(100-500)|WORD> delete +set community AA:NN +set community none +set extcommunity rt .ASN:nn_or_IP-address:nn +set extcommunity soo .ASN:nn_or_IP-address:nn +set ip next-hop A.B.C.D +set ip next-hop peer-address +set ip next-hop unchanged +set ipv6 next-hop global X:X::X:X +set ipv6 next-hop local X:X::X:X +set ipv6 next-hop peer-address +set local-preference (0-4294967295) +set metric +set metric <+/-metric> +set metric (0-4294967295) +set origin +set originator-id A.B.C.D +set tag (1-65535) +set vpnv4 next-hop A.B.C.D +set weight (0-4294967295) +show bgp statistics +show bgp update-groups +show bgp update-groups +show bgp update-groups SUBGROUP-ID +show bgp update-groups SUBGROUP-ID +show bgp BGP_INSTANCE_ALL_CMD summary [json] +show bgp BGP_INSTANCE_ALL_CMD update-groups +show bgp BGP_INSTANCE_ALL_CMD [json] +show bgp BGP_INSTANCE_CMD community +show bgp BGP_INSTANCE_CMD community +show bgp BGP_INSTANCE_CMD community +show bgp BGP_INSTANCE_CMD community +show bgp BGP_INSTANCE_CMD community +show bgp BGP_INSTANCE_CMD neighbors [json] +show bgp BGP_INSTANCE_CMD statistics +show bgp BGP_INSTANCE_CMD X:X::X:X [json] +show bgp BGP_INSTANCE_CMD X:X::X:X [json] +show bgp BGP_INSTANCE_CMD X:X::X:X/M [json] +show bgp BGP_INSTANCE_CMD X:X::X:X/M longer-prefixes +show bgp BGP_INSTANCE_CMD X:X::X:X/M [json] +show bgp BGP_INSTANCE_CMD community-list <(1-500)|WORD> +show bgp BGP_INSTANCE_CMD filter-list WORD +show bgp BGP_INSTANCE_CMD ipv6 summary [json] +show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X [json] +show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X [json] +show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M [json] +show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M longer-prefixes +show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M [json] +show bgp BGP_INSTANCE_CMD ipv6 community-list <(1-500)|WORD> +show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD +show bgp BGP_INSTANCE_CMD ipv6 neighbors advertised-routes [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors dampened-routes [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors flap-statistics [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors prefix-counts [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors received prefix-filter [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors received-routes [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors routes [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] +show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] +show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD +show bgp BGP_INSTANCE_CMD ipv6 route-map WORD +show bgp BGP_INSTANCE_CMD ipv6 summary [json] +show bgp BGP_INSTANCE_CMD ipv6 [json] +show bgp BGP_INSTANCE_CMD neighbors advertised-routes [json] +show bgp BGP_INSTANCE_CMD neighbors dampened-routes [json] +show bgp BGP_INSTANCE_CMD neighbors flap-statistics [json] +show bgp BGP_INSTANCE_CMD neighbors received prefix-filter [json] +show bgp BGP_INSTANCE_CMD neighbors received-routes [json] +show bgp BGP_INSTANCE_CMD neighbors routes [json] +show bgp BGP_INSTANCE_CMD neighbors [json] +show bgp BGP_INSTANCE_CMD neighbors [json] +show bgp BGP_INSTANCE_CMD prefix-list WORD +show bgp BGP_INSTANCE_CMD route-map WORD +show bgp BGP_INSTANCE_CMD summary [json] +show bgp BGP_INSTANCE_CMD update-groups +show bgp BGP_INSTANCE_CMD update-groups +show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID +show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID +show bgp BGP_INSTANCE_CMD [json] +show bgp X:X::X:X [json] +show bgp X:X::X:X [json] +show bgp X:X::X:X/M [json] +show bgp X:X::X:X/M longer-prefixes +show bgp X:X::X:X/M [json] +show bgp community +show bgp community +show bgp community +show bgp community +show bgp community +show bgp community exact-match +show bgp community exact-match +show bgp community exact-match +show bgp community exact-match +show bgp community-list <(1-500)|WORD> +show bgp community-list <(1-500)|WORD> exact-match +show bgp filter-list WORD +show bgp ipv4 A.B.C.D [json] +show bgp ipv4 A.B.C.D [json] +show bgp ipv4 A.B.C.D/M [json] +show bgp ipv4 A.B.C.D/M [json] +show bgp ipv4 summary [json] +show bgp ipv4 [json] +show bgp ipv4 encap +show bgp ipv4 encap neighbors A.B.C.D advertised-routes +show bgp ipv4 encap neighbors A.B.C.D routes +show bgp ipv4 encap rd ASN:nn_or_IP-address:nn +show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes +show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors routes +show bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags +show bgp ipv4 encap tags +show bgp ipv6 X:X::X:X [json] +show bgp ipv6 X:X::X:X [json] +show bgp ipv6 X:X::X:X/M [json] +show bgp ipv6 X:X::X:X/M [json] +show bgp ipv6 summary [json] +show bgp ipv6 [json] +show bgp ipv6 X:X::X:X [json] +show bgp ipv6 X:X::X:X [json] +show bgp ipv6 X:X::X:X/M [json] +show bgp ipv6 X:X::X:X/M longer-prefixes +show bgp ipv6 X:X::X:X/M [json] +show bgp ipv6 community +show bgp ipv6 community +show bgp ipv6 community +show bgp ipv6 community +show bgp ipv6 community +show bgp ipv6 community exact-match +show bgp ipv6 community exact-match +show bgp ipv6 community exact-match +show bgp ipv6 community exact-match +show bgp ipv6 community-list <(1-500)|WORD> +show bgp ipv6 community-list <(1-500)|WORD> exact-match +show bgp ipv6 encap +show bgp ipv6 encap neighbors A.B.C.D advertised-routes +show bgp ipv6 encap neighbors A.B.C.D routes +show bgp ipv6 encap rd ASN:nn_or_IP-address:nn +show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes +show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors routes +show bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags +show bgp ipv6 encap tags +show bgp ipv6 filter-list WORD +show bgp ipv6 neighbors advertised-routes [json] +show bgp ipv6 neighbors dampened-routes [json] +show bgp ipv6 neighbors flap-statistics [json] +show bgp ipv6 neighbors prefix-counts [json] +show bgp ipv6 neighbors received prefix-filter [json] +show bgp ipv6 neighbors received-routes [json] +show bgp ipv6 neighbors routes [json] +show bgp ipv6 neighbors [json] +show bgp ipv6 neighbors [json] +show bgp ipv6 prefix-list WORD +show bgp ipv6 regexp LINE +show bgp ipv6 route-map WORD +show bgp ipv6 summary [json] +show bgp ipv6 [json] +show bgp memory +show bgp neighbors advertised-routes [json] +show bgp neighbors dampened-routes [json] +show bgp neighbors flap-statistics [json] +show bgp neighbors received prefix-filter [json] +show bgp neighbors received-routes [json] +show bgp neighbors routes [json] +show bgp neighbors [json] +show bgp neighbors [json] +show bgp prefix-list WORD +show bgp regexp LINE +show bgp route-map WORD +show bgp summary [json] +show bgp update-groups +show bgp update-groups +show bgp update-groups SUBGROUP-ID +show bgp update-groups SUBGROUP-ID +show bgp view WORD ipv4 summary [json] +show bgp views +show bgp vrfs [json] +show bgp [json] +show debugging bgp +show ip as-path-access-list +show ip as-path-access-list WORD +show ip bgp A.B.C.D [json] +show ip bgp A.B.C.D [json] +show ip bgp A.B.C.D/M [json] +show ip bgp A.B.C.D/M longer-prefixes +show ip bgp A.B.C.D/M [json] +show ip bgp BGP_INSTANCE_ALL_CMD neighbors [json] +show ip bgp BGP_INSTANCE_ALL_CMD nexthop +show ip bgp BGP_INSTANCE_ALL_CMD summary [json] +show ip bgp BGP_INSTANCE_ALL_CMD update-groups +show ip bgp BGP_INSTANCE_ALL_CMD [json] +show ip bgp BGP_INSTANCE_CMD A.B.C.D [json] +show ip bgp BGP_INSTANCE_CMD A.B.C.D [json] +show ip bgp BGP_INSTANCE_CMD A.B.C.D/M [json] +show ip bgp BGP_INSTANCE_CMD A.B.C.D/M longer-prefixes +show ip bgp BGP_INSTANCE_CMD A.B.C.D/M [json] +show ip bgp BGP_INSTANCE_CMD community-list <(1-500)|WORD> +show ip bgp BGP_INSTANCE_CMD filter-list WORD +show ip bgp BGP_INSTANCE_CMD neighbors advertised-routes route-map WORD [json] +show ip bgp BGP_INSTANCE_CMD neighbors advertised-routes [json] +show ip bgp BGP_INSTANCE_CMD neighbors prefix-counts [json] +show ip bgp BGP_INSTANCE_CMD neighbors received-routes route-map WORD [json] +show ip bgp BGP_INSTANCE_CMD neighbors received-routes [json] +show ip bgp BGP_INSTANCE_CMD neighbors routes [json] +show ip bgp BGP_INSTANCE_CMD neighbors [json] +show ip bgp BGP_INSTANCE_CMD neighbors [json] +show ip bgp BGP_INSTANCE_CMD nexthop +show ip bgp BGP_INSTANCE_CMD nexthop detail +show ip bgp BGP_INSTANCE_CMD peer-group +show ip bgp BGP_INSTANCE_CMD peer-group WORD +show ip bgp BGP_INSTANCE_CMD prefix-list WORD +show ip bgp BGP_INSTANCE_CMD route-map WORD +show ip bgp BGP_INSTANCE_CMD summary [json] +show ip bgp BGP_INSTANCE_CMD update-groups +show ip bgp BGP_INSTANCE_CMD update-groups +show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID +show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID +show ip bgp BGP_INSTANCE_CMD [json] +show ip bgp attribute-info +show ip bgp cidr-only +show ip bgp community +show ip bgp community +show ip bgp community +show ip bgp community +show ip bgp community +show ip bgp community exact-match +show ip bgp community exact-match +show ip bgp community exact-match +show ip bgp community exact-match +show ip bgp community-info +show ip bgp community-list <(1-500)|WORD> +show ip bgp community-list <(1-500)|WORD> exact-match +show ip bgp dampened-paths +show ip bgp dampening dampened-paths +show ip bgp dampening flap-statistics +show ip bgp dampening flap-statistics A.B.C.D +show ip bgp dampening flap-statistics A.B.C.D/M longer-prefixes +show ip bgp dampening flap-statistics cidr-only +show ip bgp dampening flap-statistics filter-list WORD +show ip bgp dampening flap-statistics prefix-list WORD +show ip bgp dampening flap-statistics regexp LINE +show ip bgp dampening flap-statistics route-map WORD +show ip bgp dampening parameters +show ip bgp filter-list WORD +show ip bgp flap-statistics +show ip bgp flap-statistics A.B.C.D +show ip bgp flap-statistics A.B.C.D/M +show ip bgp flap-statistics A.B.C.D/M longer-prefixes +show ip bgp flap-statistics cidr-only +show ip bgp flap-statistics filter-list WORD +show ip bgp flap-statistics prefix-list WORD +show ip bgp flap-statistics regexp LINE +show ip bgp flap-statistics route-map WORD +show ip bgp ipv4 A.B.C.D [json] +show ip bgp ipv4 A.B.C.D/M [json] +show ip bgp ipv4 A.B.C.D/M longer-prefixes +show ip bgp ipv4 A.B.C.D/M [json] +show ip bgp ipv4 cidr-only +show ip bgp ipv4 community +show ip bgp ipv4 community +show ip bgp ipv4 community +show ip bgp ipv4 community +show ip bgp ipv4 community +show ip bgp ipv4 community exact-match +show ip bgp ipv4 community exact-match +show ip bgp ipv4 community exact-match +show ip bgp ipv4 community exact-match +show ip bgp ipv4 community-list <(1-500)|WORD> +show ip bgp ipv4 community-list <(1-500)|WORD> exact-match +show ip bgp ipv4 filter-list WORD +show ip bgp ipv4 neighbors advertised-routes route-map WORD [json] +show ip bgp ipv4 neighbors advertised-routes [json] +show ip bgp ipv4 neighbors prefix-counts [json] +show ip bgp ipv4 neighbors received prefix-filter [json] +show ip bgp ipv4 neighbors received-routes route-map WORD [json] +show ip bgp ipv4 neighbors received-routes [json] +show ip bgp ipv4 neighbors routes [json] +show ip bgp ipv4 neighbors [json] +show ip bgp ipv4 neighbors [json] +show ip bgp ipv4 paths +show ip bgp ipv4 prefix-list WORD +show ip bgp ipv4 regexp LINE +show ip bgp ipv4 route-map WORD +show ip bgp ipv4 summary [json] +show ip bgp ipv4 [json] +show ip bgp neighbors advertised-routes route-map WORD [json] +show ip bgp neighbors advertised-routes [json] +show ip bgp neighbors dampened-routes [json] +show ip bgp neighbors flap-statistics [json] +show ip bgp neighbors prefix-counts [json] +show ip bgp neighbors received prefix-filter [json] +show ip bgp neighbors received-routes route-map WORD [json] +show ip bgp neighbors received-routes [json] +show ip bgp neighbors routes [json] +show ip bgp neighbors [json] +show ip bgp neighbors [json] +show ip bgp nexthop +show ip bgp nexthop detail +show ip bgp paths +show ip bgp peer-group +show ip bgp peer-group WORD +show ip bgp prefix-list WORD +show ip bgp regexp LINE +show ip bgp route-map WORD +show ip bgp summary [json] +show ip bgp update-groups +show ip bgp update-groups +show ip bgp update-groups SUBGROUP-ID +show ip bgp update-groups SUBGROUP-ID +show ip bgp view WORD ipv4 summary [json] +show ip bgp vpnv4 all +show ip bgp vpnv4 all A.B.C.D [json] +show ip bgp vpnv4 all A.B.C.D/M [json] +show ip bgp vpnv4 all neighbors prefix-counts [json] +show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes [json] +show ip bgp vpnv4 all neighbors A.B.C.D routes [json] +show ip bgp vpnv4 all neighbors A.B.C.D [json] +show ip bgp vpnv4 all neighbors [json] +show ip bgp vpnv4 all summary [json] +show ip bgp vpnv4 all tags +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] +show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags +show ip bgp [json] +show ip community-list +show ip community-list <(1-500)|WORD> +show ip extcommunity-list +show ip extcommunity-list <(1-500)|WORD> +show ipv6 bgp X:X::X:X [json] +show ipv6 bgp X:X::X:X/M longer-prefixes +show ipv6 bgp X:X::X:X/M [json] +show ipv6 bgp community +show ipv6 bgp community +show ipv6 bgp community +show ipv6 bgp community +show ipv6 bgp community +show ipv6 bgp community exact-match +show ipv6 bgp community exact-match +show ipv6 bgp community exact-match +show ipv6 bgp community exact-match +show ipv6 bgp community-list WORD +show ipv6 bgp community-list WORD exact-match +show ipv6 bgp filter-list WORD +show ipv6 bgp neighbors advertised-routes [json] +show ipv6 bgp neighbors received-routes [json] +show ipv6 bgp neighbors routes [json] +show ipv6 bgp prefix-list WORD +show ipv6 bgp regexp LINE +show ipv6 bgp summary [json] +show ipv6 bgp [json] +show ipv6 mbgp X:X::X:X [json] +show ipv6 mbgp X:X::X:X/M longer-prefixes +show ipv6 mbgp X:X::X:X/M [json] +show ipv6 mbgp community +show ipv6 mbgp community +show ipv6 mbgp community +show ipv6 mbgp community +show ipv6 mbgp community +show ipv6 mbgp community exact-match +show ipv6 mbgp community exact-match +show ipv6 mbgp community exact-match +show ipv6 mbgp community exact-match +show ipv6 mbgp community-list WORD +show ipv6 mbgp community-list WORD exact-match +show ipv6 mbgp filter-list WORD +show ipv6 mbgp neighbors advertised-routes [json] +show ipv6 mbgp neighbors received-routes [json] +show ipv6 mbgp neighbors routes [json] +show ipv6 mbgp prefix-list WORD +show ipv6 mbgp regexp LINE +show ipv6 mbgp summary [json] +show ipv6 mbgp [json] +table-map WORD +timers bgp (0-65535) (0-65535) +update-delay (0-3600) +update-delay (0-3600) (1-3600) +write-quanta (1-10000) diff --git a/quagga_parser_to_network_docopt.py b/quagga_parser_to_network_docopt.py new file mode 100755 index 0000000000..89a6fd7985 --- /dev/null +++ b/quagga_parser_to_network_docopt.py @@ -0,0 +1,1327 @@ +#!/usr/bin/env python + +""" +The primary use case of this tool is to print a network-docopt compatible +docstring that covers all bgp and ospf commands in quagga. +""" + +import argparse +import logging +import os +import re +import sys +from pprint import pprint, pformat + +# All of the clear commands in bgp_clear_ignore will be covered by these clear commands: +# quagga clear bgp (|||*) +# quagga clear bgp (|||*) soft [in|out] +# quagga clear bgp prefix +bgp_clear_ignore = """ quagga clear bgp (||) + quagga clear bgp (||) in + quagga clear bgp (||) in prefix-filter + quagga clear bgp (||) out + quagga clear bgp (||) soft + quagga clear bgp (||) soft in + quagga clear bgp (||) soft out + quagga clear bgp * + quagga clear bgp * in + quagga clear bgp * in prefix-filter + quagga clear bgp * out + quagga clear bgp * soft + quagga clear bgp * soft in + quagga clear bgp * soft out + quagga clear bgp <1-4294967295> + quagga clear bgp <1-4294967295> in + quagga clear bgp <1-4294967295> in prefix-filter + quagga clear bgp <1-4294967295> out + quagga clear bgp <1-4294967295> soft + quagga clear bgp <1-4294967295> soft in + quagga clear bgp <1-4294967295> soft out + quagga clear bgp BGP_INSTANCE_CMD * + quagga clear bgp BGP_INSTANCE_CMD * soft + quagga clear bgp BGP_INSTANCE_CMD * soft in + quagga clear bgp BGP_INSTANCE_CMD * soft out + quagga clear bgp external + quagga clear bgp external in + quagga clear bgp external in prefix-filter + quagga clear bgp external out + quagga clear bgp external soft + quagga clear bgp external soft in + quagga clear bgp external soft out + quagga clear bgp ipv6 (||) + quagga clear bgp ipv6 (||) in + quagga clear bgp ipv6 (||) in prefix-filter + quagga clear bgp ipv6 (||) out + quagga clear bgp ipv6 (||) soft + quagga clear bgp ipv6 (||) soft in + quagga clear bgp ipv6 (||) soft out + quagga clear bgp ipv6 (unicast|multicast) prefix + quagga clear bgp ipv6 * + quagga clear bgp ipv6 * in + quagga clear bgp ipv6 * in prefix-filter + quagga clear bgp ipv6 * out + quagga clear bgp ipv6 * soft + quagga clear bgp ipv6 * soft in + quagga clear bgp ipv6 * soft out + quagga clear bgp ipv6 <1-4294967295> + quagga clear bgp ipv6 <1-4294967295> in + quagga clear bgp ipv6 <1-4294967295> in prefix-filter + quagga clear bgp ipv6 <1-4294967295> out + quagga clear bgp ipv6 <1-4294967295> soft + quagga clear bgp ipv6 <1-4294967295> soft in + quagga clear bgp ipv6 <1-4294967295> soft out + quagga clear bgp ipv6 external + quagga clear bgp ipv6 external WORD in + quagga clear bgp ipv6 external WORD out + quagga clear bgp ipv6 external in prefix-filter + quagga clear bgp ipv6 external soft + quagga clear bgp ipv6 external soft in + quagga clear bgp ipv6 external soft out + quagga clear bgp ipv6 peer-group WORD + quagga clear bgp ipv6 peer-group WORD in + quagga clear bgp ipv6 peer-group WORD in prefix-filter + quagga clear bgp ipv6 peer-group WORD out + quagga clear bgp ipv6 peer-group WORD soft + quagga clear bgp ipv6 peer-group WORD soft in + quagga clear bgp ipv6 peer-group WORD soft out + quagga clear bgp peer-group WORD + quagga clear bgp peer-group WORD in + quagga clear bgp peer-group WORD in prefix-filter + quagga clear bgp peer-group WORD out + quagga clear bgp peer-group WORD soft + quagga clear bgp peer-group WORD soft in + quagga clear bgp peer-group WORD soft out + quagga clear ip bgp (|) in + quagga clear ip bgp (|) in prefix-filter + quagga clear ip bgp (|) ipv4 (unicast|multicast) in + quagga clear ip bgp (|) ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp (|) ipv4 (unicast|multicast) out + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft in + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft out + quagga clear ip bgp (|) out + quagga clear ip bgp (|) soft + quagga clear ip bgp (|) soft in + quagga clear ip bgp (|) soft out + quagga clear ip bgp (|) vpnv4 unicast in + quagga clear ip bgp (|) vpnv4 unicast out + quagga clear ip bgp (|) vpnv4 unicast soft + quagga clear ip bgp (|) vpnv4 unicast soft in + quagga clear ip bgp (|) vpnv4 unicast soft out + quagga clear ip bgp (||) + quagga clear ip bgp * + quagga clear ip bgp * in + quagga clear ip bgp * in prefix-filter + quagga clear ip bgp * ipv4 (unicast|multicast) in + quagga clear ip bgp * ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp * ipv4 (unicast|multicast) out + quagga clear ip bgp * ipv4 (unicast|multicast) soft + quagga clear ip bgp * ipv4 (unicast|multicast) soft in + quagga clear ip bgp * ipv4 (unicast|multicast) soft out + quagga clear ip bgp * out + quagga clear ip bgp * soft + quagga clear ip bgp * soft in + quagga clear ip bgp * soft out + quagga clear ip bgp * vpnv4 unicast in + quagga clear ip bgp * vpnv4 unicast out + quagga clear ip bgp * vpnv4 unicast soft + quagga clear ip bgp * vpnv4 unicast soft in + quagga clear ip bgp * vpnv4 unicast soft out + quagga clear ip bgp <1-4294967295> + quagga clear ip bgp <1-4294967295> in + quagga clear ip bgp <1-4294967295> in prefix-filter + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) out + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft in + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft out + quagga clear ip bgp <1-4294967295> out + quagga clear ip bgp <1-4294967295> soft + quagga clear ip bgp <1-4294967295> soft in + quagga clear ip bgp <1-4294967295> soft out + quagga clear ip bgp <1-4294967295> vpnv4 unicast in + quagga clear ip bgp <1-4294967295> vpnv4 unicast out + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft in + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft out + quagga clear ip bgp BGP_INSTANCE_CMD * + quagga clear ip bgp BGP_INSTANCE_CMD * in prefix-filter + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft in + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft out + quagga clear ip bgp BGP_INSTANCE_CMD * soft + quagga clear ip bgp BGP_INSTANCE_CMD * soft in + quagga clear ip bgp BGP_INSTANCE_CMD * soft out + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp external + quagga clear ip bgp external in + quagga clear ip bgp external in prefix-filter + quagga clear ip bgp external ipv4 (unicast|multicast) in + quagga clear ip bgp external ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp external ipv4 (unicast|multicast) out + quagga clear ip bgp external ipv4 (unicast|multicast) soft + quagga clear ip bgp external ipv4 (unicast|multicast) soft in + quagga clear ip bgp external ipv4 (unicast|multicast) soft out + quagga clear ip bgp external out + quagga clear ip bgp external soft + quagga clear ip bgp external soft in + quagga clear ip bgp external soft out + quagga clear ip bgp peer-group WORD + quagga clear ip bgp peer-group WORD in + quagga clear ip bgp peer-group WORD in prefix-filter + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) out + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out + quagga clear ip bgp peer-group WORD out + quagga clear ip bgp peer-group WORD soft + quagga clear ip bgp peer-group WORD soft in + quagga clear ip bgp peer-group WORD soft out + quagga clear ip bgp prefix """.splitlines() + +# All of the debug commands in bgp_debug_ignore will be covered by these debug commands: +# quagga (add|del) debug bgp bestpath +# quagga (add|del) debug bgp keepalives (||) +# quagga (add|del) debug bgp neighbor-events (||) +# quagga (add|del) debug bgp nht +# quagga (add|del) debug bgp update-groups +# quagga (add|del) debug bgp updates prefix +# quagga (add|del) debug bgp zebra prefix +bgp_debug_ignore = """ quagga debug bgp as4 + quagga debug bgp as4 segment + quagga debug bgp bestpath (|) + quagga debug bgp keepalives + quagga debug bgp keepalives (||) + quagga debug bgp neighbor-events + quagga debug bgp neighbor-events (||) + quagga debug bgp nht + quagga debug bgp update-groups + quagga debug bgp updates + quagga debug bgp updates (in|out) + quagga debug bgp updates (in|out) (||) + quagga debug bgp updates prefix (|) + quagga debug bgp zebra + quagga debug bgp zebra prefix (|)""".splitlines() + + +bgp_show_ignore = """ quagga show bgp (ipv4) (vpnv4) statistics + quagga show bgp (ipv4|ipv6) (unicast|multicast) statistics + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp (bestpath|multipath) [json] + quagga show bgp [json] + quagga show bgp longer-prefixes + quagga show bgp (bestpath|multipath) [json] + quagga show bgp [json] + quagga show bgp BGP_INSTANCE_CMD (ipv4) (vpnv4) statistics + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) neighbors (||) (advertised-routes|received-routes) [json] + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) statistics + quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD longer-prefixes + quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) + quagga show bgp BGP_INSTANCE_CMD filter-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 (unicast|multicast) summary [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 longer-prefixes + quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 community-list (<1-500>|WORD) + quagga show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) advertised-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) dampened-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) flap-statistics [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) prefix-counts [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received prefix-filter [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 route-map WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 summary [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) dampened-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) flap-statistics [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) received prefix-filter [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors [json] + quagga show bgp BGP_INSTANCE_CMD prefix-list WORD + quagga show bgp BGP_INSTANCE_CMD route-map WORD + quagga show bgp BGP_INSTANCE_CMD summary [json] + quagga show bgp BGP_INSTANCE_CMD update-groups + quagga show bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID + quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp [json] + quagga show bgp community + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community-list (<1-500>|WORD) + quagga show bgp community-list (<1-500>|WORD) exact-match + quagga show bgp filter-list WORD + quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) summary [json] + quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) summary [json] + quagga show bgp ipv6 (bestpath|multipath) [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 longer-prefixes + quagga show bgp ipv6 (bestpath|multipath) [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 community + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community-list (<1-500>|WORD) + quagga show bgp ipv6 community-list (<1-500>|WORD) exact-match + quagga show bgp ipv6 filter-list WORD + quagga show bgp ipv6 neighbors (||) [json] + quagga show bgp ipv6 neighbors (||) advertised-routes [json] + quagga show bgp ipv6 neighbors (||) dampened-routes [json] + quagga show bgp ipv6 neighbors (||) flap-statistics [json] + quagga show bgp ipv6 neighbors (||) prefix-counts [json] + quagga show bgp ipv6 neighbors (||) received prefix-filter [json] + quagga show bgp ipv6 neighbors (||) received-routes [json] + quagga show bgp ipv6 neighbors (||) routes [json] + quagga show bgp ipv6 neighbors [json] + quagga show bgp ipv6 prefix-list WORD + quagga show bgp ipv6 regexp LINE + quagga show bgp ipv6 route-map WORD + quagga show bgp ipv6 summary [json] + quagga show bgp memory + quagga show bgp neighbors (||) [json] + quagga show bgp neighbors (||) advertised-routes [json] + quagga show bgp neighbors (||) dampened-routes [json] + quagga show bgp neighbors (||) flap-statistics [json] + quagga show bgp neighbors (||) received prefix-filter [json] + quagga show bgp neighbors (||) received-routes [json] + quagga show bgp neighbors (||) routes [json] + quagga show bgp neighbors [json] + quagga show bgp prefix-list WORD + quagga show bgp regexp LINE + quagga show bgp route-map WORD + quagga show bgp summary [json] + quagga show bgp update-groups + quagga show bgp update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp update-groups SUBGROUP-ID + quagga show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp view WORD ipv4 (unicast|multicast) summary [json] + quagga show bgp views + quagga show bgp vrfs [json] + quagga show debugging bgp + quagga show ip as-path-access-list + quagga show ip as-path-access-list WORD + quagga show ip bgp (bestpath|multipath) [json] + quagga show ip bgp [json] + quagga show ip bgp longer-prefixes + quagga show ip bgp (bestpath|multipath) [json] + quagga show ip bgp [json] + quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD longer-prefixes + quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) + quagga show ip bgp BGP_INSTANCE_CMD filter-list WORD + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) prefix-counts [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors [json] + quagga show ip bgp BGP_INSTANCE_CMD nexthop + quagga show ip bgp BGP_INSTANCE_CMD nexthop detail + quagga show ip bgp BGP_INSTANCE_CMD peer-group + quagga show ip bgp BGP_INSTANCE_CMD peer-group WORD + quagga show ip bgp BGP_INSTANCE_CMD prefix-list WORD + quagga show ip bgp BGP_INSTANCE_CMD route-map WORD + quagga show ip bgp BGP_INSTANCE_CMD summary [json] + quagga show ip bgp BGP_INSTANCE_CMD update-groups + quagga show ip bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID + quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp [json] + quagga show ip bgp attribute-info + quagga show ip bgp cidr-only + quagga show ip bgp community + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community-info + quagga show ip bgp community-list (<1-500>|WORD) + quagga show ip bgp community-list (<1-500>|WORD) exact-match + quagga show ip bgp dampened-paths + quagga show ip bgp filter-list WORD + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics longer-prefixes + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics cidr-only + quagga show ip bgp flap-statistics filter-list WORD + quagga show ip bgp flap-statistics prefix-list WORD + quagga show ip bgp flap-statistics regexp LINE + quagga show ip bgp flap-statistics route-map WORD + quagga show ip bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) longer-prefixes + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) cidr-only + quagga show ip bgp ipv4 (unicast|multicast) community + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) + quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match + quagga show ip bgp ipv4 (unicast|multicast) filter-list WORD + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) prefix-counts [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received prefix-filter [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors [json] + quagga show ip bgp ipv4 (unicast|multicast) paths + quagga show ip bgp ipv4 (unicast|multicast) prefix-list WORD + quagga show ip bgp ipv4 (unicast|multicast) regexp LINE + quagga show ip bgp ipv4 (unicast|multicast) route-map WORD + quagga show ip bgp ipv4 (unicast|multicast) summary [json] + quagga show ip bgp neighbors (||) [json] + quagga show ip bgp neighbors (||) advertised-routes [json] + quagga show ip bgp neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp neighbors (||) dampened-routes [json] + quagga show ip bgp neighbors (||) flap-statistics [json] + quagga show ip bgp neighbors (||) prefix-counts [json] + quagga show ip bgp neighbors (||) received prefix-filter [json] + quagga show ip bgp neighbors (||) received-routes [json] + quagga show ip bgp neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp neighbors (||) routes [json] + quagga show ip bgp neighbors [json] + quagga show ip bgp nexthop + quagga show ip bgp nexthop detail + quagga show ip bgp paths + quagga show ip bgp peer-group + quagga show ip bgp peer-group WORD + quagga show ip bgp prefix-list WORD + quagga show ip bgp regexp LINE + quagga show ip bgp route-map WORD + quagga show ip bgp summary [json] + quagga show ip bgp update-groups + quagga show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp update-groups SUBGROUP-ID + quagga show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp view WORD ipv4 (unicast|multicast) summary [json] + quagga show ip bgp vpnv4 all + quagga show ip bgp vpnv4 all [json] + quagga show ip bgp vpnv4 all [json] + quagga show ip bgp vpnv4 all neighbors (||) prefix-counts [json] + quagga show ip bgp vpnv4 all neighbors [json] + quagga show ip bgp vpnv4 all neighbors advertised-routes [json] + quagga show ip bgp vpnv4 all neighbors routes [json] + quagga show ip bgp vpnv4 all neighbors [json] + quagga show ip bgp vpnv4 all summary [json] + quagga show ip bgp vpnv4 all tags + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors advertised-routes [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors routes [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags + quagga show ip community-list + quagga show ip community-list (<1-500>|WORD) + quagga show ip extcommunity-list + quagga show ip extcommunity-list (<1-500>|WORD) + quagga show ipv6 bgp [json] + quagga show ipv6 bgp longer-prefixes + quagga show ipv6 bgp [json] + quagga show ipv6 bgp [json] + quagga show ipv6 bgp community + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community-list WORD + quagga show ipv6 bgp community-list WORD exact-match + quagga show ipv6 bgp filter-list WORD + quagga show ipv6 bgp neighbors (||) advertised-routes [json] + quagga show ipv6 bgp neighbors (||) received-routes [json] + quagga show ipv6 bgp neighbors (||) routes [json] + quagga show ipv6 bgp prefix-list WORD + quagga show ipv6 bgp regexp LINE + quagga show ipv6 bgp summary [json] + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp longer-prefixes + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp community + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community-list WORD + quagga show ipv6 mbgp community-list WORD exact-match + quagga show ipv6 mbgp filter-list WORD + quagga show ipv6 mbgp neighbors (||) advertised-routes [json] + quagga show ipv6 mbgp neighbors (||) received-routes [json] + quagga show ipv6 mbgp neighbors (||) routes [json] + quagga show ipv6 mbgp prefix-list WORD + quagga show ipv6 mbgp regexp LINE + quagga show ipv6 mbgp summary [json]""".splitlines() + +bgp_config_ignore = """ quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) activate + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-all-paths + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-bestpath-per-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in <1-10> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) as-override + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged (as-path|next-hop|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path (next-hop|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path med next-hop + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path next-hop med + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med (as-path|next-hop) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med as-path next-hop + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med next-hop as-path + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop (as-path|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop as-path med + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop med as-path + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) capability orf prefix-list (both|send|receive) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate route-map WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) distribute-list (<1-199>|<1300-2699>|WORD) (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) filter-list WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> restart <1-65535> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> warning-only + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> restart <1-65535> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> warning-only + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self force + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) peer-group WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) prefix-list WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all replace-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS replace-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-map WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-reflector-client + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-server-client + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community (both|extended|standard) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) soft-reconfiguration inbound + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) unsuppress-map WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map WORD + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths <1-255> + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> equal-cluster-length + quagga (add|del) bgp always-compare-med + quagga (add|del) bgp bestpath as-path confed + quagga (add|del) bgp bestpath as-path ignore + quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set] + quagga (add|del) bgp bestpath compare-routerid + quagga (add|del) bgp bestpath med (confed|missing-as-worst) + quagga (add|del) bgp bestpath med confed missing-as-worst + quagga (add|del) bgp bestpath med missing-as-worst confed + quagga (add|del) bgp client-to-client reflection + quagga (add|del) bgp cluster-id <1-4294967295> + quagga (add|del) bgp cluster-id + quagga (add|del) bgp confederation identifier <1-4294967295> + quagga (add|del) bgp confederation peers . <1-4294967295> + quagga (add|del) bgp default ipv4-unicast + quagga (add|del) bgp default local-preference <0-4294967295> + quagga (add|del) bgp default show-hostname + quagga (add|del) bgp default subgroup-pkt-queue-max <20-100> + quagga (add|del) bgp deterministic-med + quagga (add|del) bgp disable-ebgp-connected-route-check + quagga (add|del) bgp enforce-first-as + quagga (add|del) bgp fast-external-failover + quagga (add|del) bgp graceful-restart + quagga (add|del) bgp graceful-restart stalepath-time <1-3600> + quagga (add|del) bgp listen limit <1-5000> + quagga (add|del) bgp listen range (|) peer-group WORD + quagga (add|del) bgp log-neighbor-changes + quagga (add|del) bgp max-med administrative + quagga (add|del) bgp max-med administrative <0-4294967294> + quagga (add|del) bgp max-med on-startup <5-86400> + quagga (add|del) bgp max-med on-startup <5-86400> <0-4294967294> + quagga (add|del) bgp network import-check + quagga (add|del) bgp route-map delay-timer <0-600> + quagga (add|del) bgp route-reflector allow-outbound-policy + quagga (add|del) bgp router-id + quagga (add|del) bgp coalesce-time <0-4294967295> + quagga (add|del) bgp distance <1-255> + quagga (add|del) bgp distance <1-255> WORD + quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255> + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set + quagga (add|del) bgp ipv4 [unicast|multicast] network + quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD + quagga (add|del) bgp ipv4 [unicast|multicast] network + quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen + quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen route-map WORD + quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD + quagga (add|del) bgp ipv4 unicast bgp dampening + quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> + quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> <1-20000> <1-20000> <1-255> + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295> + quagga (add|del) bgp ipv6 [unicast|multicast] network + quagga (add|del) bgp ipv6 bgp aggregate-address + quagga (add|del) bgp ipv6 bgp aggregate-address summary-only + quagga (add|del) bgp ipv6 bgp network + quagga (add|del) bgp ipv6 unicast aggregate-address + quagga (add|del) bgp ipv6 unicast aggregate-address summary-only + quagga (add|del) bgp ipv6 unicast neighbor (||) nexthop-local unchanged + quagga (add|del) bgp ipv6 unicast network route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD metric <0-4294967295> + quagga (add|del) bgp neighbor (|) interface WORD + quagga (add|del) bgp neighbor (|) port <0-65535> + quagga (add|del) bgp neighbor (|) strict-capability-match + quagga (add|del) bgp neighbor (||) advertisement-interval <0-600> + quagga (add|del) bgp neighbor (||) bfd + quagga (add|del) bgp neighbor (||) bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> + quagga (add|del) bgp neighbor (||) capability dynamic + quagga (add|del) bgp neighbor (||) capability extended-nexthop + quagga (add|del) bgp neighbor (||) description LINE + quagga (add|del) bgp neighbor (||) disable-connected-check + quagga (add|del) bgp neighbor (||) dont-capability-negotiate + quagga (add|del) bgp neighbor (||) ebgp-multihop + quagga (add|del) bgp neighbor (||) ebgp-multihop <1-255> + quagga (add|del) bgp neighbor (||) enforce-multihop + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend replace-as + quagga (add|del) bgp neighbor (||) override-capability + quagga (add|del) bgp neighbor (||) passive + quagga (add|del) bgp neighbor (||) password LINE + quagga (add|del) bgp neighbor (||) remote-as (<1-4294967295>|external|internal) + quagga (add|del) bgp neighbor (||) shutdown + quagga (add|del) bgp neighbor (||) solo + quagga (add|del) bgp neighbor (||) timers <0-65535> <0-65535> + quagga (add|del) bgp neighbor (||) timers connect <1-65535> + quagga (add|del) bgp neighbor (||) ttl-security hops <1-254> + quagga (add|del) bgp neighbor (||) update-source (||) + quagga (add|del) bgp neighbor (||) weight <0-65535> + quagga (add|del) bgp neighbor WORD interface + quagga (add|del) bgp neighbor WORD interface peer-group WORD + quagga (add|del) bgp neighbor WORD interface v6only + quagga (add|del) bgp neighbor WORD interface v6only peer-group WORD + quagga (add|del) bgp neighbor WORD peer-group + quagga (add|del) bgp network backdoor + quagga (add|del) bgp network backdoor + quagga (add|del) bgp network prefixlen backdoor + quagga (add|del) bgp timers bgp <0-65535> <0-65535> + quagga (add|del) bgp update-delay <0-3600> + quagga (add|del) bgp update-delay <0-3600> <1-3600> + quagga (add|del) bgp write-quanta <1-10000>""".splitlines() + +ospf_clear_ignore = [" quagga clear ip ospf interface [IFNAME]", ] + +ospf_debug_ignore = """ quagga debug ospf <1-65535> event + quagga debug ospf <1-65535> ism + quagga debug ospf <1-65535> ism (status|events|timers) + quagga debug ospf <1-65535> lsa + quagga debug ospf <1-65535> lsa (generate|flooding|install|refresh) + quagga debug ospf <1-65535> nsm + quagga debug ospf <1-65535> nsm (status|events|timers) + quagga debug ospf <1-65535> nssa + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) + quagga debug ospf <1-65535> zebra + quagga debug ospf <1-65535> zebra (interface|redistribute) + quagga debug ospf event + quagga debug ospf ism + quagga debug ospf ism (status|events|timers) + quagga debug ospf lsa + quagga debug ospf lsa (generate|flooding|install|refresh) + quagga debug ospf nsm + quagga debug ospf nsm (status|events|timers) + quagga debug ospf nssa + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) + quagga debug ospf zebra + quagga debug ospf zebra (interface|redistribute)""".splitlines() + +ospf_show_ignore = """ quagga show debugging ospf + quagga show debugging ospf <1-65535> + quagga show ip ospf <1-65535> [json] + quagga show ip ospf <1-65535> border-routers + quagga show ip ospf <1-65535> database + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) + quagga show ip ospf <1-65535> interface [INTERFACE] [json] + quagga show ip ospf <1-65535> neighbor [json] + quagga show ip ospf <1-65535> neighbor IFNAME [json] + quagga show ip ospf <1-65535> neighbor IFNAME detail [json] + quagga show ip ospf <1-65535> neighbor [json] + quagga show ip ospf <1-65535> neighbor all [json] + quagga show ip ospf <1-65535> neighbor detail [json] + quagga show ip ospf <1-65535> neighbor detail all [json] + quagga show ip ospf <1-65535> route + quagga show ip ospf [json] + quagga show ip ospf border-routers + quagga show ip ospf database + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) + quagga show ip ospf interface [INTERFACE] [json] + quagga show ip ospf neighbor [json] + quagga show ip ospf neighbor IFNAME [json] + quagga show ip ospf neighbor IFNAME detail [json] + quagga show ip ospf neighbor [json] + quagga show ip ospf neighbor all [json] + quagga show ip ospf neighbor detail [json] + quagga show ip ospf neighbor detail all [json] + quagga show ip ospf route + quagga show mpls-te interface [INTERFACE] + quagga show mpls-te router""".splitlines() + +ospf_config_ignore = """ quagga (add|del) ip ospf <1-65535> area (|<0-4294967295>) + quagga (add|del) ip ospf area (|<0-4294967295>) + quagga (add|del) ip ospf authentication + quagga (add|del) ip ospf authentication (null|message-digest) + quagga (add|del) ip ospf authentication (null|message-digest) + quagga (add|del) ip ospf authentication + quagga (add|del) ip ospf authentication-key AUTH_KEY + quagga (add|del) ip ospf authentication-key AUTH_KEY + quagga (add|del) ip ospf bfd + quagga (add|del) ip ospf bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> + quagga (add|del) ip ospf cost <1-65535> + quagga (add|del) ip ospf cost <1-65535> + quagga (add|del) ip ospf dead-interval <1-65535> + quagga (add|del) ip ospf dead-interval <1-65535> + quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> + quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> + quagga (add|del) ip ospf hello-interval <1-65535> + quagga (add|del) ip ospf hello-interval <1-65535> + quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY + quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY + quagga (add|del) ip ospf mtu-ignore + quagga (add|del) ip ospf mtu-ignore + quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) + quagga (add|del) ip ospf priority <0-255> + quagga (add|del) ip ospf priority <0-255> + quagga (add|del) ip ospf retransmit-interval <3-65535> + quagga (add|del) ip ospf retransmit-interval <3-65535> + quagga (add|del) ip ospf transmit-delay <1-65535> + quagga (add|del) ip ospf transmit-delay <1-65535> + quagga (add|del) mpls-te link max-bw BANDWIDTH + quagga (add|del) mpls-te link max-rsv-bw BANDWIDTH + quagga (add|del) mpls-te link metric <0-4294967295> + quagga (add|del) mpls-te link rsc-clsclr BITPATTERN + quagga (add|del) mpls-te link unrsv-bw <0-7> BANDWIDTH + quagga (add|del) ospf abr-type (cisco|ibm|shortcut|standard) + quagga (add|del) ospf area (|<0-4294967295>) authentication + quagga (add|del) ospf area (|<0-4294967295>) authentication message-digest + quagga (add|del) ospf area (|<0-4294967295>) default-cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) export-list NAME + quagga (add|del) ospf area (|<0-4294967295>) filter-list prefix WORD (in|out) + quagga (add|del) ospf area (|<0-4294967295>) import-list NAME + quagga (add|del) ospf area (|<0-4294967295>) nssa + quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) + quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary + quagga (add|del) ospf area (|<0-4294967295>) nssa no-summary + quagga (add|del) ospf area (|<0-4294967295>) range + quagga (add|del) ospf area (|<0-4294967295>) range advertise + quagga (add|del) ospf area (|<0-4294967295>) range advertise cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) range cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) range not-advertise + quagga (add|del) ospf area (|<0-4294967295>) range substitute + quagga (add|del) ospf area (|<0-4294967295>) shortcut (default|enable|disable) + quagga (add|del) ospf area (|<0-4294967295>) stub + quagga (add|del) ospf area (|<0-4294967295>) stub no-summary + quagga (add|del) ospf area (|<0-4294967295>) virtual-link + quagga (add|del) ospf area (|<0-4294967295>) virtual-link + quagga (add|del) ospf auto-cost reference-bandwidth <1-4294967> + quagga (add|del) ospf capability opaque + quagga (add|del) ospf compatible rfc1583 + quagga (add|del) ospf default-information originate + quagga (add|del) ospf default-metric <0-16777214> + quagga (add|del) ospf distance <1-255> + quagga (add|del) ospf distance <1-255> + quagga (add|del) ospf distance <1-255> WORD + quagga (add|del) ospf distance ospf + quagga (add|del) ospf distribute-list WORD out QUAGGA_REDIST_STR_OSPFD + quagga (add|del) ospf log-adjacency-changes + quagga (add|del) ospf log-adjacency-changes detail + quagga (add|del) ospf max-metric router-lsa administrative + quagga (add|del) ospf max-metric router-lsa on-shutdown <5-100> + quagga (add|del) ospf max-metric router-lsa on-startup <5-86400> + quagga (add|del) ospf mpls-te + quagga (add|del) ospf mpls-te on + quagga (add|del) ospf mpls-te router-address + quagga (add|del) ospf neighbor + quagga (add|del) ospf neighbor poll-interval <1-65535> + quagga (add|del) ospf neighbor poll-interval <1-65535> priority <0-255> + quagga (add|del) ospf neighbor priority <0-255> + quagga (add|del) ospf neighbor priority <0-255> poll-interval <1-65535> + quagga (add|del) ospf network area (|<0-4294967295>) + quagga (add|del) ospf opaque-lsa + quagga (add|del) ospf passive-interface IFNAME + quagga (add|del) ospf passive-interface IFNAME + quagga (add|del) ospf passive-interface default + quagga (add|del) ospf redistribute (ospf|table) <1-65535> + quagga (add|del) ospf redistribute QUAGGA_REDIST_STR_OSPFD + quagga (add|del) ospf rfc1583compatibility + quagga (add|del) ospf router-id + quagga (add|del) ospf timers lsa arrival <0-1000> + quagga (add|del) ospf timers lsa min-arrival <0-600000> + quagga (add|del) ospf timers throttle lsa all <0-5000> + quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000> + quagga (add|del) ospf write-multiplier <1-100> + quagga (add|del) ospf write-multiplier <1-100>""".splitlines() + +def replace_constants(line): + line = line.replace('NO_NEIGHBOR_CMD2', 'no neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NEIGHBOR_CMD2', 'neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NO_NEIGHBOR_CMD', 'no neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('NEIGHBOR_CMD', 'neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('CMD_AS_RANGE', '<1-4294967295>') + line = line.replace('LISTEN_RANGE_CMD', 'bgp listen range (A.B.C.D/M|X:X::X:X/M) ') + line = line.replace('DYNAMIC_NEIGHBOR_LIMIT_RANGE', '<1-5000>') + line = line.replace('QUAGGA_IP_REDIST_STR_BGPD', '(kernel|connected|static|rip|ospf|isis)') + line = line.replace('QUAGGA_IP6_REDIST_STR_BGPD', '(kernel|connected|static|ripng|ospf6|isis)') + line = line.replace('QUAGGA_IP6_REDIST_STR_ZEBRA', '(kernel|connected|static|ripng|ospf6|isis|bgp)') + line = line.replace('QUAGGA_IP_REDIST_STR_ZEBRA', '(kernel|connected|static|rip|ospf|isis|bgp)') + line = line.replace('OSPF_LSA_TYPES_CMD_STR', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') + line = line.replace('CMD_RANGE_STR(1, MULTIPATH_NUM)', '<1-255>') + line = line.replace('CMD_RANGE_STR(1, MAXTTL)', '<1-255>') + line = line.replace('BFD_CMD_DETECT_MULT_RANGE', '<2-255>') + line = line.replace('BFD_CMD_MIN_TX_RANGE', '<50-60000>') + line = line.replace('BGP_UPDATE_SOURCE_REQ_STR', '(A.B.C.D|X:X::X:X|WORD)') + line = line.replace('BGP_UPDATE_SOURCE_OPT_STR', '{A.B.C.D|X:X::X:X|WORD}') + line = line.replace('.LINE', 'LINE') + line = line.replace('.AA:NN', 'AA:NN') + # line = line.replace('', '') + return line + + +ignore = {} +ignore['bgpd'] = [] +ignore['bgpd'].append('address-family ipv4') +ignore['bgpd'].append('address-family ipv4 (unicast|multicast)') +ignore['bgpd'].append('address-family ipv6') +ignore['bgpd'].append('address-family ipv6 (unicast|multicast)') +ignore['bgpd'].append('address-family vpnv4') +ignore['bgpd'].append('address-family vpnv4 unicast') +ignore['bgpd'].append('exit-address-family') + +ignore['ospfd'] = [] + + +class Command(object): + + def __init__(self, defun, text, line_number): + self.defun = defun + self.text = text + self.line_number = line_number + self.context = [] + self.docstring = None + + def __str__(self): + return "%s - %s" % (self.context, self.text) + + def set_docstring(self): + ds = self.text + + if self.text in ignore['bgpd']: + return None + + # For these two WORD means an interface name + ds = ds.replace('A.B.C.D|X:X::X:X|WORD', '||') + ds = ds.replace('A.B.C.D|WORD', '|') + + ds = ds.replace('A.B.C.D/M', '') + ds = ds.replace('A.B.C.D', '') + ds = ds.replace('X:X::X:X/M', '') + ds = ds.replace('X:X::X:X', '') + ds = ds.replace('{json}', '[json]') + ds = ds.replace('{', '[') + ds = ds.replace('}', ']') + ds = ds.replace(' PATH ', ' ') + + afis = [] + safis = [] + + if 'BGP_IPV4_NODE' in self.context: + afis.append('ipv4') + safis.append('unicast') + + if 'BGP_IPV4M_NODE' in self.context: + afis.append('ipv4') + safis.append('multicast') + + if 'BGP_IPV6_NODE' in self.context: + afis.append('ipv6') + safis.append('unicast') + + if 'BGP_IPV6M_NODE' in self.context: + afis.append('ipv6') + safis.append('multicast') + + afis = list(set(afis)) + safis = list(set(safis)) + + # clear, debug, show, etc + if 'ENABLE_NODE' in self.context: + pass + + # config command so need to add (add|del) and maybe afi/safi + else: + if afis: + if len(afis) > 1: + afi_string = "[%s]" % '|'.join(afis) + else: + afi_string = afis[0] + + if len(safis) > 1: + safi_string = "[%s]" % '|'.join(safis) + else: + safi_string = safis[0] + + ds = "(add|del) bgp %s %s " % (afi_string, safi_string) + ds + + elif 'BGP_NODE' in self.context: + if ds.startswith('bgp'): + ds = "(add|del) " + ds + else: + ds = "(add|del) bgp " + ds + + elif 'INTERFACE_NODE' in self.context: + ds = "(add|del) " + ds + + elif 'OSPF_NODE' in self.context: + if ds.startswith('ospf'): + ds = "(add|del) " + ds + else: + ds = "(add|del) ospf " + ds + + # Ignore the route-map commands, ip community-list, etc for now + else: + ds = None + + if ds: + ds = ds.rstrip() + self.docstring = ' quagga ' + ds + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser(description='Parse the quagga parser') + parser.add_argument('directory', help='quagga directory') + parser.add_argument('daemon', help='bgpd, ospfd, etc') + parser.add_argument('--print-quagga', action='store_true', help='print the raw quagga commands') + parser.add_argument('--print-docstring', action='store_true', help='print a docstring for network-docopt') + parser.add_argument('--print-context', action='store_true', help='print quagga commands with their context') + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(levelname)7s: %(message)s') + log = logging.getLogger(__name__) + + # Color the errors and warnings in red + logging.addLevelName(logging.ERROR, "\033[91m %s\033[0m" % logging.getLevelName(logging.ERROR)) + logging.addLevelName(logging.WARNING, "\033[91m%s\033[0m" % logging.getLevelName(logging.WARNING)) + + bgpd = os.path.join(args.directory, 'bgpd') + isisd = os.path.join(args.directory, 'isisd') + ospfd = os.path.join(args.directory, 'ospfd') + ospf6d = os.path.join(args.directory, 'ospf6d') + ripd = os.path.join(args.directory, 'ripd') + ripngd = os.path.join(args.directory, 'ripngd') + zebra = os.path.join(args.directory, 'zebra') + parser_files = [] + + for (directory, foo, files) in sorted(os.walk(args.directory)): + + # We do not care about crunching files in these directories + if (directory.endswith('vtysh') or + directory.endswith('quagga-0.99.23.1/') or + directory.endswith('lib') or + directory.endswith('isisd') or + directory.endswith('ripd') or + directory.endswith('ripngd') or + directory.endswith('m4') or + directory.endswith('tests')): + continue + + if args.daemon not in directory: + continue + + for x in sorted(files): + if x.endswith('.c'): + filename = os.path.join(directory, x) + parser_files.append(filename) + + commands = {} + defun_to_context = {} + + for filename in parser_files: + + with open(filename, 'r') as fh: + state = 'LIMBO' + line_number = 1 + + for line in fh.readlines(): + + if state == 'LIMBO': + if (line.startswith('DEFUN ') or line.startswith('ALIAS ')): + state = 'DEFUN_LINE_1' + + elif 'install_element' in line: + # install_element (BGP_NODE, &neighbor_bfd_cmd); + re_line = re.search('install_element\s*\(\s*(\S+)\s*, \&(\S+)\)', line) + + if re_line: + context = re_line.group(1) + defun = re_line.group(2) + + if defun not in defun_to_context: + defun_to_context[defun] = [] + defun_to_context[defun].append(context) + else: + log.warning("regex failed on '%s'" % line.strip()) + + elif state == 'DEFUN_LINE_1': + state = 'DEFUN_LINE_2' + # remove spaces and trailing comma + defun = line.strip()[0:-1] + + elif state == 'DEFUN_LINE_2': + if 'ifdef HAVE_IPV6' in line: + pass + else: + state = 'LIMBO' + + # remove the leading and trailing spaces + # remove the leading and trailing " + # remove the trailing , + line = line.strip() + line = replace_constants(line) + + if line.endswith(','): + line = line.rstrip().lstrip()[:-1] + + if line.startswith('"'): + line = line.rstrip().lstrip()[1:] + + if line.endswith('"'): + line = line.rstrip().lstrip()[:-1] + + line = line.replace(' " ', ' ') + line = line.replace(' "', ' ') + line = line.replace('" ', ' ') + line = line.replace('( ', '(') + line = line.replace(' )', ')') + + line = line.replace('| ', '|') + line = line.replace(' |', '|') + + # compress multiple whitespaces + while ' ' in line: + line = line.replace(' ', ' ') + + commands[line] = Command(defun, line, line_number) + defun = None + line_number += 1 + + # Fill in the context for each Command based on its defun + for cmd in commands.itervalues(): + cmd.context = defun_to_context.get(cmd.defun) + if cmd.context is None: + log.error("%s: could not find defun for %s" % (cmd, cmd.defun)) + continue + cmd.set_docstring() + + normal = [] + expert = [] + + if args.print_docstring: + if args.daemon == 'bgpd': + normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] summary [json]') + normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] [|] [bestpath|multipath] [json]') + normal.append(' quagga show bgp neighbor [|]') + normal.append(' quagga clear bgp (||*)') + normal.append(' quagga clear bgp (||*) soft [in|out]') + normal.append(' quagga clear bgp prefix ') + normal.append(' quagga (add|del) debug bgp bestpath ') + normal.append(' quagga (add|del) debug bgp keepalives ()') + normal.append(' quagga (add|del) debug bgp neighbor-events (|)') + expert.append(' quagga (add|del) debug bgp nht') + expert.append(' quagga (add|del) debug bgp update-groups') + normal.append(' quagga (add|del) debug bgp updates prefix ') + normal.append(' quagga (add|del) debug bgp zebra prefix ') + + bgp_bgp = ['always-compare-med', + 'bestpath', + 'client-to-client reflection', + 'cluster-id', + 'confederation peers', + 'default ipv4-unicast', + 'default local-preference', + 'default show-hostname', + 'default subgroup-pkt-queue-max', + 'deterministic-med', + 'disable-ebgp-connected-route-check', + 'enforce-first-as', + 'fast-external-failover', + 'graceful-restart', + 'listen', + 'log-neighbor-changes', + 'max-med', + 'network import-check', + 'route-map delay-timer', + 'route-reflector allow-outbound-policy', + 'router-id'] + + # ====== + # global + # ====== + normal.append(' quagga (add|del) bgp always-compare-med') + expert.append(' quagga (add|del) bgp bestpath as-path (confed|ignore)') + normal.append(' quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]') + expert.append(' quagga (add|del) bgp bestpath med (confed|missing-as-worst)') + expert.append(' quagga (add|del) bgp client-to-client reflection') + expert.append(' quagga (add|del) bgp cluster-id (|<1-4294967295>)') + expert.append(' quagga (add|del) bgp confederation peers <1-4294967295>') + expert.append(' quagga (add|del) bgp default ipv4-unicast') + expert.append(' quagga (add|del) bgp default local-preference <0-4294967295>') + expert.append(' quagga (add|del) bgp default show-hostname') + expert.append(' quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>') + expert.append(' quagga (add|del) bgp deterministic-med') + expert.append(' quagga (add|del) bgp disable-ebgp-connected-route-check') + expert.append(' quagga (add|del) bgp enforce-first-as') + expert.append(' quagga (add|del) bgp fast-external-failover') + expert.append(' quagga (add|del) bgp graceful-restart') + expert.append(' quagga (add|del) bgp listen limit <1-5000>') + expert.append(' quagga (add|del) bgp listen range (|) peer-group ') + expert.append(' quagga (add|del) bgp log-neighbor-changes') + expert.append(' quagga (add|del) bgp max-med administrative <0-4294967294>') + expert.append(' quagga (add|del) bgp max-med on-startup <5-86400> [<0-4294967294>]') + expert.append(' quagga (add|del) bgp network import-check') + expert.append(' quagga (add|del) bgp route-map delay-timer <0-600>') + expert.append(' quagga (add|del) bgp route-reflector allow-outbound-policy') + normal.append(' quagga (add|del) bgp router-id ') + expert.append(' quagga (add|del) bgp coalesce-time <0-4294967295>') + expert.append(' quagga (add|del) bgp distance <1-255> ') + expert.append(' quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>') + expert.append(' quagga (add|del) bgp timers bgp <0-65535> <0-65535>') + expert.append(' quagga (add|del) bgp update-delay <0-3600> [<1-3600>]') + expert.append(' quagga (add|del) bgp write-quanta <1-10000>') + + # ==================== + # peer global afi/safi + # ==================== + normal.append(' quagga (add|del) bgp neighbor interface') + normal.append(' quagga (add|del) bgp neighbor interface peer-group ') + expert.append(' quagga (add|del) bgp neighbor interface v6only') + expert.append(' quagga (add|del) bgp neighbor interface v6only peer-group ') + normal.append(' quagga (add|del) bgp neighbor peer-group') + expert.append(' quagga (add|del) bgp neighbor (|) advertisement-interval <0-600>') + expert.append(' quagga (add|del) bgp neighbor (|) bfd') + expert.append(' quagga (add|del) bgp neighbor (|) capability dynamic') + normal.append(' quagga (add|del) bgp neighbor (|) capability extended-nexthop') + normal.append(' quagga (add|del) bgp neighbor (|) description ') + expert.append(' quagga (add|del) bgp neighbor (|) disable-connected-check') + expert.append(' quagga (add|del) bgp neighbor (|) dont-capability-negotiate') + normal.append(' quagga (add|del) bgp neighbor (|) ebgp-multihop [<1-255>]') + expert.append(' quagga (add|del) bgp neighbor (|) enforce-multihop') + expert.append(' quagga (add|del) bgp neighbor (|) local-as <1-4294967295> [no-prepend] [replace-as]') + expert.append(' quagga (add|del) bgp neighbor (|) override-capability') + expert.append(' quagga (add|del) bgp neighbor (|) passive') + normal.append(' quagga (add|del) bgp neighbor (|) password ') + expert.append(' quagga (add|del) bgp neighbor (|) port <0-65535>') + normal.append(' quagga (add|del) bgp neighbor (|) remote-as (<1-4294967295>|external|internal)') + normal.append(' quagga (add|del) bgp neighbor (|) shutdown') + expert.append(' quagga (add|del) bgp neighbor (|) solo') + expert.append(' quagga (add|del) bgp neighbor (|) strict-capability-match') + normal.append(' quagga (add|del) bgp neighbor (|) timers <0-65535> <0-65535>') + normal.append(' quagga (add|del) bgp neighbor (|) timers connect <1-65535>') + expert.append(' quagga (add|del) bgp neighbor (|) ttl-security hops <1-254>') + normal.append(' quagga (add|del) bgp neighbor (|) update-source (||)') + expert.append(' quagga (add|del) bgp neighbor (|) weight <0-65535>') + + # ================= + # peer per afi/safi + # ================= + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-all-paths') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-bestpath-per-AS') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) allowas-in [<1-10>]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) as-override') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) attribute-unchanged [as-path] [next-hop] [med]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) capability orf prefix-list (both|send|receive)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) default-originate [route-map ]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) distribute-list (<1-199>|<1300-2699>|) (in|out)') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) filter-list (in|out)') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) maximum-prefix <1-4294967295>') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) next-hop-self [force]') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) peer-group ') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) prefix-list (in|out)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) remove-private-AS [all] [replace-AS]') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-map (in|out)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-reflector-client') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-server-client') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) send-community [both|extended|standard]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) soft-reconfiguration inbound') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) unsuppress-map ') + expert.append(' quagga (add|del) bgp ipv6 unicast neighbor (|) nexthop-local unchanged') + + # ============ + # per afi/safi + # ============ + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] maximum-paths [ibgp] <1-255> [equal-cluster-length]') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] aggregate-address [as-set] [summary-only]') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|)') + expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|) route-map ') + expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] bgp dampening <1-45> <1-20000> <1-20000> <1-255>') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] redistribute (kernel|connected|static|rip|ospf|isis) [metric <0-4294967295>] [route-map ]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map ') + + if args.daemon == 'ospfd': + normal.append(' quagga clear ip ospf interface []') + normal.append(' quagga (add|del) debug ospf [<1-65535>] ism [status|events|timers]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] lsa [generate|flooding|install|refresh]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] nsm [status|events|timers]') + expert.append(' quagga (add|del) debug ospf [<1-65535>] nssa') + normal.append(' quagga (add|del) debug ospf [<1-65535>] packet [hello|dd|ls-request|ls-update|ls-ack|all] [send|recv|detail]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] zebra [interface|redistribute]') + normal.append(' quagga show ip ospf [<1-65535>]') + expert.append(' quagga show ip ospf [<1-65535>] border-routers') + expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) [self-originate]') + expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) adv-router ') + normal.append(' quagga show ip ospf [<1-65535>] interface [] [json]') + normal.append(' quagga show ip ospf [<1-65535>] neighbor (all||) [detail] [json]') + normal.append(' quagga show ip ospf [<1-65535>] route') + + normal.append(' quagga (add|del) ip ospf [<1-65535>] area (|<0-4294967295>)') + normal.append(' quagga (add|del) ip ospf dead-interval <1-65535>') + normal.append(' quagga (add|del) ip ospf hello-interval <1-65535>') + normal.append(' quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)') + normal.append(' quagga (add|del) ospf network area (|<0-4294967295>)') + normal.append(' quagga (add|del) ospf passive-interface IFNAME') + normal.append(' quagga (add|del) ospf router-id ') + normal.append(' quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>') + + + + ignore_list = bgp_clear_ignore + bgp_debug_ignore + bgp_show_ignore + bgp_config_ignore + ignore_list += ospf_clear_ignore + ospf_debug_ignore + ospf_show_ignore + ospf_config_ignore + + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + if cmd.docstring: + if cmd.docstring not in ignore_list: + normal.append(cmd.docstring) + + elif args.print_quagga: + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + normal.append(cmd.text) + + elif args.print_context: + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + normal.append("%s - %s" % (cmd.context, cmd.text)) + else: + raise Exception("No print option specified") + + normal = sorted(normal) + print '\n'.join(map(str, normal)) From 1a8c390d4abc7c3f599813ddee6ca3990de7576c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 1 Aug 2016 17:03:39 +0000 Subject: [PATCH 022/280] lib: Fixed bad node copy, modified token regex When building argv for matched command, only the last node was being copied to argv; the rest were added by reference. Additionally the regex for certain tokens was too restrictive and disallowed characters allowed by the old parser; these have been reinstated. Signed-off-by: Quentin Young --- feed.x | 20 ++++++++++++++++---- lib/command_graph.c | 21 ++------------------- lib/command_graph.h | 12 ------------ lib/command_lex.l | 4 ++-- lib/command_match.c | 42 ++++++++++++++++++++++++++++-------------- lib/command_parse.y | 5 +++++ 6 files changed, 53 insertions(+), 51 deletions(-) mode change 100644 => 100755 feed.x diff --git a/feed.x b/feed.x old mode 100644 new mode 100755 index a087987d40..cbff1944bf --- a/feed.x +++ b/feed.x @@ -1,14 +1,26 @@ -#!/bin/expect +#!/usr/bin/expect -set f [open "copt.txt"] +# takes a list of command format strings +# and feeds them to the test grammar +# parser + +set f [open [lindex $argv 0]] set cmds [split [read $f] "\n"] close $f spawn vtysh foreach command $cmds { - expect "dell-s6000-16#" - send "$command\r" + expect { + "dell-s6000-16#" { + send "grammar parse $command\r" + } + "Grammar error" { + send_user "$command" + send "exit\r" + exit + } + } } interact diff --git a/lib/command_graph.c b/lib/command_graph.c index 3e52f42598..e8f72db19e 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -88,29 +88,12 @@ new_node(enum graph_node_type type) return node; } -struct graph_node * -copy_node (struct graph_node *node) -{ - struct graph_node *new = new_node(node->type); - new->children = NULL; - new->is_start = node->is_start; - new->end = node->end; - new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; - new->value = node->value; - new->min = node->min; - new->max = node->max; - new->element = node->element ? copy_cmd_element(node->element) : NULL; - new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; - new->refs = 0; - return new; -} - void free_node (struct graph_node *node) { if (!node) return; - vector_free (node->children); - free_cmd_element (node->element); + if (node->children) vector_free (node->children); + if (node->element) free_cmd_element (node->element); free (node->text); free (node->arg); free (node); diff --git a/lib/command_graph.h b/lib/command_graph.h index dc78475ca6..ed0e98a6e5 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -77,18 +77,6 @@ cmp_node(struct graph_node *, struct graph_node *); struct graph_node * new_node(enum graph_node_type); -/** - * Copies a node. - * The children vector is copied, but the pointers the vector - * holds point to the same data as the original vector. - * The element, if it exists, is copied. - * - * @param[in] pointer to node to copy - * @return pointer to copied node - */ -struct graph_node * -copy_node(struct graph_node *); - /** * Frees the data associated with a graph_node. * @param[out] pointer to graph_node to free diff --git a/lib/command_lex.l b/lib/command_lex.l index ce09c5bf28..9f47d96a84 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -4,12 +4,12 @@ extern void set_buffer_string(const char *); %} -WORD [a-z][-_a-z0-9]+ +WORD [-+a-z\*][-+_a-zA-Z0-9\*]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M -VARIABLE [A-Z][A-Z_:]+ +VARIABLE [A-Z][-_a-zA-Z:0-9]+ NUMBER [0-9]{1,20} RANGE \({NUMBER}\-{NUMBER}\) diff --git a/lib/command_match.c b/lib/command_match.c index 7b9c5f15d8..f7854cbe6d 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -46,6 +46,24 @@ match_token (struct graph_node *, char *, enum filter_type); /* matching functions */ +static struct graph_node * +copy_node (struct graph_node *node) +{ + struct graph_node *new = new_node(node->type); + new->children = NULL; + new->is_start = node->is_start; + new->end = NULL; + new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; + new->value = node->value; + new->min = node->min; + new->max = node->max; + new->element = node->element ? copy_cmd_element(node->element) : NULL; + new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; + new->refs = 0; + return new; +} + + /* Linked list data deletion callback */ static void free_nodelist (void *node) { @@ -68,8 +86,8 @@ match_command (struct graph_node *start, const char *line, struct list **argv) if (*argv) break; } + // walk the list, find the END_GN, return that if (*argv) { - // copy the nodes we need struct listnode *ln; struct graph_node *gn; char buf[50]; @@ -147,9 +165,6 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) if (match_token(start, vector_slot(vline, n), FILTER_RELAXED) < minmatch) return NULL; - // arg list for this subgraph - struct list *argv; - // pointers for iterating linklist struct graph_node *gn; struct listnode *ln; @@ -165,11 +180,11 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) struct graph_node *curr = copy_node(start); curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); // initialize a new argument list - argv = list_new(); + struct list *argv = list_new(); argv->del = &free_nodelist; - // push the currnode - listnode_add(argv, curr); - // push the endnode + // add the current node + listnode_add(argv, copy_node(curr)); + // push the end node listnode_add(argv, copy_node(gn)); // clean up list_delete (next); @@ -215,13 +230,12 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } if (bestmatch) { - argv = list_new(); - listnode_add(argv, start); - list_add_list(argv, bestmatch); - list_free (bestmatch); + struct graph_node *curr = copy_node(start); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + list_add_node_prev (bestmatch, bestmatch->head, curr); + // cleanup list_delete (next); - start->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - return argv; + return bestmatch; } else return NULL; diff --git a/lib/command_parse.y b/lib/command_parse.y index cf87ca1042..01fc01d302 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -310,6 +310,11 @@ option_token: void yyerror(char const *message) { // fail on bad parse fprintf(stderr, "Grammar error: %s\n", message); + fprintf(stderr, "Token on error: "); + if (yylval.string) fprintf(stderr, "%s\n", yylval.string); + else if (yylval.node) fprintf(stderr, "%s\n", yylval.node->text); + else fprintf(stderr, "%d\n", yylval.integer); + } struct graph_node * From e648e61a747c6c13ccea7d97066dfb07d4461d96 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 1 Aug 2016 18:36:30 +0000 Subject: [PATCH 023/280] lib: Fix OOB range parses, variable matches Variables now allow strings beginning with numbers to match, ranges and numbers are now long long to fix OOB parses resulting in integer wraparounds. Signed-off-by: Quentin Young --- lib/command_graph.c | 2 +- lib/command_graph.h | 2 +- lib/command_lex.l | 6 +++++- lib/command_match.c | 6 +++--- lib/command_parse.y | 11 ++++++----- lib/grammar_sandbox.c | 5 +++++ 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index e8f72db19e..07cc306505 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -193,7 +193,7 @@ dump_node (struct graph_node *node) fprintf(stderr, "\t->value: %ld\n", node->value); fprintf(stderr, "\t->is_start: %d\n", node->is_start); fprintf(stderr, "\t->element: %p\n", node->element); - fprintf(stderr, "\t->min: %ld\n->max: %ld\n", node->min, node->max); + fprintf(stderr, "\t->min: %lld\n->max: %lld\n", node->min, node->max); fprintf(stderr, "\t->arg: %s\n", node->arg); fprintf(stderr, "\t->refs: %d\n", node->refs); fprintf(stderr, "\tnum children: %d\n", vector_active(node->children)); diff --git a/lib/command_graph.h b/lib/command_graph.h index ed0e98a6e5..32a07ce4ea 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -29,7 +29,7 @@ struct graph_node char* text; // for WORD_GN and VARIABLE_GN long value; // for NUMBER_GN - long min, max; // for RANGE_GN + signed long long min, max;// for RANGE_GN /* cmd_element struct pointer, only valid for END_GN */ struct cmd_element *element; diff --git a/lib/command_lex.l b/lib/command_lex.l index 9f47d96a84..ff951149b3 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -28,7 +28,11 @@ RANGE \({NUMBER}\-{NUMBER}\) {IPV6} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;} {IPV6_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;} {VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} -{NUMBER} {yylval.integer = atoi(yytext); return NUMBER;} +{NUMBER} { + char *endptr; + yylval.integer = strtoll(yytext, &endptr, 10); + return NUMBER; + } {RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} . {return yytext[0];} %% diff --git a/lib/command_match.c b/lib/command_match.c index f7854cbe6d..13dee51fef 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -604,7 +604,7 @@ static enum match_type match_range (struct graph_node *rangenode, const char *str) { char *endptr = NULL; - signed long val; + signed long long val; if (str == NULL) return 1; @@ -653,11 +653,11 @@ match_number(struct graph_node *numnode, const char *word) return num == numnode->value ? exact_match : no_match; } -#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" +#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" static enum match_type match_variable(struct graph_node *varnode, const char *word) { - return strlen(word) == strspn(word, VARIABLE_ALPHABET) && isalpha(word[0]) ? + return strlen(word) == strspn(word, VARIABLE_ALPHABET) ? exact_match : no_match; } diff --git a/lib/command_parse.y b/lib/command_parse.y index 01fc01d302..146c8b6101 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -30,7 +30,7 @@ extern void yyerror(const char *); /* valid types for tokens */ %union{ - int integer; + signed long long integer; char *string; struct graph_node *node; } @@ -91,7 +91,7 @@ start: sentence_root yyerror("Duplicate command."); YYABORT; } - fprintf(stderr, "Added END_GN with active children: %d\n", vector_active(end->children)); + fprintf(stderr, "Parsed full command successfully.\n"); } sentence_root: WORD @@ -179,8 +179,9 @@ placeholder_token: // get the numbers out strsep(&yylval.string, "(-)"); - $$->min = atoi( strsep(&yylval.string, "(-)") ); - $$->max = atoi( strsep(&yylval.string, "(-)") ); + char *endptr; + $$->min = strtoll( strsep(&yylval.string, "(-)"), &endptr, 10 ); + $$->max = strtoll( strsep(&yylval.string, "(-)"), &endptr, 10 ); free ($1); } @@ -313,7 +314,7 @@ void yyerror(char const *message) { fprintf(stderr, "Token on error: "); if (yylval.string) fprintf(stderr, "%s\n", yylval.string); else if (yylval.node) fprintf(stderr, "%s\n", yylval.node->text); - else fprintf(stderr, "%d\n", yylval.integer); + else fprintf(stderr, "%lld\n", yylval.integer); } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 66e530595b..90aadc6a9f 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -17,6 +17,8 @@ DEFUN (grammar_test, char* command = argv_concat(argv, argc, 0); struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); cmd->string = command; + cmd->doc = NULL; + cmd->func = NULL; parse_command_format(nodegraph, cmd); return CMD_SUCCESS; } @@ -59,6 +61,9 @@ DEFUN (grammar_test_complete, fprintf(stderr, " %p\n", cnode->element->func); else fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); + + if (cnode->type == RANGE_GN) + fprintf(stderr, "%lld - %lld\n", cnode->min, cnode->max); } free(desc); } From e1cbb2ff67441cac4a486efdb3b5584bd701cba0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 1 Aug 2016 20:30:14 +0000 Subject: [PATCH 024/280] lib: Add partial completion support Completions now include nodes that the input partially matches as well as the children of nodes those that the input exactly matches. Also some minor cleanup and bugfixes. Signed-off-by: Quentin Young --- lib/command_match.c | 84 +++++++++++++++++++++---------------------- lib/command_match.h | 2 +- lib/grammar_sandbox.c | 6 ++-- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 13dee51fef..af506591ed 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -33,7 +33,7 @@ static enum match_type match_range (struct graph_node *, const char *str); static enum match_type -match_word (struct graph_node *, const char *, enum filter_type); +match_word (struct graph_node *, const char *); static enum match_type match_number (struct graph_node *, const char *); @@ -42,7 +42,7 @@ static enum match_type match_variable (struct graph_node *, const char *); static enum match_type -match_token (struct graph_node *, char *, enum filter_type); +match_token (struct graph_node *, char *); /* matching functions */ @@ -66,7 +66,7 @@ copy_node (struct graph_node *node) /* Linked list data deletion callback */ static void -free_nodelist (void *node) { +delete_nodelist (void *node) { free_node ((struct graph_node *) node); } @@ -161,8 +161,11 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) // get the minimum match level that can count as a full match enum match_type minmatch = min_match_level(start->type); + // get the current operating token + char *token = vector_slot(vline, n); + // if we don't match this node, die - if (match_token(start, vector_slot(vline, n), FILTER_RELAXED) < minmatch) + if (match_token(start, token) < minmatch) return NULL; // pointers for iterating linklist @@ -177,14 +180,14 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) if (n+1 == vector_active (vline)) { for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { if (gn->type == END_GN) { - struct graph_node *curr = copy_node(start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); - // initialize a new argument list + // we have a match, so build an argv and pass it back up the chain struct list *argv = list_new(); - argv->del = &free_nodelist; + argv->del = &delete_nodelist; + struct graph_node *curr = copy_node(start); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); // add the current node - listnode_add(argv, copy_node(curr)); - // push the end node + listnode_add(argv, curr); + // add the end node listnode_add(argv, copy_node(gn)); // clean up list_delete (next); @@ -230,8 +233,10 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } if (bestmatch) { + // if we have a best match, prepend this node + matching token + // to argv and pass it up the chain struct graph_node *curr = copy_node(start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, vector_slot(vline, n)); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); list_add_node_prev (bestmatch, bestmatch->head, curr); // cleanup list_delete (next); @@ -242,10 +247,8 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } struct list * -match_command_complete (struct graph_node *start, const char *line, enum filter_type filter) +match_command_complete (struct graph_node *start, const char *line) { - enum match_type minmatch = filter + 1; - // vectorize command line vector vline = cmd_make_strvec (line); @@ -253,7 +256,6 @@ match_command_complete (struct graph_node *start, const char *line, enum filter_ char *token; struct list *current = list_new(), // current nodes to match input token against - *matched = list_new(), // current nodes that match the input token *next = list_new(); // possible next hops to current input token // pointers used for iterating lists @@ -272,13 +274,17 @@ match_command_complete (struct graph_node *start, const char *line, enum filter_ token = vector_slot(vline, idx); - list_delete_all_node(matched); - for (ALL_LIST_ELEMENTS_RO(current,node,gn)) { - if (match_token(gn, token, filter) >= minmatch) { - listnode_add(matched, gn); - add_nexthops(next, gn); + switch (match_token(gn, token)) { + case partly_match: // if it's a partial match, add this node to possible next hops + listnode_add(next, gn); + break; + case exact_match: // if it's an exact match, add this node's children to next hops + add_nexthops(next, gn); + break; + default: // otherwise do nothing + break; } } } @@ -292,7 +298,6 @@ match_command_complete (struct graph_node *start, const char *line, enum filter_ * next = set of all nodes reachable from all nodes in `matched` */ list_free (current); - list_free (matched); cmd_free_strvec(vline); @@ -374,11 +379,11 @@ score_precedence (struct graph_node *node) } static enum match_type -match_token (struct graph_node *node, char *token, enum filter_type filter) +match_token (struct graph_node *node, char *token) { switch (node->type) { case WORD_GN: - return match_word (node, token, filter); + return match_word (node, token); case IPV4_GN: return match_ipv4 (token); case IPV4_PREFIX_GN: @@ -621,26 +626,21 @@ match_range (struct graph_node *rangenode, const char *str) } static enum match_type -match_word(struct graph_node *wordnode, - const char *word, - enum filter_type filter) +match_word(struct graph_node *wordnode, const char *word) { - if (filter == FILTER_RELAXED) - { - if (!word || !strlen(word)) - return partly_match; - else if (!strncmp(wordnode->text, word, strlen(word))) - return !strcmp(wordnode->text, word) ? exact_match : partly_match; - else - return no_match; - } - else - { - if (!word) - return no_match; - else - return !strcmp(wordnode->text, word) ? exact_match : no_match; - } + // if the passed token is null or 0 length, partly match + if (!word || !strlen(word)) + return partly_match; + + // if the passed token is strictly a prefix of the full word, partly match + if (strlen(word) < strlen(wordnode->text)) + return !strncmp(wordnode->text, word, strlen(word)) ? partly_match : no_match; + + // if they are the same length and exactly equal, exact match + else if (strlen(word) == strlen(wordnode->text)) + return !strncmp(wordnode->text, word, strlen(word)) ? exact_match : no_match; + + return no_match; } static enum match_type diff --git a/lib/command_match.h b/lib/command_match.h index a102ba9484..8ad7ab0556 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -78,6 +78,6 @@ match_command (struct graph_node *, const char *, struct list **); * matched token. If this is empty, the input did not match any command. */ struct list * -match_command_complete (struct graph_node *, const char *, enum filter_type); +match_command_complete (struct graph_node *, const char *); #endif diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 90aadc6a9f..c53811e062 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -19,6 +19,7 @@ DEFUN (grammar_test, cmd->string = command; cmd->doc = NULL; cmd->func = NULL; + cmd->tokens = vector_init(VECTOR_MIN_SIZE); parse_command_format(nodegraph, cmd); return CMD_SUCCESS; } @@ -45,7 +46,7 @@ DEFUN (grammar_test_complete, "command to complete") { const char* command = argv_concat(argv, argc, 0); - struct list *result = match_command_complete (nodegraph, command, FILTER_STRICT); + struct list *result = match_command_complete (nodegraph, command); if (result->count == 0) // invalid command fprintf(stderr, "%% Unknown command\n"); @@ -61,9 +62,6 @@ DEFUN (grammar_test_complete, fprintf(stderr, " %p\n", cnode->element->func); else fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); - - if (cnode->type == RANGE_GN) - fprintf(stderr, "%lld - %lld\n", cnode->min, cnode->max); } free(desc); } From 279712aa19ee8b1e05271980f0c9894f1594a186 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 2 Aug 2016 16:23:54 +0000 Subject: [PATCH 025/280] lib: Reorganize command matcher Signed-off-by: Quentin Young --- lib/command_match.c | 197 +++++++++++++++++++++----------------------- 1 file changed, 93 insertions(+), 104 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index af506591ed..9695786e4b 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -11,12 +11,21 @@ static struct list * match_command_r (struct graph_node *, vector, unsigned int); static int -score_precedence (struct graph_node *); +score_precedence (enum graph_node_type); static enum match_type -min_match_level(enum node_type type); +min_match_level(enum node_type); + +static struct graph_node * +copy_node (struct graph_node *); + +static void +delete_nodelist (void *); /* token matcher prototypes */ +static enum match_type +match_token (struct graph_node *, char *); + static enum match_type match_ipv4 (const char *); @@ -30,7 +39,7 @@ static enum match_type match_ipv6_prefix (const char *); static enum match_type -match_range (struct graph_node *, const char *str); +match_range (struct graph_node *, const char *); static enum match_type match_word (struct graph_node *, const char *); @@ -41,35 +50,8 @@ match_number (struct graph_node *, const char *); static enum match_type match_variable (struct graph_node *, const char *); -static enum match_type -match_token (struct graph_node *, char *); - /* matching functions */ -static struct graph_node * -copy_node (struct graph_node *node) -{ - struct graph_node *new = new_node(node->type); - new->children = NULL; - new->is_start = node->is_start; - new->end = NULL; - new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; - new->value = node->value; - new->min = node->min; - new->max = node->max; - new->element = node->element ? copy_cmd_element(node->element) : NULL; - new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; - new->refs = 0; - return new; -} - - -/* Linked list data deletion callback */ -static void -delete_nodelist (void *node) { - free_node ((struct graph_node *) node); -} - struct cmd_element * match_command (struct graph_node *start, const char *line, struct list **argv) { @@ -176,74 +158,58 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) struct list *next = list_new(); add_nexthops(next, start); - // if we're at the end of input, need END_GN or no match - if (n+1 == vector_active (vline)) { - for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { - if (gn->type == END_GN) { - // we have a match, so build an argv and pass it back up the chain - struct list *argv = list_new(); - argv->del = &delete_nodelist; - struct graph_node *curr = copy_node(start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); - // add the current node - listnode_add(argv, curr); - // add the end node - listnode_add(argv, copy_node(gn)); - // clean up - list_delete (next); - return argv; - } - } - // no END_GN found, free resources and return null - list_delete (next); - return NULL; - } - - // otherwise recurse on all nexthops + // determine the best match struct list *bestmatch = NULL; for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) - { - if (gn->type == END_GN) // skip END_GN since we aren't at end of input - continue; - - // get the result of the next node - struct list *result = match_command_r (gn, vline, n+1); - - // compare to our current best match, and save if it's better - if (result) { - if (bestmatch) { - int currprec = score_precedence (listgetdata(listhead(bestmatch))); - int rsltprec = score_precedence (gn); - if (currprec < rsltprec) - list_delete (result); - if (currprec > rsltprec) { - list_delete (bestmatch); - bestmatch = result; - } - if (currprec == rsltprec) { - list_delete (bestmatch); - list_delete (result); - list_delete (next); - return NULL; - } - } - else - bestmatch = result; + { + // if we've matched all input we're looking for END_GN + if (n+1 == vector_active (vline)) { + if (gn->type == END_GN) { + bestmatch = list_new(); + listnode_add(bestmatch, copy_node(gn)); + break; } + else continue; } + // else recurse on node + struct list *result = match_command_r (gn, vline, n+1); + + if (result) { + if (bestmatch) { + struct graph_node *head = listgetdata(bestmatch->head); + int currprec = score_precedence (head->type); + int rsltprec = score_precedence (gn->type); + if (currprec < rsltprec) // old match is better + list_delete (result); + if (currprec > rsltprec) { // new match is better + list_delete (bestmatch); + bestmatch = result; + } + if (currprec == rsltprec) { // match is ambiguous + list_delete (bestmatch); + list_delete (result); + bestmatch = NULL; + break; + } + } + else + bestmatch = result; + } + } + if (bestmatch) { - // if we have a best match, prepend this node + matching token - // to argv and pass it up the chain + // copy current node, set arg and prepend to bestmatch struct graph_node *curr = copy_node(start); curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); list_add_node_prev (bestmatch, bestmatch->head, curr); - // cleanup - list_delete (next); - return bestmatch; + bestmatch->del = &delete_nodelist; } - else - return NULL; + + // cleanup + list_delete (next); + + return bestmatch; } struct list * @@ -255,8 +221,8 @@ match_command_complete (struct graph_node *start, const char *line) // pointer to next input token to match char *token; - struct list *current = list_new(), // current nodes to match input token against - *next = list_new(); // possible next hops to current input token + struct list *current = list_new(), // current nodes to match input token against + *next = list_new(); // possible next hops after current input token // pointers used for iterating lists struct graph_node *gn; @@ -277,13 +243,15 @@ match_command_complete (struct graph_node *start, const char *line) for (ALL_LIST_ELEMENTS_RO(current,node,gn)) { switch (match_token(gn, token)) { - case partly_match: // if it's a partial match, add this node to possible next hops - listnode_add(next, gn); - break; - case exact_match: // if it's an exact match, add this node's children to next hops + case partly_match: + if (idx == vector_active(vline) - 1) { + listnode_add(next, gn); + break; + } + case exact_match: add_nexthops(next, gn); break; - default: // otherwise do nothing + default: break; } } @@ -294,7 +262,6 @@ match_command_complete (struct graph_node *start, const char *line) * token = last input token processed * idx = index in `command` of last token processed * current = set of all transitions from the previous input token - * matched = set of all nodes reachable with current input * next = set of all nodes reachable from all nodes in `matched` */ list_free (current); @@ -335,14 +302,16 @@ add_nexthops(struct list *l, struct graph_node *node) return added; } - -/* matching utility functions */ +/* Linked list data deletion callback */ +static void +delete_nodelist (void *node) +{ + free_node ((struct graph_node *) node); +} /** - * Determines the minimum acceptable matching level - * for a given node type that can be accepted as a - * full match. Used for things like abbreviating - * commands, e.g. `conf t`. + * Determines for which nodes a partial + * match may count as a full match. */ static enum match_type min_match_level(enum node_type type) @@ -355,10 +324,13 @@ min_match_level(enum node_type type) } } +/** + * Precedence score used to disambiguate matches. + */ static int -score_precedence (struct graph_node *node) +score_precedence (enum graph_node_type type) { - switch (node->type) + switch (type) { // these should be mutually exclusive, // or never compared @@ -378,6 +350,23 @@ score_precedence (struct graph_node *node) } } +static struct graph_node * +copy_node (struct graph_node *node) +{ + struct graph_node *new = new_node(node->type); + new->children = NULL; + new->is_start = node->is_start; + new->end = NULL; + new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; + new->value = node->value; + new->min = node->min; + new->max = node->max; + new->element = node->element ? copy_cmd_element(node->element) : NULL; + new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; + new->refs = 0; + return new; +} + static enum match_type match_token (struct graph_node *node, char *token) { From 88255c7cfbd2da60c52eeea57b62a63c21264ab0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 2 Aug 2016 16:40:03 +0000 Subject: [PATCH 026/280] lib: Add vararg support Signed-off-by: Quentin Young --- lib/command_parse.y | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 146c8b6101..57a0ba3f82 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -78,8 +78,8 @@ struct cmd_element *command; // command we're parsing /* grammar proper */ %% -start: sentence_root - cmd_token_seq +start: + sentence_root cmd_token_seq { // create leaf node struct graph_node *end = new_node(END_GN); @@ -93,6 +93,29 @@ start: sentence_root } fprintf(stderr, "Parsed full command successfully.\n"); } +| sentence_root cmd_token_seq '.' placeholder_token +{ + currnode = add_node(currnode, $4); + if (currnode != $4) + free_node ($4); + + // since varargs may match any number of the last token, + // simply add this node as a child of itself and proceed + // wth normal command termination procedure + add_node(currnode, currnode); + + // create leaf node + struct graph_node *end = new_node(END_GN); + end->element = command; + + // add node + if (add_node(currnode, end) != end) + { + yyerror("Duplicate command."); + YYABORT; + } + fprintf(stderr, "Parsed full command successfully.\n"); +} sentence_root: WORD { From 54431328fc4c0e0a9e0582ece812d244995633da Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 3 Aug 2016 02:01:52 +0000 Subject: [PATCH 027/280] lib: Implement full command disambiguation logic Disambiguation is smarter and somewhat more compact. Signed-off-by: Quentin Young --- lib/command_match.c | 91 ++++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 31 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 9695786e4b..6923da776b 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -22,6 +22,9 @@ copy_node (struct graph_node *); static void delete_nodelist (void *); +static struct graph_node * +disambiguate (struct graph_node *, struct graph_node *, char *); + /* token matcher prototypes */ static enum match_type match_token (struct graph_node *, char *); @@ -159,6 +162,7 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) add_nexthops(next, start); // determine the best match + int ambiguous = 0; struct list *bestmatch = NULL; for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { @@ -167,6 +171,7 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) if (gn->type == END_GN) { bestmatch = list_new(); listnode_add(bestmatch, copy_node(gn)); + bestmatch->del = &delete_nodelist; break; } else continue; @@ -175,35 +180,36 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) // else recurse on node struct list *result = match_command_r (gn, vline, n+1); + // save the best match, subtle logic at play here if (result) { if (bestmatch) { - struct graph_node *head = listgetdata(bestmatch->head); - int currprec = score_precedence (head->type); - int rsltprec = score_precedence (gn->type); - if (currprec < rsltprec) // old match is better - list_delete (result); - if (currprec > rsltprec) { // new match is better - list_delete (bestmatch); + struct list *to_delete = result; + struct graph_node *new = listgetdata(result->head), + *old = listgetdata(bestmatch->head); + char *nextoken = vector_slot (vline, n+1); + struct graph_node *best = disambiguate(new, old, nextoken); + ambiguous = !best || (ambiguous && best == old); + if (best == new) { + to_delete = bestmatch; bestmatch = result; } - if (currprec == rsltprec) { // match is ambiguous - list_delete (bestmatch); - list_delete (result); - bestmatch = NULL; - break; - } + list_delete (to_delete); } else bestmatch = result; } } + if (ambiguous) { + list_delete(bestmatch); + bestmatch = NULL; + } + if (bestmatch) { // copy current node, set arg and prepend to bestmatch struct graph_node *curr = copy_node(start); curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); list_add_node_prev (bestmatch, bestmatch->head, curr); - bestmatch->del = &delete_nodelist; } // cleanup @@ -302,16 +308,9 @@ add_nexthops(struct list *l, struct graph_node *node) return added; } -/* Linked list data deletion callback */ -static void -delete_nodelist (void *node) -{ - free_node ((struct graph_node *) node); -} - /** - * Determines for which nodes a partial - * match may count as a full match. + * Determines the node types for which a partial match may count as a full + * match. Enables command abbrevations. */ static enum match_type min_match_level(enum node_type type) @@ -324,32 +323,52 @@ min_match_level(enum node_type type) } } -/** - * Precedence score used to disambiguate matches. - */ +/* Precedence score used to disambiguate matches. */ static int score_precedence (enum graph_node_type type) { switch (type) { - // these should be mutually exclusive, - // or never compared + // some of these are mutually exclusive, order is important case IPV4_GN: case IPV4_PREFIX_GN: case IPV6_GN: case IPV6_PREFIX_GN: case RANGE_GN: case NUMBER_GN: - return 1; - case WORD_GN: return 2; - case VARIABLE_GN: + case WORD_GN: return 3; + case VARIABLE_GN: + return 4; default: return 10; } } +/* Disambiguation logic to pick the best of two possible matches */ +static struct graph_node * +disambiguate (struct graph_node *first, struct graph_node *second, char *token) +{ + // if the types are different, simply go off of type precedence + if (first->type != second->type) { + int firstprec = score_precedence(first->type); + int secndprec = score_precedence(second->type); + if (firstprec != secndprec) + return firstprec < secndprec ? first : second; + else + return NULL; + } + + // if they're the same, return the more exact match + enum match_type fmtype = match_token (first, token); + enum match_type smtype = match_token (second, token); + if (fmtype != smtype) + return fmtype > smtype ? first : second; + + return NULL; +} + static struct graph_node * copy_node (struct graph_node *node) { @@ -367,6 +386,16 @@ copy_node (struct graph_node *node) return new; } +/* Linked list data deletion callback */ +static void +delete_nodelist (void *node) +{ + free_node ((struct graph_node *) node); +} + + +/* token level matching functions */ + static enum match_type match_token (struct graph_node *node, char *token) { From 6ce82b63cd35eac37a4ddf1d0253342d5160b7af Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 3 Aug 2016 19:22:27 +0000 Subject: [PATCH 028/280] lib: Implement status variable Matcher now keeps track of why it failed Signed-off-by: Quentin Young --- lib/.command.h.swo | Bin 16384 -> 0 bytes lib/command_match.c | 82 +++++++++++++++++++++++------------------- lib/command_match.h | 16 ++++----- lib/grammar_sandbox.c | 22 +++++++++--- 4 files changed, 70 insertions(+), 50 deletions(-) delete mode 100644 lib/.command.h.swo diff --git a/lib/.command.h.swo b/lib/.command.h.swo deleted file mode 100644 index 71a42cc20a022a18e2d1af9455f52606f192dfa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOU5p!76`r<0nwGQ`Jn$od4#~@A@%|;-lx0I<;`Q#1vi4dYdy@?k*6hr+J!CxN z%#6M3Mkye8K_U_e2`W&f_MtqqARgfXBm@Wv34sJWAS6Jdz!QifAt8Q3`Ocj?-m#r* zQuV1~EPdL{z2}~L&UenebMLXUx42`J>52Je4WGv}?bvf)z4ZKt@7KPyp=ox%+xPkr z_Z<0ggy+pg=N1bE5y2>fciB6*WOR&wo_^j_Uu)ME}24zoGhH zndtwQ>VL25Ur`RF`c-rOCubmMAZH+FAZH+FAZH+FAZH+FAZH+FAZOtJk^#%nv>A9V z@6-7HKfV9odQ{VX0z3yi3p@qv180E0JfdkY0XKoq0wv%W@ck2-_9ftpKm|As{P?Y! z_9E~#;054wKm>%q$AB`h2rK|6fct<~AJ(+r06znM3cLtB13V4f00htgJ_MWx-U&Pm zJOupxAx(Q3_&x9);OoFkz~_Na0@r{ZPy?O>3czV#2Kd8qP5UMAbKuKB8<+w9^dNi# zJ_URfSOFdY{&-B&z6;z0Y~XR=LEu+!!JNQ#;3L2Z;MZ>kmw*kN1^)3S_y@cI+yE{D zr+`}zXxcA;XMg}$2i^m`f_laefMo@N&`BD37MoE0-GiQ@GJTW&M3bF-8b#PAFnrLQ$tmg3n>{B9lVWZkCRf_s}gwaZ} zl}vrzn2=1>!i+n~al(xJS8|DgDNkfMPRNPTvbwG}RBMB+nMgLCLJl1taA*_cmv1xI z@?lJ-<{BS7;SVNTCM+6`<`E-zs+F-t!FHCbTjm@(s9GX%V0SFPovwQJjE5{w%yyR{ znY8B###3m&hO1=}eq2Xz<$;!!t_)-4oJxkmW^C*Dq|9 zvf^RfZN}D~Cnyr0uqU^$E2RrHJuCl|*b6P*^89IGqf#%`*7f3O0vK=ju?Sn1jeU>v zHe>frZItAsK9EQ2l;p+IZgEpLDoy+&wFROV#c&RBa(%ighFQ%cc@=>%*^C9cKIR%8 zvs&1`wbF%#ibZN;#?-JyYhth8&W_5ANZuq<5@xBkW279BeA}2J9Jrt;V_R{%vTlr} zK~cVDl+2oFSy+w6a~mkNxMco!c4?PfBu|3h)1`NI?X@Ba#d& zZdZ4W$_9>4MhiGP3J%>8hKu{=b;SR8__*K#yCg~~U1RDZt z1Q}KB?|C=`Zed^aBUZwCZr_=l;sUtmh}d$yNIG6F)$rD+;EiW&;do8Rjdi15!7-QC zw`-(RRj<{JVq;6MQMFO4Zkr`|U@FJpD^GaIsBdmJ>ZDh8>5^WnLErAGWCJHt!bags z8e9?D)1j z+RI08Bzf1s3dDNX`2PPR+?%i9-p#-NPrpC^2JZQnf%Cw-fp-Ca!yW(6zz>0M0-pgs z4cNd6@CfiS?)={dZUSv!75E_V81N|YJIwQ2;Cnz?6ZiuDeE_fxyFmWQ8ORyP8ORyP z8ORyP8ORyP8ORxUqcLzw__*qDF=+Cl&$oGTfXkP!3P-9O)wIJ^u0fnUZ--Bwq_!9A z;dabb2PK`URmg(Hs;q5gTaz&ba_y_xfm~yqx#k9)zM6Y zz;#et#<-@sf6|enTx@D4Ws_!vZ__4)$K1^dCsy!un0?$$HW-EKE((eF6ujpQbe?L&dqavDV zqFFqEq1*Lnd;`DhcnoHiIlsE18{n%m{Eu_1ozN?5zJ~^6Q%7b3TcQepDE7>ZhifF^ z;wwy=LCze8GEF>jAZ(OFkRr11+Jqk{`$Cf}ixo)u#TC8T(bJg!vv*bcnzUhwNIU-r D#5D@v diff --git a/lib/command_match.c b/lib/command_match.c index 6923da776b..5ba1c1b6e7 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -54,46 +54,41 @@ static enum match_type match_variable (struct graph_node *, const char *); /* matching functions */ +static enum matcher_rv matcher_result_value; -struct cmd_element * -match_command (struct graph_node *start, const char *line, struct list **argv) +enum matcher_rv +match_command (struct graph_node *start, + const char *line, + struct list **argvv, + struct cmd_element **el) { + matcher_result_value = MATCHER_NO_MATCH; // parse command vector vline = cmd_make_strvec (line); for (unsigned int i = 0; i < vector_active(start->children); i++) { - // call recursive builder on each starting child - *argv = match_command_r(vector_slot(start->children, i), vline, 0); - // if any of them succeed, return their argv - // since all command DFA's must begin with a word, there can only be - // one valid return value - if (*argv) break; + // call recursive matcher on each starting child + *argvv = match_command_r(vector_slot(start->children, i), vline, 0); + if (*argvv) break; } - // walk the list, find the END_GN, return that - if (*argv) { + if (*argvv) { struct listnode *ln; struct graph_node *gn; - char buf[50]; - for (ALL_LIST_ELEMENTS_RO(*argv,ln,gn)) { - describe_node(gn, buf, 50); - fprintf(stderr, "%s[%d]\n", buf, gn->type); - if (gn->type == END_GN) - return gn->element; - } - assert(0); + for (ALL_LIST_ELEMENTS_RO(*argvv,ln,gn)) + if (gn->type == END_GN) { + *el = gn->element; + break; + } + assert(el); } - return NULL; + return matcher_result_value; } /** - * Matches a given input line against a DFA. - * - * Builds an argument list given a DFA and a matching input line. This function - * should be passed the start node of the DFA, a matching input line, and the - * index of the first token in the input line. + * Builds an argument list given a DFA and a matching input line. * * First the function determines if the node it is passed matches the first * token of input. If it does not, it returns NULL. If it does match, then it @@ -177,7 +172,7 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) else continue; } - // else recurse on node + // else recurse on candidate child node struct list *result = match_command_r (gn, vline, n+1); // save the best match, subtle logic at play here @@ -200,16 +195,23 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } } - if (ambiguous) { - list_delete(bestmatch); - bestmatch = NULL; - } - if (bestmatch) { - // copy current node, set arg and prepend to bestmatch - struct graph_node *curr = copy_node(start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); - list_add_node_prev (bestmatch, bestmatch->head, curr); + if (ambiguous) { + list_delete(bestmatch); + bestmatch = NULL; + matcher_result_value = MATCHER_AMBIGUOUS; + } + else { + // copy current node, set arg and prepend to bestmatch + struct graph_node *curr = copy_node(start); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); + list_add_node_prev (bestmatch, bestmatch->head, curr); + matcher_result_value = MATCHER_OK; + } + } + else { + if (n+1 == vector_active(vline) && matcher_result_value == MATCHER_NO_MATCH) + matcher_result_value = MATCHER_INCOMPLETE; } // cleanup @@ -271,9 +273,13 @@ match_command_complete (struct graph_node *start, const char *line) * next = set of all nodes reachable from all nodes in `matched` */ list_free (current); - cmd_free_strvec(vline); + matcher_result_value = + idx + 1 == vector_active(vline) && next->count ? + MATCHER_OK : + MATCHER_NO_MATCH; + return next; } @@ -329,13 +335,15 @@ score_precedence (enum graph_node_type type) { switch (type) { - // some of these are mutually exclusive, order is important + // some of these are mutually exclusive, so they share + // the same precedence value case IPV4_GN: case IPV4_PREFIX_GN: case IPV6_GN: case IPV6_PREFIX_GN: - case RANGE_GN: case NUMBER_GN: + return 1; + case RANGE_GN: return 2; case WORD_GN: return 3; diff --git a/lib/command_match.h b/lib/command_match.h index 8ad7ab0556..895a678dce 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -18,12 +18,10 @@ enum filter_type /* matcher result value. */ enum matcher_rv { - MATCHER_OK, - MATCHER_COMPLETE, - MATCHER_INCOMPLETE, MATCHER_NO_MATCH, + MATCHER_INCOMPLETE, MATCHER_AMBIGUOUS, - MATCHER_EXCEED_ARGC_MAX + MATCHER_OK, }; /* Completion match types. */ @@ -42,7 +40,6 @@ enum match_type ( (matcher_rv) == MATCHER_INCOMPLETE \ || (matcher_rv) == MATCHER_NO_MATCH \ || (matcher_rv) == MATCHER_AMBIGUOUS \ - || (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \ ) /** @@ -50,11 +47,12 @@ enum match_type * * @param DFA to match against * @param input string - * @param pointer to argv pointer - * @return cmd_element found, or NULL if there is no match. + * @param pointer which will be pointed at argv upon match + * @param pointer which will be pointed at matching cmd_element upon match + * @return result of matcher run */ -struct cmd_element * -match_command (struct graph_node *, const char *, struct list **); +enum matcher_rv +match_command (struct graph_node *, const char *, struct list **, struct cmd_element **); /** * Compiles next-hops for a given line of user input. diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index c53811e062..0eb8d69cee 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -77,9 +77,11 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match") { + const char *line = argv_concat(argv, argc, 0); + struct list *argvv = NULL; - const char *command = argv_concat(argv, argc, 0); - struct cmd_element *element = match_command (nodegraph, command, &argvv); + struct cmd_element *element = NULL; + enum matcher_rv result = match_command (nodegraph, line, &argvv, &element); if (element) { fprintf(stderr, "Matched: %s\n", element->string); @@ -89,8 +91,20 @@ DEFUN (grammar_test_match, fprintf(stderr, "%s -- %s\n", gn->text, gn->arg); } else { - fprintf(stderr, "Returned NULL\n"); - return CMD_SUCCESS; + switch (result) { + case MATCHER_NO_MATCH: + fprintf(stderr, "%% Unknown command\n"); + break; + case MATCHER_INCOMPLETE: + fprintf(stderr, "%% Incomplete command\n"); + break; + case MATCHER_AMBIGUOUS: + fprintf(stderr, "%% Ambiguous command\n"); + break; + default: + fprintf(stderr, "%% Unknown error\n"); + break; + } } return CMD_SUCCESS; From 8aeffd7ae1aac2552f67aa8b2c7708b4d41c4d55 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 3 Aug 2016 19:49:02 +0000 Subject: [PATCH 029/280] lib: Fix use after free in matcher Signed-off-by: Quentin Young --- lib/command_match.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 5ba1c1b6e7..305e3b1a68 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -272,14 +272,15 @@ match_command_complete (struct graph_node *start, const char *line) * current = set of all transitions from the previous input token * next = set of all nodes reachable from all nodes in `matched` */ - list_free (current); - cmd_free_strvec(vline); matcher_result_value = idx + 1 == vector_active(vline) && next->count ? MATCHER_OK : MATCHER_NO_MATCH; + list_free (current); + cmd_free_strvec(vline); + return next; } From f4b0c72e5313927b3a2ddaf02d148992914474a3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 4 Aug 2016 00:58:12 +0000 Subject: [PATCH 030/280] lib: Refactor format parser Also fix a bug where selector elements beginning with the same word are only parsed once Signed-off-by: Quentin Young --- lib/command_graph.c | 8 ------ lib/command_graph.h | 5 +--- lib/command_parse.y | 60 +++++++++++++++++++++++++++++++-------------- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 07cc306505..05570d5c73 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -13,14 +13,6 @@ struct graph_node * add_node(struct graph_node *parent, struct graph_node *child) { - struct graph_node *p_child; - - for (unsigned int i = 0; i < vector_active(parent->children); i++) - { - p_child = vector_slot(parent->children, i); - if (cmp_node(child, p_child)) - return p_child; - } vector_set(parent->children, child); child->refs++; return child; diff --git a/lib/command_graph.h b/lib/command_graph.h index 32a07ce4ea..35a0eee273 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -42,13 +42,10 @@ struct graph_node /* * Adds a node as a child of another node. - * If the new parent has a child that is equal to the prospective child, as - * determined by cmp_node, then a pointer to the existing node is returned and - * the prospective child is not added. Otherwise the child node is returned. * * @param[in] parent node * @param[in] child node - * @return pointer to child if it is added, pointer to existing child otherwise + * @return child node, for convenience */ struct graph_node * add_node(struct graph_node *, struct graph_node *); diff --git a/lib/command_parse.y b/lib/command_parse.y index 57a0ba3f82..0c36c2a6dc 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -10,7 +10,11 @@ %{ extern int yylex(void); -extern void yyerror(const char *); +void yyerror(const char *); +struct graph_node * +node_exists(struct graph_node *, struct graph_node *); +struct graph_node * +node_replace(struct graph_node *, struct graph_node *); // compile with debugging facilities #define YYDEBUG 1 @@ -86,34 +90,35 @@ start: end->element = command; // add node - if (add_node(currnode, end) != end) + if (node_exists(currnode, end)) { yyerror("Duplicate command."); YYABORT; } + add_node(currnode, end); fprintf(stderr, "Parsed full command successfully.\n"); } | sentence_root cmd_token_seq '.' placeholder_token { - currnode = add_node(currnode, $4); - if (currnode != $4) + if ((currnode = node_replace(currnode, $4)) != $4) free_node ($4); // since varargs may match any number of the last token, // simply add this node as a child of itself and proceed // wth normal command termination procedure - add_node(currnode, currnode); + node_replace(currnode, currnode); // create leaf node struct graph_node *end = new_node(END_GN); end->element = command; // add node - if (add_node(currnode, end) != end) + if (node_exists(currnode, end)) { yyerror("Duplicate command."); YYABORT; } + add_node(currnode, end); fprintf(stderr, "Parsed full command successfully.\n"); } @@ -122,8 +127,7 @@ sentence_root: WORD struct graph_node *root = new_node(WORD_GN); root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - currnode = add_node(startnode, root); - if (currnode != root) + if ((currnode = node_replace(startnode, root)) != root) free (root); free ($1); @@ -134,14 +138,12 @@ sentence_root: WORD cmd_token: placeholder_token { - currnode = add_node(currnode, $1); - if (currnode != $1) + if ((currnode = node_replace(currnode, $1)) != $1) free_node ($1); } | literal_token { - currnode = add_node(currnode, $1); - if (currnode != $1) + if ((currnode = node_replace(currnode, $1)) != $1) free_node ($1); } /* selectors and options are subgraphs with start and end nodes */ @@ -226,7 +228,7 @@ literal_token: /* productions */ selector: - '<' selector_part '|' selector_element '>' + '<' selector_part '>' { // all the graph building is done in selector_element, // so just return the selector subgraph head @@ -235,7 +237,7 @@ selector: selector_part: selector_part '|' selector_element -| selector_element +| selector_element '|' selector_element ; selector_element: @@ -292,10 +294,7 @@ selector_token: option: '[' option_part ']' { // add null path - struct graph_node *nullpath = new_node(NUL_GN); - add_node(optnode_start, nullpath); - add_node(nullpath, optnode_end); - + add_node(optnode_start, optnode_end); $$ = optnode_start; }; @@ -353,7 +352,7 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) optnode_start = optnode_end = NULL; // trace parser - yydebug = 0; + yydebug = 1; // command string command = cmd; // make flex read from a string @@ -363,3 +362,26 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) // startnode points to command DFA return startnode; } + +struct graph_node * +node_exists(struct graph_node *parent, struct graph_node *child) +{ + struct graph_node *p_child; + for (unsigned int i = 0; i < vector_active(parent->children); i++) + { + p_child = vector_slot(parent->children, i); + if (cmp_node(child, p_child)) + return p_child; + } + return NULL; +} + +struct graph_node * +node_replace(struct graph_node *parent, struct graph_node *child) +{ + struct graph_node *existing = node_exists (parent, child); + if (!existing) + existing = add_node(parent, child); + + return existing; +} From 5a8bbed0b1e9b22526fd23946593f47487709497 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 4 Aug 2016 16:18:31 +0000 Subject: [PATCH 031/280] lib: Add support for negative ranges And convert range delimiters to signed int Signed-off-by: Quentin Young --- lib/command_graph.c | 2 +- lib/command_graph.h | 2 +- lib/command_lex.l | 6 +++--- lib/command_match.c | 9 ++++----- lib/command_parse.y | 16 ++++++---------- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 05570d5c73..d420b1c063 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -185,7 +185,7 @@ dump_node (struct graph_node *node) fprintf(stderr, "\t->value: %ld\n", node->value); fprintf(stderr, "\t->is_start: %d\n", node->is_start); fprintf(stderr, "\t->element: %p\n", node->element); - fprintf(stderr, "\t->min: %lld\n->max: %lld\n", node->min, node->max); + fprintf(stderr, "\t->min: %d\n->max: %d\n", node->min, node->max); fprintf(stderr, "\t->arg: %s\n", node->arg); fprintf(stderr, "\t->refs: %d\n", node->refs); fprintf(stderr, "\tnum children: %d\n", vector_active(node->children)); diff --git a/lib/command_graph.h b/lib/command_graph.h index 35a0eee273..925133c203 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -29,7 +29,7 @@ struct graph_node char* text; // for WORD_GN and VARIABLE_GN long value; // for NUMBER_GN - signed long long min, max;// for RANGE_GN + int min, max; // for RANGE_GN /* cmd_element struct pointer, only valid for END_GN */ struct cmd_element *element; diff --git a/lib/command_lex.l b/lib/command_lex.l index ff951149b3..0a997de8df 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -4,13 +4,13 @@ extern void set_buffer_string(const char *); %} -WORD [-+a-z\*][-+_a-zA-Z0-9\*]* +WORD [-|+]?[a-z\*][-+_a-zA-Z0-9\*]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M VARIABLE [A-Z][-_a-zA-Z:0-9]+ -NUMBER [0-9]{1,20} +NUMBER [-|+]?[0-9]{1,20} RANGE \({NUMBER}\-{NUMBER}\) /* yytext shall be a pointer */ @@ -30,7 +30,7 @@ RANGE \({NUMBER}\-{NUMBER}\) {VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} {NUMBER} { char *endptr; - yylval.integer = strtoll(yytext, &endptr, 10); + yylval.integer = strtoimax(yytext, &endptr, 10); return NUMBER; } {RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} diff --git a/lib/command_match.c b/lib/command_match.c index 305e3b1a68..aac2edc482 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -622,7 +622,7 @@ match_ipv6_prefix (const char *str) return no_match; /* validate mask */ - nmask = strtol (mask, &endptr, 10); + nmask = strtoimax (mask, &endptr, 10); if (*endptr != '\0' || nmask < 0 || nmask > 128) return no_match; @@ -636,15 +636,14 @@ static enum match_type match_range (struct graph_node *rangenode, const char *str) { char *endptr = NULL; - signed long long val; + signed int val; if (str == NULL) return 1; - val = strtoll (str, &endptr, 10); + val = strtoimax (str, &endptr, 10); if (*endptr != '\0') return 0; - val = llabs(val); if (val < rangenode->min || val > rangenode->max) return no_match; @@ -675,7 +674,7 @@ match_number(struct graph_node *numnode, const char *word) { if (!strcmp("\0", word)) return no_match; char *endptr; - long num = strtol(word, &endptr, 10); + int num = strtoimax(word, &endptr, 10); if (endptr != '\0') return no_match; return num == numnode->value ? exact_match : no_match; } diff --git a/lib/command_parse.y b/lib/command_parse.y index 0c36c2a6dc..9d7432ca40 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -16,6 +16,8 @@ node_exists(struct graph_node *, struct graph_node *); struct graph_node * node_replace(struct graph_node *, struct graph_node *); +#define DECIMAL_STRLEN_MAX 20 + // compile with debugging facilities #define YYDEBUG 1 %} @@ -34,7 +36,7 @@ node_replace(struct graph_node *, struct graph_node *); /* valid types for tokens */ %union{ - signed long long integer; + signed int integer; char *string; struct graph_node *node; } @@ -203,10 +205,8 @@ placeholder_token: $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); // get the numbers out - strsep(&yylval.string, "(-)"); - char *endptr; - $$->min = strtoll( strsep(&yylval.string, "(-)"), &endptr, 10 ); - $$->max = strtoll( strsep(&yylval.string, "(-)"), &endptr, 10 ); + $$->min = strtoimax( yylval.string+1, &yylval.string, 10 ); + $$->max = strtoimax( yylval.string+1, &yylval.string, 10 ); free ($1); } @@ -333,11 +333,7 @@ option_token: void yyerror(char const *message) { // fail on bad parse fprintf(stderr, "Grammar error: %s\n", message); - fprintf(stderr, "Token on error: "); - if (yylval.string) fprintf(stderr, "%s\n", yylval.string); - else if (yylval.node) fprintf(stderr, "%s\n", yylval.node->text); - else fprintf(stderr, "%lld\n", yylval.integer); - + exit(EXIT_FAILURE); } struct graph_node * From ef955a80a635f5fb821a640f7e1d7aaac8ec5e5e Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 4 Aug 2016 16:39:15 +0000 Subject: [PATCH 032/280] lib: Allow optional whitespace in ranges Makes ranges where both endpoints are negative somewhat more readable. Also validate ranges. Signed-off-by: Quentin Young --- lib/command_lex.l | 2 +- lib/command_parse.y | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index 0a997de8df..47723cbf91 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -11,7 +11,7 @@ IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M VARIABLE [A-Z][-_a-zA-Z:0-9]+ NUMBER [-|+]?[0-9]{1,20} -RANGE \({NUMBER}\-{NUMBER}\) +RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) /* yytext shall be a pointer */ %pointer diff --git a/lib/command_parse.y b/lib/command_parse.y index 9d7432ca40..0ea8744346 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -206,7 +206,11 @@ placeholder_token: // get the numbers out $$->min = strtoimax( yylval.string+1, &yylval.string, 10 ); - $$->max = strtoimax( yylval.string+1, &yylval.string, 10 ); + strsep (&yylval.string, "-"); + $$->max = strtoimax( yylval.string, &yylval.string, 10 ); + + // validate range + if ($$->min >= $$->max) yyerror("Invalid range."); free ($1); } From b3899769660fe891d5ea845e8ea64988743c1ccd Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 4 Aug 2016 18:16:26 +0000 Subject: [PATCH 033/280] lib: Unrefactor to signed long long for ranges Signed-off-by: Quentin Young --- lib/command_graph.c | 6 +++--- lib/command_graph.h | 8 ++++---- lib/command_lex.l | 4 ++-- lib/command_match.c | 6 +++--- lib/command_parse.y | 9 +++++---- lib/grammar_sandbox.c | 5 ++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index d420b1c063..50be35044a 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -125,7 +125,7 @@ describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) snprintf(buffer, bufsize, node->text); break; case NUMBER_GN: - snprintf(buffer, bufsize, "%ld", node->value); + snprintf(buffer, bufsize, "%lld", node->value); break; case SELECTOR_GN: snprintf(buffer, bufsize, "<>"); @@ -182,10 +182,10 @@ dump_node (struct graph_node *node) describe_node(node, buf, 50); fprintf(stderr, "%s[%d]\n", buf, node->type); fprintf(stderr, "\t->text: %s\n", node->text); - fprintf(stderr, "\t->value: %ld\n", node->value); + fprintf(stderr, "\t->value: %lld\n", node->value); fprintf(stderr, "\t->is_start: %d\n", node->is_start); fprintf(stderr, "\t->element: %p\n", node->element); - fprintf(stderr, "\t->min: %d\n->max: %d\n", node->min, node->max); + fprintf(stderr, "\t->min: %lld\n->max: %lld\n", node->min, node->max); fprintf(stderr, "\t->arg: %s\n", node->arg); fprintf(stderr, "\t->refs: %d\n", node->refs); fprintf(stderr, "\tnum children: %d\n", vector_active(node->children)); diff --git a/lib/command_graph.h b/lib/command_graph.h index 925133c203..e1feb9f77f 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -23,13 +23,13 @@ enum graph_node_type struct graph_node { enum graph_node_type type;// data type this node matches or holds - int is_start; // whether this node is a start node + unsigned int is_start; // whether this node is a start node vector children; // this node's children struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN char* text; // for WORD_GN and VARIABLE_GN - long value; // for NUMBER_GN - int min, max; // for RANGE_GN + long long value; // for NUMBER_GN + long long min, max; // for RANGE_GN /* cmd_element struct pointer, only valid for END_GN */ struct cmd_element *element; @@ -37,7 +37,7 @@ struct graph_node char *arg; /* refcount for node parents */ - int refs; + unsigned int refs; }; /* diff --git a/lib/command_lex.l b/lib/command_lex.l index 47723cbf91..855cf9a065 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -4,13 +4,13 @@ extern void set_buffer_string(const char *); %} -WORD [-|+]?[a-z\*][-+_a-zA-Z0-9\*]* +WORD (\-|\+)?[a-z\*][-+_a-zA-Z0-9\*]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X IPV6_PREFIX X:X::X:X\/M VARIABLE [A-Z][-_a-zA-Z:0-9]+ -NUMBER [-|+]?[0-9]{1,20} +NUMBER (\-|\+)?[0-9]{1,20} RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) /* yytext shall be a pointer */ diff --git a/lib/command_match.c b/lib/command_match.c index aac2edc482..eaacce027f 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -636,12 +636,12 @@ static enum match_type match_range (struct graph_node *rangenode, const char *str) { char *endptr = NULL; - signed int val; + long long val; if (str == NULL) return 1; - val = strtoimax (str, &endptr, 10); + val = strtoll (str, &endptr, 10); if (*endptr != '\0') return 0; @@ -674,7 +674,7 @@ match_number(struct graph_node *numnode, const char *word) { if (!strcmp("\0", word)) return no_match; char *endptr; - int num = strtoimax(word, &endptr, 10); + long long num = strtoll (word, &endptr, 10); if (endptr != '\0') return no_match; return num == numnode->value ? exact_match : no_match; } diff --git a/lib/command_parse.y b/lib/command_parse.y index 0ea8744346..ac075e67a3 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -36,7 +36,7 @@ node_replace(struct graph_node *, struct graph_node *); /* valid types for tokens */ %union{ - signed int integer; + long long integer; char *string; struct graph_node *node; } @@ -205,9 +205,10 @@ placeholder_token: $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); // get the numbers out - $$->min = strtoimax( yylval.string+1, &yylval.string, 10 ); + yylval.string++; + $$->min = strtoll( yylval.string, &yylval.string, 10 ); strsep (&yylval.string, "-"); - $$->max = strtoimax( yylval.string, &yylval.string, 10 ); + $$->max = strtoll( yylval.string, &yylval.string, 10 ); // validate range if ($$->min >= $$->max) yyerror("Invalid range."); @@ -352,7 +353,7 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) optnode_start = optnode_end = NULL; // trace parser - yydebug = 1; + yydebug = 0; // command string command = cmd; // make flex read from a string diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 0eb8d69cee..a2177c1767 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -32,9 +32,8 @@ DEFUN (grammar_test_show, { if (!nodegraph) fprintf(stderr, "!nodegraph\n"); - fprintf(stderr, "trying to print nodegraph->type\n"); - fprintf(stderr, "%d\n", nodegraph->type); - walk_graph(nodegraph, 0); + else + walk_graph(nodegraph, 0); return CMD_SUCCESS; } From 39fb395f7d628279c02c245028a6ab6029d272d7 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 5 Aug 2016 02:08:16 +0000 Subject: [PATCH 034/280] lib: Improve matching disambiguation Disambiguation logic now compares full paths instead of defaulting to an ambiguous match if the heads cannot be disambiguated Signed-off-by: Quentin Young --- lib/command_match.c | 87 ++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index eaacce027f..e4b95d5970 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -25,6 +25,9 @@ delete_nodelist (void *); static struct graph_node * disambiguate (struct graph_node *, struct graph_node *, char *); +static struct list * +disambiguate_nodelist (struct list *, struct list *, vector, unsigned int); + /* token matcher prototypes */ static enum match_type match_token (struct graph_node *, char *); @@ -81,7 +84,7 @@ match_command (struct graph_node *start, *el = gn->element; break; } - assert(el); + assert(*el); } return matcher_result_value; @@ -91,15 +94,16 @@ match_command (struct graph_node *start, * Builds an argument list given a DFA and a matching input line. * * First the function determines if the node it is passed matches the first - * token of input. If it does not, it returns NULL. If it does match, then it - * saves the input token as the head of an argument list. + * token of input. If it does not, it returns NULL (MATCHER_NO_MATCH). If it + * does match, then it saves the input token as the head of an argument list. * * The next step is to see if there is further input in the input line. If * there is not, the current node's children are searched to see if any of them * are leaves (type END_GN). If this is the case, then the bottom of the - * recursion stack has been reached, and the argument list (with one node) is - * returned. If it is not the case, NULL is returned, indicating that there is - * no match for the input along this path. + * recursion stack has been reached, the leaf is pushed onto the argument list, + * the current node is pushed, and the resulting argument list is + * returned (MATCHER_OK). If it is not the case, NULL is returned, indicating + * that there is no match for the input along this path (MATCHER_INCOMPLETE). * * If there is further input, then the function recurses on each of the current * node's children, passing them the input line minus the token that was just @@ -158,15 +162,15 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) // determine the best match int ambiguous = 0; - struct list *bestmatch = NULL; + struct list *currbest = NULL; for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) { // if we've matched all input we're looking for END_GN if (n+1 == vector_active (vline)) { if (gn->type == END_GN) { - bestmatch = list_new(); - listnode_add(bestmatch, copy_node(gn)); - bestmatch->del = &delete_nodelist; + currbest = list_new(); + listnode_add(currbest, copy_node(gn)); + currbest->del = &delete_nodelist; break; } else continue; @@ -176,36 +180,27 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) struct list *result = match_command_r (gn, vline, n+1); // save the best match, subtle logic at play here - if (result) { - if (bestmatch) { - struct list *to_delete = result; - struct graph_node *new = listgetdata(result->head), - *old = listgetdata(bestmatch->head); - char *nextoken = vector_slot (vline, n+1); - struct graph_node *best = disambiguate(new, old, nextoken); - ambiguous = !best || (ambiguous && best == old); - if (best == new) { - to_delete = bestmatch; - bestmatch = result; - } - list_delete (to_delete); - } - else - bestmatch = result; + if (result && currbest) { + struct list *newbest = disambiguate_nodelist(currbest, result, vline, n+1); + ambiguous = !newbest || (ambiguous && newbest == currbest); + list_delete ((newbest && newbest == result) ? currbest : result); + currbest = newbest ? newbest : currbest; } + else if (result) + currbest = result; } - if (bestmatch) { + if (currbest) { if (ambiguous) { - list_delete(bestmatch); - bestmatch = NULL; + list_delete(currbest); + currbest = NULL; matcher_result_value = MATCHER_AMBIGUOUS; } else { - // copy current node, set arg and prepend to bestmatch + // copy current node, set arg and prepend to currbest struct graph_node *curr = copy_node(start); curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); - list_add_node_prev (bestmatch, bestmatch->head, curr); + list_add_node_prev (currbest, currbest->head, curr); matcher_result_value = MATCHER_OK; } } @@ -217,7 +212,7 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) // cleanup list_delete (next); - return bestmatch; + return currbest; } struct list * @@ -378,6 +373,34 @@ disambiguate (struct graph_node *first, struct graph_node *second, char *token) return NULL; } +static struct list * +disambiguate_nodelist (struct list *first, struct list *second, vector vline, unsigned int n) +{ + fprintf(stderr, "%d --- %d\n", first->count, n); + + // doesn't make sense for these to be inequal length + assert(first->count == second->count); + assert(first->count == vector_active(vline) - n+1); + + struct listnode *fnode = listhead(first), + *snode = listhead(second); + struct graph_node *fgn = listgetdata(fnode), + *sgn = listgetdata(snode), + *best = NULL; + + // compare each node, if one matches better use that one + for (unsigned int i = n; i < vector_active(vline); i++) { + if ((best = disambiguate (fgn, sgn, (char*) vector_slot(vline, i)))) + return best == fgn ? first : second; + fnode = listnextnode(fnode); + fgn = (struct graph_node *) listgetdata (fnode); + snode = listnextnode(snode); + sgn = (struct graph_node *) listgetdata (snode); + } + + return NULL; +} + static struct graph_node * copy_node (struct graph_node *node) { From 0aa2c2ff01c78e6c194c16ce1d9925af918e7e4f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 5 Aug 2016 16:41:42 +0000 Subject: [PATCH 035/280] lib: Add docstring support Signed-off-by: Quentin Young --- lib/command_graph.h | 3 ++- lib/command_parse.y | 30 +++++++++++++++++++++++++++++- lib/grammar_sandbox.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/lib/command_graph.h b/lib/command_graph.h index e1feb9f77f..c987213633 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -27,7 +27,8 @@ struct graph_node vector children; // this node's children struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN - char* text; // for WORD_GN and VARIABLE_GN + char *text; // original format text + char *doc; // docstring for this node long long value; // for NUMBER_GN long long min, max; // for RANGE_GN diff --git a/lib/command_parse.y b/lib/command_parse.y index ac075e67a3..35fac1b7d5 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -15,6 +15,8 @@ struct graph_node * node_exists(struct graph_node *, struct graph_node *); struct graph_node * node_replace(struct graph_node *, struct graph_node *); +char * +doc_next(void); #define DECIMAL_STRLEN_MAX 20 @@ -55,6 +57,7 @@ struct graph_node *selnode_start, // start node for selector set *selnode_end; // end node for selector set struct cmd_element *command; // command we're parsing +char *docstring; %} %token WORD @@ -128,6 +131,7 @@ sentence_root: WORD { struct graph_node *root = new_node(WORD_GN); root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + root->doc = doc_next(); if ((currnode = node_replace(startnode, root)) != root) free (root); @@ -173,36 +177,42 @@ placeholder_token: { $$ = new_node(IPV4_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | IPV4_PREFIX { $$ = new_node(IPV4_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | IPV6 { $$ = new_node(IPV6_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | IPV6_PREFIX { $$ = new_node(IPV6_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | VARIABLE { $$ = new_node(VARIABLE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | RANGE { $$ = new_node(RANGE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); // get the numbers out yylval.string++; @@ -222,12 +232,16 @@ literal_token: { $$ = new_node(WORD_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); + $$->doc = doc_next(); free ($1); } | NUMBER { $$ = new_node(NUMBER_GN); $$->value = yylval.integer; + $$->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); + snprintf($$->text, DECIMAL_STRLEN_MAX, "%lld", $$->value); + $$->doc = doc_next(); } ; @@ -354,12 +368,17 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) // trace parser yydebug = 0; - // command string + // command element command = cmd; + // copy docstring and keep a pointer to the copy + char *doc = docstring = cmd->doc ? XSTRDUP(MTYPE_TMP, cmd->doc) : NULL; // make flex read from a string set_buffer_string(command->string); // parse command into DFA yyparse(); + // cleanup + free (doc); + doc = NULL; // startnode points to command DFA return startnode; } @@ -386,3 +405,12 @@ node_replace(struct graph_node *parent, struct graph_node *child) return existing; } + +char * +doc_next() +{ + char *piece = NULL; + if (!docstring || !(piece = strsep(&docstring, "\n"))) + return NULL; + return XSTRDUP(MTYPE_CMD_TOKENS, piece); +} diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index a2177c1767..d1779a9b6e 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -24,6 +24,33 @@ DEFUN (grammar_test, return CMD_SUCCESS; } +DEFUN (grammar_test_doc, + grammar_test_doc_cmd, + "grammar test docstring", + GRAMMAR_STR + "Test function for docstring\n" + "Command end\n") +{ + struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); + cmd->string = "test docstring (1-255) end VARIABLE [OPTION|set lol] . VARARG"; + cmd->doc = "Test stuff\n" + "docstring thing\n" + "first example\n" + "second example\n" + "follow\n" + "random range\n" + "end thingy\n" + "variable\n" + "optional variable\n" + "optional set\n" + "optional lol\n" + "vararg!\n"; + cmd->func = NULL; + cmd->tokens = vector_init(VECTOR_MIN_SIZE); + parse_command_format(nodegraph, cmd); + return CMD_SUCCESS; +} + DEFUN (grammar_test_show, grammar_test_show_cmd, "grammar tree", @@ -52,7 +79,7 @@ DEFUN (grammar_test_complete, else { fprintf(stderr, "%% Matched full input, possible completions:\n"); - char* desc = malloc(50); + char* desc = malloc(30); struct listnode *node; struct graph_node *cnode; // print possible next hops, if any @@ -60,7 +87,7 @@ DEFUN (grammar_test_complete, if (cnode->type == END_GN) fprintf(stderr, " %p\n", cnode->element->func); else - fprintf(stderr, "%s\n", describe_node(cnode, desc, 50)); + fprintf(stderr, "%-30s%s\n", describe_node(cnode, desc, 30), cnode->doc); } free(desc); } @@ -118,4 +145,5 @@ void grammar_sandbox_init() { install_element (ENABLE_NODE, &grammar_test_show_cmd); install_element (ENABLE_NODE, &grammar_test_match_cmd); install_element (ENABLE_NODE, &grammar_test_complete_cmd); + install_element (ENABLE_NODE, &grammar_test_doc_cmd); } From 51fc9379a97c9e1d1f3459fc5e69ad26356302aa Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 5 Aug 2016 20:50:42 +0000 Subject: [PATCH 036/280] lib: Major parser refactor Lots of cleanup, code consolidation, organizational improvements. Signed-off-by: Quentin Young --- lib/command_graph.c | 42 ------- lib/command_graph.h | 18 +-- lib/command_lex.l | 2 +- lib/command_parse.y | 294 +++++++++++++++++++++++++++----------------- 4 files changed, 186 insertions(+), 170 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 50be35044a..0a866de330 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -18,47 +18,6 @@ add_node(struct graph_node *parent, struct graph_node *child) return child; } -int -cmp_node(struct graph_node *first, struct graph_node *second) -{ - // compare types - if (first->type != second->type) return 0; - - switch (first->type) { - case WORD_GN: - case VARIABLE_GN: - if (first->text && second->text) { - if (strcmp(first->text, second->text)) return 0; - } - else if (first->text != second->text) return 0; - break; - case RANGE_GN: - if (first->min != second->min || first->max != second->max) - return 0; - break; - case NUMBER_GN: - if (first->value != second->value) return 0; - break; - /* selectors and options should be equal if all paths are equal, - * but the graph isomorphism problem is not solvable in polynomial - * time so we consider selectors and options inequal in all cases - */ - case SELECTOR_GN: - case OPTION_GN: - return 0; - /* end nodes are always considered equal, since each node may only - * have one at a time - */ - case START_GN: - case END_GN: - case NUL_GN: - default: - break; - } - - return 1; -} - struct graph_node * new_node(enum graph_node_type type) { @@ -149,7 +108,6 @@ describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) return buffer; } - void walk_graph(struct graph_node *start, int level) { diff --git a/lib/command_graph.h b/lib/command_graph.h index c987213633..718ce66553 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -41,30 +41,16 @@ struct graph_node unsigned int refs; }; -/* +/** * Adds a node as a child of another node. * * @param[in] parent node * @param[in] child node - * @return child node, for convenience + * @return child node */ struct graph_node * add_node(struct graph_node *, struct graph_node *); -/* - * Compares two nodes for parsing equivalence. - * Equivalence in this case means that a single user input token - * should be able to unambiguously match one of the two nodes. - * For example, two nodes which have all fields equal except their - * function pointers would be considered equal. - * - * @param[in] first node to compare - * @param[in] second node to compare - * @return 1 if equal, zero otherwise. - */ -int -cmp_node(struct graph_node *, struct graph_node *); - /* * Create a new node. * Initializes all fields to default values and sets the node type. diff --git a/lib/command_lex.l b/lib/command_lex.l index 855cf9a065..600c92d23f 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -30,7 +30,7 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) {VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} {NUMBER} { char *endptr; - yylval.integer = strtoimax(yytext, &endptr, 10); + yylval.number = strtoimax(yytext, &endptr, 10); return NUMBER; } {RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} diff --git a/lib/command_parse.y b/lib/command_parse.y index 35fac1b7d5..5a8bb69308 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -9,57 +9,43 @@ */ %{ -extern int yylex(void); -void yyerror(const char *); -struct graph_node * -node_exists(struct graph_node *, struct graph_node *); -struct graph_node * -node_replace(struct graph_node *, struct graph_node *); -char * -doc_next(void); - -#define DECIMAL_STRLEN_MAX 20 - -// compile with debugging facilities -#define YYDEBUG 1 +#define YYDEBUG 1 // compile with debugging facilities %} + +/* names for generated header and parser files */ +%defines "command_parse.h" +%output "command_parse.c" + +/* required external units */ %code requires { #include "command.h" #include "command_graph.h" #include "memory.h" -} -%code provides { + + extern int + yylex(void); + extern void set_buffer_string(const char *); - struct graph_node * - parse_command_format(struct graph_node *, struct cmd_element *); } +/* functionality this unit exports */ +%code provides { + struct graph_node * + parse_command_format(struct graph_node *, struct cmd_element *); -/* valid types for tokens */ -%union{ - long long integer; + /* maximum length of a number, lexer will not match anything longer */ + #define DECIMAL_STRLEN_MAX 20 +} + +/* valid semantic types for tokens and rules */ +%union { + long long number; char *string; struct graph_node *node; } -/* some helpful state variables */ -%{ -struct graph_node *startnode, // command root node - *currnode, // current node - *seqhead; // sequence head - - -struct graph_node *optnode_start, // start node for option set - *optnode_end; // end node for option set - -struct graph_node *selnode_start, // start node for selector set - *selnode_end; // end node for selector set - -struct cmd_element *command; // command we're parsing -char *docstring; -%} - +/* union types for lexed tokens */ %token WORD %token IPV4 %token IPV4_PREFIX @@ -67,8 +53,9 @@ char *docstring; %token IPV6_PREFIX %token VARIABLE %token RANGE -%token NUMBER +%token NUMBER +/* union types for parsed rules */ %type start %type sentence_root %type literal_token @@ -81,27 +68,73 @@ char *docstring; %type selector_token %type selector_token_seq -%defines "command_parse.h" -%output "command_parse.c" +%code { + /* bison declarations */ + void + yyerror(struct cmd_element *el, struct graph_node *sn, char const *msg); + + /* state variables for a single parser run */ + struct graph_node *currnode, // current position in DFA + *seqhead; // sequence head + + struct graph_node *optnode_start, // start node for option set + *optnode_end; // end node for option set + + struct graph_node *selnode_start, // start node for selector set + *selnode_end; // end node for selector set + + char *docstr_start, *docstr; // pointers to copy of command docstring + + /* helper functions for parser */ + static char * + doc_next(void); + + static struct graph_node * + node_exists(struct graph_node *, struct graph_node *); + + static struct graph_node * + node_replace(struct graph_node *, struct graph_node *); + + static int + cmp_node(struct graph_node *, struct graph_node *); + + static void + terminate_graph (struct graph_node *, + struct graph_node *, + struct cmd_element *); + + static void + cleanup(void); +} + +/* yyparse parameters */ +%parse-param { struct cmd_element *element } +%parse-param { struct graph_node *startnode } + +/* called automatically before yyparse */ +%initial-action { + /* clear state pointers */ + seqhead = NULL; + currnode = NULL; + selnode_start = selnode_end = NULL; + optnode_start = optnode_end = NULL; + + /* set string to parse */ + set_buffer_string(element->string); + + /* copy docstring and keep a pointer to the copy */ + docstr = element->doc ? XSTRDUP(MTYPE_TMP, element->doc) : NULL; + docstr_start = docstr; +} -/* grammar proper */ %% start: sentence_root cmd_token_seq { - // create leaf node - struct graph_node *end = new_node(END_GN); - end->element = command; - - // add node - if (node_exists(currnode, end)) - { - yyerror("Duplicate command."); - YYABORT; - } - add_node(currnode, end); - fprintf(stderr, "Parsed full command successfully.\n"); + // tack on the command element + terminate_graph (startnode, currnode, element); + cleanup(); } | sentence_root cmd_token_seq '.' placeholder_token { @@ -113,18 +146,9 @@ start: // wth normal command termination procedure node_replace(currnode, currnode); - // create leaf node - struct graph_node *end = new_node(END_GN); - end->element = command; - - // add node - if (node_exists(currnode, end)) - { - yyerror("Duplicate command."); - YYABORT; - } - add_node(currnode, end); - fprintf(stderr, "Parsed full command successfully.\n"); + // tack on the command element + terminate_graph (startnode, currnode, element); + cleanup(); } sentence_root: WORD @@ -140,7 +164,6 @@ sentence_root: WORD $$ = currnode; }; -/* valid top level tokens */ cmd_token: placeholder_token { @@ -221,7 +244,7 @@ placeholder_token: $$->max = strtoll( yylval.string, &yylval.string, 10 ); // validate range - if ($$->min >= $$->max) yyerror("Invalid range."); + if ($$->min >= $$->max) yyerror(element, startnode, "Invalid range."); free ($1); } @@ -238,7 +261,7 @@ literal_token: | NUMBER { $$ = new_node(NUMBER_GN); - $$->value = yylval.integer; + $$->value = yylval.number; $$->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); snprintf($$->text, DECIMAL_STRLEN_MAX, "%lld", $$->value); $$->doc = doc_next(); @@ -246,8 +269,7 @@ literal_token: ; /* productions */ -selector: - '<' selector_part '>' +selector: '<' selector_part '>' { // all the graph building is done in selector_element, // so just return the selector subgraph head @@ -259,8 +281,7 @@ selector_part: | selector_element '|' selector_element ; -selector_element: - selector_element_root selector_token_seq +selector_element: selector_element_root selector_token_seq { // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { // if one is null @@ -349,41 +370,63 @@ option_token: %% -void yyerror(char const *message) { - // fail on bad parse - fprintf(stderr, "Grammar error: %s\n", message); - exit(EXIT_FAILURE); -} - struct graph_node * parse_command_format(struct graph_node *start, struct cmd_element *cmd) { - fprintf(stderr, "parsing: %s\n", cmd->string); - - /* clear state pointers */ - startnode = start; - currnode = seqhead = NULL; - selnode_start = selnode_end = NULL; - optnode_start = optnode_end = NULL; - - // trace parser yydebug = 0; - // command element - command = cmd; - // copy docstring and keep a pointer to the copy - char *doc = docstring = cmd->doc ? XSTRDUP(MTYPE_TMP, cmd->doc) : NULL; - // make flex read from a string - set_buffer_string(command->string); + // parse command into DFA - yyparse(); - // cleanup - free (doc); - doc = NULL; - // startnode points to command DFA - return startnode; + yyparse(cmd, start); + + return start; } -struct graph_node * +/* parser helper functions */ + +void +yyerror(struct cmd_element *el, struct graph_node *sn, char const *msg) +{ + fprintf(stderr, "Grammar error: %s\n", msg); + exit(EXIT_FAILURE); +} + +static void +cleanup() +{ + /* free resources */ + free (docstr_start); + + /* clear state pointers */ + seqhead = NULL; + currnode = NULL; + docstr_start = docstr = NULL; + selnode_start = selnode_end = NULL; + optnode_start = optnode_end = NULL; +} + +static void +terminate_graph (struct graph_node *startnode, + struct graph_node *finalnode, + struct cmd_element *element) +{ + struct graph_node *end = new_node(END_GN); + end->element = element; + if (node_exists(finalnode, end)) + yyerror(element, startnode, "Duplicate command."); + else + add_node(finalnode, end); +} + +static char * +doc_next() +{ + char *piece = NULL; + if (!docstr || !(piece = strsep(&docstr, "\n"))) + return NULL; + return XSTRDUP(MTYPE_CMD_TOKENS, piece); +} + +static struct graph_node * node_exists(struct graph_node *parent, struct graph_node *child) { struct graph_node *p_child; @@ -396,21 +439,50 @@ node_exists(struct graph_node *parent, struct graph_node *child) return NULL; } -struct graph_node * +static struct graph_node * node_replace(struct graph_node *parent, struct graph_node *child) { struct graph_node *existing = node_exists (parent, child); - if (!existing) - existing = add_node(parent, child); - - return existing; + return existing ? existing : add_node(parent, child); } -char * -doc_next() +static int +cmp_node(struct graph_node *first, struct graph_node *second) { - char *piece = NULL; - if (!docstring || !(piece = strsep(&docstring, "\n"))) - return NULL; - return XSTRDUP(MTYPE_CMD_TOKENS, piece); + // compare types + if (first->type != second->type) return 0; + + switch (first->type) { + case WORD_GN: + case VARIABLE_GN: + if (first->text && second->text) { + if (strcmp(first->text, second->text)) return 0; + } + else if (first->text != second->text) return 0; + break; + case RANGE_GN: + if (first->min != second->min || first->max != second->max) + return 0; + break; + case NUMBER_GN: + if (first->value != second->value) return 0; + break; + /* selectors and options should be equal if all paths are equal, + * but the graph isomorphism problem is not solvable in polynomial + * time so we consider selectors and options inequal in all cases; + * ultimately this forks the graph + */ + case SELECTOR_GN: + case OPTION_GN: + return 0; + /* end nodes are always considered equal, since each node may only + * have one at a time + */ + case START_GN: + case END_GN: + case NUL_GN: + default: + break; + } + return 1; } From 1ab84bf32f891c9aa62e1d2a42501a0df7d6aec0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 8 Aug 2016 21:11:14 +0000 Subject: [PATCH 037/280] lib: Code cleanup, formatting, & headers Gnu-style code, add copyright headers, cleanup some random style issues, shuffle around code into relevant units, add docs. Signed-off-by: Quentin Young --- lib/command_graph.c | 147 ++++--------- lib/command_graph.h | 134 ++++++------ lib/command_lex.l | 24 +++ lib/command_match.c | 473 ++++++++++++++++++++++++------------------ lib/command_match.h | 87 ++++---- lib/command_parse.y | 173 ++++++++------- lib/grammar_sandbox.c | 287 +++++++++++++++++-------- 7 files changed, 754 insertions(+), 571 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index 0a866de330..f249935771 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -1,46 +1,52 @@ /* - * Command DFA module. - * Provides a DFA data structure and associated functions for manipulating it. - * Used to match user command line input. + * Graph data structure and companion routines for CLI backend. * - * @author Quentin Young + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ - -#include "command_graph.h" #include +#include "command_graph.h" #include "memory.h" struct graph_node * -add_node(struct graph_node *parent, struct graph_node *child) +add_node (struct graph_node *parent, struct graph_node *child) { - vector_set(parent->children, child); + vector_set (parent->children, child); child->refs++; return child; } struct graph_node * -new_node(enum graph_node_type type) +new_node (enum graph_node_type type) { struct graph_node *node = - XMALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); + XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); node->type = type; node->children = vector_init(VECTOR_MIN_SIZE); - node->end = NULL; - node->text = NULL; - node->element = NULL; - node->arg = NULL; - node->is_start = 0; - node->value = 0; - node->min = 0; - node->max = 0; - node->refs = 0; return node; } void -free_node (struct graph_node *node) +delete_node (struct graph_node *node) { if (!node) return; if (node->children) vector_free (node->children); @@ -51,100 +57,17 @@ free_node (struct graph_node *node) } void -free_graph (struct graph_node *start) +delete_graph (struct graph_node *start) { - if (start && start->children && vector_active(start->children) > 0) { - for (unsigned int i = 0; i < vector_active(start->children); i++) { - free_graph (vector_slot(start->children, i)); - vector_unset(start->children, i); + if (start && start->children && vector_active (start->children) > 0) + { + for (unsigned int i = 0; i < vector_active (start->children); i++) + { + delete_graph (vector_slot(start->children, i)); + vector_unset (start->children, i); + } } - } if (--(start->refs) == 0) - free_node (start); -} - -char * -describe_node(struct graph_node *node, char* buffer, unsigned int bufsize) -{ - if (node == NULL) { - snprintf(buffer, bufsize, "(null node)"); - return buffer; - } - - // print this node - switch (node->type) { - case WORD_GN: - case IPV4_GN: - case IPV4_PREFIX_GN: - case IPV6_GN: - case IPV6_PREFIX_GN: - case VARIABLE_GN: - case RANGE_GN: - snprintf(buffer, bufsize, node->text); - break; - case NUMBER_GN: - snprintf(buffer, bufsize, "%lld", node->value); - break; - case SELECTOR_GN: - snprintf(buffer, bufsize, "<>"); - break; - case OPTION_GN: - snprintf(buffer, bufsize, "[]"); - break; - case NUL_GN: - snprintf(buffer, bufsize, "NUL"); - break; - case END_GN: - snprintf(buffer, bufsize, "END"); - break; - case START_GN: - snprintf(buffer, bufsize, "START"); - break; - default: - snprintf(buffer, bufsize, "ERROR"); - } - - return buffer; -} - -void -walk_graph(struct graph_node *start, int level) -{ - char* desc = malloc(50); - // print this node - fprintf(stderr, "%s[%d] ", describe_node(start, desc, 50), vector_active(start->children)); - free(desc); - - if (vector_active(start->children)) { - if (vector_active(start->children) == 1) - walk_graph(vector_slot(start->children, 0), level); - else { - fprintf(stderr, "\n"); - for (unsigned int i = 0; i < vector_active(start->children); i++) { - struct graph_node *r = vector_slot(start->children, i); - for (int j = 0; j < level+1; j++) - fprintf(stderr, " "); - walk_graph(r, level+1); - } - } - } - else - fprintf(stderr, "\n"); -} - -void -dump_node (struct graph_node *node) -{ - char buf[50]; - describe_node(node, buf, 50); - fprintf(stderr, "%s[%d]\n", buf, node->type); - fprintf(stderr, "\t->text: %s\n", node->text); - fprintf(stderr, "\t->value: %lld\n", node->value); - fprintf(stderr, "\t->is_start: %d\n", node->is_start); - fprintf(stderr, "\t->element: %p\n", node->element); - fprintf(stderr, "\t->min: %lld\n->max: %lld\n", node->min, node->max); - fprintf(stderr, "\t->arg: %s\n", node->arg); - fprintf(stderr, "\t->refs: %d\n", node->refs); - fprintf(stderr, "\tnum children: %d\n", vector_active(node->children)); + delete_node (start); } diff --git a/lib/command_graph.h b/lib/command_graph.h index 718ce66553..48c3d9cd0a 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -1,39 +1,74 @@ -#ifndef COMMAND_GRAPH_H -#define COMMAND_GRAPH_H +/* + * Graph data structure and companion routines for CLI backend. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _ZEBRA_COMMAND_GRAPH_H +#define _ZEBRA_COMMAND_GRAPH_H #include "command.h" +/** + * Types for graph nodes. + * + * The node type determines what kind of data the node can match (in the + * matching use case) or hold (in the argv use case). + */ enum graph_node_type { - IPV4_GN, - IPV4_PREFIX_GN, - IPV6_GN, - IPV6_PREFIX_GN, - WORD_GN, - RANGE_GN, - NUMBER_GN, - VARIABLE_GN, - SELECTOR_GN, - OPTION_GN, - NUL_GN, - START_GN, - END_GN + IPV4_GN, // IPV4 addresses + IPV4_PREFIX_GN, // IPV4 network prefixes + IPV6_GN, // IPV6 prefixes + IPV6_PREFIX_GN, // IPV6 network prefixes + WORD_GN, // words + RANGE_GN, // integer ranges + NUMBER_GN, // numbers + VARIABLE_GN, // almost anything + /* plumbing types */ + SELECTOR_GN, // marks beginning of selector subgraph + OPTION_GN, // marks beginning of option subgraph + NUL_GN, // transparent node with various uses + START_GN, // first node in the graph (has no parents) + END_GN // leaf node in the graph, has pointer to cmd_element }; +/** + * Command graph node. + * Used for matching and passing arguments to vtysh commands. + */ struct graph_node { - enum graph_node_type type;// data type this node matches or holds - unsigned int is_start; // whether this node is a start node - vector children; // this node's children - struct graph_node * end; // pointer to end for SELECTOR_GN & OPTION_GN + enum graph_node_type type; // data type this node matches or holds + vector children; // this node's children + struct graph_node *end; // pointer to end for SELECTOR_GN & OPTION_GN - char *text; // original format text - char *doc; // docstring for this node - long long value; // for NUMBER_GN - long long min, max; // for RANGE_GN + char *text; // original format text + char *doc; // docstring for this node + long long value; // for NUMBER_GN + long long min, max; // for RANGE_GN /* cmd_element struct pointer, only valid for END_GN */ struct cmd_element *element; + /* used for passing arguments to command functions */ char *arg; @@ -49,52 +84,33 @@ struct graph_node * @return child node */ struct graph_node * -add_node(struct graph_node *, struct graph_node *); +add_node (struct graph_node *parent, struct graph_node *child); -/* - * Create a new node. - * Initializes all fields to default values and sets the node type. +/** + * Creates a new node, initializes all fields to default values and sets the + * node type. * - * @param[in] node type - * @return pointer to the newly allocated node + * @param[in] type node type + * @return pointer to the created node */ struct graph_node * -new_node(enum graph_node_type); +new_node (enum graph_node_type type); /** - * Frees the data associated with a graph_node. - * @param[out] pointer to graph_node to free - */ -void -free_node(struct graph_node *); - -/** - * Recursively calls free_node on a graph node - * and all its children. - * @param[out] graph to free - */ -void -free_graph(struct graph_node *); - -/** - * Walks a command DFA, printing structure to stdout. - * For debugging. + * Deletes a graph node without deleting its children. * - * @param[in] start node of graph to walk - * @param[in] graph depth for recursion, caller passes 0 + * @param[out] node pointer to node to delete */ void -walk_graph(struct graph_node *, int); +delete_node (struct graph_node *node); /** - * Returns a string representation of the given node. - * @param[in] the node to describe - * @param[out] the buffer to write the description into - * @return pointer to description string + * Deletes a graph node and recursively deletes all its direct and indirect + * children. + * + * @param[out] node start node of graph to free */ -char * -describe_node(struct graph_node *, char *, unsigned int); - void -dump_node (struct graph_node *); -#endif +delete_graph (struct graph_node *node); + +#endif /* _ZEBRA_COMMAND_GRAPH_H */ diff --git a/lib/command_lex.l b/lib/command_lex.l index 600c92d23f..920c03db8e 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -1,3 +1,27 @@ +/* + * Command format string lexer for CLI backend. + * + * -- + * Copyright (C) 2015 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + %{ #include "command_parse.h" diff --git a/lib/command_match.c b/lib/command_match.c index e4b95d5970..011ac698cb 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -1,11 +1,35 @@ +/* + * Input matching routines for CLI backend. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include #include "command_match.h" #include "command_parse.h" -#include #include "memory.h" /* matcher helper prototypes */ static int -add_nexthops(struct list *, struct graph_node *); +add_nexthops (struct list *, struct graph_node *); static struct list * match_command_r (struct graph_node *, vector, unsigned int); @@ -14,7 +38,7 @@ static int score_precedence (enum graph_node_type); static enum match_type -min_match_level(enum node_type); +min_match_level (enum node_type); static struct graph_node * copy_node (struct graph_node *); @@ -23,10 +47,10 @@ static void delete_nodelist (void *); static struct graph_node * -disambiguate (struct graph_node *, struct graph_node *, char *); +disambiguate_nodes (struct graph_node *, struct graph_node *, char *); static struct list * -disambiguate_nodelist (struct list *, struct list *, vector, unsigned int); +disambiguate (struct list *, struct list *, vector, unsigned int); /* token matcher prototypes */ static enum match_type @@ -54,40 +78,33 @@ static enum match_type match_number (struct graph_node *, const char *); static enum match_type -match_variable (struct graph_node *, const char *); +match_variable (struct graph_node *node, const char *word); /* matching functions */ -static enum matcher_rv matcher_result_value; +static enum matcher_rv matcher_rv; enum matcher_rv match_command (struct graph_node *start, - const char *line, - struct list **argvv, + vector vline, + struct list **argv, struct cmd_element **el) { - matcher_result_value = MATCHER_NO_MATCH; - // parse command - vector vline = cmd_make_strvec (line); + matcher_rv = MATCHER_NO_MATCH; - for (unsigned int i = 0; i < vector_active(start->children); i++) - { - // call recursive matcher on each starting child - *argvv = match_command_r(vector_slot(start->children, i), vline, 0); - if (*argvv) break; - } + // call recursive matcher on each starting child + for (unsigned int i = 0; i < vector_active (start->children); i++) + { + *argv = match_command_r (vector_slot (start->children, i), vline, 0); + if (*argv) // successful match + { + struct graph_node *end = listgetdata (listtail (*argv)); + *el = end->element; + assert (*el); + break; + } + } - if (*argvv) { - struct listnode *ln; - struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(*argvv,ln,gn)) - if (gn->type == END_GN) { - *el = gn->element; - break; - } - assert(*el); - } - - return matcher_result_value; + return matcher_rv; } /** @@ -134,80 +151,83 @@ match_command (struct graph_node *start, * the best match for the command, each with their `arg` fields pointing to the * matching token string. * - * @param[out] start the start node. + * @param[in] start the start node. * @param[in] vline the vectorized input line. - * @param[in] n the index of the first input token. Should be 0 for external - * callers. + * @param[in] n the index of the first input token. */ static struct list * match_command_r (struct graph_node *start, vector vline, unsigned int n) { // get the minimum match level that can count as a full match - enum match_type minmatch = min_match_level(start->type); + enum match_type minmatch = min_match_level (start->type); // get the current operating token - char *token = vector_slot(vline, n); + char *token = vector_slot (vline, n); // if we don't match this node, die - if (match_token(start, token) < minmatch) + if (match_token (start, token) < minmatch) return NULL; // pointers for iterating linklist + struct listnode *ln; struct graph_node *gn; - struct listnode *ln; // get all possible nexthops struct list *next = list_new(); - add_nexthops(next, start); + add_nexthops (next, start); // determine the best match int ambiguous = 0; struct list *currbest = NULL; - for (ALL_LIST_ELEMENTS_RO(next,ln,gn)) - { - // if we've matched all input we're looking for END_GN - if (n+1 == vector_active (vline)) { - if (gn->type == END_GN) { - currbest = list_new(); - listnode_add(currbest, copy_node(gn)); - currbest->del = &delete_nodelist; - break; - } - else continue; + for (ALL_LIST_ELEMENTS_RO (next,ln,gn)) + { + // if we've matched all input we're looking for END_GN + if (n+1 == vector_active (vline)) + { + if (gn->type == END_GN) + { + currbest = list_new(); + listnode_add (currbest, copy_node(gn)); + currbest->del = &delete_nodelist; + break; + } + else continue; + } + + // else recurse on candidate child node + struct list *result = match_command_r (gn, vline, n+1); + + // save the best match + if (result && currbest) + { + struct list *newbest = disambiguate (currbest, result, vline, n+1); + ambiguous = !newbest || (ambiguous && newbest == currbest); + list_delete ((newbest && newbest == result) ? currbest : result); + currbest = newbest ? newbest : currbest; + } + else if (result) + currbest = result; } - // else recurse on candidate child node - struct list *result = match_command_r (gn, vline, n+1); - - // save the best match, subtle logic at play here - if (result && currbest) { - struct list *newbest = disambiguate_nodelist(currbest, result, vline, n+1); - ambiguous = !newbest || (ambiguous && newbest == currbest); - list_delete ((newbest && newbest == result) ? currbest : result); - currbest = newbest ? newbest : currbest; + if (currbest) + { + if (ambiguous) + { + list_delete (currbest); + currbest = NULL; + matcher_rv = MATCHER_AMBIGUOUS; + } + else + { + // copy current node, set arg and prepend to currbest + struct graph_node *curr = copy_node (start); + curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); + list_add_node_prev (currbest, currbest->head, curr); + matcher_rv = MATCHER_OK; + } } - else if (result) - currbest = result; - } - - if (currbest) { - if (ambiguous) { - list_delete(currbest); - currbest = NULL; - matcher_result_value = MATCHER_AMBIGUOUS; - } - else { - // copy current node, set arg and prepend to currbest - struct graph_node *curr = copy_node(start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); - list_add_node_prev (currbest, currbest->head, curr); - matcher_result_value = MATCHER_OK; - } - } - else { - if (n+1 == vector_active(vline) && matcher_result_value == MATCHER_NO_MATCH) - matcher_result_value = MATCHER_INCOMPLETE; - } + else if (n+1 == vector_active (vline) && matcher_rv == MATCHER_NO_MATCH) + matcher_rv = MATCHER_INCOMPLETE; // cleanup list_delete (next); @@ -215,12 +235,9 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) return currbest; } -struct list * -match_command_complete (struct graph_node *start, const char *line) +enum matcher_rv +match_command_complete (struct graph_node *start, vector vline, struct list **completions) { - // vectorize command line - vector vline = cmd_make_strvec (line); - // pointer to next input token to match char *token; @@ -232,33 +249,35 @@ match_command_complete (struct graph_node *start, const char *line) struct listnode *node; // add all children of start node to list - add_nexthops(next, start); + add_nexthops (next, start); unsigned int idx; - for (idx = 0; idx < vector_active(vline) && next->count > 0; idx++) - { - list_free (current); - current = next; - next = list_new(); - - token = vector_slot(vline, idx); - - for (ALL_LIST_ELEMENTS_RO(current,node,gn)) + for (idx = 0; idx < vector_active (vline) && next->count > 0; idx++) { - switch (match_token(gn, token)) { - case partly_match: - if (idx == vector_active(vline) - 1) { - listnode_add(next, gn); - break; - } - case exact_match: - add_nexthops(next, gn); - break; - default: - break; - } + list_free (current); + current = next; + next = list_new(); + + token = vector_slot (vline, idx); + + for (ALL_LIST_ELEMENTS_RO (current,node,gn)) + { + switch (match_token (gn, token)) + { + case partly_match: + if (idx == vector_active (vline) - 1) + { + listnode_add (next, gn); + break; + } + case exact_match: + add_nexthops (next, gn); + break; + default: + break; + } + } } - } /* Variable summary * ----------------------------------------------------------------- @@ -268,101 +287,122 @@ match_command_complete (struct graph_node *start, const char *line) * next = set of all nodes reachable from all nodes in `matched` */ - matcher_result_value = + matcher_rv = idx + 1 == vector_active(vline) && next->count ? MATCHER_OK : MATCHER_NO_MATCH; list_free (current); - cmd_free_strvec(vline); + *completions = next; - return next; + return matcher_rv; } /** - * Adds all children that are reachable by one parser hop - * to the given list. NUL_GN, SELECTOR_GN, and OPTION_GN - * nodes are treated as transparent. + * Adds all children that are reachable by one parser hop to the given list. + * NUL_GN, SELECTOR_GN, and OPTION_GN nodes are treated as transparent. * - * @param[out] l the list to add the children to - * @param[in] node the node to get the children of + * @param[in] list to add the nexthops to + * @param[in] node to start calculating nexthops from * @return the number of children added to the list */ static int -add_nexthops(struct list *l, struct graph_node *node) +add_nexthops (struct list *list, struct graph_node *node) { int added = 0; struct graph_node *child; - for (unsigned int i = 0; i < vector_active(node->children); i++) - { - child = vector_slot(node->children, i); - switch (child->type) { - case OPTION_GN: - case SELECTOR_GN: - case NUL_GN: - added += add_nexthops(l, child); - break; - default: - listnode_add(l, child); - added++; + for (unsigned int i = 0; i < vector_active (node->children); i++) + { + child = vector_slot (node->children, i); + switch (child->type) + { + case OPTION_GN: + case SELECTOR_GN: + case NUL_GN: + added += add_nexthops (list, child); + break; + default: + listnode_add (list, child); + added++; + } } - } + return added; } /** * Determines the node types for which a partial match may count as a full * match. Enables command abbrevations. + * + * @param[in] type node type + * @return minimum match level needed to for a token to fully match */ static enum match_type -min_match_level(enum node_type type) +min_match_level (enum node_type type) { - switch (type) { - case WORD_GN: - return partly_match; - default: - return exact_match; - } + switch (type) + { + // allowing words to partly match enables command abbreviation + case WORD_GN: + return partly_match; + default: + return exact_match; + } } -/* Precedence score used to disambiguate matches. */ +/** + * Assigns precedence scores to node types. + * + * @param[in] type node type to score + * @return precedence score + */ static int score_precedence (enum graph_node_type type) { switch (type) - { - // some of these are mutually exclusive, so they share - // the same precedence value - case IPV4_GN: - case IPV4_PREFIX_GN: - case IPV6_GN: - case IPV6_PREFIX_GN: - case NUMBER_GN: - return 1; - case RANGE_GN: - return 2; - case WORD_GN: - return 3; - case VARIABLE_GN: - return 4; - default: - return 10; - } + { + // some of these are mutually exclusive, so they share + // the same precedence value + case IPV4_GN: + case IPV4_PREFIX_GN: + case IPV6_GN: + case IPV6_PREFIX_GN: + case NUMBER_GN: + return 1; + case RANGE_GN: + return 2; + case WORD_GN: + return 3; + case VARIABLE_GN: + return 4; + default: + return 10; + } } -/* Disambiguation logic to pick the best of two possible matches */ +/** + * Picks the better of two possible matches for a token. + * + * @param[in] first candidate node matching token + * @param[in] second candidate node matching token + * @param[in] token the token being matched + * @return the best-matching node, or NULL if the two are entirely ambiguous + */ static struct graph_node * -disambiguate (struct graph_node *first, struct graph_node *second, char *token) +disambiguate_nodes (struct graph_node *first, + struct graph_node *second, + char *token) { // if the types are different, simply go off of type precedence - if (first->type != second->type) { - int firstprec = score_precedence(first->type); - int secndprec = score_precedence(second->type); - if (firstprec != secndprec) - return firstprec < secndprec ? first : second; - else - return NULL; - } + if (first->type != second->type) + { + int firstprec = score_precedence (first->type); + int secndprec = score_precedence (second->type); + if (firstprec != secndprec) + return firstprec < secndprec ? first : second; + else + return NULL; + } // if they're the same, return the more exact match enum match_type fmtype = match_token (first, token); @@ -373,40 +413,60 @@ disambiguate (struct graph_node *first, struct graph_node *second, char *token) return NULL; } +/** + * Picks the better of two possible matches for an input line. + * + * @param[in] first candidate list of graph_node matching vline + * @param[in] second candidate list of graph_node matching vline + * @param[in] vline the input line being matched + * @param[in] n index into vline to start comparing at + * @return the best-matching list, or NULL if the two are entirely ambiguous + */ static struct list * -disambiguate_nodelist (struct list *first, struct list *second, vector vline, unsigned int n) +disambiguate (struct list *first, + struct list *second, + vector vline, + unsigned int n) { - fprintf(stderr, "%d --- %d\n", first->count, n); - // doesn't make sense for these to be inequal length - assert(first->count == second->count); - assert(first->count == vector_active(vline) - n+1); + assert (first->count == second->count); + assert (first->count == vector_active (vline) - n+1); - struct listnode *fnode = listhead(first), - *snode = listhead(second); - struct graph_node *fgn = listgetdata(fnode), - *sgn = listgetdata(snode), + struct listnode *fnode = listhead (first), + *snode = listhead (second); + struct graph_node *fgn = listgetdata (fnode), + *sgn = listgetdata (snode), *best = NULL; // compare each node, if one matches better use that one - for (unsigned int i = n; i < vector_active(vline); i++) { - if ((best = disambiguate (fgn, sgn, (char*) vector_slot(vline, i)))) - return best == fgn ? first : second; - fnode = listnextnode(fnode); - fgn = (struct graph_node *) listgetdata (fnode); - snode = listnextnode(snode); - sgn = (struct graph_node *) listgetdata (snode); - } + for (unsigned int i = n; i < vector_active (vline); i++) + { + char *token = vector_slot(vline, i); + if ((best = disambiguate_nodes (fgn, sgn, token))) + return best == fgn ? first : second; + fnode = listnextnode (fnode); + snode = listnextnode (snode); + fgn = (struct graph_node *) listgetdata (fnode); + sgn = (struct graph_node *) listgetdata (snode); + } return NULL; } +/** + * Performs a deep copy on a node. + * Used to build argv node lists that can be safely deleted or modified by + * endpoint functions. Everything is copied except the children vector, + * subgraph end pointer and reference count. + * + * @param[in] node to copy + * @return the copy + */ static struct graph_node * copy_node (struct graph_node *node) { struct graph_node *new = new_node(node->type); new->children = NULL; - new->is_start = node->is_start; new->end = NULL; new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; new->value = node->value; @@ -418,11 +478,13 @@ copy_node (struct graph_node *node) return new; } -/* Linked list data deletion callback */ +/** + * List deletion callback for argv lists. + */ static void delete_nodelist (void *node) { - free_node ((struct graph_node *) node); + delete_node ((struct graph_node *) node); } @@ -632,7 +694,7 @@ match_ipv6_prefix (const char *str) return no_match; /* tokenize to address + mask */ - dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); + dupe = XCALLOC(MTYPE_TMP, strlen(str)+1); strncpy(dupe, str, strlen(str)+1); prefix = strtok_r(dupe, delim, &context); mask = strtok_r(NULL, delim, &context); @@ -656,8 +718,10 @@ match_ipv6_prefix (const char *str) #endif static enum match_type -match_range (struct graph_node *rangenode, const char *str) +match_range (struct graph_node *node, const char *str) { + assert (node->type == RANGE_GN); + char *endptr = NULL; long long val; @@ -668,45 +732,54 @@ match_range (struct graph_node *rangenode, const char *str) if (*endptr != '\0') return 0; - if (val < rangenode->min || val > rangenode->max) + if (val < node->min || val > node->max) return no_match; else return exact_match; } static enum match_type -match_word(struct graph_node *wordnode, const char *word) +match_word (struct graph_node *node, const char *word) { + assert (node->type == WORD_GN); + // if the passed token is null or 0 length, partly match if (!word || !strlen(word)) return partly_match; // if the passed token is strictly a prefix of the full word, partly match - if (strlen(word) < strlen(wordnode->text)) - return !strncmp(wordnode->text, word, strlen(word)) ? partly_match : no_match; + if (strlen (word) < strlen (node->text)) + return !strncmp (node->text, word, strlen (word)) ? + partly_match : + no_match; // if they are the same length and exactly equal, exact match - else if (strlen(word) == strlen(wordnode->text)) - return !strncmp(wordnode->text, word, strlen(word)) ? exact_match : no_match; + else if (strlen (word) == strlen (node->text)) + return !strncmp (node->text, word, strlen (word)) ? exact_match : no_match; return no_match; } static enum match_type -match_number(struct graph_node *numnode, const char *word) +match_number (struct graph_node *node, const char *word) { - if (!strcmp("\0", word)) return no_match; + assert (node->type == NUMBER_GN); + + if (!strcmp ("\0", word)) return no_match; char *endptr; long long num = strtoll (word, &endptr, 10); if (endptr != '\0') return no_match; - return num == numnode->value ? exact_match : no_match; + return num == node->value ? exact_match : no_match; } -#define VARIABLE_ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" +#define VARIABLE_ALPHABET \ +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" static enum match_type -match_variable(struct graph_node *varnode, const char *word) +match_variable (struct graph_node *node, const char *word) { - return strlen(word) == strspn(word, VARIABLE_ALPHABET) ? + assert (node->type == VARIABLE_GN); + + return strlen (word) == strspn(word, VARIABLE_ALPHABET) ? exact_match : no_match; } diff --git a/lib/command_match.h b/lib/command_match.h index 895a678dce..6804a0777a 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -1,21 +1,45 @@ -#ifndef COMMAND_MATCH_H -#define COMMAND_MATCH_H +/* + * Input matching routines for CLI backend. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _ZEBRA_COMMAND_MATCH_H +#define _ZEBRA_COMMAND_MATCH_H #include "command.h" #include "command_graph.h" #include "linklist.h" -/** These definitions exist in command.c in - * the current engine but will be relocated - * here in the new engine*/ +/* These definitions exist in command.c in the current engine but should be + * relocated here in the new engine + */ enum filter_type { FILTER_RELAXED, FILTER_STRICT }; -/* matcher result value. */ +/* matcher result value */ enum matcher_rv { MATCHER_NO_MATCH, @@ -24,7 +48,7 @@ enum matcher_rv MATCHER_OK, }; -/* Completion match types. */ +/* completion match types */ enum match_type { no_match, @@ -32,9 +56,8 @@ enum match_type exact_match }; -/* Defines which matcher_rv values constitute - * an error. Should be used against matcher_rv - * return values to do basic error checking. +/* Defines which matcher_rv values constitute an error. Should be used with + * matcher_rv return values to do basic error checking. */ #define MATCHER_ERROR(matcher_rv) \ ( (matcher_rv) == MATCHER_INCOMPLETE \ @@ -45,37 +68,29 @@ enum match_type /** * Attempt to find an exact command match for a line of user input. * - * @param DFA to match against - * @param input string - * @param pointer which will be pointed at argv upon match - * @param pointer which will be pointed at matching cmd_element upon match - * @return result of matcher run + * @param[in] start start node of command graph to match against + * @param[in] vline vectorized input string + * @param[out] argv pointer to argument list if successful match + * @param[out] element pointer to matched cmd_element if successful match + * @return matcher status */ enum matcher_rv -match_command (struct graph_node *, const char *, struct list **, struct cmd_element **); +match_command (struct graph_node *start, + vector vline, + struct list **argv, + struct cmd_element **element); /** - * Compiles next-hops for a given line of user input. - * - * Given a string of input and a start node for a matching DFA, runs the input - * against the DFA until the input is exhausted or a mismatch is encountered. - * - * This function returns all valid next hops away from the current node. - * - If the input is a valid prefix to a longer command(s), the set of next - * hops determines what tokens are valid to follow the prefix. In other words, - * the returned list is a list of possible completions. - * - If the input matched a full command, exactly one of the next hops will be - * a node of type END_GN and its function pointer will be set. - * - If the input did not match any valid token sequence, the returned list - * will be empty (there are no transitions away from a nonexistent state). + * Compiles possible completions for a given line of user input. * * @param[in] start the start node of the DFA to match against - * @param[in] filter the filtering method - * @param[in] input the input string - * @return pointer to linked list with all possible next hops from the last - * matched token. If this is empty, the input did not match any command. + * @param[in] vline vectorized input string + * @param[in] completions pointer to possible completions + * @return matcher status */ -struct list * -match_command_complete (struct graph_node *, const char *); +enum matcher_rv +match_command_complete (struct graph_node *start, + vector vline, + struct list **completions); -#endif +#endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index 5a8bb69308..6b972afe90 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -1,15 +1,30 @@ /* - * Command format string parser. + * Command format string parser for CLI backend. * - * Turns a command definition into a DFA that together with the functions - * provided in command_match.c may be used to map command line input to a - * function. + * -- + * Copyright (C) 2015 Cumulus Networks, Inc. * - * @author Quentin Young + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ %{ -#define YYDEBUG 1 // compile with debugging facilities +// compile with debugging facilities +#define YYDEBUG 1 %} /* names for generated header and parser files */ @@ -23,16 +38,16 @@ #include "memory.h" extern int - yylex(void); + yylex (void); extern void - set_buffer_string(const char *); + set_buffer_string (const char *); } /* functionality this unit exports */ %code provides { struct graph_node * - parse_command_format(struct graph_node *, struct cmd_element *); + parse_command_format (struct graph_node *, struct cmd_element *); /* maximum length of a number, lexer will not match anything longer */ #define DECIMAL_STRLEN_MAX 20 @@ -71,7 +86,7 @@ %code { /* bison declarations */ void - yyerror(struct cmd_element *el, struct graph_node *sn, char const *msg); + yyerror (struct cmd_element *el, struct graph_node *sn, char const *msg); /* state variables for a single parser run */ struct graph_node *currnode, // current position in DFA @@ -90,13 +105,13 @@ doc_next(void); static struct graph_node * - node_exists(struct graph_node *, struct graph_node *); + node_exists (struct graph_node *, struct graph_node *); static struct graph_node * - node_replace(struct graph_node *, struct graph_node *); + node_replace (struct graph_node *, struct graph_node *); static int - cmp_node(struct graph_node *, struct graph_node *); + cmp_node (struct graph_node *, struct graph_node *); static void terminate_graph (struct graph_node *, @@ -104,7 +119,7 @@ struct cmd_element *); static void - cleanup(void); + cleanup (void); } /* yyparse parameters */ @@ -120,7 +135,7 @@ optnode_start = optnode_end = NULL; /* set string to parse */ - set_buffer_string(element->string); + set_buffer_string (element->string); /* copy docstring and keep a pointer to the copy */ docstr = element->doc ? XSTRDUP(MTYPE_TMP, element->doc) : NULL; @@ -138,13 +153,12 @@ start: } | sentence_root cmd_token_seq '.' placeholder_token { - if ((currnode = node_replace(currnode, $4)) != $4) - free_node ($4); + if ((currnode = node_replace (currnode, $4)) != $4) + delete_node ($4); - // since varargs may match any number of the last token, - // simply add this node as a child of itself and proceed - // wth normal command termination procedure - node_replace(currnode, currnode); + // adding a node as a child of itself accepts any number + // of the same token, which is what we want for varags + node_replace (currnode, currnode); // tack on the command element terminate_graph (startnode, currnode, element); @@ -153,11 +167,11 @@ start: sentence_root: WORD { - struct graph_node *root = new_node(WORD_GN); + struct graph_node *root = new_node (WORD_GN); root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); root->doc = doc_next(); - if ((currnode = node_replace(startnode, root)) != root) + if ((currnode = node_replace (startnode, root)) != root) free (root); free ($1); @@ -167,24 +181,24 @@ sentence_root: WORD cmd_token: placeholder_token { - if ((currnode = node_replace(currnode, $1)) != $1) - free_node ($1); + if ((currnode = node_replace (currnode, $1)) != $1) + delete_node ($1); } | literal_token { - if ((currnode = node_replace(currnode, $1)) != $1) - free_node ($1); + if ((currnode = node_replace (currnode, $1)) != $1) + delete_node ($1); } /* selectors and options are subgraphs with start and end nodes */ | selector { - add_node(currnode, $1); + add_node (currnode, $1); currnode = selnode_end; selnode_start = selnode_end = NULL; } | option { - add_node(currnode, $1); + add_node (currnode, $1); currnode = optnode_end; optnode_start = optnode_end = NULL; } @@ -198,53 +212,53 @@ cmd_token_seq: placeholder_token: IPV4 { - $$ = new_node(IPV4_GN); + $$ = new_node (IPV4_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV4_PREFIX { - $$ = new_node(IPV4_PREFIX_GN); + $$ = new_node (IPV4_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV6 { - $$ = new_node(IPV6_GN); + $$ = new_node (IPV6_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV6_PREFIX { - $$ = new_node(IPV6_PREFIX_GN); + $$ = new_node (IPV6_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | VARIABLE { - $$ = new_node(VARIABLE_GN); + $$ = new_node (VARIABLE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | RANGE { - $$ = new_node(RANGE_GN); + $$ = new_node (RANGE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); // get the numbers out yylval.string++; - $$->min = strtoll( yylval.string, &yylval.string, 10 ); + $$->min = strtoll (yylval.string, &yylval.string, 10); strsep (&yylval.string, "-"); - $$->max = strtoll( yylval.string, &yylval.string, 10 ); + $$->max = strtoll (yylval.string, &yylval.string, 10); // validate range - if ($$->min >= $$->max) yyerror(element, startnode, "Invalid range."); + if ($$->min >= $$->max) yyerror (element, startnode, "Invalid range."); free ($1); } @@ -253,14 +267,14 @@ placeholder_token: literal_token: WORD { - $$ = new_node(WORD_GN); + $$ = new_node (WORD_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | NUMBER { - $$ = new_node(NUMBER_GN); + $$ = new_node (NUMBER_GN); $$->value = yylval.number; $$->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); snprintf($$->text, DECIMAL_STRLEN_MAX, "%lld", $$->value); @@ -286,26 +300,26 @@ selector_element: selector_element_root selector_token_seq // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { // if one is null assert(!selnode_start && !selnode_end); // both should be null - selnode_start = new_node(SELECTOR_GN); // diverging node - selnode_end = new_node(NUL_GN); // converging node + selnode_start = new_node (SELECTOR_GN); // diverging node + selnode_end = new_node (NUL_GN); // converging node selnode_start->end = selnode_end; // duh } // add element head as a child of the selector - add_node(selnode_start, $1); + add_node (selnode_start, $1); if ($2->type != NUL_GN) { - add_node($1, seqhead); - add_node($2, selnode_end); + add_node ($1, seqhead); + add_node ($2, selnode_end); } else - add_node($1, selnode_end); + add_node ($1, selnode_end); seqhead = NULL; } selector_token_seq: - %empty { $$ = new_node(NUL_GN); } + %empty { $$ = new_node (NUL_GN); } | selector_token_seq selector_token { // if the sequence component is NUL_GN, this is a sequence start @@ -314,7 +328,7 @@ selector_token_seq: seqhead = $2; } else // chain on new node - add_node($1, $2); + add_node ($1, $2); $$ = $2; } @@ -334,7 +348,7 @@ selector_token: option: '[' option_part ']' { // add null path - add_node(optnode_start, optnode_end); + add_node (optnode_start, optnode_end); $$ = optnode_start; }; @@ -348,19 +362,19 @@ option_element: { if (!optnode_start || !optnode_end) { assert(!optnode_start && !optnode_end); - optnode_start = new_node(OPTION_GN); - optnode_end = new_node(NUL_GN); + optnode_start = new_node (OPTION_GN); + optnode_end = new_node (NUL_GN); } - add_node(optnode_start, seqhead); - add_node($1, optnode_end); + add_node (optnode_start, seqhead); + add_node ($1, optnode_end); } option_token_seq: option_token { $$ = seqhead = $1; } | option_token_seq option_token -{ $$ = add_node($1, $2); } +{ $$ = add_node ($1, $2); } ; option_token: @@ -373,6 +387,7 @@ option_token: struct graph_node * parse_command_format(struct graph_node *start, struct cmd_element *cmd) { + // set to 1 to enable parser traces yydebug = 0; // parse command into DFA @@ -384,9 +399,10 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) /* parser helper functions */ void -yyerror(struct cmd_element *el, struct graph_node *sn, char const *msg) +yyerror (struct cmd_element *el, struct graph_node *sn, char const *msg) { - fprintf(stderr, "Grammar error: %s\n", msg); + zlog_err ("%s: FATAL parse error: %s", __func__, msg); + zlog_err ("while parsing this command definition: \n\t%s\n", el->string); exit(EXIT_FAILURE); } @@ -409,45 +425,45 @@ terminate_graph (struct graph_node *startnode, struct graph_node *finalnode, struct cmd_element *element) { - struct graph_node *end = new_node(END_GN); + struct graph_node *end = new_node (END_GN); end->element = element; - if (node_exists(finalnode, end)) - yyerror(element, startnode, "Duplicate command."); + if (node_exists (finalnode, end)) + yyerror (element, startnode, "Duplicate command."); else - add_node(finalnode, end); + add_node (finalnode, end); } static char * doc_next() { char *piece = NULL; - if (!docstr || !(piece = strsep(&docstr, "\n"))) + if (!docstr || !(piece = strsep (&docstr, "\n"))) return NULL; return XSTRDUP(MTYPE_CMD_TOKENS, piece); } static struct graph_node * -node_exists(struct graph_node *parent, struct graph_node *child) +node_exists (struct graph_node *parent, struct graph_node *child) { struct graph_node *p_child; - for (unsigned int i = 0; i < vector_active(parent->children); i++) - { - p_child = vector_slot(parent->children, i); - if (cmp_node(child, p_child)) - return p_child; - } + for (unsigned int i = 0; i < vector_active (parent->children); i++) + { + p_child = vector_slot (parent->children, i); + if (cmp_node (child, p_child)) + return p_child; + } return NULL; } static struct graph_node * -node_replace(struct graph_node *parent, struct graph_node *child) +node_replace (struct graph_node *parent, struct graph_node *child) { struct graph_node *existing = node_exists (parent, child); - return existing ? existing : add_node(parent, child); + return existing ? existing : add_node (parent, child); } static int -cmp_node(struct graph_node *first, struct graph_node *second) +cmp_node (struct graph_node *first, struct graph_node *second) { // compare types if (first->type != second->type) return 0; @@ -455,9 +471,8 @@ cmp_node(struct graph_node *first, struct graph_node *second) switch (first->type) { case WORD_GN: case VARIABLE_GN: - if (first->text && second->text) { - if (strcmp(first->text, second->text)) return 0; - } + if (first->text && second->text && strcmp (first->text, second->text)) + return 0; else if (first->text != second->text) return 0; break; case RANGE_GN: @@ -467,16 +482,16 @@ cmp_node(struct graph_node *first, struct graph_node *second) case NUMBER_GN: if (first->value != second->value) return 0; break; - /* selectors and options should be equal if all paths are equal, - * but the graph isomorphism problem is not solvable in polynomial - * time so we consider selectors and options inequal in all cases; - * ultimately this forks the graph + /* selectors and options should be equal if their subgraphs are equal, but + * the graph isomorphism problem is not known to be solvable in polynomial time + * so we consider selectors and options inequal in all cases; ultimately this + * forks the graph, but the matcher can handle this regardless */ case SELECTOR_GN: case OPTION_GN: return 0; /* end nodes are always considered equal, since each node may only - * have one at a time + * have one END_GN child at a time */ case START_GN: case END_GN: diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index d1779a9b6e..39d4d6b7cd 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -1,29 +1,185 @@ +/* + * Testing shim and API examples for the new CLI backend. + * + * This unit defines a number of commands in the old engine that can + * be used to test and interact with the new engine. + * + * This shim should be removed upon integration. It is currently hooked in + * vtysh/vtysh.c. It has no header, vtysh.c merely includes this entire unit + * since it clutters up the makefiles less and this is only a temporary shim. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + #include "command.h" #include "command_graph.h" #include "command_parse.h" #include "command_match.h" -#include "linklist.h" #define GRAMMAR_STR "CLI grammar sandbox\n" +void +grammar_sandbox_init(void); +void +pretty_print_graph (struct graph_node *start, int level); + +/* + * Start node for testing command graph. + * + * Each cmd_node will have one of these that replaces the `cmdvector` member. + * The examples below show how to install a command to the graph, calculate + * completions for a given input line, and match input against the graph. + */ struct graph_node * nodegraph; +/** + * Reference use of parsing / command installation API + */ DEFUN (grammar_test, grammar_test_cmd, "grammar parse .COMMAND", GRAMMAR_STR "command to pass to new parser\n") { - char* command = argv_concat(argv, argc, 0); - struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); + char *command = argv_concat(argv, argc, 0); + + // initialize a pretend cmd_element + struct cmd_element *cmd = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct cmd_element)); cmd->string = command; cmd->doc = NULL; cmd->func = NULL; cmd->tokens = vector_init(VECTOR_MIN_SIZE); - parse_command_format(nodegraph, cmd); + + // parse the command and install it into the command graph + parse_command_format (nodegraph, cmd); + + // free resources + free (command); + return CMD_SUCCESS; } + +/** + * Reference use of completions API + */ +DEFUN (grammar_test_complete, + grammar_test_complete_cmd, + "grammar complete .COMMAND", + GRAMMAR_STR + "attempt to complete input on DFA\n" + "command to complete") +{ + char *cmdstr = argv_concat (argv, argc, 0); + vector command = cmd_make_strvec (cmdstr); + + struct list *completions; + enum matcher_rv result = match_command_complete (nodegraph, command, &completions); + + // print completions or relevant error message + if (completions) + { + struct listnode *ln; + struct graph_node *gn; + for (ALL_LIST_ELEMENTS_RO(completions,ln,gn)) + { + if (gn->type == END_GN) + zlog_info (" (%p)", gn->element->func); + else + zlog_info ("%-30s%s", gn->text, gn->doc); + } + list_delete (completions); + } + else + { + assert(MATCHER_ERROR(result)); + zlog_info ("%% No match for \"%s\"", cmdstr); + } + + // free resources + cmd_free_strvec (command); + free (cmdstr); + + return CMD_SUCCESS; +} + +/** + * Reference use of matching API + */ +DEFUN (grammar_test_match, + grammar_test_match_cmd, + "grammar match .COMMAND", + GRAMMAR_STR + "attempt to match input on DFA\n" + "command to match") +{ + char *cmdstr = argv_concat(argv, argc, 0); + vector command = cmd_make_strvec (cmdstr); + + struct list *argvv = NULL; + struct cmd_element *element = NULL; + enum matcher_rv result = match_command (nodegraph, command, &argvv, &element); + + // print completions or relevant error message + if (element) + { + zlog_info ("Matched: %s", element->string); + struct listnode *ln; + struct graph_node *gn; + for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) + if (gn->type != END_GN) + zlog_info ("func: %p", gn->element->func); + else + zlog_info ("%s -- %s", gn->text, gn->arg); + + list_delete (argvv); + } + else { + assert(MATCHER_ERROR(result)); + switch (result) { + case MATCHER_NO_MATCH: + zlog_info ("%% Unknown command"); + break; + case MATCHER_INCOMPLETE: + zlog_info ("%% Incomplete command"); + break; + case MATCHER_AMBIGUOUS: + zlog_info ("%% Ambiguous command"); + break; + default: + zlog_info ("%% Unknown error"); + break; + } + } + + // free resources + cmd_free_strvec(command); + free(cmdstr); + + return CMD_SUCCESS; +} + +/** + * Testing shim to test docstrings + */ DEFUN (grammar_test_doc, grammar_test_doc_cmd, "grammar test docstring", @@ -31,7 +187,8 @@ DEFUN (grammar_test_doc, "Test function for docstring\n" "Command end\n") { - struct cmd_element *cmd = malloc(sizeof(struct cmd_element)); + // create cmd_element with docstring + struct cmd_element *cmd = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct cmd_element)); cmd->string = "test docstring (1-255) end VARIABLE [OPTION|set lol] . VARARG"; cmd->doc = "Test stuff\n" "docstring thing\n" @@ -46,100 +203,33 @@ DEFUN (grammar_test_doc, "optional lol\n" "vararg!\n"; cmd->func = NULL; - cmd->tokens = vector_init(VECTOR_MIN_SIZE); - parse_command_format(nodegraph, cmd); + cmd->tokens = vector_init (VECTOR_MIN_SIZE); + + // parse element + parse_command_format (nodegraph, cmd); + return CMD_SUCCESS; } +/** + * Debugging command to print command graph + */ DEFUN (grammar_test_show, grammar_test_show_cmd, - "grammar tree", + "grammar show graph", GRAMMAR_STR "print current accumulated DFA\n") { if (!nodegraph) - fprintf(stderr, "!nodegraph\n"); + zlog_info("nodegraph uninitialized"); else - walk_graph(nodegraph, 0); + pretty_print_graph (nodegraph, 0); return CMD_SUCCESS; } -DEFUN (grammar_test_complete, - grammar_test_complete_cmd, - "grammar complete .COMMAND", - GRAMMAR_STR - "attempt to complete input on DFA\n" - "command to complete") -{ - const char* command = argv_concat(argv, argc, 0); - struct list *result = match_command_complete (nodegraph, command); - - if (result->count == 0) // invalid command - fprintf(stderr, "%% Unknown command\n"); - else - { - fprintf(stderr, "%% Matched full input, possible completions:\n"); - char* desc = malloc(30); - struct listnode *node; - struct graph_node *cnode; - // print possible next hops, if any - for (ALL_LIST_ELEMENTS_RO(result,node,cnode)) { - if (cnode->type == END_GN) - fprintf(stderr, " %p\n", cnode->element->func); - else - fprintf(stderr, "%-30s%s\n", describe_node(cnode, desc, 30), cnode->doc); - } - free(desc); - } - list_delete(result); - - return CMD_SUCCESS; -} - -DEFUN (grammar_test_match, - grammar_test_match_cmd, - "grammar match .COMMAND", - GRAMMAR_STR - "attempt to match input on DFA\n" - "command to match") -{ - const char *line = argv_concat(argv, argc, 0); - - struct list *argvv = NULL; - struct cmd_element *element = NULL; - enum matcher_rv result = match_command (nodegraph, line, &argvv, &element); - - if (element) { - fprintf(stderr, "Matched: %s\n", element->string); - struct listnode *ln; - struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) - fprintf(stderr, "%s -- %s\n", gn->text, gn->arg); - } - else { - switch (result) { - case MATCHER_NO_MATCH: - fprintf(stderr, "%% Unknown command\n"); - break; - case MATCHER_INCOMPLETE: - fprintf(stderr, "%% Incomplete command\n"); - break; - case MATCHER_AMBIGUOUS: - fprintf(stderr, "%% Ambiguous command\n"); - break; - default: - fprintf(stderr, "%% Unknown error\n"); - break; - } - } - - return CMD_SUCCESS; -} - - -void grammar_sandbox_init(void); +/* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init() { - fprintf(stderr, "reinitializing graph\n"); + zlog_info ("Initializing grammar testing shim"); nodegraph = new_node(START_GN); install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); @@ -147,3 +237,30 @@ void grammar_sandbox_init() { install_element (ENABLE_NODE, &grammar_test_complete_cmd); install_element (ENABLE_NODE, &grammar_test_doc_cmd); } + +/* recursive pretty-print for command graph */ +void +pretty_print_graph (struct graph_node *start, int level) +{ + // print this node + fprintf (stdout, "%s[%d] ", start->text, vector_active (start->children)); + + if (vector_active (start->children)) + { + if (vector_active (start->children) == 1) + pretty_print_graph (vector_slot (start->children, 0), level); + else + { + fprintf(stdout, "\n"); + for (unsigned int i = 0; i < vector_active (start->children); i++) + { + struct graph_node *r = vector_slot (start->children, i); + for (int j = 0; j < level+1; j++) + fprintf (stdout, " "); + pretty_print_graph (r, level+1); + } + } + } + else + fprintf(stdout, "\n"); +} From 4427e9b3eeb6aaff3882dd1e96e14af62fa37ad4 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 17:37:01 +0000 Subject: [PATCH 038/280] lib: Fix various minor bugs - cmd_make_strvec returns null pointer if str begins with a '#' - disallow options nested options - NULL out state variable in parser - flip backwards comparison - fix memory leak in lexer Signed-off-by: Quentin Young --- lib/command_lex.l | 14 +++++++++++--- lib/command_match.c | 2 ++ lib/command_parse.y | 12 +++++++++--- lib/grammar_sandbox.c | 7 +++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index 920c03db8e..b3276894f5 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -25,7 +25,9 @@ %{ #include "command_parse.h" -extern void set_buffer_string(const char *); +extern void set_lexer_string (const char *); +extern void cleanup_lexer (void); +YY_BUFFER_STATE buffer; %} WORD (\-|\+)?[a-z\*][-+_a-zA-Z0-9\*]* @@ -62,7 +64,13 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) %% void -set_buffer_string(const char *string) +set_lexer_string (const char *string) { - yy_scan_string(string); + buffer = yy_scan_string (XSTRDUP(MTYPE_TMP, string)); +} + +void +cleanup_lexer () +{ + yy_delete_buffer (buffer); } diff --git a/lib/command_match.c b/lib/command_match.c index 011ac698cb..9b9f8a0ec5 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -158,6 +158,8 @@ match_command (struct graph_node *start, static struct list * match_command_r (struct graph_node *start, vector vline, unsigned int n) { + assert (n < vector_active (vline)); + // get the minimum match level that can count as a full match enum match_type minmatch = min_match_level (start->type); diff --git a/lib/command_parse.y b/lib/command_parse.y index 6b972afe90..51c2331dc7 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -41,7 +41,10 @@ yylex (void); extern void - set_buffer_string (const char *); + set_lexer_string (const char *); + + extern void + cleanup_lexer (void); } /* functionality this unit exports */ @@ -135,7 +138,7 @@ optnode_start = optnode_end = NULL; /* set string to parse */ - set_buffer_string (element->string); + set_lexer_string (element->string); /* copy docstring and keep a pointer to the copy */ docstr = element->doc ? XSTRDUP(MTYPE_TMP, element->doc) : NULL; @@ -341,7 +344,6 @@ selector_element_root: selector_token: selector_element_root -| option ; /* [option|set] productions */ @@ -368,6 +370,7 @@ option_element: add_node (optnode_start, seqhead); add_node ($1, optnode_end); + seqhead = NULL; } option_token_seq: @@ -412,6 +415,9 @@ cleanup() /* free resources */ free (docstr_start); + /* cleanup lexer */ + cleanup_lexer(); + /* clear state pointers */ seqhead = NULL; currnode = NULL; diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 39d4d6b7cd..cf9ce2bb58 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -63,7 +63,7 @@ DEFUN (grammar_test, // initialize a pretend cmd_element struct cmd_element *cmd = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct cmd_element)); - cmd->string = command; + cmd->string = XSTRDUP(MTYPE_TMP, command); cmd->doc = NULL; cmd->func = NULL; cmd->tokens = vector_init(VECTOR_MIN_SIZE); @@ -132,6 +132,9 @@ DEFUN (grammar_test_match, "command to match") { char *cmdstr = argv_concat(argv, argc, 0); + if (cmdstr[0] == '#') + return CMD_SUCCESS; + vector command = cmd_make_strvec (cmdstr); struct list *argvv = NULL; @@ -145,7 +148,7 @@ DEFUN (grammar_test_match, struct listnode *ln; struct graph_node *gn; for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) - if (gn->type != END_GN) + if (gn->type == END_GN) zlog_info ("func: %p", gn->element->func); else zlog_info ("%s -- %s", gn->text, gn->arg); From 07079d78bc849dacc7b90c7fec6949687b344974 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 19:30:40 +0000 Subject: [PATCH 039/280] lib: Fix use after free in lexer Fix occasional bug where deleting flex's input buffer happens earlier than flex expects Signed-off-by: Quentin Young --- lib/command_parse.y | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 51c2331dc7..bbdf11c6e8 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -152,7 +152,6 @@ start: { // tack on the command element terminate_graph (startnode, currnode, element); - cleanup(); } | sentence_root cmd_token_seq '.' placeholder_token { @@ -165,7 +164,6 @@ start: // tack on the command element terminate_graph (startnode, currnode, element); - cleanup(); } sentence_root: WORD @@ -394,7 +392,10 @@ parse_command_format(struct graph_node *start, struct cmd_element *cmd) yydebug = 0; // parse command into DFA - yyparse(cmd, start); + yyparse (cmd, start); + + /* cleanup */ + cleanup (); return start; } @@ -416,7 +417,7 @@ cleanup() free (docstr_start); /* cleanup lexer */ - cleanup_lexer(); + cleanup_lexer (); /* clear state pointers */ seqhead = NULL; From e52c05cd8079defe2c7524e61b3241174fa969d0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 20:28:35 +0000 Subject: [PATCH 040/280] lib: Revert breaking change to cmp_node Bad conditional refactor broke graph deduplication and thus disambiguation precedence Signed-off-by: Quentin Young --- lib/command_parse.y | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index bbdf11c6e8..690832357a 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -478,8 +478,11 @@ cmp_node (struct graph_node *first, struct graph_node *second) switch (first->type) { case WORD_GN: case VARIABLE_GN: - if (first->text && second->text && strcmp (first->text, second->text)) - return 0; + if (first->text && second->text) + { + if (strcmp (first->text, second->text)) + return 0; + } else if (first->text != second->text) return 0; break; case RANGE_GN: From fe3936ecf5ab65100535db2d3cc9cce58bb69b5d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 21:02:11 +0000 Subject: [PATCH 041/280] lib: Remove unnecessary XSTRDUP yy_scan_string duplicates its input Signed-off-by: Quentin Young --- lib/command_lex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index b3276894f5..e5fc01e4c9 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -66,7 +66,7 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) void set_lexer_string (const char *string) { - buffer = yy_scan_string (XSTRDUP(MTYPE_TMP, string)); + buffer = yy_scan_string (string); } void From 78602b80294194b31fd402843c95af3bbb5c9999 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 21:31:11 +0000 Subject: [PATCH 042/280] lib: Remove unnecessary node pointer Selector and option heads had pointers to their ends, but this turned out to be unnecessary Signed-off-by: Quentin Young --- lib/command_graph.h | 1 - lib/command_match.c | 1 - lib/command_parse.y | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/command_graph.h b/lib/command_graph.h index 48c3d9cd0a..e42b8336e5 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -59,7 +59,6 @@ struct graph_node { enum graph_node_type type; // data type this node matches or holds vector children; // this node's children - struct graph_node *end; // pointer to end for SELECTOR_GN & OPTION_GN char *text; // original format text char *doc; // docstring for this node diff --git a/lib/command_match.c b/lib/command_match.c index 9b9f8a0ec5..b323bc5809 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -469,7 +469,6 @@ copy_node (struct graph_node *node) { struct graph_node *new = new_node(node->type); new->children = NULL; - new->end = NULL; new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; new->value = node->value; new->min = node->min; diff --git a/lib/command_parse.y b/lib/command_parse.y index 690832357a..56c58fdaed 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -303,7 +303,6 @@ selector_element: selector_element_root selector_token_seq assert(!selnode_start && !selnode_end); // both should be null selnode_start = new_node (SELECTOR_GN); // diverging node selnode_end = new_node (NUL_GN); // converging node - selnode_start->end = selnode_end; // duh } // add element head as a child of the selector From b84f1d850aed50dea347ab5b99888bc85448604f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 9 Aug 2016 22:23:17 +0000 Subject: [PATCH 043/280] lib: Handle vararg in graph pretty-print Signed-off-by: Quentin Young --- lib/grammar_sandbox.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index cf9ce2bb58..6473fc12e3 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -251,7 +251,13 @@ pretty_print_graph (struct graph_node *start, int level) if (vector_active (start->children)) { if (vector_active (start->children) == 1) - pretty_print_graph (vector_slot (start->children, 0), level); + { + struct graph_node *child = vector_slot (start->children, 0); + if (child == start) + fprintf (stdout, "*"); + else + pretty_print_graph (vector_slot (start->children, 0), level); + } else { fprintf(stdout, "\n"); @@ -260,7 +266,10 @@ pretty_print_graph (struct graph_node *start, int level) struct graph_node *r = vector_slot (start->children, i); for (int j = 0; j < level+1; j++) fprintf (stdout, " "); - pretty_print_graph (r, level+1); + if (r == start) + fprintf (stdout, "*"); + else + pretty_print_graph (r, level+1); } } } From eaf46b79b6c771877b9289959bb6280518beaad2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 10 Aug 2016 15:04:21 +0000 Subject: [PATCH 044/280] lib: Fix broken disambiguation on leader tokens Fix incorrect assumption that the set of first tokens of all commands are perfectly unambiguous Signed-off-by: Quentin Young --- lib/command_match.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index b323bc5809..285a776a7c 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -91,17 +91,18 @@ match_command (struct graph_node *start, { matcher_rv = MATCHER_NO_MATCH; - // call recursive matcher on each starting child - for (unsigned int i = 0; i < vector_active (start->children); i++) + // prepend a dummy token to match that pesky start node + vector vvline = vector_init (vline->alloced + 1); + vector_set_index (vvline, 0, (void *) "dummy"); + memcpy (vvline->index + 1, vline->index, sizeof (void *) * vline->alloced); + vvline->active = vline->active + 1; + + if ((*argv = match_command_r (start, vvline, 0))) // successful match { - *argv = match_command_r (vector_slot (start->children, i), vline, 0); - if (*argv) // successful match - { - struct graph_node *end = listgetdata (listtail (*argv)); - *el = end->element; - assert (*el); - break; - } + list_delete_node (*argv, listhead (*argv)); + struct graph_node *end = listgetdata (listtail (*argv)); + *el = end->element; + assert (*el); } return matcher_rv; @@ -344,6 +345,9 @@ min_match_level (enum node_type type) { switch (type) { + // anything matches a start node, for the sake of recursion + case START_GN: + return no_match; // allowing words to partly match enables command abbreviation case WORD_GN: return partly_match; From e61b63d18030562ad965709fd92e47151835632e Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 10 Aug 2016 15:08:14 +0000 Subject: [PATCH 045/280] debian: Add bison and flex to Build-Depends Signed-off-by: Quentin Young --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index dd0013e82f..3bd4e21a9d 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Christian Hammers Uploaders: Florian Weimer -Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev, python-ipaddr +Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev, python-ipaddr, bison, flex Standards-Version: 3.9.6 Homepage: http://www.quagga.net/ XS-Testsuite: autopkgtest From ca90e051043f819fe974cd110e15cf38edd63f2e Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 10 Aug 2016 18:31:15 +0000 Subject: [PATCH 046/280] lib: Add completion string convenience functions And set END_GN default text to , and scrub a coupld of extraneous files Signed-off-by: Quentin Young --- feed.x | 26 -- lib/command_match.c | 53 ++- lib/command_match.h | 16 +- lib/command_parse.y | 1 + lib/grammar_sandbox.c | 25 +- opt.txt | 905 ------------------------------------------ 6 files changed, 76 insertions(+), 950 deletions(-) delete mode 100755 feed.x delete mode 100644 opt.txt diff --git a/feed.x b/feed.x deleted file mode 100755 index cbff1944bf..0000000000 --- a/feed.x +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/expect - -# takes a list of command format strings -# and feeds them to the test grammar -# parser - -set f [open [lindex $argv 0]] -set cmds [split [read $f] "\n"] -close $f - -spawn vtysh - -foreach command $cmds { - expect { - "dell-s6000-16#" { - send "grammar parse $command\r" - } - "Grammar error" { - send_user "$command" - send "exit\r" - exit - } - } -} - -interact diff --git a/lib/command_match.c b/lib/command_match.c index 285a776a7c..d5efa39686 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -52,6 +52,9 @@ disambiguate_nodes (struct graph_node *, struct graph_node *, char *); static struct list * disambiguate (struct list *, struct list *, vector, unsigned int); +int +compare_completions (const void *, const void *); + /* token matcher prototypes */ static enum match_type match_token (struct graph_node *, char *); @@ -291,7 +294,7 @@ match_command_complete (struct graph_node *start, vector vline, struct list **co */ matcher_rv = - idx + 1 == vector_active(vline) && next->count ? + idx == vector_active(vline) && next->count ? MATCHER_OK : MATCHER_NO_MATCH; @@ -301,6 +304,54 @@ match_command_complete (struct graph_node *start, vector vline, struct list **co return matcher_rv; } +/** + * Compare two completions. Tightly coupled to vector. + * + * @param[in] fst pointer to first item pointer in vector->index + * @param[in] snd pointer to second item poitner in vector->index + * @return integer compare code as determined by strcmp + */ +int +compare_completions (const void *fst, const void *snd) +{ + const char *first = *((char **) fst); + const char *secnd = *((char **) snd); + return strcmp (first, secnd); +} + +enum matcher_rv +match_command_complete_str (struct graph_node *start, + vector vline, + vector completions) +{ + struct list *comps; + enum matcher_rv rv = match_command_complete (start, vline, &comps); + + // quick n' dirty deduplication fn here, prolly like O(n^n) + struct listnode *ln; + struct graph_node *gn; + unsigned int i; + for (ALL_LIST_ELEMENTS_RO(comps,ln,gn)) + { + // linear search for node text in completions vector + int exists = 0; + for (i = 0; i < vector_active (completions) && !exists; i++) + exists = !strcmp (gn->text, vector_slot (completions, i)); + + if (!exists) + vector_set (completions, XSTRDUP(MTYPE_TMP, gn->text)); + } + + // sort completions + qsort (completions->index, + vector_active (completions), + sizeof (void *), + &compare_completions); + + list_delete (comps); + return rv; +} + /** * Adds all children that are reachable by one parser hop to the given list. * NUL_GN, SELECTOR_GN, and OPTION_GN nodes are treated as transparent. diff --git a/lib/command_match.h b/lib/command_match.h index 6804a0777a..e8a408495e 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -85,7 +85,7 @@ match_command (struct graph_node *start, * * @param[in] start the start node of the DFA to match against * @param[in] vline vectorized input string - * @param[in] completions pointer to possible completions + * @param[in] completions pointer to list of possible next nodes * @return matcher status */ enum matcher_rv @@ -93,4 +93,18 @@ match_command_complete (struct graph_node *start, vector vline, struct list **completions); + +/** + * Compiles possible completions for a given line of user input. + * + * @param[in] start the start node of the DFA to match against + * @param[in] vline vectorized input string + * @param[in] completions vector to fill with string completions + * @return matcher status + */ +enum matcher_rv +match_command_complete_str (struct graph_node *start, + vector vline, + vector completions); + #endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index 56c58fdaed..df90f64edb 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -433,6 +433,7 @@ terminate_graph (struct graph_node *startnode, { struct graph_node *end = new_node (END_GN); end->element = element; + end->text = XSTRDUP(MTYPE_CMD_TOKENS, ""); if (node_exists (finalnode, end)) yyerror (element, startnode, "Duplicate command."); else diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 6473fc12e3..899d0469ab 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -91,31 +91,22 @@ DEFUN (grammar_test_complete, char *cmdstr = argv_concat (argv, argc, 0); vector command = cmd_make_strvec (cmdstr); - struct list *completions; - enum matcher_rv result = match_command_complete (nodegraph, command, &completions); + vector completions = vector_init (VECTOR_MIN_SIZE); + enum matcher_rv result = + match_command_complete_str (nodegraph, command, completions); // print completions or relevant error message - if (completions) + if (!MATCHER_ERROR(result)) { - struct listnode *ln; - struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(completions,ln,gn)) - { - if (gn->type == END_GN) - zlog_info (" (%p)", gn->element->func); - else - zlog_info ("%-30s%s", gn->text, gn->doc); - } - list_delete (completions); + for (unsigned int i = 0; i < vector_active (completions); i++) + zlog_info ((char *) vector_slot (completions, i)); } else - { - assert(MATCHER_ERROR(result)); - zlog_info ("%% No match for \"%s\"", cmdstr); - } + zlog_info ("%% No match for \"%s\"", cmdstr); // free resources cmd_free_strvec (command); + cmd_free_strvec (completions); free (cmdstr); return CMD_SUCCESS; diff --git a/opt.txt b/opt.txt deleted file mode 100644 index a63e0b85f2..0000000000 --- a/opt.txt +++ /dev/null @@ -1,905 +0,0 @@ -address-family encap -address-family encapv4 -address-family encapv6 -address-family ipv4 -address-family ipv4 -address-family ipv6 -address-family ipv6 -address-family vpnv4 -address-family vpnv4 unicast -address-family vpnv6 -address-family vpnv6 unicast -aggregate-address A.B.C.D A.B.C.D -aggregate-address A.B.C.D A.B.C.D as-set -aggregate-address A.B.C.D A.B.C.D as-set summary-only -aggregate-address A.B.C.D A.B.C.D summary-only -aggregate-address A.B.C.D A.B.C.D summary-only as-set -aggregate-address A.B.C.D/M -aggregate-address A.B.C.D/M as-set -aggregate-address A.B.C.D/M as-set summary-only -aggregate-address A.B.C.D/M summary-only -aggregate-address A.B.C.D/M summary-only as-set -aggregate-address X:X::X:X/M -aggregate-address X:X::X:X/M summary-only -bgp always-compare-med -bgp bestpath as-path confed -bgp bestpath as-path ignore -bgp bestpath as-path multipath-relax -bgp bestpath compare-routerid -bgp bestpath med -bgp bestpath med confed missing-as-worst -bgp bestpath med missing-as-worst confed -bgp client-to-client reflection -bgp cluster-id (1-4294967295) -bgp cluster-id A.B.C.D -bgp confederation identifier (1-4294967295) -bgp confederation peers . (1-4294967295) -bgp config-type -bgp dampening -bgp dampening (1-45) -bgp dampening (1-45) (1-20000) (1-20000) (1-255) -bgp default ipv4-unicast -bgp default local-preference (0-4294967295) -bgp default show-hostname -bgp default subgroup-pkt-queue-max (20-100) -bgp deterministic-med -bgp disable-ebgp-connected-route-check -bgp enforce-first-as -bgp fast-external-failover -bgp graceful-restart -bgp graceful-restart stalepath-time (1-3600) -bgp listen limit (1-5000) -bgp listen range peer-group WORD -bgp log-neighbor-changes -bgp max-med administrative -bgp max-med administrative (0-4294967294) -bgp max-med on-startup (5-86400) -bgp max-med on-startup (5-86400) (0-4294967294) -bgp multiple-instance -bgp network import-check -bgp route-map delay-timer (0-600) -bgp route-reflector allow-outbound-policy -bgp router-id A.B.C.D -bgp router-id IFNAME -clear bgp -clear bgp in -clear bgp in prefix-filter -clear bgp out -clear bgp soft -clear bgp soft in -clear bgp soft out -clear bgp * -clear bgp * in -clear bgp * in prefix-filter -clear bgp * out -clear bgp * soft -clear bgp * soft in -clear bgp * soft out -clear bgp (1-4294967295) -clear bgp (1-4294967295) in -clear bgp (1-4294967295) in prefix-filter -clear bgp (1-4294967295) out -clear bgp (1-4294967295) soft -clear bgp (1-4294967295) soft in -clear bgp (1-4294967295) soft out -clear bgp BGP_INSTANCE_CMD -clear bgp BGP_INSTANCE_CMD in -clear bgp BGP_INSTANCE_CMD out -clear bgp BGP_INSTANCE_CMD soft -clear bgp BGP_INSTANCE_CMD soft in -clear bgp BGP_INSTANCE_CMD soft out -clear bgp BGP_INSTANCE_CMD * -clear bgp BGP_INSTANCE_CMD * in -clear bgp BGP_INSTANCE_CMD * out -clear bgp BGP_INSTANCE_CMD * soft -clear bgp BGP_INSTANCE_CMD * soft in -clear bgp BGP_INSTANCE_CMD * soft out -clear bgp BGP_INSTANCE_CMD (1-4294967295) -clear bgp BGP_INSTANCE_CMD (1-4294967295) in -clear bgp BGP_INSTANCE_CMD (1-4294967295) out -clear bgp BGP_INSTANCE_CMD (1-4294967295) soft -clear bgp BGP_INSTANCE_CMD (1-4294967295) soft in -clear bgp BGP_INSTANCE_CMD (1-4294967295) soft out -clear bgp BGP_INSTANCE_CMD external -clear bgp BGP_INSTANCE_CMD external in -clear bgp BGP_INSTANCE_CMD external out -clear bgp BGP_INSTANCE_CMD external soft -clear bgp BGP_INSTANCE_CMD external soft in -clear bgp BGP_INSTANCE_CMD external soft out -clear bgp BGP_INSTANCE_CMD ipv6 -clear bgp BGP_INSTANCE_CMD ipv6 in -clear bgp BGP_INSTANCE_CMD ipv6 out -clear bgp BGP_INSTANCE_CMD ipv6 soft -clear bgp BGP_INSTANCE_CMD ipv6 soft in -clear bgp BGP_INSTANCE_CMD ipv6 soft out -clear bgp BGP_INSTANCE_CMD ipv6 prefix X:X::X:X/M -clear bgp BGP_INSTANCE_CMD ipv6 * -clear bgp BGP_INSTANCE_CMD ipv6 * in -clear bgp BGP_INSTANCE_CMD ipv6 * out -clear bgp BGP_INSTANCE_CMD ipv6 * soft -clear bgp BGP_INSTANCE_CMD ipv6 * soft in -clear bgp BGP_INSTANCE_CMD ipv6 * soft out -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) in -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) out -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft in -clear bgp BGP_INSTANCE_CMD ipv6 (1-4294967295) soft out -clear bgp BGP_INSTANCE_CMD ipv6 external -clear bgp BGP_INSTANCE_CMD ipv6 external WORD in -clear bgp BGP_INSTANCE_CMD ipv6 external WORD out -clear bgp BGP_INSTANCE_CMD ipv6 external soft -clear bgp BGP_INSTANCE_CMD ipv6 external soft in -clear bgp BGP_INSTANCE_CMD ipv6 external soft out -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD in -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD out -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft in -clear bgp BGP_INSTANCE_CMD ipv6 peer-group WORD soft out -clear bgp BGP_INSTANCE_CMD peer-group WORD -clear bgp BGP_INSTANCE_CMD peer-group WORD in -clear bgp BGP_INSTANCE_CMD peer-group WORD out -clear bgp BGP_INSTANCE_CMD peer-group WORD soft -clear bgp BGP_INSTANCE_CMD peer-group WORD soft in -clear bgp BGP_INSTANCE_CMD peer-group WORD soft out -clear bgp external -clear bgp external in -clear bgp external in prefix-filter -clear bgp external out -clear bgp external soft -clear bgp external soft in -clear bgp external soft out -clear bgp ipv6 -clear bgp ipv6 in -clear bgp ipv6 in prefix-filter -clear bgp ipv6 out -clear bgp ipv6 soft -clear bgp ipv6 soft in -clear bgp ipv6 soft out -clear bgp ipv6 prefix X:X::X:X/M -clear bgp ipv6 * -clear bgp ipv6 * in -clear bgp ipv6 * in prefix-filter -clear bgp ipv6 * out -clear bgp ipv6 * soft -clear bgp ipv6 * soft in -clear bgp ipv6 * soft out -clear bgp ipv6 (1-4294967295) -clear bgp ipv6 (1-4294967295) in -clear bgp ipv6 (1-4294967295) in prefix-filter -clear bgp ipv6 (1-4294967295) out -clear bgp ipv6 (1-4294967295) soft -clear bgp ipv6 (1-4294967295) soft in -clear bgp ipv6 (1-4294967295) soft out -clear bgp ipv6 external -clear bgp ipv6 external WORD in -clear bgp ipv6 external WORD out -clear bgp ipv6 external in prefix-filter -clear bgp ipv6 external soft -clear bgp ipv6 external soft in -clear bgp ipv6 external soft out -clear bgp ipv6 peer-group WORD -clear bgp ipv6 peer-group WORD in -clear bgp ipv6 peer-group WORD in prefix-filter -clear bgp ipv6 peer-group WORD out -clear bgp ipv6 peer-group WORD soft -clear bgp ipv6 peer-group WORD soft in -clear bgp ipv6 peer-group WORD soft out -clear bgp peer-group WORD -clear bgp peer-group WORD in -clear bgp peer-group WORD in prefix-filter -clear bgp peer-group WORD out -clear bgp peer-group WORD soft -clear bgp peer-group WORD soft in -clear bgp peer-group WORD soft out -clear ip bgp in -clear ip bgp in prefix-filter -clear ip bgp ipv4 in -clear ip bgp ipv4 in prefix-filter -clear ip bgp ipv4 out -clear ip bgp ipv4 soft -clear ip bgp ipv4 soft in -clear ip bgp ipv4 soft out -clear ip bgp out -clear ip bgp soft -clear ip bgp soft in -clear ip bgp soft out -clear ip bgp vpnv4 unicast in -clear ip bgp vpnv4 unicast out -clear ip bgp vpnv4 unicast soft -clear ip bgp vpnv4 unicast soft in -clear ip bgp vpnv4 unicast soft out -clear ip bgp -clear ip bgp * -clear ip bgp * encap unicast in -clear ip bgp * encap unicast out -clear ip bgp * encap unicast soft -clear ip bgp * encap unicast soft in -clear ip bgp * encap unicast soft out -clear ip bgp * in -clear ip bgp * in prefix-filter -clear ip bgp * ipv4 in -clear ip bgp * ipv4 in prefix-filter -clear ip bgp * ipv4 out -clear ip bgp * ipv4 soft -clear ip bgp * ipv4 soft in -clear ip bgp * ipv4 soft out -clear ip bgp * out -clear ip bgp * soft -clear ip bgp * soft in -clear ip bgp * soft out -clear ip bgp * vpnv4 unicast in -clear ip bgp * vpnv4 unicast out -clear ip bgp * vpnv4 unicast soft -clear ip bgp * vpnv4 unicast soft in -clear ip bgp * vpnv4 unicast soft out -clear ip bgp (1-4294967295) -clear ip bgp (1-4294967295) encap unicast in -clear ip bgp (1-4294967295) encap unicast out -clear ip bgp (1-4294967295) encap unicast soft -clear ip bgp (1-4294967295) encap unicast soft in -clear ip bgp (1-4294967295) encap unicast soft out -clear ip bgp (1-4294967295) in -clear ip bgp (1-4294967295) in prefix-filter -clear ip bgp (1-4294967295) ipv4 in -clear ip bgp (1-4294967295) ipv4 in prefix-filter -clear ip bgp (1-4294967295) ipv4 out -clear ip bgp (1-4294967295) ipv4 soft -clear ip bgp (1-4294967295) ipv4 soft in -clear ip bgp (1-4294967295) ipv4 soft out -clear ip bgp (1-4294967295) out -clear ip bgp (1-4294967295) soft -clear ip bgp (1-4294967295) soft in -clear ip bgp (1-4294967295) soft out -clear ip bgp (1-4294967295) vpnv4 unicast in -clear ip bgp (1-4294967295) vpnv4 unicast out -clear ip bgp (1-4294967295) vpnv4 unicast soft -clear ip bgp (1-4294967295) vpnv4 unicast soft in -clear ip bgp (1-4294967295) vpnv4 unicast soft out -clear ip bgp A.B.C.D encap unicast in -clear ip bgp A.B.C.D encap unicast out -clear ip bgp A.B.C.D encap unicast soft -clear ip bgp A.B.C.D encap unicast soft in -clear ip bgp A.B.C.D encap unicast soft out -clear ip bgp BGP_INSTANCE_CMD in -clear ip bgp BGP_INSTANCE_CMD ipv4 in -clear ip bgp BGP_INSTANCE_CMD ipv4 out -clear ip bgp BGP_INSTANCE_CMD ipv4 soft -clear ip bgp BGP_INSTANCE_CMD ipv4 soft in -clear ip bgp BGP_INSTANCE_CMD ipv4 soft out -clear ip bgp BGP_INSTANCE_CMD out -clear ip bgp BGP_INSTANCE_CMD soft -clear ip bgp BGP_INSTANCE_CMD soft in -clear ip bgp BGP_INSTANCE_CMD soft out -clear ip bgp BGP_INSTANCE_CMD -clear ip bgp BGP_INSTANCE_CMD * -clear ip bgp BGP_INSTANCE_CMD * in -clear ip bgp BGP_INSTANCE_CMD * ipv4 in -clear ip bgp BGP_INSTANCE_CMD * ipv4 out -clear ip bgp BGP_INSTANCE_CMD * ipv4 soft -clear ip bgp BGP_INSTANCE_CMD * ipv4 soft in -clear ip bgp BGP_INSTANCE_CMD * ipv4 soft out -clear ip bgp BGP_INSTANCE_CMD * out -clear ip bgp BGP_INSTANCE_CMD * soft -clear ip bgp BGP_INSTANCE_CMD * soft in -clear ip bgp BGP_INSTANCE_CMD * soft out -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) in -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 in -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 out -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft in -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) ipv4 soft out -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) out -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft in -clear ip bgp BGP_INSTANCE_CMD (1-4294967295) soft out -clear ip bgp BGP_INSTANCE_CMD external -clear ip bgp BGP_INSTANCE_CMD external in -clear ip bgp BGP_INSTANCE_CMD external ipv4 in -clear ip bgp BGP_INSTANCE_CMD external ipv4 out -clear ip bgp BGP_INSTANCE_CMD external ipv4 soft -clear ip bgp BGP_INSTANCE_CMD external ipv4 soft in -clear ip bgp BGP_INSTANCE_CMD external ipv4 soft out -clear ip bgp BGP_INSTANCE_CMD external out -clear ip bgp BGP_INSTANCE_CMD external soft -clear ip bgp BGP_INSTANCE_CMD external soft in -clear ip bgp BGP_INSTANCE_CMD external soft out -clear ip bgp BGP_INSTANCE_CMD peer-group WORD -clear ip bgp BGP_INSTANCE_CMD peer-group WORD in -clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 in -clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 out -clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft -clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft in -clear ip bgp BGP_INSTANCE_CMD peer-group WORD ipv4 soft out -clear ip bgp BGP_INSTANCE_CMD peer-group WORD out -clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft -clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft in -clear ip bgp BGP_INSTANCE_CMD peer-group WORD soft out -clear ip bgp BGP_INSTANCE_CMD prefix A.B.C.D/M -clear ip bgp dampening -clear ip bgp dampening A.B.C.D -clear ip bgp dampening A.B.C.D A.B.C.D -clear ip bgp dampening A.B.C.D/M -clear ip bgp external -clear ip bgp external in -clear ip bgp external in prefix-filter -clear ip bgp external ipv4 in -clear ip bgp external ipv4 in prefix-filter -clear ip bgp external ipv4 out -clear ip bgp external ipv4 soft -clear ip bgp external ipv4 soft in -clear ip bgp external ipv4 soft out -clear ip bgp external out -clear ip bgp external soft -clear ip bgp external soft in -clear ip bgp external soft out -clear ip bgp peer-group WORD -clear ip bgp peer-group WORD in -clear ip bgp peer-group WORD in prefix-filter -clear ip bgp peer-group WORD ipv4 in -clear ip bgp peer-group WORD ipv4 in prefix-filter -clear ip bgp peer-group WORD ipv4 out -clear ip bgp peer-group WORD ipv4 soft -clear ip bgp peer-group WORD ipv4 soft in -clear ip bgp peer-group WORD ipv4 soft out -clear ip bgp peer-group WORD out -clear ip bgp peer-group WORD soft -clear ip bgp peer-group WORD soft in -clear ip bgp peer-group WORD soft out -clear ip bgp prefix A.B.C.D/M -coalesce-time (0-4294967295) -debug bgp as4 -debug bgp as4 segment -debug bgp bestpath -debug bgp keepalives -debug bgp keepalives -debug bgp neighbor-events -debug bgp neighbor-events -debug bgp nht -debug bgp update-groups -debug bgp updates -debug bgp updates -debug bgp updates -debug bgp updates prefix -debug bgp zebra -debug bgp zebra prefix -distance (1-255) A.B.C.D/M -distance (1-255) A.B.C.D/M WORD -distance bgp (1-255) (1-255) (1-255) -dump bgp PATH [INTERVAL] -exit-address-family -ip community-list (1-99) -ip community-list (1-99) AA:NN -ip community-list (100-500) LINE -ip community-list expanded WORD LINE -ip community-list standard WORD -ip community-list standard WORD AA:NN -ip extcommunity-list (1-99) -ip extcommunity-list (1-99) AA:NN -ip extcommunity-list (100-500) LINE -ip extcommunity-list expanded WORD LINE -ip extcommunity-list standard WORD -ip extcommunity-list standard WORD AA:NN -ipv6 bgp aggregate-address X:X::X:X/M -ipv6 bgp aggregate-address X:X::X:X/M summary-only -ipv6 bgp network X:X::X:X/M -match as-path WORD -match community <(1-99)|(100-500)|WORD> -match community <(1-99)|(100-500)|WORD> exact-match -match extcommunity <(1-99)|(100-500)|WORD> -match interface WORD -match ip address <(1-199)|(1300-2699)|WORD> -match ip address prefix-list WORD -match ip next-hop <(1-199)|(1300-2699)|WORD> -match ip next-hop prefix-list WORD -match ip route-source <(1-199)|(1300-2699)|WORD> -match ip route-source prefix-list WORD -match ipv6 address WORD -match ipv6 address prefix-list WORD -match ipv6 next-hop X:X::X:X -match local-preference (0-4294967295) -match metric (0-4294967295) -match origin -match peer -match peer local -match probability (0-100) -match tag (1-65535) -maximum-paths (1-255) -maximum-paths ibgp (1-255) -maximum-paths ibgp (1-255) equal-cluster-length -neighbor interface WORD -neighbor port (0-65535) -neighbor strict-capability-match -neighbor activate -neighbor addpath-tx-all-paths -neighbor addpath-tx-bestpath-per-AS -neighbor advertisement-interval (0-600) -neighbor allowas-in -neighbor allowas-in (1-10) -neighbor as-override -neighbor attribute-unchanged -neighbor attribute-unchanged -neighbor attribute-unchanged as-path -neighbor attribute-unchanged as-path med next-hop -neighbor attribute-unchanged as-path next-hop med -neighbor attribute-unchanged med -neighbor attribute-unchanged med as-path next-hop -neighbor attribute-unchanged med next-hop as-path -neighbor attribute-unchanged next-hop -neighbor attribute-unchanged next-hop as-path med -neighbor attribute-unchanged next-hop med as-path -neighbor bfd -neighbor bfd (2-255) BFD_CMD_MIN_RX_RANGE (50-60000) -neighbor capability dynamic -neighbor capability extended-nexthop -neighbor capability orf prefix-list -neighbor default-originate -neighbor default-originate route-map WORD -neighbor description LINE -neighbor disable-connected-check -neighbor distribute-list <(1-199)|(1300-2699)|WORD> -neighbor dont-capability-negotiate -neighbor ebgp-multihop -neighbor ebgp-multihop (1-255) -neighbor enforce-multihop -neighbor filter-list WORD -neighbor local-as (1-4294967295) -neighbor local-as (1-4294967295) no-prepend -neighbor local-as (1-4294967295) no-prepend replace-as -neighbor maximum-prefix (1-4294967295) -neighbor maximum-prefix (1-4294967295) (1-100) -neighbor maximum-prefix (1-4294967295) (1-100) restart (1-65535) -neighbor maximum-prefix (1-4294967295) (1-100) warning-only -neighbor maximum-prefix (1-4294967295) restart (1-65535) -neighbor maximum-prefix (1-4294967295) warning-only -neighbor next-hop-self -neighbor next-hop-self force -neighbor nexthop-local unchanged -neighbor override-capability -neighbor passive -neighbor password LINE -neighbor peer-group WORD -neighbor prefix-list WORD -neighbor remote-as <(1-4294967295)|external|internal> -neighbor remove-private-AS -neighbor remove-private-AS all -neighbor remove-private-AS all replace-AS -neighbor remove-private-AS replace-AS -neighbor route-map WORD -neighbor route-reflector-client -neighbor route-server-client -neighbor send-community -neighbor send-community -neighbor shutdown -neighbor soft-reconfiguration inbound -neighbor solo -neighbor timers (0-65535) (0-65535) -neighbor timers connect (1-65535) -neighbor ttl-security hops (1-254) -neighbor unsuppress-map WORD -neighbor update-source -neighbor weight (0-65535) -neighbor WORD interface -neighbor WORD interface peer-group WORD -neighbor WORD interface v6only -neighbor WORD interface v6only peer-group WORD -neighbor WORD peer-group -network A.B.C.D -network A.B.C.D backdoor -network A.B.C.D mask A.B.C.D -network A.B.C.D mask A.B.C.D backdoor -network A.B.C.D mask A.B.C.D route-map WORD -network A.B.C.D route-map WORD -network A.B.C.D/M -network A.B.C.D/M backdoor -network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD -network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD -network A.B.C.D/M route-map WORD -network X:X::X:X/M -network X:X::X:X/M route-map WORD -redistribute -redistribute metric (0-4294967295) -redistribute metric (0-4294967295) route-map WORD -redistribute route-map WORD -redistribute route-map WORD metric (0-4294967295) -redistribute -redistribute metric (0-4294967295) -redistribute metric (0-4294967295) route-map WORD -redistribute route-map WORD -redistribute route-map WORD metric (0-4294967295) -redistribute (1-65535) -redistribute (1-65535) metric (0-4294967295) -redistribute (1-65535) metric (0-4294967295) route-map WORD -redistribute (1-65535) route-map WORD -redistribute (1-65535) route-map WORD metric (0-4294967295) -router bgp -router bgp (1-4294967295) -router bgp (1-4294967295) WORD -set aggregator as (1-4294967295) A.B.C.D -set as-path exclude . (1-4294967295) -set as-path prepend (last-as) (1-10) -set as-path prepend . (1-4294967295) -set atomic-aggregate -set comm-list <(1-99)|(100-500)|WORD> delete -set community AA:NN -set community none -set extcommunity rt .ASN:nn_or_IP-address:nn -set extcommunity soo .ASN:nn_or_IP-address:nn -set ip next-hop A.B.C.D -set ip next-hop peer-address -set ip next-hop unchanged -set ipv6 next-hop global X:X::X:X -set ipv6 next-hop local X:X::X:X -set ipv6 next-hop peer-address -set local-preference (0-4294967295) -set metric -set metric <+/-metric> -set metric (0-4294967295) -set origin -set originator-id A.B.C.D -set tag (1-65535) -set vpnv4 next-hop A.B.C.D -set weight (0-4294967295) -show bgp statistics -show bgp update-groups -show bgp update-groups -show bgp update-groups SUBGROUP-ID -show bgp update-groups SUBGROUP-ID -show bgp BGP_INSTANCE_ALL_CMD summary [json] -show bgp BGP_INSTANCE_ALL_CMD update-groups -show bgp BGP_INSTANCE_ALL_CMD [json] -show bgp BGP_INSTANCE_CMD community -show bgp BGP_INSTANCE_CMD community -show bgp BGP_INSTANCE_CMD community -show bgp BGP_INSTANCE_CMD community -show bgp BGP_INSTANCE_CMD community -show bgp BGP_INSTANCE_CMD neighbors [json] -show bgp BGP_INSTANCE_CMD statistics -show bgp BGP_INSTANCE_CMD X:X::X:X [json] -show bgp BGP_INSTANCE_CMD X:X::X:X [json] -show bgp BGP_INSTANCE_CMD X:X::X:X/M [json] -show bgp BGP_INSTANCE_CMD X:X::X:X/M longer-prefixes -show bgp BGP_INSTANCE_CMD X:X::X:X/M [json] -show bgp BGP_INSTANCE_CMD community-list <(1-500)|WORD> -show bgp BGP_INSTANCE_CMD filter-list WORD -show bgp BGP_INSTANCE_CMD ipv6 summary [json] -show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X [json] -show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X [json] -show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M [json] -show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M longer-prefixes -show bgp BGP_INSTANCE_CMD ipv6 X:X::X:X/M [json] -show bgp BGP_INSTANCE_CMD ipv6 community-list <(1-500)|WORD> -show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD -show bgp BGP_INSTANCE_CMD ipv6 neighbors advertised-routes [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors dampened-routes [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors flap-statistics [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors prefix-counts [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors received prefix-filter [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors received-routes [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors routes [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] -show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] -show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD -show bgp BGP_INSTANCE_CMD ipv6 route-map WORD -show bgp BGP_INSTANCE_CMD ipv6 summary [json] -show bgp BGP_INSTANCE_CMD ipv6 [json] -show bgp BGP_INSTANCE_CMD neighbors advertised-routes [json] -show bgp BGP_INSTANCE_CMD neighbors dampened-routes [json] -show bgp BGP_INSTANCE_CMD neighbors flap-statistics [json] -show bgp BGP_INSTANCE_CMD neighbors received prefix-filter [json] -show bgp BGP_INSTANCE_CMD neighbors received-routes [json] -show bgp BGP_INSTANCE_CMD neighbors routes [json] -show bgp BGP_INSTANCE_CMD neighbors [json] -show bgp BGP_INSTANCE_CMD neighbors [json] -show bgp BGP_INSTANCE_CMD prefix-list WORD -show bgp BGP_INSTANCE_CMD route-map WORD -show bgp BGP_INSTANCE_CMD summary [json] -show bgp BGP_INSTANCE_CMD update-groups -show bgp BGP_INSTANCE_CMD update-groups -show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID -show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID -show bgp BGP_INSTANCE_CMD [json] -show bgp X:X::X:X [json] -show bgp X:X::X:X [json] -show bgp X:X::X:X/M [json] -show bgp X:X::X:X/M longer-prefixes -show bgp X:X::X:X/M [json] -show bgp community -show bgp community -show bgp community -show bgp community -show bgp community -show bgp community exact-match -show bgp community exact-match -show bgp community exact-match -show bgp community exact-match -show bgp community-list <(1-500)|WORD> -show bgp community-list <(1-500)|WORD> exact-match -show bgp filter-list WORD -show bgp ipv4 A.B.C.D [json] -show bgp ipv4 A.B.C.D [json] -show bgp ipv4 A.B.C.D/M [json] -show bgp ipv4 A.B.C.D/M [json] -show bgp ipv4 summary [json] -show bgp ipv4 [json] -show bgp ipv4 encap -show bgp ipv4 encap neighbors A.B.C.D advertised-routes -show bgp ipv4 encap neighbors A.B.C.D routes -show bgp ipv4 encap rd ASN:nn_or_IP-address:nn -show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes -show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors routes -show bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags -show bgp ipv4 encap tags -show bgp ipv6 X:X::X:X [json] -show bgp ipv6 X:X::X:X [json] -show bgp ipv6 X:X::X:X/M [json] -show bgp ipv6 X:X::X:X/M [json] -show bgp ipv6 summary [json] -show bgp ipv6 [json] -show bgp ipv6 X:X::X:X [json] -show bgp ipv6 X:X::X:X [json] -show bgp ipv6 X:X::X:X/M [json] -show bgp ipv6 X:X::X:X/M longer-prefixes -show bgp ipv6 X:X::X:X/M [json] -show bgp ipv6 community -show bgp ipv6 community -show bgp ipv6 community -show bgp ipv6 community -show bgp ipv6 community -show bgp ipv6 community exact-match -show bgp ipv6 community exact-match -show bgp ipv6 community exact-match -show bgp ipv6 community exact-match -show bgp ipv6 community-list <(1-500)|WORD> -show bgp ipv6 community-list <(1-500)|WORD> exact-match -show bgp ipv6 encap -show bgp ipv6 encap neighbors A.B.C.D advertised-routes -show bgp ipv6 encap neighbors A.B.C.D routes -show bgp ipv6 encap rd ASN:nn_or_IP-address:nn -show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes -show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors routes -show bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags -show bgp ipv6 encap tags -show bgp ipv6 filter-list WORD -show bgp ipv6 neighbors advertised-routes [json] -show bgp ipv6 neighbors dampened-routes [json] -show bgp ipv6 neighbors flap-statistics [json] -show bgp ipv6 neighbors prefix-counts [json] -show bgp ipv6 neighbors received prefix-filter [json] -show bgp ipv6 neighbors received-routes [json] -show bgp ipv6 neighbors routes [json] -show bgp ipv6 neighbors [json] -show bgp ipv6 neighbors [json] -show bgp ipv6 prefix-list WORD -show bgp ipv6 regexp LINE -show bgp ipv6 route-map WORD -show bgp ipv6 summary [json] -show bgp ipv6 [json] -show bgp memory -show bgp neighbors advertised-routes [json] -show bgp neighbors dampened-routes [json] -show bgp neighbors flap-statistics [json] -show bgp neighbors received prefix-filter [json] -show bgp neighbors received-routes [json] -show bgp neighbors routes [json] -show bgp neighbors [json] -show bgp neighbors [json] -show bgp prefix-list WORD -show bgp regexp LINE -show bgp route-map WORD -show bgp summary [json] -show bgp update-groups -show bgp update-groups -show bgp update-groups SUBGROUP-ID -show bgp update-groups SUBGROUP-ID -show bgp view WORD ipv4 summary [json] -show bgp views -show bgp vrfs [json] -show bgp [json] -show debugging bgp -show ip as-path-access-list -show ip as-path-access-list WORD -show ip bgp A.B.C.D [json] -show ip bgp A.B.C.D [json] -show ip bgp A.B.C.D/M [json] -show ip bgp A.B.C.D/M longer-prefixes -show ip bgp A.B.C.D/M [json] -show ip bgp BGP_INSTANCE_ALL_CMD neighbors [json] -show ip bgp BGP_INSTANCE_ALL_CMD nexthop -show ip bgp BGP_INSTANCE_ALL_CMD summary [json] -show ip bgp BGP_INSTANCE_ALL_CMD update-groups -show ip bgp BGP_INSTANCE_ALL_CMD [json] -show ip bgp BGP_INSTANCE_CMD A.B.C.D [json] -show ip bgp BGP_INSTANCE_CMD A.B.C.D [json] -show ip bgp BGP_INSTANCE_CMD A.B.C.D/M [json] -show ip bgp BGP_INSTANCE_CMD A.B.C.D/M longer-prefixes -show ip bgp BGP_INSTANCE_CMD A.B.C.D/M [json] -show ip bgp BGP_INSTANCE_CMD community-list <(1-500)|WORD> -show ip bgp BGP_INSTANCE_CMD filter-list WORD -show ip bgp BGP_INSTANCE_CMD neighbors advertised-routes route-map WORD [json] -show ip bgp BGP_INSTANCE_CMD neighbors advertised-routes [json] -show ip bgp BGP_INSTANCE_CMD neighbors prefix-counts [json] -show ip bgp BGP_INSTANCE_CMD neighbors received-routes route-map WORD [json] -show ip bgp BGP_INSTANCE_CMD neighbors received-routes [json] -show ip bgp BGP_INSTANCE_CMD neighbors routes [json] -show ip bgp BGP_INSTANCE_CMD neighbors [json] -show ip bgp BGP_INSTANCE_CMD neighbors [json] -show ip bgp BGP_INSTANCE_CMD nexthop -show ip bgp BGP_INSTANCE_CMD nexthop detail -show ip bgp BGP_INSTANCE_CMD peer-group -show ip bgp BGP_INSTANCE_CMD peer-group WORD -show ip bgp BGP_INSTANCE_CMD prefix-list WORD -show ip bgp BGP_INSTANCE_CMD route-map WORD -show ip bgp BGP_INSTANCE_CMD summary [json] -show ip bgp BGP_INSTANCE_CMD update-groups -show ip bgp BGP_INSTANCE_CMD update-groups -show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID -show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID -show ip bgp BGP_INSTANCE_CMD [json] -show ip bgp attribute-info -show ip bgp cidr-only -show ip bgp community -show ip bgp community -show ip bgp community -show ip bgp community -show ip bgp community -show ip bgp community exact-match -show ip bgp community exact-match -show ip bgp community exact-match -show ip bgp community exact-match -show ip bgp community-info -show ip bgp community-list <(1-500)|WORD> -show ip bgp community-list <(1-500)|WORD> exact-match -show ip bgp dampened-paths -show ip bgp dampening dampened-paths -show ip bgp dampening flap-statistics -show ip bgp dampening flap-statistics A.B.C.D -show ip bgp dampening flap-statistics A.B.C.D/M longer-prefixes -show ip bgp dampening flap-statistics cidr-only -show ip bgp dampening flap-statistics filter-list WORD -show ip bgp dampening flap-statistics prefix-list WORD -show ip bgp dampening flap-statistics regexp LINE -show ip bgp dampening flap-statistics route-map WORD -show ip bgp dampening parameters -show ip bgp filter-list WORD -show ip bgp flap-statistics -show ip bgp flap-statistics A.B.C.D -show ip bgp flap-statistics A.B.C.D/M -show ip bgp flap-statistics A.B.C.D/M longer-prefixes -show ip bgp flap-statistics cidr-only -show ip bgp flap-statistics filter-list WORD -show ip bgp flap-statistics prefix-list WORD -show ip bgp flap-statistics regexp LINE -show ip bgp flap-statistics route-map WORD -show ip bgp ipv4 A.B.C.D [json] -show ip bgp ipv4 A.B.C.D/M [json] -show ip bgp ipv4 A.B.C.D/M longer-prefixes -show ip bgp ipv4 A.B.C.D/M [json] -show ip bgp ipv4 cidr-only -show ip bgp ipv4 community -show ip bgp ipv4 community -show ip bgp ipv4 community -show ip bgp ipv4 community -show ip bgp ipv4 community -show ip bgp ipv4 community exact-match -show ip bgp ipv4 community exact-match -show ip bgp ipv4 community exact-match -show ip bgp ipv4 community exact-match -show ip bgp ipv4 community-list <(1-500)|WORD> -show ip bgp ipv4 community-list <(1-500)|WORD> exact-match -show ip bgp ipv4 filter-list WORD -show ip bgp ipv4 neighbors advertised-routes route-map WORD [json] -show ip bgp ipv4 neighbors advertised-routes [json] -show ip bgp ipv4 neighbors prefix-counts [json] -show ip bgp ipv4 neighbors received prefix-filter [json] -show ip bgp ipv4 neighbors received-routes route-map WORD [json] -show ip bgp ipv4 neighbors received-routes [json] -show ip bgp ipv4 neighbors routes [json] -show ip bgp ipv4 neighbors [json] -show ip bgp ipv4 neighbors [json] -show ip bgp ipv4 paths -show ip bgp ipv4 prefix-list WORD -show ip bgp ipv4 regexp LINE -show ip bgp ipv4 route-map WORD -show ip bgp ipv4 summary [json] -show ip bgp ipv4 [json] -show ip bgp neighbors advertised-routes route-map WORD [json] -show ip bgp neighbors advertised-routes [json] -show ip bgp neighbors dampened-routes [json] -show ip bgp neighbors flap-statistics [json] -show ip bgp neighbors prefix-counts [json] -show ip bgp neighbors received prefix-filter [json] -show ip bgp neighbors received-routes route-map WORD [json] -show ip bgp neighbors received-routes [json] -show ip bgp neighbors routes [json] -show ip bgp neighbors [json] -show ip bgp neighbors [json] -show ip bgp nexthop -show ip bgp nexthop detail -show ip bgp paths -show ip bgp peer-group -show ip bgp peer-group WORD -show ip bgp prefix-list WORD -show ip bgp regexp LINE -show ip bgp route-map WORD -show ip bgp summary [json] -show ip bgp update-groups -show ip bgp update-groups -show ip bgp update-groups SUBGROUP-ID -show ip bgp update-groups SUBGROUP-ID -show ip bgp view WORD ipv4 summary [json] -show ip bgp vpnv4 all -show ip bgp vpnv4 all A.B.C.D [json] -show ip bgp vpnv4 all A.B.C.D/M [json] -show ip bgp vpnv4 all neighbors prefix-counts [json] -show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes [json] -show ip bgp vpnv4 all neighbors A.B.C.D routes [json] -show ip bgp vpnv4 all neighbors A.B.C.D [json] -show ip bgp vpnv4 all neighbors [json] -show ip bgp vpnv4 all summary [json] -show ip bgp vpnv4 all tags -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] -show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags -show ip bgp [json] -show ip community-list -show ip community-list <(1-500)|WORD> -show ip extcommunity-list -show ip extcommunity-list <(1-500)|WORD> -show ipv6 bgp X:X::X:X [json] -show ipv6 bgp X:X::X:X/M longer-prefixes -show ipv6 bgp X:X::X:X/M [json] -show ipv6 bgp community -show ipv6 bgp community -show ipv6 bgp community -show ipv6 bgp community -show ipv6 bgp community -show ipv6 bgp community exact-match -show ipv6 bgp community exact-match -show ipv6 bgp community exact-match -show ipv6 bgp community exact-match -show ipv6 bgp community-list WORD -show ipv6 bgp community-list WORD exact-match -show ipv6 bgp filter-list WORD -show ipv6 bgp neighbors advertised-routes [json] -show ipv6 bgp neighbors received-routes [json] -show ipv6 bgp neighbors routes [json] -show ipv6 bgp prefix-list WORD -show ipv6 bgp regexp LINE -show ipv6 bgp summary [json] -show ipv6 bgp [json] -show ipv6 mbgp X:X::X:X [json] -show ipv6 mbgp X:X::X:X/M longer-prefixes -show ipv6 mbgp X:X::X:X/M [json] -show ipv6 mbgp community -show ipv6 mbgp community -show ipv6 mbgp community -show ipv6 mbgp community -show ipv6 mbgp community -show ipv6 mbgp community exact-match -show ipv6 mbgp community exact-match -show ipv6 mbgp community exact-match -show ipv6 mbgp community exact-match -show ipv6 mbgp community-list WORD -show ipv6 mbgp community-list WORD exact-match -show ipv6 mbgp filter-list WORD -show ipv6 mbgp neighbors advertised-routes [json] -show ipv6 mbgp neighbors received-routes [json] -show ipv6 mbgp neighbors routes [json] -show ipv6 mbgp prefix-list WORD -show ipv6 mbgp regexp LINE -show ipv6 mbgp summary [json] -show ipv6 mbgp [json] -table-map WORD -timers bgp (0-65535) (0-65535) -update-delay (0-3600) -update-delay (0-3600) (1-3600) -write-quanta (1-10000) From 9b887497e855b3fbd818a51df7c089c7a9943575 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 10 Aug 2016 19:11:31 +0000 Subject: [PATCH 047/280] lib: Remove debug fprintf for cmd_element copy Signed-off-by: Quentin Young --- lib/command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/command.c b/lib/command.c index d3c6771248..faaa50a6f2 100644 --- a/lib/command.c +++ b/lib/command.c @@ -4210,7 +4210,6 @@ copy_cmd_element(struct cmd_element *cmd) el->daemon = cmd->daemon; el->tokens = cmd->tokens ? vector_copy(cmd->tokens) : NULL; el->attr = cmd->attr; - fprintf(stderr, "successful copy\n"); return el; } From 55589d304c7b5765068ae75d5223d4ff634b7fc3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 11 Aug 2016 17:50:58 +0000 Subject: [PATCH 048/280] lib: Refactor CLI interface function names Signed-off-by: Quentin Young --- lib/command_graph.c | 12 +++---- lib/command_graph.h | 8 ++--- lib/command_match.c | 26 ++++++++------- lib/command_match.h | 14 ++++---- lib/command_parse.y | 75 ++++++++++++++++++++++--------------------- lib/grammar_sandbox.c | 10 +++--- 6 files changed, 74 insertions(+), 71 deletions(-) diff --git a/lib/command_graph.c b/lib/command_graph.c index f249935771..323bd3e953 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -26,7 +26,7 @@ #include "memory.h" struct graph_node * -add_node (struct graph_node *parent, struct graph_node *child) +graphnode_add_child (struct graph_node *parent, struct graph_node *child) { vector_set (parent->children, child); child->refs++; @@ -34,7 +34,7 @@ add_node (struct graph_node *parent, struct graph_node *child) } struct graph_node * -new_node (enum graph_node_type type) +graphnode_new (enum graph_node_type type) { struct graph_node *node = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); @@ -46,7 +46,7 @@ new_node (enum graph_node_type type) } void -delete_node (struct graph_node *node) +graphnode_delete (struct graph_node *node) { if (!node) return; if (node->children) vector_free (node->children); @@ -57,17 +57,17 @@ delete_node (struct graph_node *node) } void -delete_graph (struct graph_node *start) +graphnode_delete_graph (struct graph_node *start) { if (start && start->children && vector_active (start->children) > 0) { for (unsigned int i = 0; i < vector_active (start->children); i++) { - delete_graph (vector_slot(start->children, i)); + graphnode_delete (vector_slot(start->children, i)); vector_unset (start->children, i); } } if (--(start->refs) == 0) - delete_node (start); + graphnode_delete (start); } diff --git a/lib/command_graph.h b/lib/command_graph.h index e42b8336e5..a2f84e3a0f 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -83,7 +83,7 @@ struct graph_node * @return child node */ struct graph_node * -add_node (struct graph_node *parent, struct graph_node *child); +graphnode_add_child (struct graph_node *parent, struct graph_node *child); /** * Creates a new node, initializes all fields to default values and sets the @@ -93,7 +93,7 @@ add_node (struct graph_node *parent, struct graph_node *child); * @return pointer to the created node */ struct graph_node * -new_node (enum graph_node_type type); +graphnode_new (enum graph_node_type type); /** * Deletes a graph node without deleting its children. @@ -101,7 +101,7 @@ new_node (enum graph_node_type type); * @param[out] node pointer to node to delete */ void -delete_node (struct graph_node *node); +graphnode_delete (struct graph_node *node); /** * Deletes a graph node and recursively deletes all its direct and indirect @@ -110,6 +110,6 @@ delete_node (struct graph_node *node); * @param[out] node start node of graph to free */ void -delete_graph (struct graph_node *node); +graphnode_delete_graph (struct graph_node *node); #endif /* _ZEBRA_COMMAND_GRAPH_H */ diff --git a/lib/command_match.c b/lib/command_match.c index d5efa39686..95891dd823 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -32,7 +32,7 @@ static int add_nexthops (struct list *, struct graph_node *); static struct list * -match_command_r (struct graph_node *, vector, unsigned int); +command_match_r (struct graph_node *, vector, unsigned int); static int score_precedence (enum graph_node_type); @@ -87,7 +87,7 @@ match_variable (struct graph_node *node, const char *word); static enum matcher_rv matcher_rv; enum matcher_rv -match_command (struct graph_node *start, +command_match (struct graph_node *start, vector vline, struct list **argv, struct cmd_element **el) @@ -100,7 +100,7 @@ match_command (struct graph_node *start, memcpy (vvline->index + 1, vline->index, sizeof (void *) * vline->alloced); vvline->active = vline->active + 1; - if ((*argv = match_command_r (start, vvline, 0))) // successful match + if ((*argv = command_match_r (start, vvline, 0))) // successful match { list_delete_node (*argv, listhead (*argv)); struct graph_node *end = listgetdata (listtail (*argv)); @@ -160,7 +160,7 @@ match_command (struct graph_node *start, * @param[in] n the index of the first input token. */ static struct list * -match_command_r (struct graph_node *start, vector vline, unsigned int n) +command_match_r (struct graph_node *start, vector vline, unsigned int n) { assert (n < vector_active (vline)); @@ -201,7 +201,7 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } // else recurse on candidate child node - struct list *result = match_command_r (gn, vline, n+1); + struct list *result = command_match_r (gn, vline, n+1); // save the best match if (result && currbest) @@ -242,7 +242,9 @@ match_command_r (struct graph_node *start, vector vline, unsigned int n) } enum matcher_rv -match_command_complete (struct graph_node *start, vector vline, struct list **completions) +command_complete (struct graph_node *start, + vector vline, + struct list **completions) { // pointer to next input token to match char *token; @@ -320,12 +322,12 @@ compare_completions (const void *fst, const void *snd) } enum matcher_rv -match_command_complete_str (struct graph_node *start, - vector vline, - vector completions) +command_complete_str (struct graph_node *start, + vector vline, + vector completions) { struct list *comps; - enum matcher_rv rv = match_command_complete (start, vline, &comps); + enum matcher_rv rv = command_complete (start, vline, &comps); // quick n' dirty deduplication fn here, prolly like O(n^n) struct listnode *ln; @@ -522,7 +524,7 @@ disambiguate (struct list *first, static struct graph_node * copy_node (struct graph_node *node) { - struct graph_node *new = new_node(node->type); + struct graph_node *new = graphnode_new(node->type); new->children = NULL; new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; new->value = node->value; @@ -540,7 +542,7 @@ copy_node (struct graph_node *node) static void delete_nodelist (void *node) { - delete_node ((struct graph_node *) node); + graphnode_delete ((struct graph_node *) node); } diff --git a/lib/command_match.h b/lib/command_match.h index e8a408495e..765b189496 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -75,7 +75,7 @@ enum match_type * @return matcher status */ enum matcher_rv -match_command (struct graph_node *start, +command_match (struct graph_node *start, vector vline, struct list **argv, struct cmd_element **element); @@ -89,9 +89,9 @@ match_command (struct graph_node *start, * @return matcher status */ enum matcher_rv -match_command_complete (struct graph_node *start, - vector vline, - struct list **completions); +command_complete (struct graph_node *start, + vector vline, + struct list **completions); /** @@ -103,8 +103,8 @@ match_command_complete (struct graph_node *start, * @return matcher status */ enum matcher_rv -match_command_complete_str (struct graph_node *start, - vector vline, - vector completions); +command_complete_str (struct graph_node *start, + vector vline, + vector completions); #endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index df90f64edb..da1a117b5d 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -50,7 +50,7 @@ /* functionality this unit exports */ %code provides { struct graph_node * - parse_command_format (struct graph_node *, struct cmd_element *); + command_parse_format (struct graph_node *, struct cmd_element *); /* maximum length of a number, lexer will not match anything longer */ #define DECIMAL_STRLEN_MAX 20 @@ -156,7 +156,7 @@ start: | sentence_root cmd_token_seq '.' placeholder_token { if ((currnode = node_replace (currnode, $4)) != $4) - delete_node ($4); + graphnode_delete ($4); // adding a node as a child of itself accepts any number // of the same token, which is what we want for varags @@ -168,7 +168,7 @@ start: sentence_root: WORD { - struct graph_node *root = new_node (WORD_GN); + struct graph_node *root = graphnode_new (WORD_GN); root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); root->doc = doc_next(); @@ -183,23 +183,23 @@ cmd_token: placeholder_token { if ((currnode = node_replace (currnode, $1)) != $1) - delete_node ($1); + graphnode_delete ($1); } | literal_token { if ((currnode = node_replace (currnode, $1)) != $1) - delete_node ($1); + graphnode_delete ($1); } /* selectors and options are subgraphs with start and end nodes */ | selector { - add_node (currnode, $1); + graphnode_add_child (currnode, $1); currnode = selnode_end; selnode_start = selnode_end = NULL; } | option { - add_node (currnode, $1); + graphnode_add_child (currnode, $1); currnode = optnode_end; optnode_start = optnode_end = NULL; } @@ -213,42 +213,42 @@ cmd_token_seq: placeholder_token: IPV4 { - $$ = new_node (IPV4_GN); + $$ = graphnode_new (IPV4_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV4_PREFIX { - $$ = new_node (IPV4_PREFIX_GN); + $$ = graphnode_new (IPV4_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV6 { - $$ = new_node (IPV6_GN); + $$ = graphnode_new (IPV6_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | IPV6_PREFIX { - $$ = new_node (IPV6_PREFIX_GN); + $$ = graphnode_new (IPV6_PREFIX_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | VARIABLE { - $$ = new_node (VARIABLE_GN); + $$ = graphnode_new (VARIABLE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | RANGE { - $$ = new_node (RANGE_GN); + $$ = graphnode_new (RANGE_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); @@ -268,14 +268,14 @@ placeholder_token: literal_token: WORD { - $$ = new_node (WORD_GN); + $$ = graphnode_new (WORD_GN); $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); $$->doc = doc_next(); free ($1); } | NUMBER { - $$ = new_node (NUMBER_GN); + $$ = graphnode_new (NUMBER_GN); $$->value = yylval.number; $$->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); snprintf($$->text, DECIMAL_STRLEN_MAX, "%lld", $$->value); @@ -301,25 +301,25 @@ selector_element: selector_element_root selector_token_seq // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { // if one is null assert(!selnode_start && !selnode_end); // both should be null - selnode_start = new_node (SELECTOR_GN); // diverging node - selnode_end = new_node (NUL_GN); // converging node + selnode_start = graphnode_new (SELECTOR_GN); // diverging node + selnode_end = graphnode_new (NUL_GN); // converging node } // add element head as a child of the selector - add_node (selnode_start, $1); + graphnode_add_child (selnode_start, $1); if ($2->type != NUL_GN) { - add_node ($1, seqhead); - add_node ($2, selnode_end); + graphnode_add_child ($1, seqhead); + graphnode_add_child ($2, selnode_end); } else - add_node ($1, selnode_end); + graphnode_add_child ($1, selnode_end); seqhead = NULL; } selector_token_seq: - %empty { $$ = new_node (NUL_GN); } + %empty { $$ = graphnode_new (NUL_GN); } | selector_token_seq selector_token { // if the sequence component is NUL_GN, this is a sequence start @@ -328,7 +328,7 @@ selector_token_seq: seqhead = $2; } else // chain on new node - add_node ($1, $2); + graphnode_add_child ($1, $2); $$ = $2; } @@ -347,7 +347,7 @@ selector_token: option: '[' option_part ']' { // add null path - add_node (optnode_start, optnode_end); + graphnode_add_child (optnode_start, optnode_end); $$ = optnode_start; }; @@ -361,12 +361,12 @@ option_element: { if (!optnode_start || !optnode_end) { assert(!optnode_start && !optnode_end); - optnode_start = new_node (OPTION_GN); - optnode_end = new_node (NUL_GN); + optnode_start = graphnode_new (OPTION_GN); + optnode_end = graphnode_new (NUL_GN); } - add_node (optnode_start, seqhead); - add_node ($1, optnode_end); + graphnode_add_child (optnode_start, seqhead); + graphnode_add_child ($1, optnode_end); seqhead = NULL; } @@ -374,7 +374,7 @@ option_token_seq: option_token { $$ = seqhead = $1; } | option_token_seq option_token -{ $$ = add_node ($1, $2); } +{ $$ = graphnode_add_child ($1, $2); } ; option_token: @@ -385,7 +385,7 @@ option_token: %% struct graph_node * -parse_command_format(struct graph_node *start, struct cmd_element *cmd) +command_parse_format (struct graph_node *start, struct cmd_element *cmd) { // set to 1 to enable parser traces yydebug = 0; @@ -431,13 +431,13 @@ terminate_graph (struct graph_node *startnode, struct graph_node *finalnode, struct cmd_element *element) { - struct graph_node *end = new_node (END_GN); + struct graph_node *end = graphnode_new (END_GN); end->element = element; end->text = XSTRDUP(MTYPE_CMD_TOKENS, ""); if (node_exists (finalnode, end)) yyerror (element, startnode, "Duplicate command."); else - add_node (finalnode, end); + graphnode_add_child (finalnode, end); } static char * @@ -466,7 +466,7 @@ static struct graph_node * node_replace (struct graph_node *parent, struct graph_node *child) { struct graph_node *existing = node_exists (parent, child); - return existing ? existing : add_node (parent, child); + return existing ? existing : graphnode_add_child (parent, child); } static int @@ -492,10 +492,11 @@ cmp_node (struct graph_node *first, struct graph_node *second) case NUMBER_GN: if (first->value != second->value) return 0; break; - /* selectors and options should be equal if their subgraphs are equal, but - * the graph isomorphism problem is not known to be solvable in polynomial time - * so we consider selectors and options inequal in all cases; ultimately this - * forks the graph, but the matcher can handle this regardless + /* selectors and options should be equal if their subgraphs are equal, + * but the graph isomorphism problem is not known to be solvable in + * polynomial time so we consider selectors and options inequal in all + * cases; ultimately this forks the graph, but the matcher can handle + * this regardless */ case SELECTOR_GN: case OPTION_GN: diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 899d0469ab..92a0ae304e 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -69,7 +69,7 @@ DEFUN (grammar_test, cmd->tokens = vector_init(VECTOR_MIN_SIZE); // parse the command and install it into the command graph - parse_command_format (nodegraph, cmd); + command_parse_format (nodegraph, cmd); // free resources free (command); @@ -93,7 +93,7 @@ DEFUN (grammar_test_complete, vector completions = vector_init (VECTOR_MIN_SIZE); enum matcher_rv result = - match_command_complete_str (nodegraph, command, completions); + command_complete_str (nodegraph, command, completions); // print completions or relevant error message if (!MATCHER_ERROR(result)) @@ -130,7 +130,7 @@ DEFUN (grammar_test_match, struct list *argvv = NULL; struct cmd_element *element = NULL; - enum matcher_rv result = match_command (nodegraph, command, &argvv, &element); + enum matcher_rv result = command_match (nodegraph, command, &argvv, &element); // print completions or relevant error message if (element) @@ -200,7 +200,7 @@ DEFUN (grammar_test_doc, cmd->tokens = vector_init (VECTOR_MIN_SIZE); // parse element - parse_command_format (nodegraph, cmd); + command_parse_format (nodegraph, cmd); return CMD_SUCCESS; } @@ -224,7 +224,7 @@ DEFUN (grammar_test_show, /* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init() { zlog_info ("Initializing grammar testing shim"); - nodegraph = new_node(START_GN); + nodegraph = graphnode_new (START_GN); install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); install_element (ENABLE_NODE, &grammar_test_match_cmd); From 16d7c05093f0f3a24d09f9780afc1ea114e73f94 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 1 Sep 2016 21:27:33 +0000 Subject: [PATCH 049/280] lib: Generalize graph to work for any data type Signed-off-by: Quentin Young --- lib/Makefile.am | 4 +- lib/command_graph.c | 73 ---------------------------- lib/command_graph.h | 115 -------------------------------------------- lib/graph.c | 113 +++++++++++++++++++++++++++++++++++++++++++ lib/graph.h | 99 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 214 insertions(+), 190 deletions(-) delete mode 100644 lib/command_graph.c delete mode 100644 lib/command_graph.h create mode 100644 lib/graph.c create mode 100644 lib/graph.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 2df5ed61f4..d12f9ed6d9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,7 +11,7 @@ libzebra_la_LDFLAGS = -version-info 0:0:0 libzebra_la_SOURCES = \ network.c pid_output.c getopt.c getopt1.c daemon.c \ checksum.c vector.c linklist.c vty.c \ - command_graph.c command_parse.y command_lex.l command_match.c grammar_sandbox.c \ + graph.c command_parse.y command_lex.l command_match.c grammar_sandbox.c \ command.c \ sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \ filter.c routemap.c distribute.c stream.c str.c log.c plist.c \ @@ -28,7 +28,7 @@ libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@ pkginclude_HEADERS = \ buffer.h checksum.h filter.h getopt.h hash.h \ if.h linklist.h log.h \ - command_graph.h command_match.h grammar_sandbox.h \ + graph.h command_match.h grammar_sandbox.h \ command.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \ diff --git a/lib/command_graph.c b/lib/command_graph.c deleted file mode 100644 index 323bd3e953..0000000000 --- a/lib/command_graph.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Graph data structure and companion routines for CLI backend. - * - * -- - * Copyright (C) 2016 Cumulus Networks, Inc. - * - * This file is part of GNU Zebra. - * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * GNU Zebra is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#include -#include "command_graph.h" -#include "memory.h" - -struct graph_node * -graphnode_add_child (struct graph_node *parent, struct graph_node *child) -{ - vector_set (parent->children, child); - child->refs++; - return child; -} - -struct graph_node * -graphnode_new (enum graph_node_type type) -{ - struct graph_node *node = - XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); - - node->type = type; - node->children = vector_init(VECTOR_MIN_SIZE); - - return node; -} - -void -graphnode_delete (struct graph_node *node) -{ - if (!node) return; - if (node->children) vector_free (node->children); - if (node->element) free_cmd_element (node->element); - free (node->text); - free (node->arg); - free (node); -} - -void -graphnode_delete_graph (struct graph_node *start) -{ - if (start && start->children && vector_active (start->children) > 0) - { - for (unsigned int i = 0; i < vector_active (start->children); i++) - { - graphnode_delete (vector_slot(start->children, i)); - vector_unset (start->children, i); - } - } - - if (--(start->refs) == 0) - graphnode_delete (start); -} diff --git a/lib/command_graph.h b/lib/command_graph.h deleted file mode 100644 index a2f84e3a0f..0000000000 --- a/lib/command_graph.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Graph data structure and companion routines for CLI backend. - * - * -- - * Copyright (C) 2016 Cumulus Networks, Inc. - * - * This file is part of GNU Zebra. - * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * GNU Zebra is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _ZEBRA_COMMAND_GRAPH_H -#define _ZEBRA_COMMAND_GRAPH_H - -#include "command.h" - -/** - * Types for graph nodes. - * - * The node type determines what kind of data the node can match (in the - * matching use case) or hold (in the argv use case). - */ -enum graph_node_type -{ - IPV4_GN, // IPV4 addresses - IPV4_PREFIX_GN, // IPV4 network prefixes - IPV6_GN, // IPV6 prefixes - IPV6_PREFIX_GN, // IPV6 network prefixes - WORD_GN, // words - RANGE_GN, // integer ranges - NUMBER_GN, // numbers - VARIABLE_GN, // almost anything - /* plumbing types */ - SELECTOR_GN, // marks beginning of selector subgraph - OPTION_GN, // marks beginning of option subgraph - NUL_GN, // transparent node with various uses - START_GN, // first node in the graph (has no parents) - END_GN // leaf node in the graph, has pointer to cmd_element -}; - -/** - * Command graph node. - * Used for matching and passing arguments to vtysh commands. - */ -struct graph_node -{ - enum graph_node_type type; // data type this node matches or holds - vector children; // this node's children - - char *text; // original format text - char *doc; // docstring for this node - long long value; // for NUMBER_GN - long long min, max; // for RANGE_GN - - /* cmd_element struct pointer, only valid for END_GN */ - struct cmd_element *element; - - /* used for passing arguments to command functions */ - char *arg; - - /* refcount for node parents */ - unsigned int refs; -}; - -/** - * Adds a node as a child of another node. - * - * @param[in] parent node - * @param[in] child node - * @return child node - */ -struct graph_node * -graphnode_add_child (struct graph_node *parent, struct graph_node *child); - -/** - * Creates a new node, initializes all fields to default values and sets the - * node type. - * - * @param[in] type node type - * @return pointer to the created node - */ -struct graph_node * -graphnode_new (enum graph_node_type type); - -/** - * Deletes a graph node without deleting its children. - * - * @param[out] node pointer to node to delete - */ -void -graphnode_delete (struct graph_node *node); - -/** - * Deletes a graph node and recursively deletes all its direct and indirect - * children. - * - * @param[out] node start node of graph to free - */ -void -graphnode_delete_graph (struct graph_node *node); - -#endif /* _ZEBRA_COMMAND_GRAPH_H */ diff --git a/lib/graph.c b/lib/graph.c new file mode 100644 index 0000000000..a46f71449d --- /dev/null +++ b/lib/graph.c @@ -0,0 +1,113 @@ +/* + * Graph data structure. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +#include +#include "command_graph.h" +#include "memory.h" + + +struct graph_node * +graph_new_node (struct graph *graph, void *data, void (*del) (void*)) +{ + struct graph_node *node = + XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); + + node->from = vector_init(VECTOR_MIN_SIZE); + node->to = vector_init(VECTOR_MIN_SIZE); + node->data = data; + node->del = del; + + vector_set (graph->nodes, node); + + return node; +} + +void +graph_delete_node (struct graph *graph, struct graph_node *node) +{ + if (!node) return; + + // an adjacent node + struct graph_node *adj; + + // for all nodes that have an edge to us, remove us from their ->to + for (int i = 0; i < vector_active (node->from); i++) + { + adj = vector_slot (node->from, i); + for (int j = 0; j < vector_active (adj->to); j++) + if (vector_slot (adj->to, j) == node) + vector_unset (adj->to, j); + + // if the node is orphaned, delete it + if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) + graph_delete_node (adj); + } + + // for all nodes that we have an edge to, remove us from their ->from + for (int i = 0; i < vector_active (node->to); i++) + { + adj = vector_slot (node->to, i); + for (int j = 0; j < vector_active (adj->from); j++) + if (vector_slot (adj->from, j) == node) + vector_unset (adj->from, j); + + // if the node is orphaned, delete it + if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) + graph_delete_node (adj); + } + + // if there is a deletion callback, call it! + if (node->del && node->data) + (*node->del) (node->data); + + // free adjacency lists + vector_free (node->to); + vector_free (node->from); + + // remove node from graph->nodes + for (int i = 0; i < vector_active (graph->nodes); i++) + if (vector_slot (graph->nodes, i) == node) + vector_unset (graph->nodes, i); + + // free the node itself + free (node); +} + +struct graph_node * +graph_add_edge (struct graph_node *from, struct graph_node *to) +{ + vector_set (from->to, to); + vector_set (to->from, from); + return to; +} + +void +graph_delete_graph (struct graph *graph) +{ + // delete each node in the graph + for (int i = 0; i < vector_active (graph->nodes); i++) + graph_delete_node (vector_slot (graph->nodes, i)); + + vector_free (graph->nodes); + free (graph); +} diff --git a/lib/graph.h b/lib/graph.h new file mode 100644 index 0000000000..7c0f848001 --- /dev/null +++ b/lib/graph.h @@ -0,0 +1,99 @@ +/* + * Graph data structure. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _ZEBRA_COMMAND_GRAPH_H +#define _ZEBRA_COMMAND_GRAPH_H + +#include "vector.h" + +/** + * Graph structure. + */ +struct graph +{ + vector nodes; // all nodes in the graph +} + +/** + * Graph node / vertex. + */ +struct graph_node +{ + vector from; // nodes which have edges to this node + vector to; // nodes which this node has edges to + + void *data; // node data + void (*del) (void *data) // deletion callback +}; + +/** + * Creates a new node. + * + * @struct graph the graph this node exists in + * @param[in] data this node's data + * @param[in] del data deletion callback + * @return the new node + */ +struct graph_node * +graph_new_node (struct graph *graph, void *data, void (*del) (void*)); + +/** + * Deletes a node. + * + * Before deletion, this function removes all edges to and from this node from + * any neighbor nodes. + * + * If, as a result of this operation, any neighbor node has no edges either to + * or from itself, that node will be deleted as well. If the graph topology is + * e.g. a star this will result in the deletion of all nodes. + * + * If *data and *del are non-null, the following call is made: + * (*node->del) (node->data); + * + * @param[out] node pointer to node to delete + */ +void +graph_delete_node (struct graph *graph, struct graph_node *node); + +/** + * Makes a directed edge between two nodes. + * + * @param[in] from + * @param[in] to + * @return to + */ +struct graph_node * +graph_add_edge (struct graph_node *from, struct graph_node *to); + +/** + * Deletes a graph. + * + * Calls graph_delete_node on each node before freeing the graph struct itself. + * + * @param graph the graph to delete + */ +void +graph_delete_graph (struct graph *graph); + +#endif /* _ZEBRA_COMMAND_GRAPH_H */ From 7a6ded40965d341456cdd5882c61ca4e22913c2b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 2 Sep 2016 20:19:03 +0000 Subject: [PATCH 050/280] lib: Refactor command_parse.y for graph ds Signed-off-by: Quentin Young --- lib/command_parse.y | 151 ++++++++++++++++++++++-------------------- lib/grammar_sandbox.h | 51 ++++++++++++++ lib/graph.c | 12 ++-- 3 files changed, 137 insertions(+), 77 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index da1a117b5d..750054b5c4 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -34,7 +34,7 @@ /* required external units */ %code requires { #include "command.h" - #include "command_graph.h" + #include "graph.h" #include "memory.h" extern int @@ -49,8 +49,8 @@ /* functionality this unit exports */ %code provides { - struct graph_node * - command_parse_format (struct graph_node *, struct cmd_element *); + struct graph * + command_parse_format (struct graph *, struct cmd_element *); /* maximum length of a number, lexer will not match anything longer */ #define DECIMAL_STRLEN_MAX 20 @@ -105,7 +105,7 @@ /* helper functions for parser */ static char * - doc_next(void); + doc_next (void); static struct graph_node * node_exists (struct graph_node *, struct graph_node *); @@ -127,7 +127,7 @@ /* yyparse parameters */ %parse-param { struct cmd_element *element } -%parse-param { struct graph_node *startnode } +%parse-param { struct graph *graph } /* called automatically before yyparse */ %initial-action { @@ -156,7 +156,7 @@ start: | sentence_root cmd_token_seq '.' placeholder_token { if ((currnode = node_replace (currnode, $4)) != $4) - graphnode_delete ($4); + graph_delete_node ($4); // adding a node as a child of itself accepts any number // of the same token, which is what we want for varags @@ -168,9 +168,8 @@ start: sentence_root: WORD { - struct graph_node *root = graphnode_new (WORD_GN); - root->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - root->doc = doc_next(); + struct graph_node *root = + new_token_node (WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); if ((currnode = node_replace (startnode, root)) != root) free (root); @@ -183,23 +182,23 @@ cmd_token: placeholder_token { if ((currnode = node_replace (currnode, $1)) != $1) - graphnode_delete ($1); + graph_delete_node ($1); } | literal_token { if ((currnode = node_replace (currnode, $1)) != $1) - graphnode_delete ($1); + graph_delete_node ($1); } /* selectors and options are subgraphs with start and end nodes */ | selector { - graphnode_add_child (currnode, $1); + graph_add_edge (currnode, $1); currnode = selnode_end; selnode_start = selnode_end = NULL; } | option { - graphnode_add_child (currnode, $1); + graph_add_edge (currnode, $1); currnode = optnode_end; optnode_start = optnode_end = NULL; } @@ -213,53 +212,42 @@ cmd_token_seq: placeholder_token: IPV4 { - $$ = graphnode_new (IPV4_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (IPV4_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV4_PREFIX { - $$ = graphnode_new (IPV4_PREFIX_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (IPV4_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV6 { - $$ = graphnode_new (IPV6_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (IPV6_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV6_PREFIX { - $$ = graphnode_new (IPV6_PREFIX_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (IPV6_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | VARIABLE { - $$ = graphnode_new (VARIABLE_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (VARIABLE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | RANGE { - $$ = graphnode_new (RANGE_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (RANGE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + cmd_token_t token = (cmd_token_t *) $$->data; // get the numbers out yylval.string++; - $$->min = strtoll (yylval.string, &yylval.string, 10); + token->min = strtoll (yylval.string, &yylval.string, 10); strsep (&yylval.string, "-"); - $$->max = strtoll (yylval.string, &yylval.string, 10); + token->max = strtoll (yylval.string, &yylval.string, 10); // validate range - if ($$->min >= $$->max) yyerror (element, startnode, "Invalid range."); + if (token->min >= token->max) yyerror (element, startnode, "Invalid range."); free ($1); } @@ -268,18 +256,17 @@ placeholder_token: literal_token: WORD { - $$ = graphnode_new (WORD_GN); - $$->text = XSTRDUP(MTYPE_CMD_TOKENS, $1); - $$->doc = doc_next(); + $$ = new_token_node (WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | NUMBER { - $$ = graphnode_new (NUMBER_GN); - $$->value = yylval.number; - $$->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); - snprintf($$->text, DECIMAL_STRLEN_MAX, "%lld", $$->value); - $$->doc = doc_next(); + $$ = new_token_node (NUMBER_TKN, NULL, doc_next()); + cmd_token_t token = (cmd_token_t *) $$->data; + + token->value = yylval.number; + token->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); + snprintf(token->text, DECIMAL_STRLEN_MAX, "%lld", token->value); } ; @@ -299,27 +286,27 @@ selector_part: selector_element: selector_element_root selector_token_seq { // if the selector start and end do not exist, create them - if (!selnode_start || !selnode_end) { // if one is null - assert(!selnode_start && !selnode_end); // both should be null - selnode_start = graphnode_new (SELECTOR_GN); // diverging node - selnode_end = graphnode_new (NUL_GN); // converging node + if (!selnode_start || !selnode_end) { + assert(!selnode_start && !selnode_end); + selnode_start = new_token_node (SELECTOR_TKN, NULL, NULL); + selnode_end = new_token_node (NUL_TKN, NULL, NULL); } // add element head as a child of the selector - graphnode_add_child (selnode_start, $1); + graph_add_edge (selnode_start, $1); if ($2->type != NUL_GN) { - graphnode_add_child ($1, seqhead); - graphnode_add_child ($2, selnode_end); + graph_add_edge ($1, seqhead); + graph_add_edge ($2, selnode_end); } else - graphnode_add_child ($1, selnode_end); + graph_add_edge ($1, selnode_end); seqhead = NULL; } selector_token_seq: - %empty { $$ = graphnode_new (NUL_GN); } + %empty { $$ = new_token_node (NUL_TKN, NULL, NULL); } | selector_token_seq selector_token { // if the sequence component is NUL_GN, this is a sequence start @@ -328,7 +315,7 @@ selector_token_seq: seqhead = $2; } else // chain on new node - graphnode_add_child ($1, $2); + graph_add_edge ($1, $2); $$ = $2; } @@ -347,7 +334,7 @@ selector_token: option: '[' option_part ']' { // add null path - graphnode_add_child (optnode_start, optnode_end); + graph_add_edge (optnode_start, optnode_end); $$ = optnode_start; }; @@ -361,12 +348,12 @@ option_element: { if (!optnode_start || !optnode_end) { assert(!optnode_start && !optnode_end); - optnode_start = graphnode_new (OPTION_GN); - optnode_end = graphnode_new (NUL_GN); + optnode_start = new_token_node (OPTION_TKN, NULL, NULL); + optnode_end = new_token_node (NUL_TKN, NULL, NULL); } - graphnode_add_child (optnode_start, seqhead); - graphnode_add_child ($1, optnode_end); + graph_add_edge (optnode_start, seqhead); + graph_add_edge ($1, optnode_end); seqhead = NULL; } @@ -374,7 +361,7 @@ option_token_seq: option_token { $$ = seqhead = $1; } | option_token_seq option_token -{ $$ = graphnode_add_child ($1, $2); } +{ $$ = graph_add_edge ($1, $2); } ; option_token: @@ -393,7 +380,7 @@ command_parse_format (struct graph_node *start, struct cmd_element *cmd) // parse command into DFA yyparse (cmd, start); - /* cleanup */ + // cleanup cleanup (); return start; @@ -431,13 +418,12 @@ terminate_graph (struct graph_node *startnode, struct graph_node *finalnode, struct cmd_element *element) { - struct graph_node *end = graphnode_new (END_GN); - end->element = element; - end->text = XSTRDUP(MTYPE_CMD_TOKENS, ""); - if (node_exists (finalnode, end)) + struct graph_node *end = graph_new_node (graph, element, &cmd_delete_element); + + if (node_adjacent (finalnode, end)) yyerror (element, startnode, "Duplicate command."); else - graphnode_add_child (finalnode, end); + graph_add_edge (finalnode, end); } static char * @@ -450,14 +436,30 @@ doc_next() } static struct graph_node * -node_exists (struct graph_node *parent, struct graph_node *child) +new_token_node (cmd_token_type_t type, char *text, char *doc) { - struct graph_node *p_child; - for (unsigned int i = 0; i < vector_active (parent->children); i++) + struct cmd_token_t *token = + XMALLOC(MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); + + token->type = type; + token->text = text; + token->desc = doc; + + return graph_new_node (graph, token, &cmd_delete_token); +} + +/** + * Determines if a node is adjacent to another node + */ +static struct graph_node * +node_adjacent (struct graph_node *node, struct graph_node *neighbor) +{ + struct graph_node *adj; + for (unsigned int i = 0; i < vector_active (node->to); i++) { - p_child = vector_slot (parent->children, i); - if (cmp_node (child, p_child)) - return p_child; + adj = vector_slot (node->to, i); + if (cmp_node (neighbor, adj)) + return adj; } return NULL; } @@ -465,13 +467,16 @@ node_exists (struct graph_node *parent, struct graph_node *child) static struct graph_node * node_replace (struct graph_node *parent, struct graph_node *child) { - struct graph_node *existing = node_exists (parent, child); - return existing ? existing : graphnode_add_child (parent, child); + struct graph_node *existing = node_adjacent (parent, child); + return existing ? existing : graph_add_edge (parent, child); } static int -cmp_node (struct graph_node *first, struct graph_node *second) +cmp_token (struct cmd_token_t *first, struct cmd_token_t *second) { + struct cmd_token_t *first = (cmd_token *) firstgn->data; + struct cmd_token_t *second = (cmd_token *) secondgn->data; + // compare types if (first->type != second->type) return 0; diff --git a/lib/grammar_sandbox.h b/lib/grammar_sandbox.h index 2b2c742461..98d987668f 100644 --- a/lib/grammar_sandbox.h +++ b/lib/grammar_sandbox.h @@ -1,2 +1,53 @@ +#include "memory.h" + void grammar_sandbox_init(void); + +/** + * Types for tokens. + * + * The type determines what kind of data the token can match (in the + * matching use case) or hold (in the argv use case). + */ +enum cmd_token_type_t +{ + _TOKEN_BUG = 0, + LITERAL_TKN, // words + OPTION_TKN, // integer ranges + VARIABLE_TKN, // almost anything + RANGE_TKN, // integer range + IPV4_TKN, // IPV4 addresses + IPV4_PREFIX_TKN, // IPV4 network prefixes + IPV6_TKN, // IPV6 prefixes + IPV6_PREFIX_TKN, // IPV6 network prefixes + + /* plumbing types */ + SELECTOR, // marks beginning of selector + OPTION, // marks beginning of option + NUL, // dummy token + START, // first token in line + END; // last token in line +}; + +/** + * Token struct. + */ +struct cmd_token_t +{ + enum cmd_token_type_t type; // token type + + char *text; // token text + char *desc; // token description + + long long value; // for numeric types + long long min, max; // for ranges +}; + +inline struct cmd_token_t * +cmd_new_token (cmd_token_type_t type, char *text, char *desc) +{ + struct cmd_token_t *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); + token->type = type; + token->text = text; + token->desc = desc; +} diff --git a/lib/graph.c b/lib/graph.c index a46f71449d..891851b301 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -59,8 +59,10 @@ graph_delete_node (struct graph *graph, struct graph_node *node) vector_unset (adj->to, j); // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) - graph_delete_node (adj); + if (vector_active (adj->to) == 0 && + vector_active (adj->from) == 0 && + adj != node) + graph_delete_node (adj); } // for all nodes that we have an edge to, remove us from their ->from @@ -72,8 +74,10 @@ graph_delete_node (struct graph *graph, struct graph_node *node) vector_unset (adj->from, j); // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) - graph_delete_node (adj); + if (vector_active (adj->to) == 0 && + vector_active (adj->from) == 0 && + adj != node) + graph_delete_node (adj); } // if there is a deletion callback, call it! From 1eb5e8dcd17d84959a46a2d837ae719fc8eb3516 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 7 Sep 2016 04:05:07 +0000 Subject: [PATCH 051/280] lib: Continue matching system refactor Most things back to working, all CLI units refactored to use improved graph implementation. Signed-off-by: Quentin Young --- lib/command.c | 2 +- lib/command.h | 2 +- lib/command_match.c | 292 ++++++++++++++++++++++-------------------- lib/command_match.h | 19 ++- lib/command_parse.y | 186 ++++++++++++++++----------- lib/grammar_sandbox.c | 84 +++++++++--- lib/grammar_sandbox.h | 48 ++++--- lib/graph.c | 38 +++--- lib/graph.h | 15 +-- 9 files changed, 396 insertions(+), 290 deletions(-) diff --git a/lib/command.c b/lib/command.c index faaa50a6f2..5bc157c851 100644 --- a/lib/command.c +++ b/lib/command.c @@ -4191,7 +4191,7 @@ cmd_terminate_element(struct cmd_element *cmd) } void -free_cmd_element(struct cmd_element *cmd) +del_cmd_element(struct cmd_element *cmd) { if (!cmd) return; free ((char*) cmd->string); diff --git a/lib/command.h b/lib/command.h index 9a77d3b87c..6d0fb18061 100644 --- a/lib/command.h +++ b/lib/command.h @@ -573,7 +573,7 @@ extern void cmd_terminate (void); /* memory management for cmd_element */ void -free_cmd_element(struct cmd_element *); +del_cmd_element(struct cmd_element *); struct cmd_element * copy_cmd_element(struct cmd_element *cmd); diff --git a/lib/command_match.c b/lib/command_match.c index 95891dd823..0b8cc99219 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -25,6 +25,7 @@ #include #include "command_match.h" #include "command_parse.h" +#include "grammar_sandbox.h" #include "memory.h" /* matcher helper prototypes */ @@ -35,19 +36,16 @@ static struct list * command_match_r (struct graph_node *, vector, unsigned int); static int -score_precedence (enum graph_node_type); +score_precedence (enum cmd_token_type_t); static enum match_type -min_match_level (enum node_type); - -static struct graph_node * -copy_node (struct graph_node *); +min_match_level (enum cmd_token_type_t); static void -delete_nodelist (void *); +del_arglist (struct list *); -static struct graph_node * -disambiguate_nodes (struct graph_node *, struct graph_node *, char *); +static struct cmd_token_t * +disambiguate_tokens (struct cmd_token_t *, struct cmd_token_t *, char *); static struct list * disambiguate (struct list *, struct list *, vector, unsigned int); @@ -57,7 +55,7 @@ compare_completions (const void *, const void *); /* token matcher prototypes */ static enum match_type -match_token (struct graph_node *, char *); +match_token (struct cmd_token_t *, char *); static enum match_type match_ipv4 (const char *); @@ -72,22 +70,22 @@ static enum match_type match_ipv6_prefix (const char *); static enum match_type -match_range (struct graph_node *, const char *); +match_range (struct cmd_token_t *, const char *); static enum match_type -match_word (struct graph_node *, const char *); +match_word (struct cmd_token_t *, const char *); static enum match_type -match_number (struct graph_node *, const char *); +match_number (struct cmd_token_t *, const char *); static enum match_type -match_variable (struct graph_node *node, const char *word); +match_variable (struct cmd_token_t *, const char *); /* matching functions */ static enum matcher_rv matcher_rv; enum matcher_rv -command_match (struct graph_node *start, +command_match (struct graph *cmdgraph, vector vline, struct list **argv, struct cmd_element **el) @@ -100,11 +98,19 @@ command_match (struct graph_node *start, memcpy (vvline->index + 1, vline->index, sizeof (void *) * vline->alloced); vvline->active = vline->active + 1; + struct graph_node *start = vector_slot (cmdgraph->nodes, 0); if ((*argv = command_match_r (start, vvline, 0))) // successful match { + // delete dummy start node list_delete_node (*argv, listhead (*argv)); - struct graph_node *end = listgetdata (listtail (*argv)); - *el = end->element; + // get cmd_element out of list tail + struct listnode *tail = listtail (*argv); + *el = listgetdata (tail); + // delete list tail + tail->data = NULL; + list_delete_node (*argv, tail); + // now argv is an ordered list of cmd_token matching the user + // input, with each cmd_token->arg holding the corresponding input assert (*el); } @@ -120,7 +126,7 @@ command_match (struct graph_node *start, * * The next step is to see if there is further input in the input line. If * there is not, the current node's children are searched to see if any of them - * are leaves (type END_GN). If this is the case, then the bottom of the + * are leaves (type END_TKN). If this is the case, then the bottom of the * recursion stack has been reached, the leaf is pushed onto the argument list, * the current node is pushed, and the resulting argument list is * returned (MATCHER_OK). If it is not the case, NULL is returned, indicating @@ -165,13 +171,14 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) assert (n < vector_active (vline)); // get the minimum match level that can count as a full match - enum match_type minmatch = min_match_level (start->type); + struct cmd_token_t *token = start->data; + enum match_type minmatch = min_match_level (token->type); - // get the current operating token - char *token = vector_slot (vline, n); + // get the current operating input token + char *input_token = vector_slot (vline, n); // if we don't match this node, die - if (match_token (start, token) < minmatch) + if (match_token (token, input_token) < minmatch) return NULL; // pointers for iterating linklist @@ -187,14 +194,22 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) struct list *currbest = NULL; for (ALL_LIST_ELEMENTS_RO (next,ln,gn)) { - // if we've matched all input we're looking for END_GN + // if we've matched all input we're looking for END_TKN if (n+1 == vector_active (vline)) { - if (gn->type == END_GN) + struct cmd_token_t *tok = gn->data; + if (tok->type == END_TKN) { currbest = list_new(); - listnode_add (currbest, copy_node(gn)); - currbest->del = &delete_nodelist; + // node should have one child node with the element + struct graph_node *leaf = vector_slot (gn->to, 0); + // last node in the list will hold the cmd_element; + // this is important because list_delete() expects + // that all nodes have the same data type, so when + // deleting this list the last node must be + // manually deleted + listnode_add (currbest, leaf->data); + currbest->del = (void (*)(void *)) &del_cmd_token; break; } else continue; @@ -206,9 +221,17 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // save the best match if (result && currbest) { + // pick the best of two matches struct list *newbest = disambiguate (currbest, result, vline, n+1); + // set ambiguity flag ambiguous = !newbest || (ambiguous && newbest == currbest); - list_delete ((newbest && newbest == result) ? currbest : result); + // choose the list to be deleted + struct list *todelete = ((newbest && newbest == result) ? currbest : result); + // manually delete the last node, which has a cmd_element + del_cmd_element (listgetdata (listtail (todelete))); + // use the list->del callback to delete the rest of the list + list_delete (todelete); + currbest = newbest ? newbest : currbest; } else if (result) @@ -219,16 +242,16 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) { if (ambiguous) { - list_delete (currbest); - currbest = NULL; + del_arglist (currbest); matcher_rv = MATCHER_AMBIGUOUS; } else { - // copy current node, set arg and prepend to currbest - struct graph_node *curr = copy_node (start); - curr->arg = XSTRDUP(MTYPE_CMD_TOKENS, token); - list_add_node_prev (currbest, currbest->head, curr); + // copy token, set arg and prepend to currbest + struct cmd_token_t *token = start->data; + struct cmd_token_t *copy = copy_cmd_token (token); + copy->arg = XSTRDUP(MTYPE_CMD_TOKENS, input_token); + list_add_node_prev (currbest, currbest->head, copy); matcher_rv = MATCHER_OK; } } @@ -242,12 +265,12 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) } enum matcher_rv -command_complete (struct graph_node *start, +command_complete (struct graph *graph, vector vline, struct list **completions) { // pointer to next input token to match - char *token; + char *input_token; struct list *current = list_new(), // current nodes to match input token against *next = list_new(); // possible next hops after current input token @@ -257,6 +280,7 @@ command_complete (struct graph_node *start, struct listnode *node; // add all children of start node to list + struct graph_node *start = vector_slot (graph->nodes, 0); add_nexthops (next, start); unsigned int idx; @@ -266,11 +290,12 @@ command_complete (struct graph_node *start, current = next; next = list_new(); - token = vector_slot (vline, idx); + input_token = vector_slot (vline, idx); for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { - switch (match_token (gn, token)) + struct cmd_token_t *token = gn->data; + switch (match_token (token, input_token)) { case partly_match: if (idx == vector_active (vline) - 1) @@ -300,19 +325,24 @@ command_complete (struct graph_node *start, MATCHER_OK : MATCHER_NO_MATCH; + // extract cmd_token into list + *completions = list_new (); + for (ALL_LIST_ELEMENTS_RO (next,node,gn)) + listnode_add (*completions, gn->data); + list_free (current); - *completions = next; + list_free (next); return matcher_rv; } /** + * TODO: move this logic to command.c * Compare two completions. Tightly coupled to vector. * * @param[in] fst pointer to first item pointer in vector->index * @param[in] snd pointer to second item poitner in vector->index * @return integer compare code as determined by strcmp - */ int compare_completions (const void *fst, const void *snd) { @@ -353,10 +383,11 @@ command_complete_str (struct graph_node *start, list_delete (comps); return rv; } +*/ /** * Adds all children that are reachable by one parser hop to the given list. - * NUL_GN, SELECTOR_GN, and OPTION_GN nodes are treated as transparent. + * NUL_TKN, SELECTOR_TKN, and OPTION_TKN nodes are treated as transparent. * * @param[in] list to add the nexthops to * @param[in] node to start calculating nexthops from @@ -367,14 +398,15 @@ add_nexthops (struct list *list, struct graph_node *node) { int added = 0; struct graph_node *child; - for (unsigned int i = 0; i < vector_active (node->children); i++) + for (unsigned int i = 0; i < vector_active (node->to); i++) { - child = vector_slot (node->children, i); - switch (child->type) + child = vector_slot (node->to, i); + struct cmd_token_t *token = child->data; + switch (token->type) { - case OPTION_GN: - case SELECTOR_GN: - case NUL_GN: + case OPTION_TKN: + case SELECTOR_TKN: + case NUL_TKN: added += add_nexthops (list, child); break; default: @@ -394,15 +426,15 @@ add_nexthops (struct list *list, struct graph_node *node) * @return minimum match level needed to for a token to fully match */ static enum match_type -min_match_level (enum node_type type) +min_match_level (enum cmd_token_type_t type) { switch (type) { // anything matches a start node, for the sake of recursion - case START_GN: + case START_TKN: return no_match; // allowing words to partly match enables command abbreviation - case WORD_GN: + case WORD_TKN: return partly_match; default: return exact_match; @@ -416,23 +448,23 @@ min_match_level (enum node_type type) * @return precedence score */ static int -score_precedence (enum graph_node_type type) +score_precedence (enum cmd_token_type_t type) { switch (type) { // some of these are mutually exclusive, so they share // the same precedence value - case IPV4_GN: - case IPV4_PREFIX_GN: - case IPV6_GN: - case IPV6_PREFIX_GN: - case NUMBER_GN: + case IPV4_TKN: + case IPV4_PREFIX_TKN: + case IPV6_TKN: + case IPV6_PREFIX_TKN: + case NUMBER_TKN: return 1; - case RANGE_GN: + case RANGE_TKN: return 2; - case WORD_GN: + case WORD_TKN: return 3; - case VARIABLE_GN: + case VARIABLE_TKN: return 4; default: return 10; @@ -447,10 +479,10 @@ score_precedence (enum graph_node_type type) * @param[in] token the token being matched * @return the best-matching node, or NULL if the two are entirely ambiguous */ -static struct graph_node * -disambiguate_nodes (struct graph_node *first, - struct graph_node *second, - char *token) +static struct cmd_token_t * +disambiguate_tokens (struct cmd_token_t *first, + struct cmd_token_t *second, + char *input_token) { // if the types are different, simply go off of type precedence if (first->type != second->type) @@ -464,8 +496,8 @@ disambiguate_nodes (struct graph_node *first, } // if they're the same, return the more exact match - enum match_type fmtype = match_token (first, token); - enum match_type smtype = match_token (second, token); + enum match_type fmtype = match_token (first, input_token); + enum match_type smtype = match_token (second, input_token); if (fmtype != smtype) return fmtype > smtype ? first : second; @@ -475,8 +507,8 @@ disambiguate_nodes (struct graph_node *first, /** * Picks the better of two possible matches for an input line. * - * @param[in] first candidate list of graph_node matching vline - * @param[in] second candidate list of graph_node matching vline + * @param[in] first candidate list of cmd_token_t matching vline + * @param[in] second candidate list of cmd_token_t matching vline * @param[in] vline the input line being matched * @param[in] n index into vline to start comparing at * @return the best-matching list, or NULL if the two are entirely ambiguous @@ -493,82 +525,68 @@ disambiguate (struct list *first, struct listnode *fnode = listhead (first), *snode = listhead (second); - struct graph_node *fgn = listgetdata (fnode), - *sgn = listgetdata (snode), - *best = NULL; + struct cmd_token_t *ftok = listgetdata (fnode), + *stok = listgetdata (snode), + *best = NULL; - // compare each node, if one matches better use that one + // compare each token, if one matches better use that one for (unsigned int i = n; i < vector_active (vline); i++) { char *token = vector_slot(vline, i); - if ((best = disambiguate_nodes (fgn, sgn, token))) - return best == fgn ? first : second; - fnode = listnextnode (fnode); - snode = listnextnode (snode); - fgn = (struct graph_node *) listgetdata (fnode); - sgn = (struct graph_node *) listgetdata (snode); + if ((best = disambiguate_tokens (ftok, stok, token))) + return best == ftok ? first : second; + ftok = listgetdata (listnextnode (fnode)); + stok = listgetdata (listnextnode (snode)); } return NULL; } -/** - * Performs a deep copy on a node. - * Used to build argv node lists that can be safely deleted or modified by - * endpoint functions. Everything is copied except the children vector, - * subgraph end pointer and reference count. +/* + * Deletion function for arglist. * - * @param[in] node to copy - * @return the copy - */ -static struct graph_node * -copy_node (struct graph_node *node) -{ - struct graph_node *new = graphnode_new(node->type); - new->children = NULL; - new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; - new->value = node->value; - new->min = node->min; - new->max = node->max; - new->element = node->element ? copy_cmd_element(node->element) : NULL; - new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; - new->refs = 0; - return new; -} - -/** - * List deletion callback for argv lists. + * Since list->del for arglists expects all listnode->data to hold cmd_token, + * but arglists have cmd_element as the data for the tail, this function + * manually deletes the tail before deleting the rest of the list as usual. + * + * @param list the arglist to delete */ static void -delete_nodelist (void *node) +del_arglist (struct list *list) { - graphnode_delete ((struct graph_node *) node); + // manually delete last node + struct listnode *tail = listtail (list); + del_cmd_element (tail->data); + tail->data = NULL; + list_delete_node (list, tail); + + // delete the rest of the list as usual + list_delete (list); } - -/* token level matching functions */ +/*---------- token level matching functions ----------*/ static enum match_type -match_token (struct graph_node *node, char *token) +match_token (struct cmd_token_t *token, char *input_token) { - switch (node->type) { - case WORD_GN: - return match_word (node, token); - case IPV4_GN: - return match_ipv4 (token); - case IPV4_PREFIX_GN: - return match_ipv4_prefix (token); - case IPV6_GN: - return match_ipv6 (token); - case IPV6_PREFIX_GN: - return match_ipv6_prefix (token); - case RANGE_GN: - return match_range (node, token); - case NUMBER_GN: - return match_number (node, token); - case VARIABLE_GN: - return match_variable (node, token); - case END_GN: + switch (token->type) { + case WORD_TKN: + return match_word (token, input_token); + case IPV4_TKN: + return match_ipv4 (input_token); + case IPV4_PREFIX_TKN: + return match_ipv4_prefix (input_token); + case IPV6_TKN: + return match_ipv6 (input_token); + case IPV6_PREFIX_TKN: + return match_ipv6_prefix (input_token); + case RANGE_TKN: + return match_range (token, input_token); + case NUMBER_TKN: + return match_number (token, input_token); + case VARIABLE_TKN: + return match_variable (token, input_token); + case END_TKN: default: return no_match; } @@ -776,9 +794,9 @@ match_ipv6_prefix (const char *str) #endif static enum match_type -match_range (struct graph_node *node, const char *str) +match_range (struct cmd_token_t *token, const char *str) { - assert (node->type == RANGE_GN); + assert (token->type == RANGE_TKN); char *endptr = NULL; long long val; @@ -790,53 +808,53 @@ match_range (struct graph_node *node, const char *str) if (*endptr != '\0') return 0; - if (val < node->min || val > node->max) + if (val < token->min || val > token->max) return no_match; else return exact_match; } static enum match_type -match_word (struct graph_node *node, const char *word) +match_word (struct cmd_token_t *token, const char *word) { - assert (node->type == WORD_GN); + assert (token->type == WORD_TKN); // if the passed token is null or 0 length, partly match if (!word || !strlen(word)) return partly_match; // if the passed token is strictly a prefix of the full word, partly match - if (strlen (word) < strlen (node->text)) - return !strncmp (node->text, word, strlen (word)) ? + if (strlen (word) < strlen (token->text)) + return !strncmp (token->text, word, strlen (word)) ? partly_match : no_match; // if they are the same length and exactly equal, exact match - else if (strlen (word) == strlen (node->text)) - return !strncmp (node->text, word, strlen (word)) ? exact_match : no_match; + else if (strlen (word) == strlen (token->text)) + return !strncmp (token->text, word, strlen (word)) ? exact_match : no_match; return no_match; } static enum match_type -match_number (struct graph_node *node, const char *word) +match_number (struct cmd_token_t *token, const char *word) { - assert (node->type == NUMBER_GN); + assert (token->type == NUMBER_TKN); if (!strcmp ("\0", word)) return no_match; char *endptr; long long num = strtoll (word, &endptr, 10); if (endptr != '\0') return no_match; - return num == node->value ? exact_match : no_match; + return num == token->value ? exact_match : no_match; } #define VARIABLE_ALPHABET \ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" static enum match_type -match_variable (struct graph_node *node, const char *word) +match_variable (struct cmd_token_t *token, const char *word) { - assert (node->type == VARIABLE_GN); + assert (token->type == VARIABLE_TKN); return strlen (word) == strspn(word, VARIABLE_ALPHABET) ? exact_match : no_match; diff --git a/lib/command_match.h b/lib/command_match.h index 765b189496..2bb0790337 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -25,10 +25,9 @@ #ifndef _ZEBRA_COMMAND_MATCH_H #define _ZEBRA_COMMAND_MATCH_H -#include "command.h" -#include "command_graph.h" +#include "graph.h" #include "linklist.h" - +#include "command.h" /* These definitions exist in command.c in the current engine but should be * relocated here in the new engine @@ -68,14 +67,14 @@ enum match_type /** * Attempt to find an exact command match for a line of user input. * - * @param[in] start start node of command graph to match against + * @param[in] cmdgraph command graph to match against * @param[in] vline vectorized input string * @param[out] argv pointer to argument list if successful match * @param[out] element pointer to matched cmd_element if successful match * @return matcher status */ enum matcher_rv -command_match (struct graph_node *start, +command_match (struct graph *cmdgraph, vector vline, struct list **argv, struct cmd_element **element); @@ -85,11 +84,11 @@ command_match (struct graph_node *start, * * @param[in] start the start node of the DFA to match against * @param[in] vline vectorized input string - * @param[in] completions pointer to list of possible next nodes - * @return matcher status + * @param[in] completions pointer to list of cmd_token representing + * acceptable next inputs */ enum matcher_rv -command_complete (struct graph_node *start, +command_complete (struct graph *cmdgraph, vector vline, struct list **completions); @@ -101,10 +100,10 @@ command_complete (struct graph_node *start, * @param[in] vline vectorized input string * @param[in] completions vector to fill with string completions * @return matcher status - */ enum matcher_rv -command_complete_str (struct graph_node *start, +command_complete_str (struct graph *cmdgraph, vector vline, vector completions); + */ #endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/command_parse.y b/lib/command_parse.y index 750054b5c4..12f5a53212 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -36,6 +36,7 @@ #include "command.h" #include "graph.h" #include "memory.h" + #include "grammar_sandbox.h" extern int yylex (void); @@ -49,7 +50,7 @@ /* functionality this unit exports */ %code provides { - struct graph * + void command_parse_format (struct graph *, struct cmd_element *); /* maximum length of a number, lexer will not match anything longer */ @@ -89,9 +90,11 @@ %code { /* bison declarations */ void - yyerror (struct cmd_element *el, struct graph_node *sn, char const *msg); + yyerror (struct graph *, struct cmd_element *el, char const *msg); /* state variables for a single parser run */ + struct graph_node *startnode; // start node of DFA + struct graph_node *currnode, // current position in DFA *seqhead; // sequence head @@ -108,16 +111,21 @@ doc_next (void); static struct graph_node * - node_exists (struct graph_node *, struct graph_node *); + node_adjacent (struct graph_node *, struct graph_node *); static struct graph_node * - node_replace (struct graph_node *, struct graph_node *); + add_edge_dedup (struct graph_node *, struct graph_node *); static int - cmp_node (struct graph_node *, struct graph_node *); + cmp_token (struct cmd_token_t *, struct cmd_token_t *); + + static struct graph_node * + new_token_node (struct graph *, + enum cmd_token_type_t type, + char *text, char *doc); static void - terminate_graph (struct graph_node *, + terminate_graph (struct graph *, struct graph_node *, struct cmd_element *); @@ -126,11 +134,13 @@ } /* yyparse parameters */ -%parse-param { struct cmd_element *element } %parse-param { struct graph *graph } +%parse-param { struct cmd_element *element } /* called automatically before yyparse */ %initial-action { + startnode = vector_slot (graph->nodes, 0); + /* clear state pointers */ seqhead = NULL; currnode = NULL; @@ -151,28 +161,28 @@ start: sentence_root cmd_token_seq { // tack on the command element - terminate_graph (startnode, currnode, element); + terminate_graph (graph, currnode, element); } | sentence_root cmd_token_seq '.' placeholder_token { - if ((currnode = node_replace (currnode, $4)) != $4) - graph_delete_node ($4); + if ((currnode = add_edge_dedup (currnode, $4)) != $4) + graph_delete_node (graph, $4); // adding a node as a child of itself accepts any number // of the same token, which is what we want for varags - node_replace (currnode, currnode); + add_edge_dedup (currnode, currnode); // tack on the command element - terminate_graph (startnode, currnode, element); + terminate_graph (graph, currnode, element); } sentence_root: WORD { struct graph_node *root = - new_token_node (WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); - if ((currnode = node_replace (startnode, root)) != root) - free (root); + if ((currnode = add_edge_dedup (startnode, root)) != root) + graph_delete_node (graph, root); free ($1); $$ = currnode; @@ -181,13 +191,13 @@ sentence_root: WORD cmd_token: placeholder_token { - if ((currnode = node_replace (currnode, $1)) != $1) - graph_delete_node ($1); + if ((currnode = add_edge_dedup (currnode, $1)) != $1) + graph_delete_node (graph, $1); } | literal_token { - if ((currnode = node_replace (currnode, $1)) != $1) - graph_delete_node ($1); + if ((currnode = add_edge_dedup (currnode, $1)) != $1) + graph_delete_node (graph, $1); } /* selectors and options are subgraphs with start and end nodes */ | selector @@ -212,33 +222,33 @@ cmd_token_seq: placeholder_token: IPV4 { - $$ = new_token_node (IPV4_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, IPV4_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV4_PREFIX { - $$ = new_token_node (IPV4_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, IPV4_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV6 { - $$ = new_token_node (IPV6_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, IPV6_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | IPV6_PREFIX { - $$ = new_token_node (IPV6_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, IPV6_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | VARIABLE { - $$ = new_token_node (VARIABLE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, VARIABLE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | RANGE { - $$ = new_token_node (RANGE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); - cmd_token_t token = (cmd_token_t *) $$->data; + $$ = new_token_node (graph, RANGE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + struct cmd_token_t *token = $$->data; // get the numbers out yylval.string++; @@ -247,7 +257,7 @@ placeholder_token: token->max = strtoll (yylval.string, &yylval.string, 10); // validate range - if (token->min >= token->max) yyerror (element, startnode, "Invalid range."); + if (token->min >= token->max) yyerror (graph, element, "Invalid range."); free ($1); } @@ -256,13 +266,13 @@ placeholder_token: literal_token: WORD { - $$ = new_token_node (WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + $$ = new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); free ($1); } | NUMBER { - $$ = new_token_node (NUMBER_TKN, NULL, doc_next()); - cmd_token_t token = (cmd_token_t *) $$->data; + $$ = new_token_node (graph, NUMBER_TKN, NULL, doc_next()); + struct cmd_token_t *token = $$->data; token->value = yylval.number; token->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); @@ -288,14 +298,14 @@ selector_element: selector_element_root selector_token_seq // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { assert(!selnode_start && !selnode_end); - selnode_start = new_token_node (SELECTOR_TKN, NULL, NULL); - selnode_end = new_token_node (NUL_TKN, NULL, NULL); + selnode_start = new_token_node (graph, SELECTOR_TKN, NULL, NULL); + selnode_end = new_token_node (graph, NUL_TKN, NULL, NULL); } // add element head as a child of the selector graph_add_edge (selnode_start, $1); - if ($2->type != NUL_GN) { + if (((struct cmd_token_t *) $2->data)->type != NUL_TKN) { graph_add_edge ($1, seqhead); graph_add_edge ($2, selnode_end); } @@ -306,12 +316,12 @@ selector_element: selector_element_root selector_token_seq } selector_token_seq: - %empty { $$ = new_token_node (NUL_TKN, NULL, NULL); } + %empty { $$ = new_token_node (graph, NUL_TKN, NULL, NULL); } | selector_token_seq selector_token { - // if the sequence component is NUL_GN, this is a sequence start - if ($1->type == NUL_GN) { - assert(!seqhead); // sequence head should always be null here + // if the sequence component is NUL_TKN, this is a sequence start + if (((struct cmd_token_t *) $1->data)->type != NUL_TKN) { + assert(!seqhead); seqhead = $2; } else // chain on new node @@ -348,8 +358,8 @@ option_element: { if (!optnode_start || !optnode_end) { assert(!optnode_start && !optnode_end); - optnode_start = new_token_node (OPTION_TKN, NULL, NULL); - optnode_end = new_token_node (NUL_TKN, NULL, NULL); + optnode_start = new_token_node (graph, OPTION_TKN, NULL, NULL); + optnode_end = new_token_node (graph, NUL_TKN, NULL, NULL); } graph_add_edge (optnode_start, seqhead); @@ -371,25 +381,23 @@ option_token: %% -struct graph_node * -command_parse_format (struct graph_node *start, struct cmd_element *cmd) +void +command_parse_format (struct graph *graph, struct cmd_element *cmd) { // set to 1 to enable parser traces yydebug = 0; // parse command into DFA - yyparse (cmd, start); + yyparse (graph, cmd); // cleanup cleanup (); - - return start; } /* parser helper functions */ void -yyerror (struct cmd_element *el, struct graph_node *sn, char const *msg) +yyerror (struct graph *graph, struct cmd_element *el, char const *msg) { zlog_err ("%s: FATAL parse error: %s", __func__, msg); zlog_err ("while parsing this command definition: \n\t%s\n", el->string); @@ -414,16 +422,19 @@ cleanup() } static void -terminate_graph (struct graph_node *startnode, - struct graph_node *finalnode, - struct cmd_element *element) +terminate_graph (struct graph *graph, struct graph_node *finalnode, struct cmd_element *element) { - struct graph_node *end = graph_new_node (graph, element, &cmd_delete_element); + // end of graph should look like this + // * -> finalnode -> END_TKN -> cmd_element + struct graph_node *end_token_node = new_token_node (graph, END_TKN, NULL, NULL); + struct graph_node *end_element_node = + graph_new_node (graph, element, (void (*)(void *)) &del_cmd_element); - if (node_adjacent (finalnode, end)) - yyerror (element, startnode, "Duplicate command."); - else - graph_add_edge (finalnode, end); + if (node_adjacent (finalnode, end_token_node)) + yyerror (graph, element, "Duplicate command."); + + graph_add_edge (finalnode, end_token_node); + graph_add_edge (end_token_node, end_element_node); } static char * @@ -432,57 +443,74 @@ doc_next() char *piece = NULL; if (!docstr || !(piece = strsep (&docstr, "\n"))) return NULL; - return XSTRDUP(MTYPE_CMD_TOKENS, piece); + return XSTRDUP (MTYPE_CMD_TOKENS, piece); } static struct graph_node * -new_token_node (cmd_token_type_t type, char *text, char *doc) +new_token_node (struct graph *graph, enum cmd_token_type_t type, char *text, char *doc) { struct cmd_token_t *token = - XMALLOC(MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); + XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); token->type = type; token->text = text; token->desc = doc; - return graph_new_node (graph, token, &cmd_delete_token); + return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); } /** - * Determines if a node is adjacent to another node + * Determines if there is an out edge from the first node to the second */ static struct graph_node * -node_adjacent (struct graph_node *node, struct graph_node *neighbor) +node_adjacent (struct graph_node *first, struct graph_node *second) { struct graph_node *adj; - for (unsigned int i = 0; i < vector_active (node->to); i++) + for (unsigned int i = 0; i < vector_active (first->to); i++) { - adj = vector_slot (node->to, i); - if (cmp_node (neighbor, adj)) + adj = vector_slot (first->to, i); + struct cmd_token_t *ftok = first->data, + *stok = second->data; + if (cmp_token (ftok, stok)) return adj; } return NULL; } +/** + * Creates an edge betwen two nodes, unless there is already an edge to an + * equivalent node. + * + * The first node's out edges are searched to see if any of them point to a + * node that is equivalent to the second node. If such a node exists, it is + * returned. Otherwise an edge is created from the first node to the second. + * + * @param from start node for edge + * @param to end node for edge + * @return the node which the new edge points to + */ static struct graph_node * -node_replace (struct graph_node *parent, struct graph_node *child) +add_edge_dedup (struct graph_node *from, struct graph_node *to) { - struct graph_node *existing = node_adjacent (parent, child); - return existing ? existing : graph_add_edge (parent, child); + struct graph_node *existing = node_adjacent (from, to); + return existing ? existing : graph_add_edge (from, to); } +/** + * Compares two cmd_token's for equality, + * + * As such, this function is the working definition of token equality + * for parsing purposes and determines overall graph structure. + */ static int cmp_token (struct cmd_token_t *first, struct cmd_token_t *second) { - struct cmd_token_t *first = (cmd_token *) firstgn->data; - struct cmd_token_t *second = (cmd_token *) secondgn->data; - // compare types if (first->type != second->type) return 0; switch (first->type) { - case WORD_GN: - case VARIABLE_GN: + case WORD_TKN: + case VARIABLE_TKN: if (first->text && second->text) { if (strcmp (first->text, second->text)) @@ -490,28 +518,30 @@ cmp_token (struct cmd_token_t *first, struct cmd_token_t *second) } else if (first->text != second->text) return 0; break; - case RANGE_GN: + case RANGE_TKN: if (first->min != second->min || first->max != second->max) return 0; break; - case NUMBER_GN: + case NUMBER_TKN: if (first->value != second->value) return 0; break; + /* selectors and options should be equal if their subgraphs are equal, * but the graph isomorphism problem is not known to be solvable in * polynomial time so we consider selectors and options inequal in all * cases; ultimately this forks the graph, but the matcher can handle * this regardless */ - case SELECTOR_GN: - case OPTION_GN: + case SELECTOR_TKN: + case OPTION_TKN: return 0; + /* end nodes are always considered equal, since each node may only - * have one END_GN child at a time + * have one END_TKN child at a time */ - case START_GN: - case END_GN: - case NUL_GN: + case START_TKN: + case END_TKN: + case NUL_TKN: default: break; } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 92a0ae304e..6f323d6319 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -30,16 +30,16 @@ */ #include "command.h" -#include "command_graph.h" +#include "graph.h" #include "command_parse.h" #include "command_match.h" #define GRAMMAR_STR "CLI grammar sandbox\n" void -grammar_sandbox_init(void); +grammar_sandbox_init (void); void -pretty_print_graph (struct graph_node *start, int level); +pretty_print_graph (struct graph *start, int level); /* * Start node for testing command graph. @@ -48,7 +48,7 @@ pretty_print_graph (struct graph_node *start, int level); * The examples below show how to install a command to the graph, calculate * completions for a given input line, and match input against the graph. */ -struct graph_node * nodegraph; +struct graph *nodegraph; /** * Reference use of parsing / command installation API @@ -62,11 +62,11 @@ DEFUN (grammar_test, char *command = argv_concat(argv, argc, 0); // initialize a pretend cmd_element - struct cmd_element *cmd = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct cmd_element)); - cmd->string = XSTRDUP(MTYPE_TMP, command); + struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); + cmd->string = XSTRDUP (MTYPE_TMP, command); cmd->doc = NULL; cmd->func = NULL; - cmd->tokens = vector_init(VECTOR_MIN_SIZE); + cmd->tokens = vector_init (VECTOR_MIN_SIZE); // parse the command and install it into the command graph command_parse_format (nodegraph, cmd); @@ -91,22 +91,24 @@ DEFUN (grammar_test_complete, char *cmdstr = argv_concat (argv, argc, 0); vector command = cmd_make_strvec (cmdstr); - vector completions = vector_init (VECTOR_MIN_SIZE); + struct list *completions = list_new (); enum matcher_rv result = - command_complete_str (nodegraph, command, completions); + command_complete (nodegraph, command, &completions); // print completions or relevant error message if (!MATCHER_ERROR(result)) { - for (unsigned int i = 0; i < vector_active (completions); i++) - zlog_info ((char *) vector_slot (completions, i)); + struct listnode *ln; + struct cmd_token_t *tkn; + for (ALL_LIST_ELEMENTS_RO(completions,ln,tkn)) + zlog_info (tkn->text); } else zlog_info ("%% No match for \"%s\"", cmdstr); // free resources cmd_free_strvec (command); - cmd_free_strvec (completions); + list_delete (completions); free (cmdstr); return CMD_SUCCESS; @@ -138,11 +140,12 @@ DEFUN (grammar_test_match, zlog_info ("Matched: %s", element->string); struct listnode *ln; struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) - if (gn->type == END_GN) - zlog_info ("func: %p", gn->element->func); - else - zlog_info ("%s -- %s", gn->text, gn->arg); + for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) { + struct cmd_token_t *token = gn->data; + zlog_info ("%s -- %s", token->text, token->arg); + } + + zlog_info ("func: %p", element->func); list_delete (argvv); } @@ -182,7 +185,7 @@ DEFUN (grammar_test_doc, "Command end\n") { // create cmd_element with docstring - struct cmd_element *cmd = XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct cmd_element)); + struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); cmd->string = "test docstring (1-255) end VARIABLE [OPTION|set lol] . VARARG"; cmd->doc = "Test stuff\n" "docstring thing\n" @@ -224,7 +227,13 @@ DEFUN (grammar_test_show, /* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init() { zlog_info ("Initializing grammar testing shim"); - nodegraph = graphnode_new (START_GN); + + // initialize graph, add start noe + nodegraph = graph_new (); + struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL); + graph_new_node (nodegraph, token, (void (*)(void *)) &del_cmd_token); + + // install all enable elements install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); install_element (ENABLE_NODE, &grammar_test_match_cmd); @@ -234,8 +243,9 @@ void grammar_sandbox_init() { /* recursive pretty-print for command graph */ void -pretty_print_graph (struct graph_node *start, int level) +pretty_print_graph (struct graph *graph, int level) { + /* // print this node fprintf (stdout, "%s[%d] ", start->text, vector_active (start->children)); @@ -266,4 +276,38 @@ pretty_print_graph (struct graph_node *start, int level) } else fprintf(stdout, "\n"); + */ +} + +/** stuff that should go in command.c + command.h */ +struct cmd_token_t * +new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) +{ + struct cmd_token_t *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); + token->type = type; + token->text = text; + token->desc = desc; + token->arg = NULL; + + return token; +} + +void +del_cmd_token (struct cmd_token_t *token) +{ + XFREE (MTYPE_CMD_TOKENS, token->text); + XFREE (MTYPE_CMD_TOKENS, token->desc); + XFREE (MTYPE_CMD_TOKENS, token->arg); + XFREE (MTYPE_CMD_TOKENS, token); +} + +struct cmd_token_t * +copy_cmd_token (struct cmd_token_t *token) +{ + struct cmd_token_t *copy = new_cmd_token (token->type, NULL, NULL); + copy->text = XSTRDUP (MTYPE_CMD_TOKENS, token->text); + copy->desc = XSTRDUP (MTYPE_CMD_TOKENS, token->desc); + copy->arg = copy->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; + + return copy; } diff --git a/lib/grammar_sandbox.h b/lib/grammar_sandbox.h index 98d987668f..8cdcc2359c 100644 --- a/lib/grammar_sandbox.h +++ b/lib/grammar_sandbox.h @@ -1,7 +1,14 @@ +#ifndef _GRAMMAR_SANDBOX_H +#define _GRAMMAR_SANDBOX_H + +/** + * Houses functionality for testing shim as well as code that should go into + * command.h and command.c during integration. + */ #include "memory.h" void -grammar_sandbox_init(void); +grammar_sandbox_init (void); /** * Types for tokens. @@ -11,9 +18,8 @@ grammar_sandbox_init(void); */ enum cmd_token_type_t { - _TOKEN_BUG = 0, - LITERAL_TKN, // words - OPTION_TKN, // integer ranges + WORD_TKN, // words + NUMBER_TKN, // integral numbers VARIABLE_TKN, // almost anything RANGE_TKN, // integer range IPV4_TKN, // IPV4 addresses @@ -22,13 +28,13 @@ enum cmd_token_type_t IPV6_PREFIX_TKN, // IPV6 network prefixes /* plumbing types */ - SELECTOR, // marks beginning of selector - OPTION, // marks beginning of option - NUL, // dummy token - START, // first token in line - END; // last token in line -}; - + SELECTOR_TKN, // marks beginning of selector + OPTION_TKN, // marks beginning of option + NUL_TKN, // dummy token + START_TKN, // first token in line + END_TKN, // last token in line +}; + /** * Token struct. */ @@ -41,13 +47,17 @@ struct cmd_token_t long long value; // for numeric types long long min, max; // for ranges + + char *arg; // user input that matches this token }; -inline struct cmd_token_t * -cmd_new_token (cmd_token_type_t type, char *text, char *desc) -{ - struct cmd_token_t *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); - token->type = type; - token->text = text; - token->desc = desc; -} +struct cmd_token_t * +new_cmd_token (enum cmd_token_type_t, char *, char *); + +void +del_cmd_token (struct cmd_token_t *); + +struct cmd_token_t * +copy_cmd_token (struct cmd_token_t *); + +#endif /* _GRAMMAR_SANDBOX_H */ diff --git a/lib/graph.c b/lib/graph.c index 891851b301..be7d5aef38 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -22,18 +22,26 @@ * 02111-1307, USA. */ #include -#include "command_graph.h" +#include "graph.h" #include "memory.h" +struct graph * +graph_new () +{ + struct graph *graph = XCALLOC (MTYPE_GRAPH, sizeof(struct graph)); + graph->nodes = vector_init (VECTOR_MIN_SIZE); + + return graph; +} struct graph_node * graph_new_node (struct graph *graph, void *data, void (*del) (void*)) { struct graph_node *node = - XCALLOC(MTYPE_CMD_TOKENS, sizeof(struct graph_node)); + XCALLOC(MTYPE_GRAPH_NODE, sizeof(struct graph_node)); - node->from = vector_init(VECTOR_MIN_SIZE); - node->to = vector_init(VECTOR_MIN_SIZE); + node->from = vector_init (VECTOR_MIN_SIZE); + node->to = vector_init (VECTOR_MIN_SIZE); node->data = data; node->del = del; @@ -51,10 +59,10 @@ graph_delete_node (struct graph *graph, struct graph_node *node) struct graph_node *adj; // for all nodes that have an edge to us, remove us from their ->to - for (int i = 0; i < vector_active (node->from); i++) + for (unsigned int i = 0; i < vector_active (node->from); i++) { adj = vector_slot (node->from, i); - for (int j = 0; j < vector_active (adj->to); j++) + for (unsigned int j = 0; j < vector_active (adj->to); j++) if (vector_slot (adj->to, j) == node) vector_unset (adj->to, j); @@ -62,14 +70,14 @@ graph_delete_node (struct graph *graph, struct graph_node *node) if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0 && adj != node) - graph_delete_node (adj); + graph_delete_node (graph, adj); } // for all nodes that we have an edge to, remove us from their ->from - for (int i = 0; i < vector_active (node->to); i++) + for (unsigned int i = 0; i < vector_active (node->to); i++) { adj = vector_slot (node->to, i); - for (int j = 0; j < vector_active (adj->from); j++) + for (unsigned int j = 0; j < vector_active (adj->from); j++) if (vector_slot (adj->from, j) == node) vector_unset (adj->from, j); @@ -77,7 +85,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node) if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0 && adj != node) - graph_delete_node (adj); + graph_delete_node (graph, adj); } // if there is a deletion callback, call it! @@ -89,12 +97,12 @@ graph_delete_node (struct graph *graph, struct graph_node *node) vector_free (node->from); // remove node from graph->nodes - for (int i = 0; i < vector_active (graph->nodes); i++) + for (unsigned int i = 0; i < vector_active (graph->nodes); i++) if (vector_slot (graph->nodes, i) == node) vector_unset (graph->nodes, i); // free the node itself - free (node); + XFREE (MTYPE_GRAPH_NODE, node); } struct graph_node * @@ -109,9 +117,9 @@ void graph_delete_graph (struct graph *graph) { // delete each node in the graph - for (int i = 0; i < vector_active (graph->nodes); i++) - graph_delete_node (vector_slot (graph->nodes, i)); + for (unsigned int i = 0; i < vector_active (graph->nodes); i++) + graph_delete_node (graph, vector_slot (graph->nodes, i)); vector_free (graph->nodes); - free (graph); + XFREE (MTYPE_GRAPH, graph); } diff --git a/lib/graph.h b/lib/graph.h index 7c0f848001..bccbbb94a0 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -27,26 +27,23 @@ #include "vector.h" -/** - * Graph structure. - */ struct graph { - vector nodes; // all nodes in the graph -} + vector nodes; +}; -/** - * Graph node / vertex. - */ struct graph_node { vector from; // nodes which have edges to this node vector to; // nodes which this node has edges to void *data; // node data - void (*del) (void *data) // deletion callback + void (*del) (void *data); // deletion callback }; +struct graph * +graph_new (void); + /** * Creates a new node. * From 97f13f08655c924e782e2aa82933b4a7eec68de2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 7 Sep 2016 23:02:39 +0000 Subject: [PATCH 052/280] lib: Fix deduplication bug, reinstate graph print Comparing the wrong nodes led to duplication during graph construction, fixed. Also update graph pretty print to use new graph struct. Signed-off-by: Quentin Young --- lib/command_parse.y | 4 +-- lib/grammar_sandbox.c | 62 ++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 12f5a53212..9babfb76b0 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -469,7 +469,7 @@ node_adjacent (struct graph_node *first, struct graph_node *second) for (unsigned int i = 0; i < vector_active (first->to); i++) { adj = vector_slot (first->to, i); - struct cmd_token_t *ftok = first->data, + struct cmd_token_t *ftok = adj->data, *stok = second->data; if (cmp_token (ftok, stok)) return adj; @@ -514,7 +514,7 @@ cmp_token (struct cmd_token_t *first, struct cmd_token_t *second) if (first->text && second->text) { if (strcmp (first->text, second->text)) - return 0; + return 0; } else if (first->text != second->text) return 0; break; diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 6f323d6319..4a1a5fea5e 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -39,7 +39,7 @@ void grammar_sandbox_init (void); void -pretty_print_graph (struct graph *start, int level); +pretty_print_graph (struct graph_node *, int); /* * Start node for testing command graph. @@ -139,11 +139,9 @@ DEFUN (grammar_test_match, { zlog_info ("Matched: %s", element->string); struct listnode *ln; - struct graph_node *gn; - for (ALL_LIST_ELEMENTS_RO(argvv,ln,gn)) { - struct cmd_token_t *token = gn->data; + struct cmd_token_t *token; + for (ALL_LIST_ELEMENTS_RO(argvv,ln,token)) zlog_info ("%s -- %s", token->text, token->arg); - } zlog_info ("func: %p", element->func); @@ -220,7 +218,7 @@ DEFUN (grammar_test_show, if (!nodegraph) zlog_info("nodegraph uninitialized"); else - pretty_print_graph (nodegraph, 0); + pretty_print_graph (vector_slot (nodegraph->nodes, 0), 0); return CMD_SUCCESS; } @@ -241,42 +239,40 @@ void grammar_sandbox_init() { install_element (ENABLE_NODE, &grammar_test_doc_cmd); } -/* recursive pretty-print for command graph */ +/** + * Pretty-prints a graph, assuming it is a tree. + * + * @param start the node to take as the root + * @param level indent level for recursive calls, always pass 0 + */ void -pretty_print_graph (struct graph *graph, int level) +pretty_print_graph (struct graph_node *start, int level) { - /* // print this node - fprintf (stdout, "%s[%d] ", start->text, vector_active (start->children)); + struct cmd_token_t *tok = start->data; + fprintf (stdout, "%s[%d] ", tok->text, tok->type); - if (vector_active (start->children)) + int numto = vector_active (start->to); + if (numto) { - if (vector_active (start->children) == 1) + if (numto > 1) + fprintf (stdout, "\n"); + for (unsigned int i = 0; i < vector_active (start->to); i++) { - struct graph_node *child = vector_slot (start->children, 0); - if (child == start) + struct graph_node *adj = vector_slot (start->to, i); + // if we're listing multiple children, indent! + if (numto > 1) + for (int j = 0; j < level+1; j++) + fprintf (stdout, " "); + // if this node is a vararg, just print * + if (adj == start) fprintf (stdout, "*"); else - pretty_print_graph (vector_slot (start->children, 0), level); - } - else - { - fprintf(stdout, "\n"); - for (unsigned int i = 0; i < vector_active (start->children); i++) - { - struct graph_node *r = vector_slot (start->children, i); - for (int j = 0; j < level+1; j++) - fprintf (stdout, " "); - if (r == start) - fprintf (stdout, "*"); - else - pretty_print_graph (r, level+1); - } + pretty_print_graph (adj, numto > 1 ? level+1 : level); } } else fprintf(stdout, "\n"); - */ } /** stuff that should go in command.c + command.h */ @@ -305,9 +301,9 @@ struct cmd_token_t * copy_cmd_token (struct cmd_token_t *token) { struct cmd_token_t *copy = new_cmd_token (token->type, NULL, NULL); - copy->text = XSTRDUP (MTYPE_CMD_TOKENS, token->text); - copy->desc = XSTRDUP (MTYPE_CMD_TOKENS, token->desc); - copy->arg = copy->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; + copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; + copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_TOKENS, token->desc) : NULL; + copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; return copy; } From 5e8856790c50c30ea208e5cd28021818e5f2fcbf Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 8 Sep 2016 18:14:16 +0000 Subject: [PATCH 053/280] lib: Remove automatic node deletion Signed-off-by: Quentin Young --- lib/graph.c | 14 +------------- lib/graph.h | 4 ---- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/graph.c b/lib/graph.c index be7d5aef38..314cf86850 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -65,12 +65,6 @@ graph_delete_node (struct graph *graph, struct graph_node *node) for (unsigned int j = 0; j < vector_active (adj->to); j++) if (vector_slot (adj->to, j) == node) vector_unset (adj->to, j); - - // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && - vector_active (adj->from) == 0 && - adj != node) - graph_delete_node (graph, adj); } // for all nodes that we have an edge to, remove us from their ->from @@ -80,15 +74,9 @@ graph_delete_node (struct graph *graph, struct graph_node *node) for (unsigned int j = 0; j < vector_active (adj->from); j++) if (vector_slot (adj->from, j) == node) vector_unset (adj->from, j); - - // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && - vector_active (adj->from) == 0 && - adj != node) - graph_delete_node (graph, adj); } - // if there is a deletion callback, call it! + // if there is a deletion callback, call it if (node->del && node->data) (*node->del) (node->data); diff --git a/lib/graph.h b/lib/graph.h index bccbbb94a0..b6a03b938a 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -61,10 +61,6 @@ graph_new_node (struct graph *graph, void *data, void (*del) (void*)); * Before deletion, this function removes all edges to and from this node from * any neighbor nodes. * - * If, as a result of this operation, any neighbor node has no edges either to - * or from itself, that node will be deleted as well. If the graph topology is - * e.g. a star this will result in the deletion of all nodes. - * * If *data and *del are non-null, the following call is made: * (*node->del) (node->data); * From d8074cc04cbd7f59910007c62f62c776ec884d00 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 8 Sep 2016 20:27:39 +0000 Subject: [PATCH 054/280] lib: Add text for end nodes Signed-off-by: Quentin Young --- lib/command_parse.y | 16 ++++++++++------ lib/grammar_sandbox.h | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 9babfb76b0..1ee5afc65e 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -305,9 +305,9 @@ selector_element: selector_element_root selector_token_seq // add element head as a child of the selector graph_add_edge (selnode_start, $1); - if (((struct cmd_token_t *) $2->data)->type != NUL_TKN) { - graph_add_edge ($1, seqhead); - graph_add_edge ($2, selnode_end); + if ($2) { + graph_add_edge ($1, seqhead); // tack on selector_token_seq + graph_add_edge ($2, selnode_end); // $2 is the sequence tail } else graph_add_edge ($1, selnode_end); @@ -316,11 +316,11 @@ selector_element: selector_element_root selector_token_seq } selector_token_seq: - %empty { $$ = new_token_node (graph, NUL_TKN, NULL, NULL); } + %empty { $$ = NULL; } | selector_token_seq selector_token { // if the sequence component is NUL_TKN, this is a sequence start - if (((struct cmd_token_t *) $1->data)->type != NUL_TKN) { + if (!$1) { assert(!seqhead); seqhead = $2; } @@ -426,7 +426,11 @@ terminate_graph (struct graph *graph, struct graph_node *finalnode, struct cmd_e { // end of graph should look like this // * -> finalnode -> END_TKN -> cmd_element - struct graph_node *end_token_node = new_token_node (graph, END_TKN, NULL, NULL); + struct graph_node *end_token_node = + new_token_node (graph, + END_TKN, + XSTRDUP (MTYPE_CMD_TOKENS, CMD_CR_TEXT), + XSTRDUP (MTYPE_CMD_TOKENS, "")); struct graph_node *end_element_node = graph_new_node (graph, element, (void (*)(void *)) &del_cmd_element); diff --git a/lib/grammar_sandbox.h b/lib/grammar_sandbox.h index 8cdcc2359c..6e61ce1b46 100644 --- a/lib/grammar_sandbox.h +++ b/lib/grammar_sandbox.h @@ -7,6 +7,8 @@ */ #include "memory.h" +#define CMD_CR_TEXT "" + void grammar_sandbox_init (void); From ff35126c0661e4b869f3c4782c02605a7f226e18 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 8 Sep 2016 20:27:57 +0000 Subject: [PATCH 055/280] lib: Update grammar sandbox driver Signed-off-by: Quentin Young --- lib/grammar_sandbox.c | 80 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 4a1a5fea5e..fe01c113d2 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -41,27 +41,19 @@ grammar_sandbox_init (void); void pretty_print_graph (struct graph_node *, int); -/* - * Start node for testing command graph. - * - * Each cmd_node will have one of these that replaces the `cmdvector` member. - * The examples below show how to install a command to the graph, calculate - * completions for a given input line, and match input against the graph. - */ +/* Command graph. Used to match user input to cmd_elements. */ struct graph *nodegraph; -/** - * Reference use of parsing / command installation API - */ DEFUN (grammar_test, grammar_test_cmd, "grammar parse .COMMAND", GRAMMAR_STR "command to pass to new parser\n") { - char *command = argv_concat(argv, argc, 0); + // make a string from tokenized command line + char *command = argv_concat (argv, argc, 0); - // initialize a pretend cmd_element + // create cmd_element for parser struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); cmd->string = XSTRDUP (MTYPE_TMP, command); cmd->doc = NULL; @@ -71,16 +63,9 @@ DEFUN (grammar_test, // parse the command and install it into the command graph command_parse_format (nodegraph, cmd); - // free resources - free (command); - return CMD_SUCCESS; } - -/** - * Reference use of completions API - */ DEFUN (grammar_test_complete, grammar_test_complete_cmd, "grammar complete .COMMAND", @@ -91,32 +76,44 @@ DEFUN (grammar_test_complete, char *cmdstr = argv_concat (argv, argc, 0); vector command = cmd_make_strvec (cmdstr); + // generate completions of user input struct list *completions = list_new (); - enum matcher_rv result = - command_complete (nodegraph, command, &completions); + enum matcher_rv result = command_complete (nodegraph, command, &completions); // print completions or relevant error message if (!MATCHER_ERROR(result)) { struct listnode *ln; struct cmd_token_t *tkn; - for (ALL_LIST_ELEMENTS_RO(completions,ln,tkn)) - zlog_info (tkn->text); + + // calculate length of longest tkn->text in completions + int width = 0; + for (ALL_LIST_ELEMENTS_RO (completions,ln,tkn)) { + if (tkn && tkn->text) { + int len = strlen (tkn->text); + width = len > width ? len : width; + } + else { + fprintf (stdout, "tkn: %p\n", tkn); + fprintf (stdout, "tkn->text: %p\n", tkn->text); + } + } + + // print completions + for (ALL_LIST_ELEMENTS_RO (completions,ln,tkn)) + fprintf (stdout, " %-*s %s%s", width, tkn->text, tkn->desc, "\n"); } else - zlog_info ("%% No match for \"%s\"", cmdstr); + fprintf (stdout, "%% No match%s", "\n"); // free resources - cmd_free_strvec (command); list_delete (completions); + cmd_free_strvec (command); free (cmdstr); return CMD_SUCCESS; } -/** - * Reference use of matching API - */ DEFUN (grammar_test_match, grammar_test_match_cmd, "grammar match .COMMAND", @@ -124,10 +121,10 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match") { - char *cmdstr = argv_concat(argv, argc, 0); - if (cmdstr[0] == '#') + if (argv[0][0] == '#') return CMD_SUCCESS; + char *cmdstr = argv_concat(argv, argc, 0); vector command = cmd_make_strvec (cmdstr); struct list *argvv = NULL; @@ -137,13 +134,13 @@ DEFUN (grammar_test_match, // print completions or relevant error message if (element) { - zlog_info ("Matched: %s", element->string); + fprintf (stdout, "Matched: %s%s", element->string, "\n"); struct listnode *ln; struct cmd_token_t *token; for (ALL_LIST_ELEMENTS_RO(argvv,ln,token)) - zlog_info ("%s -- %s", token->text, token->arg); + fprintf (stdout, "%s -- %s%s", token->text, token->arg, "\n"); - zlog_info ("func: %p", element->func); + fprintf (stdout, "func: %p%s", element->func, "\n"); list_delete (argvv); } @@ -151,16 +148,16 @@ DEFUN (grammar_test_match, assert(MATCHER_ERROR(result)); switch (result) { case MATCHER_NO_MATCH: - zlog_info ("%% Unknown command"); + fprintf (stdout, "%% Unknown command%s", "\n"); break; case MATCHER_INCOMPLETE: - zlog_info ("%% Incomplete command"); + fprintf (stdout, "%% Incomplete command%s", "\n"); break; case MATCHER_AMBIGUOUS: - zlog_info ("%% Ambiguous command"); + fprintf (stdout, "%% Ambiguous command%s", "\n"); break; default: - zlog_info ("%% Unknown error"); + fprintf (stdout, "%% Unknown error%s", "\n"); break; } } @@ -184,8 +181,9 @@ DEFUN (grammar_test_doc, { // create cmd_element with docstring struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); - cmd->string = "test docstring (1-255) end VARIABLE [OPTION|set lol] . VARARG"; - cmd->doc = "Test stuff\n" + cmd->string = XSTRDUP (MTYPE_CMD_TOKENS, "test docstring (1-255) end VARIABLE [OPTION|set lol] . VARARG"); + cmd->doc = XSTRDUP (MTYPE_CMD_TOKENS, + "Test stuff\n" "docstring thing\n" "first example\n" "second example\n" @@ -196,7 +194,7 @@ DEFUN (grammar_test_doc, "optional variable\n" "optional set\n" "optional lol\n" - "vararg!\n"; + "vararg!\n"); cmd->func = NULL; cmd->tokens = vector_init (VECTOR_MIN_SIZE); @@ -224,7 +222,7 @@ DEFUN (grammar_test_show, /* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init() { - zlog_info ("Initializing grammar testing shim"); + fprintf (stdout, "Initializing grammar testing shim%s", "\n"); // initialize graph, add start noe nodegraph = graph_new (); From fe2e10e8d85990079da100fa0e2646a436cf3602 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 8 Sep 2016 21:07:55 +0000 Subject: [PATCH 056/280] lib: Fix uninitialized pointer segfault Signed-off-by: Quentin Young --- lib/command_parse.y | 8 +------- lib/grammar_sandbox.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 1ee5afc65e..a5d391d19e 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -453,13 +453,7 @@ doc_next() static struct graph_node * new_token_node (struct graph *graph, enum cmd_token_type_t type, char *text, char *doc) { - struct cmd_token_t *token = - XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t)); - - token->type = type; - token->text = text; - token->desc = doc; - + struct cmd_token_t *token = new_cmd_token (type, text, doc); return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index fe01c113d2..6a783a6d56 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -289,9 +289,15 @@ new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) void del_cmd_token (struct cmd_token_t *token) { - XFREE (MTYPE_CMD_TOKENS, token->text); - XFREE (MTYPE_CMD_TOKENS, token->desc); - XFREE (MTYPE_CMD_TOKENS, token->arg); + if (!token) return; + + if (token->text) + XFREE (MTYPE_CMD_TOKENS, token->text); + if (token->desc) + XFREE (MTYPE_CMD_TOKENS, token->desc); + if (token->arg) + XFREE (MTYPE_CMD_TOKENS, token->arg); + XFREE (MTYPE_CMD_TOKENS, token); } From 8d8cf5e3220bad44641d27b9eafbe7c5c4b2c41a Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 8 Sep 2016 23:53:06 +0000 Subject: [PATCH 057/280] lib: Fix dangling pointer in matcher Signed-off-by: Quentin Young --- lib/command_match.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 0b8cc99219..68dda6f9cd 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -225,12 +225,9 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) struct list *newbest = disambiguate (currbest, result, vline, n+1); // set ambiguity flag ambiguous = !newbest || (ambiguous && newbest == currbest); - // choose the list to be deleted + // delete the unnecessary result struct list *todelete = ((newbest && newbest == result) ? currbest : result); - // manually delete the last node, which has a cmd_element - del_cmd_element (listgetdata (listtail (todelete))); - // use the list->del callback to delete the rest of the list - list_delete (todelete); + del_arglist (todelete); currbest = newbest ? newbest : currbest; } @@ -243,6 +240,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) if (ambiguous) { del_arglist (currbest); + currbest = NULL; matcher_rv = MATCHER_AMBIGUOUS; } else @@ -250,7 +248,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // copy token, set arg and prepend to currbest struct cmd_token_t *token = start->data; struct cmd_token_t *copy = copy_cmd_token (token); - copy->arg = XSTRDUP(MTYPE_CMD_TOKENS, input_token); + copy->arg = XSTRDUP (MTYPE_CMD_TOKENS, input_token); list_add_node_prev (currbest, currbest->head, copy); matcher_rv = MATCHER_OK; } From df0620e4a09f65c77e98d90309f6860dbcc399a8 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 9 Sep 2016 19:45:43 +0000 Subject: [PATCH 058/280] lib: Add nullcheck before graph node deletion Signed-off-by: Quentin Young --- lib/graph.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/graph.c b/lib/graph.c index 314cf86850..18f32b8ca2 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -62,6 +62,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node) for (unsigned int i = 0; i < vector_active (node->from); i++) { adj = vector_slot (node->from, i); + if (!adj) continue; for (unsigned int j = 0; j < vector_active (adj->to); j++) if (vector_slot (adj->to, j) == node) vector_unset (adj->to, j); @@ -71,6 +72,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node) for (unsigned int i = 0; i < vector_active (node->to); i++) { adj = vector_slot (node->to, i); + if (!adj) continue; for (unsigned int j = 0; j < vector_active (adj->from); j++) if (vector_slot (adj->from, j) == node) vector_unset (adj->from, j); From 500b1a5becd68f7db0e37bfc457b501c05da0999 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 9 Sep 2016 19:46:36 +0000 Subject: [PATCH 059/280] lib: Add testing shim for graph deletion Signed-off-by: Quentin Young --- lib/grammar_sandbox.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 6a783a6d56..521029af6b 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -40,10 +40,22 @@ void grammar_sandbox_init (void); void pretty_print_graph (struct graph_node *, int); +void +init_cmdgraph (struct graph **); /* Command graph. Used to match user input to cmd_elements. */ struct graph *nodegraph; +void +init_cmdgraph (struct graph **graph) +{ + // initialize graph, add start noe + *graph = graph_new (); + struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL); + graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token); + fprintf (stdout, "initialized graph\n"); +} + DEFUN (grammar_test, grammar_test_cmd, "grammar parse .COMMAND", @@ -55,7 +67,7 @@ DEFUN (grammar_test, // create cmd_element for parser struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); - cmd->string = XSTRDUP (MTYPE_TMP, command); + cmd->string = command; cmd->doc = NULL; cmd->func = NULL; cmd->tokens = vector_init (VECTOR_MIN_SIZE); @@ -220,14 +232,20 @@ DEFUN (grammar_test_show, return CMD_SUCCESS; } +DEFUN (grammar_init_graph, + grammar_init_graph_cmd, + "grammar init graph", + GRAMMAR_STR + "(re)initialize graph\n") +{ + graph_delete_graph (nodegraph); + init_cmdgraph (&nodegraph); + return CMD_SUCCESS; +} + /* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init() { - fprintf (stdout, "Initializing grammar testing shim%s", "\n"); - - // initialize graph, add start noe - nodegraph = graph_new (); - struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL); - graph_new_node (nodegraph, token, (void (*)(void *)) &del_cmd_token); + init_cmdgraph (&nodegraph); // install all enable elements install_element (ENABLE_NODE, &grammar_test_cmd); @@ -235,8 +253,10 @@ void grammar_sandbox_init() { install_element (ENABLE_NODE, &grammar_test_match_cmd); install_element (ENABLE_NODE, &grammar_test_complete_cmd); install_element (ENABLE_NODE, &grammar_test_doc_cmd); + install_element (ENABLE_NODE, &grammar_init_graph_cmd); } + /** * Pretty-prints a graph, assuming it is a tree. * From 97c45dae54bc4d4fc3a24155ef7703beac4ae7aa Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 9 Sep 2016 19:57:54 +0000 Subject: [PATCH 060/280] lib: Reorganize grammar sandbox Signed-off-by: Quentin Young --- lib/grammar_sandbox.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 521029af6b..1ba76babda 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -36,6 +36,7 @@ #define GRAMMAR_STR "CLI grammar sandbox\n" +/** headers **/ void grammar_sandbox_init (void); void @@ -43,19 +44,9 @@ pretty_print_graph (struct graph_node *, int); void init_cmdgraph (struct graph **); -/* Command graph. Used to match user input to cmd_elements. */ +/** shim interface commands **/ struct graph *nodegraph; -void -init_cmdgraph (struct graph **graph) -{ - // initialize graph, add start noe - *graph = graph_new (); - struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL); - graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token); - fprintf (stdout, "initialized graph\n"); -} - DEFUN (grammar_test, grammar_test_cmd, "grammar parse .COMMAND", @@ -294,6 +285,16 @@ pretty_print_graph (struct graph_node *start, int level) } /** stuff that should go in command.c + command.h */ +void +init_cmdgraph (struct graph **graph) +{ + // initialize graph, add start noe + *graph = graph_new (); + struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL); + graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token); + fprintf (stdout, "initialized graph\n"); +} + struct cmd_token_t * new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) { From ee551f4827cf861c84916726ceea0e3bb8afc46c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 01:16:22 +0000 Subject: [PATCH 061/280] lib: Fix various matching bugs Missed a copy, disambigs forgot to walkback Signed-off-by: Quentin Young --- lib/command_match.c | 9 ++++++--- lib/command_parse.y | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 68dda6f9cd..3faa059a44 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -208,7 +208,8 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // that all nodes have the same data type, so when // deleting this list the last node must be // manually deleted - listnode_add (currbest, leaf->data); + struct cmd_element *el = leaf->data; + listnode_add (currbest, copy_cmd_element (el)); currbest->del = (void (*)(void *)) &del_cmd_token; break; } @@ -533,8 +534,10 @@ disambiguate (struct list *first, char *token = vector_slot(vline, i); if ((best = disambiguate_tokens (ftok, stok, token))) return best == ftok ? first : second; - ftok = listgetdata (listnextnode (fnode)); - stok = listgetdata (listnextnode (snode)); + fnode = listnextnode (fnode); + snode = listnextnode (snode); + ftok = listgetdata (fnode); + stok = listgetdata (snode); } return NULL; diff --git a/lib/command_parse.y b/lib/command_parse.y index a5d391d19e..bd958c5ace 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -446,7 +446,7 @@ doc_next() { char *piece = NULL; if (!docstr || !(piece = strsep (&docstr, "\n"))) - return NULL; + return XSTRDUP (MTYPE_CMD_TOKENS, ""); return XSTRDUP (MTYPE_CMD_TOKENS, piece); } From ee761cc086a1cbee6dd705fece71cb004b215e21 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 18:33:55 +0000 Subject: [PATCH 062/280] lib: Move string completions out of command_match.c Signed-off-by: Quentin Young --- lib/command_match.c | 49 ---------------------------- lib/command_match.h | 14 -------- lib/grammar_sandbox.c | 74 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 59 insertions(+), 78 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 3faa059a44..ca2135a1c2 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -335,55 +335,6 @@ command_complete (struct graph *graph, return matcher_rv; } -/** - * TODO: move this logic to command.c - * Compare two completions. Tightly coupled to vector. - * - * @param[in] fst pointer to first item pointer in vector->index - * @param[in] snd pointer to second item poitner in vector->index - * @return integer compare code as determined by strcmp -int -compare_completions (const void *fst, const void *snd) -{ - const char *first = *((char **) fst); - const char *secnd = *((char **) snd); - return strcmp (first, secnd); -} - -enum matcher_rv -command_complete_str (struct graph_node *start, - vector vline, - vector completions) -{ - struct list *comps; - enum matcher_rv rv = command_complete (start, vline, &comps); - - // quick n' dirty deduplication fn here, prolly like O(n^n) - struct listnode *ln; - struct graph_node *gn; - unsigned int i; - for (ALL_LIST_ELEMENTS_RO(comps,ln,gn)) - { - // linear search for node text in completions vector - int exists = 0; - for (i = 0; i < vector_active (completions) && !exists; i++) - exists = !strcmp (gn->text, vector_slot (completions, i)); - - if (!exists) - vector_set (completions, XSTRDUP(MTYPE_TMP, gn->text)); - } - - // sort completions - qsort (completions->index, - vector_active (completions), - sizeof (void *), - &compare_completions); - - list_delete (comps); - return rv; -} -*/ - /** * Adds all children that are reachable by one parser hop to the given list. * NUL_TKN, SELECTOR_TKN, and OPTION_TKN nodes are treated as transparent. diff --git a/lib/command_match.h b/lib/command_match.h index 2bb0790337..728d9c1d95 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -92,18 +92,4 @@ command_complete (struct graph *cmdgraph, vector vline, struct list **completions); - -/** - * Compiles possible completions for a given line of user input. - * - * @param[in] start the start node of the DFA to match against - * @param[in] vline vectorized input string - * @param[in] completions vector to fill with string completions - * @return matcher status -enum matcher_rv -command_complete_str (struct graph *cmdgraph, - vector vline, - vector completions); - - */ #endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 1ba76babda..1fe46a87e5 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -43,6 +43,10 @@ void pretty_print_graph (struct graph_node *, int); void init_cmdgraph (struct graph **); +vector +completions_to_vec (struct list *); +int +compare_completions (const void *, const void *); /** shim interface commands **/ struct graph *nodegraph; @@ -86,25 +90,22 @@ DEFUN (grammar_test_complete, // print completions or relevant error message if (!MATCHER_ERROR(result)) { - struct listnode *ln; + vector comps = completions_to_vec (completions); struct cmd_token_t *tkn; // calculate length of longest tkn->text in completions - int width = 0; - for (ALL_LIST_ELEMENTS_RO (completions,ln,tkn)) { - if (tkn && tkn->text) { - int len = strlen (tkn->text); - width = len > width ? len : width; - } - else { - fprintf (stdout, "tkn: %p\n", tkn); - fprintf (stdout, "tkn->text: %p\n", tkn->text); - } + unsigned int width = 0, i = 0; + for (i = 0; i < vector_active (comps); i++) { + tkn = vector_slot (comps, i); + unsigned int len = strlen (tkn->text); + width = len > width ? len : width; } // print completions - for (ALL_LIST_ELEMENTS_RO (completions,ln,tkn)) + for (i = 0; i < vector_active (comps); i++) { + tkn = vector_slot (comps, i); fprintf (stdout, " %-*s %s%s", width, tkn->text, tkn->desc, "\n"); + } } else fprintf (stdout, "%% No match%s", "\n"); @@ -295,6 +296,46 @@ init_cmdgraph (struct graph **graph) fprintf (stdout, "initialized graph\n"); } +int +compare_completions (const void *fst, const void *snd) +{ + struct cmd_token_t *first = *(struct cmd_token_t **) fst, + *secnd = *(struct cmd_token_t **) snd; + return strcmp (first->text, secnd->text); +} + +vector +completions_to_vec (struct list *completions) +{ + vector comps = vector_init (VECTOR_MIN_SIZE); + + struct listnode *ln; + struct cmd_token_t *token; + unsigned int i, exists; + for (ALL_LIST_ELEMENTS_RO(completions,ln,token)) + { + // linear search for token in completions vector + exists = 0; + for (i = 0; i < vector_active (comps) && !exists; i++) + { + struct cmd_token_t *curr = vector_slot (comps, i); + exists = !strcmp (curr->text, token->text) && + !strcmp (curr->desc, token->desc); + } + + if (!exists) + vector_set (comps, copy_cmd_token (token)); + } + + // sort completions + qsort (comps->index, + vector_active (comps), + sizeof (void *), + &compare_completions); + + return comps; +} + struct cmd_token_t * new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) { @@ -326,9 +367,12 @@ struct cmd_token_t * copy_cmd_token (struct cmd_token_t *token) { struct cmd_token_t *copy = new_cmd_token (token->type, NULL, NULL); - copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; - copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_TOKENS, token->desc) : NULL; - copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; + copy->value = token->value; + copy->max = token->max; + copy->min = token->min; + copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; + copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_TOKENS, token->desc) : NULL; + copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; return copy; } From 67c02c9449671a12bcaaaf71b06efd7989ebc026 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 18:39:56 +0000 Subject: [PATCH 063/280] lib: Fix memory leak in matcher Signed-off-by: Quentin Young --- lib/command_match.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/command_match.c b/lib/command_match.c index ca2135a1c2..75780de2c5 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -94,7 +94,7 @@ command_match (struct graph *cmdgraph, // prepend a dummy token to match that pesky start node vector vvline = vector_init (vline->alloced + 1); - vector_set_index (vvline, 0, (void *) "dummy"); + vector_set_index (vvline, 0, (void *) XSTRDUP (MTYPE_TMP, "dummy")); memcpy (vvline->index + 1, vline->index, sizeof (void *) * vline->alloced); vvline->active = vline->active + 1; @@ -114,6 +114,11 @@ command_match (struct graph *cmdgraph, assert (*el); } + // free the leader token we alloc'd + XFREE (MTYPE_TMP, vector_slot (vvline, 0)); + // free vector + vector_free (vvline); + return matcher_rv; } From 795d02785aa3f6d1638d79cfdaa5e45ed2ff8199 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 19:55:37 +0000 Subject: [PATCH 064/280] lib: Fix various memory leaks Signed-off-by: Quentin Young --- lib/command_match.c | 19 +++++++++++-------- lib/grammar_sandbox.c | 12 +++++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 75780de2c5..cd2200e0c0 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -101,14 +101,17 @@ command_match (struct graph *cmdgraph, struct graph_node *start = vector_slot (cmdgraph->nodes, 0); if ((*argv = command_match_r (start, vvline, 0))) // successful match { - // delete dummy start node - list_delete_node (*argv, listhead (*argv)); - // get cmd_element out of list tail + struct listnode *head = listhead (*argv); struct listnode *tail = listtail (*argv); + + // delete dummy start node + del_cmd_token ((struct cmd_token_t *) head->data); + list_delete_node (*argv, head); + + // get cmd_element out of list tail *el = listgetdata (tail); - // delete list tail - tail->data = NULL; list_delete_node (*argv, tail); + // now argv is an ordered list of cmd_token matching the user // input, with each cmd_token->arg holding the corresponding input assert (*el); @@ -290,7 +293,7 @@ command_complete (struct graph *graph, unsigned int idx; for (idx = 0; idx < vector_active (vline) && next->count > 0; idx++) { - list_free (current); + list_delete (current); current = next; next = list_new(); @@ -334,8 +337,8 @@ command_complete (struct graph *graph, for (ALL_LIST_ELEMENTS_RO (next,node,gn)) listnode_add (*completions, gn->data); - list_free (current); - list_free (next); + list_delete (current); + list_delete (next); return matcher_rv; } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 1fe46a87e5..5e01e6c05b 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -84,7 +84,7 @@ DEFUN (grammar_test_complete, vector command = cmd_make_strvec (cmdstr); // generate completions of user input - struct list *completions = list_new (); + struct list *completions; enum matcher_rv result = command_complete (nodegraph, command, &completions); // print completions or relevant error message @@ -106,6 +106,10 @@ DEFUN (grammar_test_complete, tkn = vector_slot (comps, i); fprintf (stdout, " %-*s %s%s", width, tkn->text, tkn->desc, "\n"); } + + for (i = 0; i < vector_active (comps); i++) + del_cmd_token ((struct cmd_token_t *) vector_slot (comps, i)); + vector_free (comps); } else fprintf (stdout, "%% No match%s", "\n"); @@ -147,6 +151,7 @@ DEFUN (grammar_test_match, fprintf (stdout, "func: %p%s", element->func, "\n"); list_delete (argvv); + del_cmd_element (element); } else { assert(MATCHER_ERROR(result)); @@ -167,8 +172,8 @@ DEFUN (grammar_test_match, } // free resources - cmd_free_strvec(command); - free(cmdstr); + cmd_free_strvec (command); + free (cmdstr); return CMD_SUCCESS; } @@ -351,6 +356,7 @@ new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) void del_cmd_token (struct cmd_token_t *token) { + fprintf (stdout, "deleting token\n"); if (!token) return; if (token->text) From 040f39843e3440b01d32d7620b8c14d576cdd8e3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 21:22:34 +0000 Subject: [PATCH 065/280] lib: Fix memory leak in ipv6_prefix_match Signed-off-by: Quentin Young --- lib/command_match.c | 31 +++++++++++++++++++------------ lib/grammar_sandbox.c | 1 - 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index cd2200e0c0..dce3292709 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -720,7 +720,7 @@ match_ipv6_prefix (const char *str) { struct sockaddr_in6 sin6_dummy; const char *delim = "/\0"; - char *dupe, *prefix, *mask, *context, *endptr; + char *tofree, *dupe, *prefix, *mask, *endptr; int nmask = -1; if (str == NULL) @@ -729,26 +729,33 @@ match_ipv6_prefix (const char *str) if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) return no_match; - /* tokenize to address + mask */ - dupe = XCALLOC(MTYPE_TMP, strlen(str)+1); - strncpy(dupe, str, strlen(str)+1); - prefix = strtok_r(dupe, delim, &context); - mask = strtok_r(NULL, delim, &context); - - if (!mask) - return partly_match; + /* tokenize to prefix + mask */ + tofree = dupe = XSTRDUP (MTYPE_TMP, str); + prefix = strsep (&dupe, delim); + mask = dupe; /* validate prefix */ - if (inet_pton(AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) + if (inet_pton (AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) + { + XFREE (MTYPE_TMP, tofree); return no_match; + } /* validate mask */ + if (!mask) + { + XFREE (MTYPE_TMP, tofree); + return partly_match; + } + nmask = strtoimax (mask, &endptr, 10); if (*endptr != '\0' || nmask < 0 || nmask > 128) + { + XFREE (MTYPE_TMP, tofree); return no_match; + } - XFREE(MTYPE_TMP, dupe); - + XFREE (MTYPE_TMP, tofree); return exact_match; } #endif diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 5e01e6c05b..41fee1c1cb 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -356,7 +356,6 @@ new_cmd_token (enum cmd_token_type_t type, char *text, char *desc) void del_cmd_token (struct cmd_token_t *token) { - fprintf (stdout, "deleting token\n"); if (!token) return; if (token->text) From 535ef5569adb011209ad4f852da75d4a8fa06c1d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 14 Sep 2016 22:04:53 +0000 Subject: [PATCH 066/280] lib: Add support for selectors inside options Selectors may be nested inside options []. Removed the ability to make multipart options [like|so]. Signed-off-by: Quentin Young --- lib/command_parse.y | 105 ++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index bd958c5ace..cf829eeb59 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -83,7 +83,6 @@ %type option_token %type option_token_seq %type selector -%type selector_element_root %type selector_token %type selector_token_seq @@ -95,13 +94,14 @@ /* state variables for a single parser run */ struct graph_node *startnode; // start node of DFA - struct graph_node *currnode, // current position in DFA - *seqhead; // sequence head + struct graph_node *currnode; // current position in DFA struct graph_node *optnode_start, // start node for option set + *optnode_seqtail, // sequence tail for option sequence *optnode_end; // end node for option set struct graph_node *selnode_start, // start node for selector set + *selnode_seqtail, // sequence tail for selector sequence *selnode_end; // end node for selector set char *docstr_start, *docstr; // pointers to copy of command docstring @@ -124,6 +124,9 @@ enum cmd_token_type_t type, char *text, char *doc); + static struct graph_node * + find_tail (struct graph_node *); + static void terminate_graph (struct graph *, struct graph_node *, @@ -142,10 +145,9 @@ startnode = vector_slot (graph->nodes, 0); /* clear state pointers */ - seqhead = NULL; currnode = NULL; - selnode_start = selnode_end = NULL; - optnode_start = optnode_end = NULL; + selnode_start = selnode_seqtail = selnode_end = NULL; + optnode_start = optnode_seqtail = optnode_end = NULL; /* set string to parse */ set_lexer_string (element->string); @@ -203,14 +205,12 @@ cmd_token: | selector { graph_add_edge (currnode, $1); - currnode = selnode_end; - selnode_start = selnode_end = NULL; + currnode = find_tail ($1); } | option { graph_add_edge (currnode, $1); - currnode = optnode_end; - optnode_start = optnode_end = NULL; + currnode = find_tail ($1); } ; @@ -286,6 +286,7 @@ selector: '<' selector_part '>' // all the graph building is done in selector_element, // so just return the selector subgraph head $$ = selnode_start; + selnode_start = selnode_end = NULL; }; selector_part: @@ -293,7 +294,7 @@ selector_part: | selector_element '|' selector_element ; -selector_element: selector_element_root selector_token_seq +selector_element: selector_token_seq { // if the selector start and end do not exist, create them if (!selnode_start || !selnode_end) { @@ -304,79 +305,69 @@ selector_element: selector_element_root selector_token_seq // add element head as a child of the selector graph_add_edge (selnode_start, $1); + graph_add_edge (selnode_seqtail, selnode_end); - if ($2) { - graph_add_edge ($1, seqhead); // tack on selector_token_seq - graph_add_edge ($2, selnode_end); // $2 is the sequence tail - } - else - graph_add_edge ($1, selnode_end); - - seqhead = NULL; + selnode_seqtail = NULL; } selector_token_seq: - %empty { $$ = NULL; } + selector_token +{ + assert (!selnode_seqtail); + selnode_seqtail = $1; +} | selector_token_seq selector_token { - // if the sequence component is NUL_TKN, this is a sequence start - if (!$1) { - assert(!seqhead); - seqhead = $2; - } - else // chain on new node - graph_add_edge ($1, $2); - - $$ = $2; + graph_add_edge ($1, $2); + selnode_seqtail = $2; } ; -selector_element_root: +selector_token: literal_token | placeholder_token ; -selector_token: - selector_element_root -; - -/* [option|set] productions */ -option: '[' option_part ']' +/* [optional] productions */ +option: '[' option_element ']' { // add null path graph_add_edge (optnode_start, optnode_end); $$ = optnode_start; + optnode_start = optnode_end = NULL; }; -option_part: - option_part '|' option_element -| option_element -; - -option_element: - option_token_seq +option_element: option_token_seq { if (!optnode_start || !optnode_end) { - assert(!optnode_start && !optnode_end); + assert (!optnode_start && !optnode_end); optnode_start = new_token_node (graph, OPTION_TKN, NULL, NULL); optnode_end = new_token_node (graph, NUL_TKN, NULL, NULL); } - graph_add_edge (optnode_start, seqhead); - graph_add_edge ($1, optnode_end); - seqhead = NULL; + graph_add_edge (optnode_start, $1); + graph_add_edge (optnode_seqtail, optnode_end); + optnode_seqtail = NULL; } option_token_seq: option_token -{ $$ = seqhead = $1; } +{ + assert (!optnode_seqtail); + optnode_seqtail = find_tail ($1); +} | option_token_seq option_token -{ $$ = graph_add_edge ($1, $2); } +{ + graph_add_edge (find_tail ($1), $2); +// exit (EXIT_FAILURE); + optnode_seqtail = find_tail ($2); +} ; option_token: literal_token | placeholder_token +| selector ; %% @@ -414,11 +405,10 @@ cleanup() cleanup_lexer (); /* clear state pointers */ - seqhead = NULL; currnode = NULL; docstr_start = docstr = NULL; - selnode_start = selnode_end = NULL; - optnode_start = optnode_end = NULL; + selnode_start = selnode_seqtail = selnode_end = NULL; + optnode_start = selnode_seqtail = optnode_end = NULL; } static void @@ -475,6 +465,17 @@ node_adjacent (struct graph_node *first, struct graph_node *second) return NULL; } +/** + * Walks down the left side of graph, returning the first encountered node with + * no children. + */ +static struct graph_node * +find_tail (struct graph_node *node) +{ + while (vector_active (node->to) > 0) + node = vector_slot (node->to, 0); + return node; +} /** * Creates an edge betwen two nodes, unless there is already an edge to an * equivalent node. From ba06a3a0dec8b132f3ad81c62f7ec98f95430f11 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 18 Sep 2016 20:31:20 +0000 Subject: [PATCH 067/280] lib: Add edge removal to graph data structure Ability to remove directed edge between two nodes. Also ensures that adjacency vectors have no null entries. Signed-off-by: Quentin Young --- lib/graph.c | 51 ++++++++++++++++++++++++++++++++++++--------------- lib/graph.h | 11 ++++++++++- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lib/graph.c b/lib/graph.c index 18f32b8ca2..7c59fe95b5 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -50,6 +50,16 @@ graph_new_node (struct graph *graph, void *data, void (*del) (void*)) return node; } +static void +vector_remove (vector v, unsigned int ix) +{ + vector_unset (v, ix); + if (ix == vector_active (v)) return; + for (; ix < vector_active (v) - 1; ix++) + v->index[ix] = v->index[ix+1]; + v->active--; +} + void graph_delete_node (struct graph *graph, struct graph_node *node) { @@ -58,25 +68,23 @@ graph_delete_node (struct graph *graph, struct graph_node *node) // an adjacent node struct graph_node *adj; - // for all nodes that have an edge to us, remove us from their ->to - for (unsigned int i = 0; i < vector_active (node->from); i++) + // remove all edges from other nodes to us + vector edges = vector_copy (node->from); + for (unsigned int i = 0; i < vector_active (edges); i++) { - adj = vector_slot (node->from, i); - if (!adj) continue; - for (unsigned int j = 0; j < vector_active (adj->to); j++) - if (vector_slot (adj->to, j) == node) - vector_unset (adj->to, j); + adj = vector_slot (edges, i); + graph_remove_edge (adj, node); } + vector_free (edges); - // for all nodes that we have an edge to, remove us from their ->from - for (unsigned int i = 0; i < vector_active (node->to); i++) + // remove all edges from us to other nodes + edges = vector_copy (node->to); + for (unsigned int i = 0; i < vector_active (edges); i++) { - adj = vector_slot (node->to, i); - if (!adj) continue; - for (unsigned int j = 0; j < vector_active (adj->from); j++) - if (vector_slot (adj->from, j) == node) - vector_unset (adj->from, j); + adj = vector_slot (edges, i); + graph_remove_edge (node, adj); } + vector_free (edges); // if there is a deletion callback, call it if (node->del && node->data) @@ -89,7 +97,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node) // remove node from graph->nodes for (unsigned int i = 0; i < vector_active (graph->nodes); i++) if (vector_slot (graph->nodes, i) == node) - vector_unset (graph->nodes, i); + vector_remove (graph->nodes, i); // free the node itself XFREE (MTYPE_GRAPH_NODE, node); @@ -103,6 +111,19 @@ graph_add_edge (struct graph_node *from, struct graph_node *to) return to; } +void +graph_remove_edge (struct graph_node *from, struct graph_node *to) +{ + // remove from from to->from + for (unsigned int i = 0; i < vector_active (to->from); i++) + if (vector_slot (to->from, i) == from) + vector_remove (to->from, i); + // remove to from from->to + for (unsigned int i = 0; i < vector_active (from->to); i++) + if (vector_slot (from->to, i) == to) + vector_remove (from->to, i); +} + void graph_delete_graph (struct graph *graph) { diff --git a/lib/graph.h b/lib/graph.h index b6a03b938a..8d8aa3823b 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -64,6 +64,7 @@ graph_new_node (struct graph *graph, void *data, void (*del) (void*)); * If *data and *del are non-null, the following call is made: * (*node->del) (node->data); * + * @param[in] graph the graph this node belongs to * @param[out] node pointer to node to delete */ void @@ -80,8 +81,16 @@ struct graph_node * graph_add_edge (struct graph_node *from, struct graph_node *to); /** - * Deletes a graph. + * Removes a directed edge between two nodes. * + * @param[in] from + * @param[in] to + */ +void +graph_remove_edge (struct graph_node *from, struct graph_node *to); + +/** + * Deletes a graph. * Calls graph_delete_node on each node before freeing the graph struct itself. * * @param graph the graph to delete From 9286efabb9c08098c811faeca0656617dfc79ed5 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 18 Sep 2016 20:32:21 +0000 Subject: [PATCH 068/280] lib: Allow nesting options in selectors Options may now be nested in selectors as long as they are not the first token in sequence. Signed-off-by: Quentin Young --- lib/command_lex.l | 5 - lib/command_parse.y | 291 ++++++++++++++++++++++---------------------- 2 files changed, 146 insertions(+), 150 deletions(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index e5fc01e4c9..5c709dce22 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -54,11 +54,6 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\) {IPV6} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;} {IPV6_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;} {VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} -{NUMBER} { - char *endptr; - yylval.number = strtoimax(yytext, &endptr, 10); - return NUMBER; - } {RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} . {return yytext[0];} %% diff --git a/lib/command_parse.y b/lib/command_parse.y index cf829eeb59..1922ba2297 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -62,6 +62,7 @@ long long number; char *string; struct graph_node *node; + struct subgraph *subgraph; } /* union types for lexed tokens */ @@ -72,39 +73,36 @@ %token IPV6_PREFIX %token VARIABLE %token RANGE -%token NUMBER /* union types for parsed rules */ %type start %type sentence_root %type literal_token %type placeholder_token -%type option -%type option_token -%type option_token_seq -%type selector -%type selector_token -%type selector_token_seq +%type simple_token +%type option +%type option_token +%type option_token_seq +%type selector +%type selector_token +%type selector_token_seq +%type selector_seq_seq +%type compound_token %code { /* bison declarations */ void yyerror (struct graph *, struct cmd_element *el, char const *msg); - /* state variables for a single parser run */ - struct graph_node *startnode; // start node of DFA + /* subgraph semantic value */ + struct subgraph { + struct graph_node *start, *end; + }; - struct graph_node *currnode; // current position in DFA + struct graph_node *currnode, *startnode; - struct graph_node *optnode_start, // start node for option set - *optnode_seqtail, // sequence tail for option sequence - *optnode_end; // end node for option set - - struct graph_node *selnode_start, // start node for selector set - *selnode_seqtail, // sequence tail for selector sequence - *selnode_end; // end node for selector set - - char *docstr_start, *docstr; // pointers to copy of command docstring + /* pointers to copy of command docstring */ + char *docstr_start, *docstr; /* helper functions for parser */ static char * @@ -124,9 +122,6 @@ enum cmd_token_type_t type, char *text, char *doc); - static struct graph_node * - find_tail (struct graph_node *); - static void terminate_graph (struct graph *, struct graph_node *, @@ -142,12 +137,10 @@ /* called automatically before yyparse */ %initial-action { - startnode = vector_slot (graph->nodes, 0); - /* clear state pointers */ - currnode = NULL; - selnode_start = selnode_seqtail = selnode_end = NULL; - optnode_start = optnode_seqtail = optnode_end = NULL; + currnode = startnode = NULL; + + startnode = vector_slot (graph->nodes, 0); /* set string to parse */ set_lexer_string (element->string); @@ -165,10 +158,10 @@ start: // tack on the command element terminate_graph (graph, currnode, element); } -| sentence_root cmd_token_seq '.' placeholder_token +| sentence_root cmd_token_seq placeholder_token '.' '.' '.' { - if ((currnode = add_edge_dedup (currnode, $4)) != $4) - graph_delete_node (graph, $4); + if ((currnode = add_edge_dedup (currnode, $3)) != $3) + graph_delete_node (graph, $3); // adding a node as a child of itself accepts any number // of the same token, which is what we want for varags @@ -177,40 +170,18 @@ start: // tack on the command element terminate_graph (graph, currnode, element); } +; sentence_root: WORD { struct graph_node *root = - new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + new_token_node (graph, WORD_TKN, XSTRDUP (MTYPE_CMD_TOKENS, $1), doc_next()); if ((currnode = add_edge_dedup (startnode, root)) != root) graph_delete_node (graph, root); free ($1); $$ = currnode; -}; - -cmd_token: - placeholder_token -{ - if ((currnode = add_edge_dedup (currnode, $1)) != $1) - graph_delete_node (graph, $1); -} -| literal_token -{ - if ((currnode = add_edge_dedup (currnode, $1)) != $1) - graph_delete_node (graph, $1); -} -/* selectors and options are subgraphs with start and end nodes */ -| selector -{ - graph_add_edge (currnode, $1); - currnode = find_tail ($1); -} -| option -{ - graph_add_edge (currnode, $1); - currnode = find_tail ($1); } ; @@ -219,6 +190,37 @@ cmd_token_seq: | cmd_token_seq cmd_token ; +cmd_token: + simple_token +{ + if ((currnode = add_edge_dedup (currnode, $1)) != $1) + graph_delete_node (graph, $1); +} +| compound_token +{ + graph_add_edge (currnode, $1->start); + currnode = $1->end; + XFREE (MTYPE_TMP, $1); +} +; + +simple_token: + literal_token +| placeholder_token +; + +compound_token: + selector +| option +; + +literal_token: WORD +{ + $$ = new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); + free ($1); +} +; + placeholder_token: IPV4 { @@ -257,117 +259,129 @@ placeholder_token: token->max = strtoll (yylval.string, &yylval.string, 10); // validate range - if (token->min >= token->max) yyerror (graph, element, "Invalid range."); + if (token->min > token->max) yyerror (graph, element, "Invalid range."); free ($1); } ; -literal_token: - WORD -{ - $$ = new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); - free ($1); -} -| NUMBER -{ - $$ = new_token_node (graph, NUMBER_TKN, NULL, doc_next()); - struct cmd_token_t *token = $$->data; - - token->value = yylval.number; - token->text = XCALLOC(MTYPE_CMD_TOKENS, DECIMAL_STRLEN_MAX+1); - snprintf(token->text, DECIMAL_STRLEN_MAX, "%lld", token->value); -} -; - /* productions */ -selector: '<' selector_part '>' +selector: '<' selector_seq_seq '>' { - // all the graph building is done in selector_element, - // so just return the selector subgraph head - $$ = selnode_start; - selnode_start = selnode_end = NULL; + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = new_token_node (graph, SELECTOR_TKN, NULL, NULL); + $$->end = new_token_node (graph, NUL_TKN, NULL, NULL); + for (unsigned int i = 0; i < vector_active ($2->start->to); i++) + { + struct graph_node *sn = vector_slot ($2->start->to, i), + *en = vector_slot ($2->end->from, i); + graph_add_edge ($$->start, sn); + graph_add_edge (en, $$->end); + } + graph_delete_node (graph, $2->start); + graph_delete_node (graph, $2->end); + XFREE (MTYPE_TMP, $2); }; -selector_part: - selector_part '|' selector_element -| selector_element '|' selector_element +selector_seq_seq: + selector_seq_seq '|' selector_token_seq +{ + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = graph_new_node (graph, NULL, NULL); + $$->end = graph_new_node (graph, NULL, NULL); + + // link in last sequence + graph_add_edge ($$->start, $3->start); + graph_add_edge ($3->end, $$->end); + XFREE (MTYPE_TMP, $3); + + for (unsigned int i = 0; i < vector_active ($1->start->to); i++) + { + struct graph_node *sn = vector_slot ($1->start->to, i), + *en = vector_slot ($1->end->from, i); + graph_add_edge ($$->start, sn); + graph_add_edge (en, $$->end); + } + graph_delete_node (graph, $1->start); + graph_delete_node (graph, $1->end); + XFREE (MTYPE_TMP, $1); + XFREE (MTYPE_TMP, $3); +} +| selector_token_seq '|' selector_token_seq +{ + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = graph_new_node (graph, NULL, NULL); + $$->end = graph_new_node (graph, NULL, NULL); + graph_add_edge ($$->start, $1->start); + graph_add_edge ($1->end, $$->end); + graph_add_edge ($$->start, $3->start); + graph_add_edge ($3->end, $$->end); + XFREE (MTYPE_TMP, $1); + XFREE (MTYPE_TMP, $3); +} ; -selector_element: selector_token_seq -{ - // if the selector start and end do not exist, create them - if (!selnode_start || !selnode_end) { - assert(!selnode_start && !selnode_end); - selnode_start = new_token_node (graph, SELECTOR_TKN, NULL, NULL); - selnode_end = new_token_node (graph, NUL_TKN, NULL, NULL); - } - - // add element head as a child of the selector - graph_add_edge (selnode_start, $1); - graph_add_edge (selnode_seqtail, selnode_end); - - selnode_seqtail = NULL; -} - selector_token_seq: - selector_token + simple_token { - assert (!selnode_seqtail); - selnode_seqtail = $1; + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = $$->end = $1; } | selector_token_seq selector_token { - graph_add_edge ($1, $2); - selnode_seqtail = $2; + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + graph_add_edge ($1->end, $2->start); + $$->start = $1->start; + $$->end = $2->end; + XFREE (MTYPE_TMP, $1); + XFREE (MTYPE_TMP, $2); } ; selector_token: - literal_token -| placeholder_token + simple_token +{ + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = $$->end = $1; +} +| option ; -/* [optional] productions */ -option: '[' option_element ']' +/* [option] productions */ +option: '[' option_token_seq ']' { - // add null path - graph_add_edge (optnode_start, optnode_end); - $$ = optnode_start; - optnode_start = optnode_end = NULL; -}; - -option_element: option_token_seq -{ - if (!optnode_start || !optnode_end) { - assert (!optnode_start && !optnode_end); - optnode_start = new_token_node (graph, OPTION_TKN, NULL, NULL); - optnode_end = new_token_node (graph, NUL_TKN, NULL, NULL); - } - - graph_add_edge (optnode_start, $1); - graph_add_edge (optnode_seqtail, optnode_end); - optnode_seqtail = NULL; + // make a new option + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = new_token_node (graph, OPTION_TKN, NULL, NULL); + $$->end = new_token_node (graph, NUL_TKN, NULL, NULL); + // add a path through the sequence to the end + graph_add_edge ($$->start, $2->start); + graph_add_edge ($2->end, $$->end); + // add a path directly from the start to the end + graph_add_edge ($$->start, $$->end); + XFREE (MTYPE_TMP, $2); } +; option_token_seq: option_token -{ - assert (!optnode_seqtail); - optnode_seqtail = find_tail ($1); -} | option_token_seq option_token { - graph_add_edge (find_tail ($1), $2); -// exit (EXIT_FAILURE); - optnode_seqtail = find_tail ($2); + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + graph_add_edge ($1->end, $2->start); + $$->start = $1->start; + $$->end = $2->end; + XFREE (MTYPE_TMP, $1); } ; option_token: - literal_token -| placeholder_token -| selector + simple_token +{ + $$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); + $$->start = $$->end = $1; +} +| compound_token ; %% @@ -407,8 +421,6 @@ cleanup() /* clear state pointers */ currnode = NULL; docstr_start = docstr = NULL; - selnode_start = selnode_seqtail = selnode_end = NULL; - optnode_start = selnode_seqtail = optnode_end = NULL; } static void @@ -465,17 +477,6 @@ node_adjacent (struct graph_node *first, struct graph_node *second) return NULL; } -/** - * Walks down the left side of graph, returning the first encountered node with - * no children. - */ -static struct graph_node * -find_tail (struct graph_node *node) -{ - while (vector_active (node->to) > 0) - node = vector_slot (node->to, 0); - return node; -} /** * Creates an edge betwen two nodes, unless there is already an edge to an * equivalent node. From d0bfb22c223d645e554290ca82581eb06f94ac3b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 19 Sep 2016 23:46:51 +0000 Subject: [PATCH 069/280] lib: Initial refactor pass on CLI backend Shotgun commit: * Remove shim sources from Makefile.am * Move new types to command.c / command.h * Rewrite command.c / command.h * Refactor shim types to real types in matcher and parser * Initial refactor pass on vty.c Signed-off-by: Quentin Young --- lib/Makefile.am | 4 +- lib/command.c | 2949 +++++++------------------------------------ lib/command.h | 411 ++---- lib/command_match.c | 59 +- lib/command_parse.y | 16 +- lib/vty.c | 1096 ++++++++-------- 6 files changed, 1193 insertions(+), 3342 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index d12f9ed6d9..b7bb434776 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,7 +11,7 @@ libzebra_la_LDFLAGS = -version-info 0:0:0 libzebra_la_SOURCES = \ network.c pid_output.c getopt.c getopt1.c daemon.c \ checksum.c vector.c linklist.c vty.c \ - graph.c command_parse.y command_lex.l command_match.c grammar_sandbox.c \ + graph.c command_parse.y command_lex.l command_match.c \ command.c \ sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \ filter.c routemap.c distribute.c stream.c str.c log.c plist.c \ @@ -28,7 +28,7 @@ libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@ pkginclude_HEADERS = \ buffer.h checksum.h filter.h getopt.h hash.h \ if.h linklist.h log.h \ - graph.h command_match.h grammar_sandbox.h \ + graph.h command_match.h \ command.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \ diff --git a/lib/command.c b/lib/command.c index 5bc157c851..f7800aa724 100644 --- a/lib/command.c +++ b/lib/command.c @@ -5,7 +5,7 @@ Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") This file is part of GNU Zebra. - + GNU Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your @@ -29,53 +29,19 @@ Boston, MA 02111-1307, USA. */ #include #include "thread.h" #include "vector.h" +#include "linklist.h" #include "vty.h" #include "command.h" #include "workqueue.h" #include "vrf.h" +#include "command_match.h" +#include "command_parse.h" + /* Command vector which includes some level of command lists. Normally each daemon maintains each own cmdvec. */ vector cmdvec = NULL; -struct cmd_token token_cr; -char *command_cr = NULL; - -/** - * Filter types. These tell the parser whether to allow - * partial matching on tokens. - */ -enum filter_type -{ - FILTER_RELAXED, - FILTER_STRICT -}; - -/** - * Command matcher result value. - */ -enum matcher_rv -{ - MATCHER_OK, - MATCHER_COMPLETE, - MATCHER_INCOMPLETE, - MATCHER_NO_MATCH, - MATCHER_AMBIGUOUS, - MATCHER_EXCEED_ARGC_MAX -}; - -/** - * Defines which matcher_rv values constitute - * an error. Should be used against matcher_rv - * return values to do basic error checking. - */ -#define MATCHER_ERROR(matcher_rv) \ - ( (matcher_rv) == MATCHER_INCOMPLETE \ - || (matcher_rv) == MATCHER_NO_MATCH \ - || (matcher_rv) == MATCHER_AMBIGUOUS \ - || (matcher_rv) == MATCHER_EXCEED_ARGC_MAX \ - ) - /* Host information structure. */ struct host host; @@ -129,7 +95,7 @@ static const struct facility_map { int facility; const char *name; size_t match; -} syslog_facilities[] = +} syslog_facilities[] = { { LOG_KERN, "kern", 1 }, { LOG_USER, "user", 2 }, @@ -181,7 +147,7 @@ static int level_match(const char *s) { int level ; - + for ( level = 0 ; zlog_priority [level] != NULL ; level ++ ) if (!strncmp (s, zlog_priority[level], 2)) return level; @@ -201,7 +167,7 @@ print_version (const char *progname) /* Utility function to concatenate argv argument into a single string with inserting ' ' character between each argument. */ char * -argv_concat (const char **argv, int argc, int shift) +argv_concat (struct cmd_token **argv, int argc, int shift) { int i; size_t len; @@ -210,14 +176,14 @@ argv_concat (const char **argv, int argc, int shift) len = 0; for (i = shift; i < argc; i++) - len += strlen(argv[i])+1; + len += strlen(argv[i]->arg)+1; if (!len) return NULL; p = str = XMALLOC(MTYPE_TMP, len); for (i = shift; i < argc; i++) { size_t arglen; - memcpy(p, argv[i], (arglen = strlen(argv[i]))); + memcpy(p, argv[i]->arg, (arglen = strlen(argv[i]->arg))); p += arglen; *p++ = ' '; } @@ -227,12 +193,12 @@ argv_concat (const char **argv, int argc, int shift) /* Install top node of command vector. */ void -install_node (struct cmd_node *node, - int (*func) (struct vty *)) +install_node (struct cmd_node *node, + int (*func) (struct vty *)) { vector_set_index (cmdvec, node->node, node); node->func = func; - node->cmd_vector = vector_init (VECTOR_MIN_SIZE); + node->cmdgraph = graph_new (); } /* Breaking up string into each command piece. I assume given @@ -245,10 +211,10 @@ cmd_make_strvec (const char *string) char *token; int strlen; vector strvec; - + if (string == NULL) return NULL; - + cp = string; /* Skip white spaces. */ @@ -266,12 +232,12 @@ cmd_make_strvec (const char *string) strvec = vector_init (VECTOR_MIN_SIZE); /* Copy each command piece and set into vector. */ - while (1) + while (1) { start = cp; while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && - *cp != '\0') - cp++; + *cp != '\0') + cp++; strlen = cp - start; token = XMALLOC (MTYPE_STRVEC, strlen + 1); memcpy (token, start, strlen); @@ -279,11 +245,11 @@ cmd_make_strvec (const char *string) vector_set (strvec, token); while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && - *cp != '\0') - cp++; + *cp != '\0') + cp++; if (*cp == '\0') - return strvec; + return strvec; } } @@ -304,388 +270,6 @@ cmd_free_strvec (vector v) vector_free (v); } -/** - * State structure for command format parser. Tracks - * parse tree position and miscellaneous state variables. - * Used when building a command vector from format strings. - */ -struct format_parser_state -{ - vector topvect; /* Top level vector */ - vector intvect; /* Intermediate level vector, used when there's - a multiple in a keyword. */ - vector curvect; /* current vector where read tokens should be - appended. */ - - const char *string; /* pointer to command string, not modified */ - const char *cp; /* pointer in command string, moved along while - parsing */ - const char *dp; /* pointer in description string, moved along while - parsing */ - - int in_keyword; /* flag to remember if we are in a keyword group */ - int in_multiple; /* flag to remember if we are in a multiple group */ - int just_read_word; /* flag to remember if the last thing we read was a - real word and not some abstract token */ -}; - -static void -format_parser_error(struct format_parser_state *state, const char *message) -{ - int offset = state->cp - state->string + 1; - - fprintf(stderr, "\nError parsing command: \"%s\"\n", state->string); - fprintf(stderr, " %*c\n", offset, '^'); - fprintf(stderr, "%s at offset %d.\n", message, offset); - fprintf(stderr, "This is a programming error. Check your DEFUNs etc.\n"); - exit(1); -} - -/** - * Reads out one section of a help string from state->dp. - * Leading whitespace is trimmed and the string is read until - * a newline is reached. - * - * @param[out] state format parser state - * @return the help string token read - */ -static char * -format_parser_desc_str(struct format_parser_state *state) -{ - const char *cp, *start; - char *token; - int strlen; - - cp = state->dp; - - if (cp == NULL) - return NULL; - - /* Skip white spaces. */ - while (isspace ((int) *cp) && *cp != '\0') - cp++; - - /* Return if there is only white spaces */ - if (*cp == '\0') - return NULL; - - start = cp; - - while (!(*cp == '\r' || *cp == '\n') && *cp != '\0') - cp++; - - strlen = cp - start; - token = XMALLOC (MTYPE_CMD_TOKENS, strlen + 1); - memcpy (token, start, strlen); - *(token + strlen) = '\0'; - - state->dp = cp; - - return token; -} - -/** - * Transitions format parser state into keyword parsing mode. - * A cmd_token struct, `token`, representing this keyword token is initialized - * and appended to state->curvect. token->keyword is initialized as a vector of - * vector, a new vector is initialized and added to token->keyword, and - * state->curvect is set to point at this vector. When control returns to the - * caller newly parsed tokens will be added to this vector. - * - * In short: - * state->curvect[HEAD] = new cmd_token - * state->curvect[HEAD]->keyword[0] = new vector - * state->curvect = state->curvect[HEAD]->keyword[0] - * - * @param[out] state state struct to transition - */ -static void -format_parser_begin_keyword(struct format_parser_state *state) -{ - struct cmd_token *token; - vector keyword_vect; - - if (state->in_keyword - || state->in_multiple) - format_parser_error(state, "Unexpected '{'"); - - state->cp++; - state->in_keyword = 1; - - token = XCALLOC(MTYPE_CMD_TOKENS, sizeof(*token)); - token->type = TOKEN_KEYWORD; - token->keyword = vector_init(VECTOR_MIN_SIZE); - - keyword_vect = vector_init(VECTOR_MIN_SIZE); - vector_set(token->keyword, keyword_vect); - - vector_set(state->curvect, token); - state->curvect = keyword_vect; -} - -/** - * Transitions format parser state into multiple parsing mode. - * A cmd_token struct, `token`, representing this multiple token is initialized - * and appended to state->curvect. token->multiple is initialized as a vector - * of cmd_token and state->curvect is set to point at token->multiple. If - * state->curvect != state->topvect (i.e. this multiple token is nested inside - * another composite token) then a pointer to state->curvect is saved in - * state->intvect. - * - * In short: - * state->curvect[HEAD] = new cmd_token - * state->curvect[HEAD]->multiple = new vector - * state->intvect = state->curvect IFF nested token - * state->curvect = state->curvect[HEAD]->multiple - * - * @param[out] state state struct to transition - */ -static void -format_parser_begin_multiple(struct format_parser_state *state) -{ - struct cmd_token *token; - - if (state->in_keyword == 1) - format_parser_error(state, "Keyword starting with '('"); - - if (state->in_multiple) - format_parser_error(state, "Nested group"); - - state->cp++; - state->in_multiple = 1; - state->just_read_word = 0; - - token = XCALLOC(MTYPE_CMD_TOKENS, sizeof(*token)); - token->type = TOKEN_MULTIPLE; - token->multiple = vector_init(VECTOR_MIN_SIZE); - - vector_set(state->curvect, token); - if (state->curvect != state->topvect) - state->intvect = state->curvect; - state->curvect = token->multiple; -} - -/** - * Transition format parser state out of keyword parsing mode. - * This function is called upon encountering '}'. - * state->curvect is reassigned to the top level vector (as - * keywords cannot be nested) and state flags are set appropriately. - * - * @param[out] state state struct to transition - */ -static void -format_parser_end_keyword(struct format_parser_state *state) -{ - if (state->in_multiple - || !state->in_keyword) - format_parser_error(state, "Unexpected '}'"); - - if (state->in_keyword == 1) - format_parser_error(state, "Empty keyword group"); - - state->cp++; - state->in_keyword = 0; - state->curvect = state->topvect; -} - -/** - * Transition format parser state out of multiple parsing mode. - * This function is called upon encountering ')'. - * state->curvect is reassigned to its parent vector (state->intvect - * if the multiple token being exited was nested inside another token, - * state->topvect otherwise) and state flags are set appropriately. - * - * @param[out] state state struct to transition - */ -static void -format_parser_end_multiple(struct format_parser_state *state) -{ - char *dummy; - - if (!state->in_multiple) - format_parser_error(state, "Unexpected ')'"); - - if (vector_active(state->curvect) == 0) - format_parser_error(state, "Empty multiple section"); - - if (!state->just_read_word) - { - /* There are constructions like - * 'show ip ospf database ... (self-originate|)' - * in use. - * The old parser reads a description string for the - * word '' between |) which will never match. - * Simulate this behvaior by dropping the next desc - * string in such a case. */ - - dummy = format_parser_desc_str(state); - XFREE(MTYPE_CMD_TOKENS, dummy); - } - - state->cp++; - state->in_multiple = 0; - - if (state->intvect) - state->curvect = state->intvect; - else - state->curvect = state->topvect; -} - -/** - * Format parser handler for pipe '|' character. - * This character separates subtokens in multiple and keyword type tokens. - * If the current token is a multiple keyword, the position pointer is - * simply moved past the pipe and state flags are set appropriately. - * If the current token is a keyword token, the position pointer is moved - * past the pipe. Then the cmd_token struct for the keyword is fetched and - * a new vector of cmd_token is appended to its vector of vector. Finally - * state->curvect is set to point at this new vector. - * - * In short: - * state->curvect = state->topvect[HEAD]->keyword[HEAD] = new vector - * - * @param[out] state state struct to transition - */ -static void -format_parser_handle_pipe(struct format_parser_state *state) -{ - struct cmd_token *keyword_token; - vector keyword_vect; - - if (state->in_multiple) - { - state->just_read_word = 0; - state->cp++; - } - else if (state->in_keyword) - { - state->in_keyword = 1; - state->cp++; - - keyword_token = vector_slot(state->topvect, - vector_active(state->topvect) - 1); - keyword_vect = vector_init(VECTOR_MIN_SIZE); - vector_set(keyword_token->keyword, keyword_vect); - state->curvect = keyword_vect; - } - else - { - format_parser_error(state, "Unexpected '|'"); - } -} - -/** - * Format parser handler for terminal tokens. - * Parses the token, appends it to state->curvect, and sets - * state flags appropriately. - * - * @param[out] state state struct for current format parser state - */ -static void -format_parser_read_word(struct format_parser_state *state) -{ - const char *start; - int len; - char *cmd; - struct cmd_token *token; - - start = state->cp; - - while (state->cp[0] != '\0' - && !strchr("\r\n(){}|", state->cp[0]) - && !isspace((int)state->cp[0])) - state->cp++; - - len = state->cp - start; - cmd = XMALLOC(MTYPE_CMD_TOKENS, len + 1); - memcpy(cmd, start, len); - cmd[len] = '\0'; - - token = XCALLOC(MTYPE_CMD_TOKENS, sizeof(*token)); - token->type = TOKEN_TERMINAL; - if (strcmp (cmd, "A.B.C.D") == 0) - token->terminal = TERMINAL_IPV4; - else if (strcmp (cmd, "A.B.C.D/M") == 0) - token->terminal = TERMINAL_IPV4_PREFIX; - else if (strcmp (cmd, "X:X::X:X") == 0) - token->terminal = TERMINAL_IPV6; - else if (strcmp (cmd, "X:X::X:X/M") == 0) - token->terminal = TERMINAL_IPV6_PREFIX; - else if (cmd[0] == '[') - token->terminal = TERMINAL_OPTION; - else if (cmd[0] == '.') - token->terminal = TERMINAL_VARARG; - else if (cmd[0] == '<') - token->terminal = TERMINAL_RANGE; - else if (cmd[0] >= 'A' && cmd[0] <= 'Z') - token->terminal = TERMINAL_VARIABLE; - else - token->terminal = TERMINAL_LITERAL; - - token->cmd = cmd; - token->desc = format_parser_desc_str(state); - vector_set(state->curvect, token); - - if (state->in_keyword == 1) - state->in_keyword = 2; - - state->just_read_word = 1; -} - -/** - * Parse a given command format string and build a tree of tokens from - * it that is suitable to be used by the command subsystem. - * - * @param string Command format string. - * @param descstr Description string. - * @return A vector of struct cmd_token representing the given command, - * or NULL on error. - */ -static vector -cmd_parse_format(const char *string, const char *descstr) -{ - struct format_parser_state state; - - if (string == NULL) - return NULL; - - memset(&state, 0, sizeof(state)); - state.topvect = state.curvect = vector_init(VECTOR_MIN_SIZE); - state.cp = state.string = string; - state.dp = descstr; - - while (1) - { - while (isspace((int)state.cp[0]) && state.cp[0] != '\0') - state.cp++; - - switch (state.cp[0]) - { - case '\0': - if (state.in_keyword - || state.in_multiple) - format_parser_error(&state, "Unclosed group/keyword"); - return state.topvect; - case '{': - format_parser_begin_keyword(&state); - break; - case '(': - format_parser_begin_multiple(&state); - break; - case '}': - format_parser_end_keyword(&state); - break; - case ')': - format_parser_end_multiple(&state); - break; - case '|': - format_parser_handle_pipe(&state); - break; - default: - format_parser_read_word(&state); - } - } -} /* Return prompt character of specified node. */ const char * @@ -702,23 +286,23 @@ void install_element (enum node_type ntype, struct cmd_element *cmd) { struct cmd_node *cnode; - + /* cmd_init hasn't been called */ if (!cmdvec) return; - + cnode = vector_slot (cmdvec, ntype); - if (cnode == NULL) + if (cnode == NULL) { fprintf (stderr, "Command node %d doesn't exist, please check it\n", - ntype); - exit (1); + ntype); + exit (EXIT_FAILURE); } + // add node to command graph and command vector + command_parse_format (cnode->cmdgraph, cmd); vector_set (cnode->cmd_vector, cmd); - if (cmd->tokens == NULL) - cmd->tokens = cmd_parse_format(cmd->string, cmd->doc); } static const unsigned char itoa64[] = @@ -727,7 +311,7 @@ static const unsigned char itoa64[] = static void to64(char *s, long v, int n) { - while (--n >= 0) + while (--n >= 0) { *s++ = itoa64[v&0x3f]; v >>= 6; @@ -742,7 +326,7 @@ zencrypt (const char *passwd) char *crypt (const char *, const char *); gettimeofday(&tv,0); - + to64(&salt[0], random(), 3); to64(&salt[3], tv.tv_usec, 3); salt[5] = '\0'; @@ -760,9 +344,9 @@ config_write_host (struct vty *vty) if (host.encrypt) { if (host.password_encrypt) - vty_out (vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE); + vty_out (vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE); if (host.enable_encrypt) - vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE); + vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE); } else { @@ -775,17 +359,17 @@ config_write_host (struct vty *vty) if (zlog_default->default_lvl != LOG_DEBUG) { vty_out (vty, "! N.B. The 'log trap' command is deprecated.%s", - VTY_NEWLINE); + VTY_NEWLINE); vty_out (vty, "log trap %s%s", - zlog_priority[zlog_default->default_lvl], VTY_NEWLINE); + zlog_priority[zlog_default->default_lvl], VTY_NEWLINE); } if (host.logfile && (zlog_default->maxlvl[ZLOG_DEST_FILE] != ZLOG_DISABLED)) { vty_out (vty, "log file %s", host.logfile); if (zlog_default->maxlvl[ZLOG_DEST_FILE] != zlog_default->default_lvl) - vty_out (vty, " %s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_FILE]]); + vty_out (vty, " %s", + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_FILE]]); vty_out (vty, "%s", VTY_NEWLINE); } @@ -793,8 +377,8 @@ config_write_host (struct vty *vty) { vty_out (vty, "log stdout"); if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != zlog_default->default_lvl) - vty_out (vty, " %s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_STDOUT]]); + vty_out (vty, " %s", + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_STDOUT]]); vty_out (vty, "%s", VTY_NEWLINE); } @@ -802,27 +386,27 @@ config_write_host (struct vty *vty) vty_out(vty,"no log monitor%s",VTY_NEWLINE); else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl) vty_out(vty,"log monitor %s%s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE); + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE); if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED) { vty_out (vty, "log syslog"); if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != zlog_default->default_lvl) - vty_out (vty, " %s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_SYSLOG]]); + vty_out (vty, " %s", + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_SYSLOG]]); vty_out (vty, "%s", VTY_NEWLINE); } if (zlog_default->facility != LOG_DAEMON) vty_out (vty, "log facility %s%s", - facility_name(zlog_default->facility), VTY_NEWLINE); + facility_name(zlog_default->facility), VTY_NEWLINE); if (zlog_default->record_priority == 1) vty_out (vty, "log record-priority%s", VTY_NEWLINE); if (zlog_default->timestamp_precision > 0) vty_out (vty, "log timestamp precision %d%s", - zlog_default->timestamp_precision, VTY_NEWLINE); + zlog_default->timestamp_precision, VTY_NEWLINE); if (host.advanced) vty_out (vty, "service advanced-vty%s", VTY_NEWLINE); @@ -832,7 +416,7 @@ config_write_host (struct vty *vty) if (host.lines >= 0) vty_out (vty, "service terminal-length %d%s", host.lines, - VTY_NEWLINE); + VTY_NEWLINE); if (host.motdfile) vty_out (vty, "banner motd file %s%s", host.motdfile, VTY_NEWLINE); @@ -850,1091 +434,15 @@ cmd_node_vector (vector v, enum node_type ntype) return cnode->cmd_vector; } -/* Completion match types. */ -enum match_type +/* Utility function for getting command graph. */ +static struct graph * +cmd_node_graph (vector v, enum node_type ntype) { - no_match, - extend_match, - ipv4_prefix_match, - ipv4_match, - ipv6_prefix_match, - ipv6_match, - range_match, - vararg_match, - partly_match, - exact_match -}; - -#define IPV4_ADDR_STR "0123456789." -#define IPV4_PREFIX_STR "0123456789./" - -/** - * Determines whether a string is a valid ipv4 token. - * - * @param[in] str the string to match - * @return exact_match if the string is an exact match, no_match/partly_match - * otherwise - */ -static enum match_type -cmd_ipv4_match (const char *str) -{ - struct sockaddr_in sin_dummy; - - if (str == NULL) - return partly_match; - - if (strspn (str, IPV4_ADDR_STR) != strlen (str)) - return no_match; - - if (inet_pton(AF_INET, str, &sin_dummy.sin_addr) != 1) - return no_match; - - return exact_match; -} - -static enum match_type -cmd_ipv4_prefix_match (const char *str) -{ - struct sockaddr_in sin_dummy; - const char *delim = "/\0"; - char *dupe, *prefix, *mask, *context, *endptr; - int nmask = -1; - - if (str == NULL) - return partly_match; - - if (strspn (str, IPV4_PREFIX_STR) != strlen (str)) - return no_match; - - /* tokenize to address + mask */ - dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); - strncpy(dupe, str, strlen(str)+1); - prefix = strtok_r(dupe, delim, &context); - mask = strtok_r(NULL, delim, &context); - - if (!mask) - return partly_match; - - /* validate prefix */ - if (inet_pton(AF_INET, prefix, &sin_dummy.sin_addr) != 1) - return no_match; - - /* validate mask */ - nmask = strtol (mask, &endptr, 10); - if (*endptr != '\0' || nmask < 0 || nmask > 32) - return no_match; - - XFREE(MTYPE_TMP, dupe); - - return exact_match; -} - -#define IPV6_ADDR_STR "0123456789abcdefABCDEF:." -#define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./" - -#ifdef HAVE_IPV6 - -static enum match_type -cmd_ipv6_match (const char *str) -{ - struct sockaddr_in6 sin6_dummy; - int ret; - - if (str == NULL) - return partly_match; - - if (strspn (str, IPV6_ADDR_STR) != strlen (str)) - return no_match; - - /* use inet_pton that has a better support, - * for example inet_pton can support the automatic addresses: - * ::1.2.3.4 - */ - ret = inet_pton(AF_INET6, str, &sin6_dummy.sin6_addr); - - if (ret == 1) - return exact_match; - - return no_match; -} - -static enum match_type -cmd_ipv6_prefix_match (const char *str) -{ - struct sockaddr_in6 sin6_dummy; - const char *delim = "/\0"; - char *dupe, *prefix, *mask, *context, *endptr; - int nmask = -1; - - if (str == NULL) - return partly_match; - - if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) - return no_match; - - /* tokenize to address + mask */ - dupe = XMALLOC(MTYPE_TMP, strlen(str)+1); - strncpy(dupe, str, strlen(str)+1); - prefix = strtok_r(dupe, delim, &context); - mask = strtok_r(NULL, delim, &context); - - if (!mask) - return partly_match; - - /* validate prefix */ - if (inet_pton(AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) - return no_match; - - /* validate mask */ - nmask = strtol (mask, &endptr, 10); - if (*endptr != '\0' || nmask < 0 || nmask > 128) - return no_match; - - XFREE(MTYPE_TMP, dupe); - - return exact_match; -} - -#endif /* HAVE_IPV6 */ - -#define DECIMAL_STRLEN_MAX 20 - -static int -cmd_range_match (const char *range, const char *str) -{ - char *p; - char buf[DECIMAL_STRLEN_MAX + 1]; - char *endptr = NULL; - signed long long min, max, val; - - if (str == NULL) - return 1; - - val = strtoll (str, &endptr, 10); - if (*endptr != '\0') - return 0; - val = llabs(val); - - range++; - p = strchr (range, '-'); - if (p == NULL) - return 0; - if (p - range > DECIMAL_STRLEN_MAX) - return 0; - strncpy (buf, range, p - range); - buf[p - range] = '\0'; - min = strtoll (buf, &endptr, 10); - if (*endptr != '\0') - return 0; - - range = p + 1; - p = strchr (range, '>'); - if (p == NULL) - return 0; - if (p - range > DECIMAL_STRLEN_MAX) - return 0; - strncpy (buf, range, p - range); - buf[p - range] = '\0'; - max = strtoll (buf, &endptr, 10); - if (*endptr != '\0') - return 0; - - if (val < min || val > max) - return 0; - - return 1; -} - -static enum match_type -cmd_word_match(struct cmd_token *token, - enum filter_type filter, - const char *word) -{ - const char *str; - enum match_type match_type; - - str = token->cmd; - - if (filter == FILTER_RELAXED) - if (!word || !strlen(word)) - return partly_match; - - if (!word) - return no_match; - - switch (token->terminal) - { - case TERMINAL_VARARG: - return vararg_match; - - case TERMINAL_RANGE: - if (cmd_range_match(str, word)) - return range_match; - break; - - case TERMINAL_IPV6: - match_type = cmd_ipv6_match(word); - if ((filter == FILTER_RELAXED && match_type != no_match) - || (filter == FILTER_STRICT && match_type == exact_match)) - return ipv6_match; - break; - - case TERMINAL_IPV6_PREFIX: - match_type = cmd_ipv6_prefix_match(word); - if ((filter == FILTER_RELAXED && match_type != no_match) - || (filter == FILTER_STRICT && match_type == exact_match)) - return ipv6_prefix_match; - break; - - case TERMINAL_IPV4: - match_type = cmd_ipv4_match(word); - if ((filter == FILTER_RELAXED && match_type != no_match) - || (filter == FILTER_STRICT && match_type == exact_match)) - return ipv4_match; - break; - - case TERMINAL_IPV4_PREFIX: - match_type = cmd_ipv4_prefix_match(word); - if ((filter == FILTER_RELAXED && match_type != no_match) - || (filter == FILTER_STRICT && match_type == exact_match)) - return ipv4_prefix_match; - break; - - case TERMINAL_OPTION: - case TERMINAL_VARIABLE: - return extend_match; - - case TERMINAL_LITERAL: - if (filter == FILTER_RELAXED && !strncmp(str, word, strlen(word))) - { - if (!strcmp(str, word)) - return exact_match; - return partly_match; - } - if (filter == FILTER_STRICT && !strcmp(str, word)) - return exact_match; - break; - - default: - assert (0); - } - - return no_match; -} - -struct cmd_matcher -{ - struct cmd_element *cmd; /* The command element the matcher is using */ - enum filter_type filter; /* Whether to use strict or relaxed matching */ - vector vline; /* The tokenized commandline which is to be matched */ - unsigned int index; /* The index up to which matching should be done */ - - /* If set, construct a list of matches at the position given by index */ - enum match_type *match_type; - vector *match; - - unsigned int word_index; /* iterating over vline */ -}; - -static int -push_argument(int *argc, const char **argv, const char *arg) -{ - if (!arg || !strlen(arg)) - arg = NULL; - - if (!argc || !argv) - return 0; - - if (*argc >= CMD_ARGC_MAX) - return -1; - - argv[(*argc)++] = arg; - return 0; -} - -static void -cmd_matcher_record_match(struct cmd_matcher *matcher, - enum match_type match_type, - struct cmd_token *token) -{ - if (matcher->word_index != matcher->index) - return; - - if (matcher->match) - { - if (!*matcher->match) - *matcher->match = vector_init(VECTOR_MIN_SIZE); - vector_set(*matcher->match, token); - } - - if (matcher->match_type) - { - if (match_type > *matcher->match_type) - *matcher->match_type = match_type; - } + struct cmd_node *cnode = vector_slot (v, ntype); + return cnode->cmdgraph; } static int -cmd_matcher_words_left(struct cmd_matcher *matcher) -{ - return matcher->word_index < vector_active(matcher->vline); -} - -static const char* -cmd_matcher_get_word(struct cmd_matcher *matcher) -{ - assert(cmd_matcher_words_left(matcher)); - - return vector_slot(matcher->vline, matcher->word_index); -} - -static enum matcher_rv -cmd_matcher_match_terminal(struct cmd_matcher *matcher, - struct cmd_token *token, - int *argc, const char **argv) -{ - const char *word; - enum match_type word_match; - - assert(token->type == TOKEN_TERMINAL); - - if (!cmd_matcher_words_left(matcher)) - { - if (token->terminal == TERMINAL_OPTION) - return MATCHER_OK; /* missing optional args are NOT pushed as NULL */ - else - return MATCHER_INCOMPLETE; - } - - word = cmd_matcher_get_word(matcher); - word_match = cmd_word_match(token, matcher->filter, word); - if (word_match == no_match) - return MATCHER_NO_MATCH; - - /* We have to record the input word as argument if it matched - * against a variable. */ - if (TERMINAL_RECORD (token->terminal)) - { - if (push_argument(argc, argv, word)) - return MATCHER_EXCEED_ARGC_MAX; - } - - cmd_matcher_record_match(matcher, word_match, token); - - matcher->word_index++; - - /* A vararg token should consume all left over words as arguments */ - if (token->terminal == TERMINAL_VARARG) - while (cmd_matcher_words_left(matcher)) - { - word = cmd_matcher_get_word(matcher); - if (word && strlen(word)) - push_argument(argc, argv, word); - matcher->word_index++; - } - - return MATCHER_OK; -} - -static enum matcher_rv -cmd_matcher_match_multiple(struct cmd_matcher *matcher, - struct cmd_token *token, - int *argc, const char **argv) -{ - enum match_type multiple_match; - unsigned int multiple_index; - const char *word; - const char *arg = NULL; - struct cmd_token *word_token; - enum match_type word_match; - - assert(token->type == TOKEN_MULTIPLE); - - multiple_match = no_match; - - if (!cmd_matcher_words_left(matcher)) - return MATCHER_INCOMPLETE; - - word = cmd_matcher_get_word(matcher); - for (multiple_index = 0; - multiple_index < vector_active(token->multiple); - multiple_index++) - { - word_token = vector_slot(token->multiple, multiple_index); - - word_match = cmd_word_match(word_token, matcher->filter, word); - if (word_match == no_match) - continue; - - cmd_matcher_record_match(matcher, word_match, word_token); - - if (word_match > multiple_match) - { - multiple_match = word_match; - arg = word; - } - /* To mimic the behavior of the old command implementation, we - * tolerate any ambiguities here :/ */ - } - - matcher->word_index++; - - if (multiple_match == no_match) - return MATCHER_NO_MATCH; - - if (push_argument(argc, argv, arg)) - return MATCHER_EXCEED_ARGC_MAX; - - return MATCHER_OK; -} - -static enum matcher_rv -cmd_matcher_read_keywords(struct cmd_matcher *matcher, - struct cmd_token *token, - vector args_vector) -{ - unsigned int i; - unsigned long keyword_mask; - unsigned int keyword_found; - enum match_type keyword_match; - enum match_type word_match; - vector keyword_vector; - struct cmd_token *word_token; - const char *word; - int keyword_argc; - const char **keyword_argv; - enum matcher_rv rv = MATCHER_OK; - - keyword_mask = 0; - while (1) - { - if (!cmd_matcher_words_left(matcher)) - return MATCHER_OK; - - word = cmd_matcher_get_word(matcher); - - keyword_found = -1; - keyword_match = no_match; - for (i = 0; i < vector_active(token->keyword); i++) - { - if (keyword_mask & (1 << i)) - continue; - - keyword_vector = vector_slot(token->keyword, i); - word_token = vector_slot(keyword_vector, 0); - - word_match = cmd_word_match(word_token, matcher->filter, word); - if (word_match == no_match) - continue; - - cmd_matcher_record_match(matcher, word_match, word_token); - - if (word_match > keyword_match) - { - keyword_match = word_match; - keyword_found = i; - } - else if (word_match == keyword_match) - { - if (matcher->word_index != matcher->index || args_vector) - return MATCHER_AMBIGUOUS; - } - } - - if (keyword_found == (unsigned int)-1) - return MATCHER_NO_MATCH; - - matcher->word_index++; - - if (matcher->word_index > matcher->index) - return MATCHER_OK; - - keyword_mask |= (1 << keyword_found); - - if (args_vector) - { - keyword_argc = 0; - keyword_argv = XMALLOC(MTYPE_TMP, (CMD_ARGC_MAX + 1) * sizeof(char*)); - /* We use -1 as a marker for unused fields as NULL might be a valid value */ - for (i = 0; i < CMD_ARGC_MAX + 1; i++) - keyword_argv[i] = (void*)-1; - vector_set_index(args_vector, keyword_found, keyword_argv); - } - else - { - keyword_argv = NULL; - } - - keyword_vector = vector_slot(token->keyword, keyword_found); - /* the keyword itself is at 0. We are only interested in the arguments, - * so start counting at 1. */ - for (i = 1; i < vector_active(keyword_vector); i++) - { - word_token = vector_slot(keyword_vector, i); - - switch (word_token->type) - { - case TOKEN_TERMINAL: - rv = cmd_matcher_match_terminal(matcher, word_token, - &keyword_argc, keyword_argv); - break; - case TOKEN_MULTIPLE: - rv = cmd_matcher_match_multiple(matcher, word_token, - &keyword_argc, keyword_argv); - break; - case TOKEN_KEYWORD: - assert(!"Keywords should never be nested."); - break; - } - - if (MATCHER_ERROR(rv)) - return rv; - - if (matcher->word_index > matcher->index) - return MATCHER_OK; - } - } - /* not reached */ -} - -static enum matcher_rv -cmd_matcher_build_keyword_args(struct cmd_matcher *matcher, - struct cmd_token *token, - int *argc, const char **argv, - vector keyword_args_vector) -{ - unsigned int i, j; - const char **keyword_args; - vector keyword_vector; - struct cmd_token *word_token; - const char *arg; - enum matcher_rv rv; - - rv = MATCHER_OK; - - if (keyword_args_vector == NULL) - return rv; - - for (i = 0; i < vector_active(token->keyword); i++) - { - keyword_vector = vector_slot(token->keyword, i); - keyword_args = vector_lookup(keyword_args_vector, i); - - if (vector_active(keyword_vector) == 1) - { - /* this is a keyword without arguments */ - if (keyword_args) - { - word_token = vector_slot(keyword_vector, 0); - arg = word_token->cmd; - } - else - { - arg = NULL; - } - - if (push_argument(argc, argv, arg)) - rv = MATCHER_EXCEED_ARGC_MAX; - } - else - { - /* this is a keyword with arguments */ - if (keyword_args) - { - /* the keyword was present, so just fill in the arguments */ - for (j = 0; keyword_args[j] != (void*)-1; j++) - if (push_argument(argc, argv, keyword_args[j])) - rv = MATCHER_EXCEED_ARGC_MAX; - XFREE(MTYPE_TMP, keyword_args); - } - else - { - /* the keyword was not present, insert NULL for the arguments - * the keyword would have taken. */ - for (j = 1; j < vector_active(keyword_vector); j++) - { - word_token = vector_slot(keyword_vector, j); - if ((word_token->type == TOKEN_TERMINAL - && TERMINAL_RECORD (word_token->terminal)) - || word_token->type == TOKEN_MULTIPLE) - { - if (push_argument(argc, argv, NULL)) - rv = MATCHER_EXCEED_ARGC_MAX; - } - } - } - } - } - vector_free(keyword_args_vector); - return rv; -} - -static enum matcher_rv -cmd_matcher_match_keyword(struct cmd_matcher *matcher, - struct cmd_token *token, - int *argc, const char **argv) -{ - vector keyword_args_vector; - enum matcher_rv reader_rv; - enum matcher_rv builder_rv; - - assert(token->type == TOKEN_KEYWORD); - - if (argc && argv) - keyword_args_vector = vector_init(VECTOR_MIN_SIZE); - else - keyword_args_vector = NULL; - - reader_rv = cmd_matcher_read_keywords(matcher, token, keyword_args_vector); - builder_rv = cmd_matcher_build_keyword_args(matcher, token, argc, - argv, keyword_args_vector); - /* keyword_args_vector is consumed by cmd_matcher_build_keyword_args */ - - if (!MATCHER_ERROR(reader_rv) && MATCHER_ERROR(builder_rv)) - return builder_rv; - - return reader_rv; -} - -static void -cmd_matcher_init(struct cmd_matcher *matcher, - struct cmd_element *cmd, - enum filter_type filter, - vector vline, - unsigned int index, - enum match_type *match_type, - vector *match) -{ - memset(matcher, 0, sizeof(*matcher)); - - matcher->cmd = cmd; - matcher->filter = filter; - matcher->vline = vline; - matcher->index = index; - - matcher->match_type = match_type; - if (matcher->match_type) - *matcher->match_type = no_match; - matcher->match = match; - - matcher->word_index = 0; -} - -static enum matcher_rv -cmd_element_match(struct cmd_element *cmd_element, - enum filter_type filter, - vector vline, - unsigned int index, - enum match_type *match_type, - vector *match, - int *argc, - const char **argv) -{ - struct cmd_matcher matcher; - unsigned int token_index; - enum matcher_rv rv = MATCHER_OK; - - cmd_matcher_init(&matcher, cmd_element, filter, - vline, index, match_type, match); - - if (argc != NULL) - *argc = 0; - - for (token_index = 0; - token_index < vector_active(cmd_element->tokens); - token_index++) - { - struct cmd_token *token = vector_slot(cmd_element->tokens, token_index); - - switch (token->type) - { - case TOKEN_TERMINAL: - rv = cmd_matcher_match_terminal(&matcher, token, argc, argv); - break; - case TOKEN_MULTIPLE: - rv = cmd_matcher_match_multiple(&matcher, token, argc, argv); - break; - case TOKEN_KEYWORD: - rv = cmd_matcher_match_keyword(&matcher, token, argc, argv); - } - - if (MATCHER_ERROR(rv)) - return rv; - - if (matcher.word_index > index) - return MATCHER_OK; - } - - /* return MATCHER_COMPLETE if all words were consumed */ - if (matcher.word_index >= vector_active(vline)) - return MATCHER_COMPLETE; - - /* return MATCHER_COMPLETE also if only an empty word is left. */ - if (matcher.word_index == vector_active(vline) - 1 - && (!vector_slot(vline, matcher.word_index) - || !strlen((char*)vector_slot(vline, matcher.word_index)))) - return MATCHER_COMPLETE; - - return MATCHER_NO_MATCH; /* command is too long to match */ -} - -/** - * Filter a given vector of commands against a given commandline and - * calculate possible completions. - * - * @param commands A vector of struct cmd_element*. Commands that don't - * match against the given command line will be overwritten - * with NULL in that vector. - * @param filter Either FILTER_RELAXED or FILTER_STRICT. This basically - * determines how incomplete commands are handled, compare with - * cmd_word_match for details. - * @param vline A vector of char* containing the tokenized commandline. - * @param index Only match up to the given token of the commandline. - * @param match_type Record the type of the best match here. - * @param matches Record the matches here. For each cmd_element in the commands - * vector, a match vector will be created in the matches vector. - * That vector will contain all struct command_token* of the - * cmd_element which matched against the given vline at the given - * index. - * @return A code specifying if an error occured. If all went right, it's - * CMD_SUCCESS. - */ -static int -cmd_vector_filter(vector commands, - enum filter_type filter, - vector vline, - unsigned int index, - enum match_type *match_type, - vector *matches) -{ - unsigned int i; - struct cmd_element *cmd_element; - enum match_type best_match; - enum match_type element_match; - enum matcher_rv matcher_rv; - - best_match = no_match; - *matches = vector_init(VECTOR_MIN_SIZE); - - for (i = 0; i < vector_active (commands); i++) - if ((cmd_element = vector_slot (commands, i)) != NULL) - { - vector_set_index(*matches, i, NULL); - matcher_rv = cmd_element_match(cmd_element, filter, - vline, index, - &element_match, - (vector*)&vector_slot(*matches, i), - NULL, NULL); - if (MATCHER_ERROR(matcher_rv)) - { - vector_slot(commands, i) = NULL; - if (matcher_rv == MATCHER_AMBIGUOUS) - return CMD_ERR_AMBIGUOUS; - if (matcher_rv == MATCHER_EXCEED_ARGC_MAX) - return CMD_ERR_EXEED_ARGC_MAX; - } - else if (element_match > best_match) - { - best_match = element_match; - } - } - *match_type = best_match; - return CMD_SUCCESS; -} - -/** - * Check whether a given commandline is complete if used for a specific - * cmd_element. - * - * @param cmd_element A cmd_element against which the commandline should be - * checked. - * @param vline The tokenized commandline. - * @return 1 if the given commandline is complete, 0 otherwise. - */ -static int -cmd_is_complete(struct cmd_element *cmd_element, - vector vline) -{ - enum matcher_rv rv; - - rv = cmd_element_match(cmd_element, - FILTER_RELAXED, - vline, -1, - NULL, NULL, - NULL, NULL); - return (rv == MATCHER_COMPLETE); -} - -/** - * Parse a given commandline and construct a list of arguments for the - * given command_element. - * - * @param cmd_element The cmd_element for which we want to construct arguments. - * @param vline The tokenized commandline. - * @param argc Where to store the argument count. - * @param argv Where to store the argument list. Should be at least - * CMD_ARGC_MAX elements long. - * @return CMD_SUCCESS if everything went alright, an error otherwise. - */ -static int -cmd_parse(struct cmd_element *cmd_element, - vector vline, - int *argc, const char **argv) -{ - enum matcher_rv rv = cmd_element_match(cmd_element, - FILTER_RELAXED, - vline, -1, - NULL, NULL, - argc, argv); - switch (rv) - { - case MATCHER_COMPLETE: - return CMD_SUCCESS; - - case MATCHER_NO_MATCH: - return CMD_ERR_NO_MATCH; - - case MATCHER_AMBIGUOUS: - return CMD_ERR_AMBIGUOUS; - - case MATCHER_EXCEED_ARGC_MAX: - return CMD_ERR_EXEED_ARGC_MAX; - - default: - return CMD_ERR_INCOMPLETE; - } -} - -/* Check ambiguous match */ -static int -is_cmd_ambiguous (vector cmd_vector, - const char *command, - vector matches, - enum match_type type) -{ - unsigned int i; - unsigned int j; - const char *str = NULL; - const char *matched = NULL; - vector match_vector; - struct cmd_token *cmd_token; - - if (command == NULL) - command = ""; - - for (i = 0; i < vector_active (matches); i++) - if ((match_vector = vector_slot (matches, i)) != NULL) - { - int match = 0; - - for (j = 0; j < vector_active (match_vector); j++) - if ((cmd_token = vector_slot (match_vector, j)) != NULL) - { - enum match_type ret; - - assert(cmd_token->type == TOKEN_TERMINAL); - if (cmd_token->type != TOKEN_TERMINAL) - continue; - - str = cmd_token->cmd; - - switch (type) - { - case exact_match: - if (!TERMINAL_RECORD (cmd_token->terminal) - && strcmp (command, str) == 0) - match++; - break; - case partly_match: - if (!TERMINAL_RECORD (cmd_token->terminal) - && strncmp (command, str, strlen (command)) == 0) - { - if (matched && strcmp (matched, str) != 0) - return 1; /* There is ambiguous match. */ - else - matched = str; - match++; - } - break; - case range_match: - if (cmd_range_match (str, command)) - { - if (matched && strcmp (matched, str) != 0) - return 1; - else - matched = str; - match++; - } - break; -#ifdef HAVE_IPV6 - case ipv6_match: - if (cmd_token->terminal == TERMINAL_IPV6) - match++; - break; - case ipv6_prefix_match: - if ((ret = cmd_ipv6_prefix_match (command)) != no_match) - { - if (ret == partly_match) - return 2; /* There is incomplete match. */ - - match++; - } - break; -#endif /* HAVE_IPV6 */ - case ipv4_match: - if (cmd_token->terminal == TERMINAL_IPV4) - match++; - break; - case ipv4_prefix_match: - if ((ret = cmd_ipv4_prefix_match (command)) != no_match) - { - if (ret == partly_match) - return 2; /* There is incomplete match. */ - - match++; - } - break; - case extend_match: - if (TERMINAL_RECORD (cmd_token->terminal)) - match++; - break; - case no_match: - default: - break; - } - } - if (!match) - vector_slot (cmd_vector, i) = NULL; - } - return 0; -} - -/* If src matches dst return dst string, otherwise return NULL */ -static const char * -cmd_entry_function (const char *src, struct cmd_token *token) -{ - const char *dst = token->cmd; - - /* Skip variable arguments. */ - if (TERMINAL_RECORD (token->terminal)) - return NULL; - - /* In case of 'command \t', given src is NULL string. */ - if (src == NULL) - return dst; - - /* Matched with input string. */ - if (strncmp (src, dst, strlen (src)) == 0) - return dst; - - return NULL; -} - -/* If src matches dst return dst string, otherwise return NULL */ -/* This version will return the dst string always if it is - CMD_VARIABLE for '?' key processing */ -static const char * -cmd_entry_function_desc (const char *src, struct cmd_token *token) -{ - const char *dst = token->cmd; - - switch (token->terminal) - { - case TERMINAL_VARARG: - return dst; - - case TERMINAL_RANGE: - if (cmd_range_match (dst, src)) - return dst; - else - return NULL; - - case TERMINAL_IPV6: - if (cmd_ipv6_match (src)) - return dst; - else - return NULL; - - case TERMINAL_IPV6_PREFIX: - if (cmd_ipv6_prefix_match (src)) - return dst; - else - return NULL; - - case TERMINAL_IPV4: - if (cmd_ipv4_match (src)) - return dst; - else - return NULL; - - case TERMINAL_IPV4_PREFIX: - if (cmd_ipv4_prefix_match (src)) - return dst; - else - return NULL; - - /* Optional or variable commands always match on '?' */ - case TERMINAL_OPTION: - case TERMINAL_VARIABLE: - return dst; - - case TERMINAL_LITERAL: - /* In case of 'command \t', given src is NULL string. */ - if (src == NULL) - return dst; - - if (strncmp (src, dst, strlen (src)) == 0) - return dst; - else - return NULL; - - default: - assert(0); - return NULL; - } -} - -/** - * Check whether a string is already present in a vector of strings. - * @param v A vector of char*. - * @param str A char*. - * @return 0 if str is already present in the vector, 1 otherwise. - */ -static int -cmd_unique_string (vector v, const char *str) -{ - unsigned int i; - char *match; - - for (i = 0; i < vector_active (v); i++) - if ((match = vector_slot (v, i)) != NULL) - if (strcmp (match, str) == 0) - return 0; - return 1; -} - -/** - * Check whether a struct cmd_token matching a given string is already - * present in a vector of struct cmd_token. - * @param v A vector of struct cmd_token*. - * @param str A char* which should be searched for. - * @return 0 if there is a struct cmd_token* with its cmd matching str, - * 1 otherwise. - */ -static int -desc_unique_string (vector v, const char *str) -{ - unsigned int i; - struct cmd_token *token; - - for (i = 0; i < vector_active (v); i++) - if ((token = vector_slot (v, i)) != NULL) - if (strcmp (token->cmd, str) == 0) - return 0; - return 1; -} - -static int cmd_try_do_shortcut (enum node_type node, char* first_word) { if ( first_word != NULL && node != AUTH_NODE && @@ -1947,199 +455,99 @@ cmd_try_do_shortcut (enum node_type node, char* first_word) { return 0; } -static void -cmd_matches_free(vector *matches) -{ - unsigned int i; - vector cmd_matches; - - for (i = 0; i < vector_active(*matches); i++) - if ((cmd_matches = vector_slot(*matches, i)) != NULL) - vector_free(cmd_matches); - vector_free(*matches); - *matches = NULL; -} - +/** + * Compare function for cmd_token. + * Used with qsort to sort command completions. + */ static int -cmd_describe_cmp(const void *a, const void *b) +compare_completions (const void *fst, const void *snd) { - const struct cmd_token *first = *(struct cmd_token * const *)a; - const struct cmd_token *second = *(struct cmd_token * const *)b; - - return strcmp(first->cmd, second->cmd); + struct cmd_token *first = *(struct cmd_token **) fst, + *secnd = *(struct cmd_token **) snd; + return strcmp (first->text, secnd->text); } -static void -cmd_describe_sort(vector matchvec) -{ - qsort(matchvec->index, vector_active(matchvec), - sizeof(void*), cmd_describe_cmp); -} - -/* '?' describe command support. */ +/** + * Takes a list of completions returned by command_complete, + * dedeuplicates them based on both text and description, + * and returns them as a vector. + */ static vector -cmd_describe_command_real (vector vline, struct vty *vty, int *status) +completions_to_vec (struct list *completions) { - unsigned int i; - vector cmd_vector; -#define INIT_MATCHVEC_SIZE 10 - vector matchvec; - struct cmd_element *cmd_element; - unsigned int index; - int ret; - enum match_type match; - char *command; - vector matches = NULL; - vector match_vector; - uint32_t command_found = 0; - const char *last_word; + vector comps = vector_init (VECTOR_MIN_SIZE); - /* Set index. */ - if (vector_active (vline) == 0) + struct listnode *ln; + struct cmd_token *token; + unsigned int i, exists; + for (ALL_LIST_ELEMENTS_RO(completions,ln,token)) + { + // linear search for token in completions vector + exists = 0; + for (i = 0; i < vector_active (comps) && !exists; i++) { - *status = CMD_ERR_NO_MATCH; - return NULL; + struct cmd_token *curr = vector_slot (comps, i); + exists = !strcmp (curr->text, token->text) && + !strcmp (curr->desc, token->desc); } - index = vector_active (vline) - 1; - - /* Make copy vector of current node's command vector. */ - cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node)); - - /* Prepare match vector */ - matchvec = vector_init (INIT_MATCHVEC_SIZE); - - /* Filter commands and build a list how they could possibly continue. */ - for (i = 0; i <= index; i++) - { - command = vector_slot (vline, i); - - if (matches) - cmd_matches_free(&matches); - - ret = cmd_vector_filter(cmd_vector, - FILTER_RELAXED, - vline, i, - &match, - &matches); - - if (ret != CMD_SUCCESS) - { - vector_free (cmd_vector); - vector_free (matchvec); - cmd_matches_free(&matches); - *status = ret; - return NULL; - } - - /* The last match may well be ambigious, so break here */ - if (i == index) - break; - - if (match == vararg_match) - { - /* We found a vararg match - so we can throw out the current matches here - * and don't need to continue checking the command input */ - unsigned int j, k; - - for (j = 0; j < vector_active (matches); j++) - if ((match_vector = vector_slot (matches, j)) != NULL) - for (k = 0; k < vector_active (match_vector); k++) - { - struct cmd_token *token = vector_slot (match_vector, k); - vector_set (matchvec, token); - } - - *status = CMD_SUCCESS; - vector_set(matchvec, &token_cr); - vector_free (cmd_vector); - cmd_matches_free(&matches); - cmd_describe_sort(matchvec); - return matchvec; - } - - ret = is_cmd_ambiguous(cmd_vector, command, matches, match); - if (ret == 1) - { - vector_free (cmd_vector); - vector_free (matchvec); - cmd_matches_free(&matches); - *status = CMD_ERR_AMBIGUOUS; - return NULL; - } - else if (ret == 2) - { - vector_free (cmd_vector); - vector_free (matchvec); - cmd_matches_free(&matches); - *status = CMD_ERR_NO_MATCH; - return NULL; - } - } - - /* Make description vector. */ - for (i = 0; i < vector_active (matches); i++) { - if ((cmd_element = vector_slot (cmd_vector, i)) != NULL && - !(cmd_element->attr == CMD_ATTR_DEPRECATED || - cmd_element->attr == CMD_ATTR_HIDDEN)) - { - unsigned int j; - vector vline_trimmed; - - command_found++; - last_word = vector_slot(vline, vector_active(vline) - 1); - if (last_word == NULL || !strlen(last_word)) - { - vline_trimmed = vector_copy(vline); - vector_unset(vline_trimmed, vector_active(vline_trimmed) - 1); - - if (cmd_is_complete(cmd_element, vline_trimmed) - && desc_unique_string(matchvec, command_cr)) - { - if (match != vararg_match) - vector_set(matchvec, &token_cr); - } - - vector_free(vline_trimmed); - } - - match_vector = vector_slot (matches, i); - if (match_vector) - for (j = 0; j < vector_active(match_vector); j++) - { - struct cmd_token *token = vector_slot(match_vector, j); - const char *string; - - string = cmd_entry_function_desc(command, token); - if (string && desc_unique_string(matchvec, string)) - vector_set(matchvec, token); - } - } + if (!exists) + vector_set (comps, copy_cmd_token (token)); } - /* - * We can get into this situation when the command is complete - * but the last part of the command is an optional piece of - * cli. - */ - last_word = vector_slot(vline, vector_active(vline) - 1); - if (command_found == 0 && (last_word == NULL || !strlen(last_word))) { - vector_set(matchvec, &token_cr); + // sort completions + qsort (comps->index, + vector_active (comps), + sizeof (void *), + &compare_completions); + + return comps; +} +/** + * Generates a vector of cmd_token representing possible completions + * on the current input. + * + * @param vline the vectorized input line + * @param vty the vty with the node to match on + * @param status pointer to matcher status code + */ +static vector +cmd_complete_command_real (vector vline, struct vty *vty, int *status) +{ + struct list *completions; + struct graph *cmdgraph = cmd_node_graph (cmdvec, vty->node); + + enum matcher_rv rv = command_complete (cmdgraph, vline, &completions); + + if (MATCHER_ERROR(rv)) + { + switch (rv) + { + case MATCHER_AMBIGUOUS: + *status = CMD_ERR_AMBIGUOUS; + default: + *status = CMD_ERR_NO_MATCH; + } + return NULL; } - vector_free (cmd_vector); - cmd_matches_free(&matches); + vector comps = completions_to_vec (completions); + list_delete (completions); - if (vector_slot (matchvec, 0) == NULL) - { - vector_free (matchvec); + // set status code appropriately + switch (vector_active (comps)) + { + case 0: *status = CMD_ERR_NO_MATCH; - return NULL; - } + break; + case 1: + *status = CMD_COMPLETE_FULL_MATCH; + break; + default: + *status = CMD_COMPLETE_LIST_MATCH; + } - *status = CMD_SUCCESS; - cmd_describe_sort(matchvec); - return matchvec; + return comps; } vector @@ -2159,247 +567,19 @@ cmd_describe_command (vector vline, struct vty *vty, int *status) shifted_vline = vector_init (vector_count(vline)); /* use memcpy? */ - for (index = 1; index < vector_active (vline); index++) - { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); - } + for (index = 1; index < vector_active (vline); index++) + { + vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); + } - ret = cmd_describe_command_real (shifted_vline, vty, status); + ret = cmd_complete_command_real (shifted_vline, vty, status); vector_free(shifted_vline); vty->node = onode; return ret; } - - return cmd_describe_command_real (vline, vty, status); -} - - -/* Check LCD of matched command. */ -static int -cmd_lcd (char **matched) -{ - int i; - int j; - int lcd = -1; - char *s1, *s2; - char c1, c2; - - if (matched[0] == NULL || matched[1] == NULL) - return 0; - - for (i = 1; matched[i] != NULL; i++) - { - s1 = matched[i - 1]; - s2 = matched[i]; - - for (j = 0; (c1 = s1[j]) && (c2 = s2[j]); j++) - if (c1 != c2) - break; - - if (lcd < 0) - lcd = j; - else - { - if (lcd > j) - lcd = j; - } - } - return lcd; -} - -static int -cmd_complete_cmp(const void *a, const void *b) -{ - const char *first = *(char * const *)a; - const char *second = *(char * const *)b; - - if (!first) - { - if (!second) - return 0; - return 1; - } - if (!second) - return -1; - - return strcmp(first, second); -} - -static void -cmd_complete_sort(vector matchvec) -{ - qsort(matchvec->index, vector_active(matchvec), - sizeof(void*), cmd_complete_cmp); -} - -/* Command line completion support. */ -static char ** -cmd_complete_command_real (vector vline, struct vty *vty, int *status, int islib) -{ - unsigned int i; - vector cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node)); -#define INIT_MATCHVEC_SIZE 10 - vector matchvec; - unsigned int index; - char **match_str; - struct cmd_token *token; - char *command; - int lcd; - vector matches = NULL; - vector match_vector; - - if (vector_active (vline) == 0) - { - vector_free (cmd_vector); - *status = CMD_ERR_NO_MATCH; - return NULL; - } - else - index = vector_active (vline) - 1; - - /* First, filter by command string */ - for (i = 0; i <= index; i++) - { - command = vector_slot (vline, i); - enum match_type match; - int ret; - - if (matches) - cmd_matches_free(&matches); - - /* First try completion match, if there is exactly match return 1 */ - ret = cmd_vector_filter(cmd_vector, - FILTER_RELAXED, - vline, i, - &match, - &matches); - - if (ret != CMD_SUCCESS) - { - vector_free(cmd_vector); - cmd_matches_free(&matches); - *status = ret; - return NULL; - } - - /* Break here - the completion mustn't be checked to be non-ambiguous */ - if (i == index) - break; - - /* If there is exact match then filter ambiguous match else check - ambiguousness. */ - ret = is_cmd_ambiguous (cmd_vector, command, matches, match); - if (ret == 1) - { - vector_free (cmd_vector); - cmd_matches_free(&matches); - *status = CMD_ERR_AMBIGUOUS; - return NULL; - } - } - - /* Prepare match vector. */ - matchvec = vector_init (INIT_MATCHVEC_SIZE); - - /* Build the possible list of continuations into a list of completions */ - for (i = 0; i < vector_active (matches); i++) - if ((match_vector = vector_slot (matches, i))) - { - const char *string; - unsigned int j; - - for (j = 0; j < vector_active (match_vector); j++) - if ((token = vector_slot (match_vector, j))) - { - string = cmd_entry_function (vector_slot (vline, index), - token); - if (string && cmd_unique_string (matchvec, string)) - vector_set (matchvec, (islib != 0 ? - XSTRDUP (MTYPE_TMP, string) : - strdup (string) /* rl freed */)); - } - } - - /* We don't need cmd_vector any more. */ - vector_free (cmd_vector); - cmd_matches_free(&matches); - - /* No matched command */ - if (vector_slot (matchvec, 0) == NULL) - { - vector_free (matchvec); - - /* In case of 'command \t' pattern. Do you need '?' command at - the end of the line. */ - if (vector_slot (vline, index) == '\0') - *status = CMD_ERR_NOTHING_TODO; - else - *status = CMD_ERR_NO_MATCH; - return NULL; - } - - /* Only one matched */ - if (vector_slot (matchvec, 1) == NULL) - { - match_str = (char **) matchvec->index; - vector_only_wrapper_free (matchvec); - *status = CMD_COMPLETE_FULL_MATCH; - return match_str; - } - /* Make it sure last element is NULL. */ - vector_set (matchvec, NULL); - - /* Check LCD of matched strings. */ - if (vector_slot (vline, index) != NULL) - { - lcd = cmd_lcd ((char **) matchvec->index); - - if (lcd) - { - int len = strlen (vector_slot (vline, index)); - - if (len < lcd) - { - char *lcdstr; - - lcdstr = (islib != 0 ? - XMALLOC (MTYPE_TMP, lcd + 1) : - malloc(lcd + 1)); - memcpy (lcdstr, matchvec->index[0], lcd); - lcdstr[lcd] = '\0'; - - /* Free matchvec. */ - for (i = 0; i < vector_active (matchvec); i++) - { - if (vector_slot (matchvec, i)) - { - if (islib != 0) - XFREE (MTYPE_TMP, vector_slot (matchvec, i)); - else - free (vector_slot (matchvec, i)); - } - } - vector_free (matchvec); - - /* Make new matchvec. */ - matchvec = vector_init (INIT_MATCHVEC_SIZE); - vector_set (matchvec, lcdstr); - match_str = (char **) matchvec->index; - vector_only_wrapper_free (matchvec); - - *status = CMD_COMPLETE_MATCH; - return match_str; - } - } - } - - match_str = (char **) matchvec->index; - cmd_complete_sort(matchvec); - vector_only_wrapper_free (matchvec); - *status = CMD_COMPLETE_LIST_MATCH; - return match_str; + return cmd_complete_command_real (vline, vty, status); } char ** @@ -2419,19 +599,41 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) shifted_vline = vector_init (vector_count(vline)); /* use memcpy? */ - for (index = 1; index < vector_active (vline); index++) - { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); - } + for (index = 1; index < vector_active (vline); index++) + { + vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); + } - ret = cmd_complete_command_real (shifted_vline, vty, status, islib); + // get token completions + vector comps = cmd_complete_command_real (shifted_vline, vty, status); + ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *)); + for (unsigned int i = 0; i < vector_active (comps); i++) + { + struct cmd_token *token = vector_slot (comps, i); + ret[i] = XSTRDUP (MTYPE_TMP, token->text); + vector_unset (comps, i); + del_cmd_token (token); + } + vector_free (comps); vector_free(shifted_vline); vty->node = onode; return ret; } - return cmd_complete_command_real (vline, vty, status, islib); + // get token completions + vector comps = cmd_complete_command_real (vline, vty, status); + ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *)); + for (unsigned int i = 0; i < vector_active (comps); i++) + { + struct cmd_token *token = vector_slot (comps, i); + ret[i] = XSTRDUP (MTYPE_TMP, token->text); + vector_unset (comps, i); + del_cmd_token (token); + } + vector_free (comps); + + return ret; } char ** @@ -2474,109 +676,47 @@ node_parent ( enum node_type node ) /* Execute command by argument vline vector. */ static int cmd_execute_command_real (vector vline, - enum filter_type filter, - struct vty *vty, - struct cmd_element **cmd) + enum filter_type filter, + struct vty *vty, + struct cmd_element **cmd) { - unsigned int i; - unsigned int index; - vector cmd_vector; - struct cmd_element *cmd_element; - struct cmd_element *matched_element; - unsigned int matched_count, incomplete_count; - int argc; - const char *argv[CMD_ARGC_MAX]; - enum match_type match = 0; - char *command; + struct list *argv_list; + enum matcher_rv status; + struct graph *cmdgraph = cmd_node_graph (cmdvec, vty->node); + status = command_match (cmdgraph, vline, &argv_list, cmd); + + // if matcher error, return corresponding CMD_ERR + if (MATCHER_ERROR(status)) + switch (status) + { + case MATCHER_INCOMPLETE: + return CMD_ERR_INCOMPLETE; + case MATCHER_AMBIGUOUS: + return CMD_ERR_AMBIGUOUS; + default: + return CMD_ERR_NO_MATCH; + } + + // build argv array from argv list + struct cmd_token **argv = XMALLOC (MTYPE_TMP, argv_list->count * sizeof (struct cmd_token *)); + struct listnode *ln; + struct cmd_token *token; + unsigned int i = 0; + for (ALL_LIST_ELEMENTS_RO(argv_list,ln,token)) + argv[i++] = token; + + int argc = argv_list->count; + int ret; - vector matches; + if ((*cmd)->daemon) + ret = CMD_SUCCESS_DAEMON; + else + ret = (*cmd)->func (*cmd, vty, argc, argv); - /* Make copy of command elements. */ - cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node)); + // delete list and cmd_token's in it + list_delete (argv_list); - for (index = 0; index < vector_active (vline); index++) - { - command = vector_slot (vline, index); - ret = cmd_vector_filter(cmd_vector, - filter, - vline, index, - &match, - &matches); - - if (ret != CMD_SUCCESS) - { - cmd_matches_free(&matches); - return ret; - } - - if (match == vararg_match) - { - cmd_matches_free(&matches); - break; - } - - ret = is_cmd_ambiguous (cmd_vector, command, matches, match); - cmd_matches_free(&matches); - - if (ret == 1) - { - vector_free(cmd_vector); - return CMD_ERR_AMBIGUOUS; - } - else if (ret == 2) - { - vector_free(cmd_vector); - return CMD_ERR_NO_MATCH; - } - } - - /* Check matched count. */ - matched_element = NULL; - matched_count = 0; - incomplete_count = 0; - - for (i = 0; i < vector_active (cmd_vector); i++) - if ((cmd_element = vector_slot (cmd_vector, i))) - { - if (cmd_is_complete(cmd_element, vline)) - { - matched_element = cmd_element; - matched_count++; - } - else - { - incomplete_count++; - } - } - - /* Finish of using cmd_vector. */ - vector_free (cmd_vector); - - /* To execute command, matched_count must be 1. */ - if (matched_count == 0) - { - if (incomplete_count) - return CMD_ERR_INCOMPLETE; - else - return CMD_ERR_NO_MATCH; - } - - if (matched_count > 1) - return CMD_ERR_AMBIGUOUS; - - ret = cmd_parse(matched_element, vline, &argc, argv); - if (ret != CMD_SUCCESS) - return ret; - - /* For vtysh execution. */ - if (cmd) - *cmd = matched_element; - - if (matched_element->daemon) - return CMD_SUCCESS_DAEMON; - - /* Execute matched command. */ - return (*matched_element->func) (matched_element, vty, argc, argv); + return ret; } /** @@ -2596,7 +736,7 @@ cmd_execute_command_real (vector vline, */ int cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, - int vtysh) { + int vtysh) { int ret, saved_ret = 0; enum node_type onode, try_node; @@ -2612,7 +752,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, shifted_vline = vector_init (vector_count(vline)); /* use memcpy? */ - for (index = 1; index < vector_active (vline); index++) + for (index = 1; index < vector_active (vline); index++) vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); ret = cmd_execute_command_real (shifted_vline, FILTER_RELAXED, vty, cmd); @@ -2662,7 +802,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, */ int cmd_execute_command_strict (vector vline, struct vty *vty, - struct cmd_element **cmd) + struct cmd_element **cmd) { return cmd_execute_command_real(vline, FILTER_STRICT, vty, cmd); } @@ -2706,7 +846,7 @@ command_config_read_one_line (struct vty *vty, struct cmd_element **cmd, int use while (!(use_daemon && ret == CMD_SUCCESS_DAEMON) && !(!use_daemon && ret == CMD_ERR_NOTHING_TODO) && - ret != CMD_SUCCESS && + ret != CMD_SUCCESS && ret != CMD_WARNING && vty->node > CONFIG_NODE) { vty->node = node_parent(vty->node); @@ -2717,11 +857,11 @@ command_config_read_one_line (struct vty *vty, struct cmd_element **cmd, int use // stay at the same node if (!(use_daemon && ret == CMD_SUCCESS_DAEMON) && !(!use_daemon && ret == CMD_ERR_NOTHING_TODO) && - ret != CMD_SUCCESS && + ret != CMD_SUCCESS && ret != CMD_WARNING) { - vty->node = saved_node; - memcpy(vty->error_buf, vty->buf, VTY_BUFSIZ); + vty->node = saved_node; + memcpy(vty->error_buf, vty->buf, VTY_BUFSIZ); } } @@ -2740,13 +880,13 @@ config_from_file (struct vty *vty, FILE *fp, unsigned int *line_num) while (fgets (vty->buf, VTY_BUFSIZ, fp)) { if (!error_ret) - ++(*line_num); + ++(*line_num); ret = command_config_read_one_line (vty, NULL, 0); if (ret != CMD_SUCCESS && ret != CMD_WARNING && - ret != CMD_ERR_NOTHING_TODO) - error_ret = ret; + ret != CMD_ERR_NOTHING_TODO) + error_ret = ret; } if (error_ret) { @@ -2774,7 +914,7 @@ DEFUN (config_terminal, } /* Enable command */ -DEFUN (enable, +DEFUN (enable, config_enable_cmd, "enable", "Turn on privileged mode command\n") @@ -2790,7 +930,7 @@ DEFUN (enable, } /* Disable command */ -DEFUN (disable, +DEFUN (disable, config_disable_cmd, "disable", "Turn off privileged mode command\n") @@ -2812,9 +952,9 @@ DEFUN (config_exit, case ENABLE_NODE: case RESTRICTED_NODE: if (vty_shell (vty)) - exit (0); + exit (0); else - vty->status = VTY_CLOSE; + vty->status = VTY_CLOSE; break; case CONFIG_NODE: vty->node = ENABLE_NODE; @@ -2860,7 +1000,7 @@ ALIAS (config_exit, config_quit_cmd, "quit", "Exit current mode and down to previous mode\n") - + /* End of configuration. */ DEFUN (config_end, config_end_cmd, @@ -2915,7 +1055,7 @@ DEFUN (show_version, "Displays zebra version\n") { vty_out (vty, "Quagga %s (%s).%s", QUAGGA_VERSION, host.name?host.name:"", - VTY_NEWLINE); + VTY_NEWLINE); vty_out (vty, "%s%s%s", QUAGGA_COPYRIGHT, GIT_INFO, VTY_NEWLINE); vty_out (vty, "configured with:%s %s%s", VTY_NEWLINE, QUAGGA_CONFIG_ARGS, VTY_NEWLINE); @@ -2929,8 +1069,8 @@ DEFUN (config_help, "help", "Description of the interactive help system\n") { - vty_out (vty, - "Quagga VTY provides advanced help feature. When you need help,%s\ + vty_out (vty, + "Quagga VTY provides advanced help feature. When you need help,%s\ anytime at the command line please press '?'.%s\ %s\ If nothing matches, the help list will be empty and you must backup%s\ @@ -2942,8 +1082,8 @@ argument.%s\ 2. Partial help is provided when an abbreviated argument is entered%s\ and you want to know what arguments match the input%s\ (e.g. 'show me?'.)%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); return CMD_SUCCESS; } @@ -2962,16 +1102,18 @@ DEFUN (config_list, && !(cmd->attr == CMD_ATTR_DEPRECATED || cmd->attr == CMD_ATTR_HIDDEN)) vty_out (vty, " %s%s", cmd->string, - VTY_NEWLINE); + VTY_NEWLINE); return CMD_SUCCESS; } /* Write current configuration into file. */ -DEFUN (config_write_file, - config_write_file_cmd, - "write file", +DEFUN (config_write, + config_write_cmd, + "write []", "Write running configuration to memory, network, or terminal\n" - "Write to configuration file\n") + "Write to configuration file\n" + "Write configuration currently in memory\n" + "Write configuration to terminal\n") { unsigned int i; int fd; @@ -2983,17 +1125,47 @@ DEFUN (config_write_file, struct vty *file_vty; struct stat conf_stat; + // if command was 'write terminal' or 'show running-config' + if (argc == 2 && (!strcmp(argv[1]->arg, "terminal") || + !strcmp(argv[1]->arg, "running-config"))) + { + if (vty->type == VTY_SHELL_SERV) + { + for (i = 0; i < vector_active (cmdvec); i++) + if ((node = vector_slot (cmdvec, i)) && node->func && node->vtysh) + { + if ((*node->func) (vty)) + vty_out (vty, "!%s", VTY_NEWLINE); + } + } + else + { + vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, + VTY_NEWLINE); + vty_out (vty, "!%s", VTY_NEWLINE); + + for (i = 0; i < vector_active (cmdvec); i++) + if ((node = vector_slot (cmdvec, i)) && node->func) + { + if ((*node->func) (vty)) + vty_out (vty, "!%s", VTY_NEWLINE); + } + vty_out (vty, "end%s",VTY_NEWLINE); + } + return CMD_SUCCESS; + } + /* Check and see if we are operating under vtysh configuration */ if (host.config == NULL) { vty_out (vty, "Can't save to configuration file, using vtysh.%s", - VTY_NEWLINE); + VTY_NEWLINE); return CMD_WARNING; } /* Get filename. */ config_file = host.config; - + config_file_sav = XMALLOC (MTYPE_TMP, strlen (config_file) + strlen (CONF_BACKUP_EXT) + 1); strcpy (config_file_sav, config_file); @@ -3002,16 +1174,16 @@ DEFUN (config_write_file, config_file_tmp = XMALLOC (MTYPE_TMP, strlen (config_file) + 8); sprintf (config_file_tmp, "%s.XXXXXX", config_file); - + /* Open file to configuration write. */ fd = mkstemp (config_file_tmp); if (fd < 0) { vty_out (vty, "Can't open configuration file %s.%s", config_file_tmp, - VTY_NEWLINE); + VTY_NEWLINE); goto finished; } - + /* Make vty for configuration file. */ file_vty = vty_new (); file_vty->wfd = fd; @@ -3025,51 +1197,51 @@ DEFUN (config_write_file, for (i = 0; i < vector_active (cmdvec); i++) if ((node = vector_slot (cmdvec, i)) && node->func) { - if ((*node->func) (file_vty)) - vty_out (file_vty, "!\n"); + if ((*node->func) (file_vty)) + vty_out (file_vty, "!\n"); } vty_close (file_vty); if (stat(config_file, &conf_stat) >= 0) { if (unlink (config_file_sav) != 0) - if (errno != ENOENT) - { - vty_out (vty, "Can't unlink backup configuration file %s.%s", config_file_sav, - VTY_NEWLINE); - goto finished; - } + if (errno != ENOENT) + { + vty_out (vty, "Can't unlink backup configuration file %s.%s", config_file_sav, + VTY_NEWLINE); + goto finished; + } if (link (config_file, config_file_sav) != 0) - { - vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, - VTY_NEWLINE); - goto finished; - } + { + vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, + VTY_NEWLINE); + goto finished; + } sync (); if (unlink (config_file) != 0) - { - vty_out (vty, "Can't unlink configuration file %s.%s", config_file, - VTY_NEWLINE); - goto finished; - } + { + vty_out (vty, "Can't unlink configuration file %s.%s", config_file, + VTY_NEWLINE); + goto finished; + } } if (link (config_file_tmp, config_file) != 0) { vty_out (vty, "Can't save configuration file %s.%s", config_file, - VTY_NEWLINE); + VTY_NEWLINE); goto finished; } sync (); - + if (chmod (config_file, CONFIGFILE_MASK) != 0) { - vty_out (vty, "Can't chmod configuration file %s: %s (%d).%s", - config_file, safe_strerror(errno), errno, VTY_NEWLINE); + vty_out (vty, "Can't chmod configuration file %s: %s (%d).%s", + config_file, safe_strerror(errno), errno, VTY_NEWLINE); goto finished; } vty_out (vty, "Configuration saved to %s%s", config_file, - VTY_NEWLINE); + VTY_NEWLINE); ret = CMD_SUCCESS; finished: @@ -3079,62 +1251,15 @@ finished: return ret; } -ALIAS (config_write_file, - config_write_cmd, - "write", - "Write running configuration to memory, network, or terminal\n") - -ALIAS (config_write_file, - config_write_memory_cmd, - "write memory", - "Write running configuration to memory, network, or terminal\n" - "Write configuration to the file (same as write file)\n") - -ALIAS (config_write_file, +ALIAS (config_write, copy_runningconfig_startupconfig_cmd, - "copy running-config startup-config", + "copy running-config startup-config", "Copy configuration\n" "Copy running config to... \n" "Copy running config to startup config (same as write file)\n") /* Write current configuration into the terminal. */ -DEFUN (config_write_terminal, - config_write_terminal_cmd, - "write terminal", - "Write running configuration to memory, network, or terminal\n" - "Write to terminal\n") -{ - unsigned int i; - struct cmd_node *node; - - if (vty->type == VTY_SHELL_SERV) - { - for (i = 0; i < vector_active (cmdvec); i++) - if ((node = vector_slot (cmdvec, i)) && node->func && node->vtysh) - { - if ((*node->func) (vty)) - vty_out (vty, "!%s", VTY_NEWLINE); - } - } - else - { - vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, - VTY_NEWLINE); - vty_out (vty, "!%s", VTY_NEWLINE); - - for (i = 0; i < vector_active (cmdvec); i++) - if ((node = vector_slot (cmdvec, i)) && node->func) - { - if ((*node->func) (vty)) - vty_out (vty, "!%s", VTY_NEWLINE); - } - vty_out (vty, "end%s",VTY_NEWLINE); - } - return CMD_SUCCESS; -} - -/* Write current configuration into the terminal. */ -ALIAS (config_write_terminal, +ALIAS (config_write, show_running_config_cmd, "show running-config", SHOW_STR @@ -3145,7 +1270,7 @@ DEFUN (show_startup_config, show_startup_config_cmd, "show startup-config", SHOW_STR - "Contentes of startup configuration\n") + "Contents of startup configuration\n") { char buf[BUFSIZ]; FILE *confp; @@ -3154,7 +1279,7 @@ DEFUN (show_startup_config, if (confp == NULL) { vty_out (vty, "Can't open configuration file [%s] due to '%s'%s", - host.config, safe_strerror(errno), VTY_NEWLINE); + host.config, safe_strerror(errno), VTY_NEWLINE); return CMD_WARNING; } @@ -3163,7 +1288,7 @@ DEFUN (show_startup_config, char *cp = buf; while (*cp != '\r' && *cp != '\n' && *cp != '\0') - cp++; + cp++; *cp = '\0'; vty_out (vty, "%s%s", buf, VTY_NEWLINE); @@ -3175,13 +1300,15 @@ DEFUN (show_startup_config, } /* Hostname configuration */ -DEFUN (config_hostname, +DEFUN (config_hostname, hostname_cmd, "hostname WORD", "Set system's network name\n" "This system's network name\n") { - if (!isalpha((int) *argv[0])) + struct cmd_token *word = argv[1]; + + if (!isalpha((int) word->arg[0])) { vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE); return CMD_WARNING; @@ -3189,12 +1316,12 @@ DEFUN (config_hostname, if (host.name) XFREE (MTYPE_HOST, host.name); - - host.name = XSTRDUP (MTYPE_HOST, argv[0]); + + host.name = XSTRDUP (MTYPE_HOST, word->arg); return CMD_SUCCESS; } -DEFUN (config_no_hostname, +DEFUN (config_no_hostname, no_hostname_cmd, "no hostname [HOSTNAME]", NO_STR @@ -3209,42 +1336,26 @@ DEFUN (config_no_hostname, /* VTY interface password set. */ DEFUN (config_password, password_cmd, - "password (8|) WORD", + "password [8] WORD", "Assign the terminal connection password\n" "Specifies a HIDDEN password will follow\n" - "dummy string \n" - "The HIDDEN line password string\n") + "The password string\n") { - /* Argument check. */ - if (argc == 0) - { - vty_out (vty, "Please specify password.%s", VTY_NEWLINE); - return CMD_WARNING; - } + if (argc == 3) // '8' was specified + { + if (host.password) + XFREE (MTYPE_HOST, host.password); + host.password = NULL; + if (host.password_encrypt) + XFREE (MTYPE_HOST, host.password_encrypt); + host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[2]->arg); + return CMD_SUCCESS; + } - if (argc == 2) + if (!isalnum (argv[1]->arg[0])) { - if (*argv[0] == '8') - { - if (host.password) - XFREE (MTYPE_HOST, host.password); - host.password = NULL; - if (host.password_encrypt) - XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[1]); - return CMD_SUCCESS; - } - else - { - vty_out (vty, "Unknown encryption type.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (!isalnum ((int) *argv[0])) - { - vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + vty_out (vty, + "Please specify string starting with alphanumeric%s", VTY_NEWLINE); return CMD_WARNING; } @@ -3255,62 +1366,50 @@ DEFUN (config_password, password_cmd, if (host.encrypt) { if (host.password_encrypt) - XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[0])); + XFREE (MTYPE_HOST, host.password_encrypt); + host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[1]->arg)); } else - host.password = XSTRDUP (MTYPE_HOST, argv[0]); + host.password = XSTRDUP (MTYPE_HOST, argv[1]->arg); return CMD_SUCCESS; } -ALIAS (config_password, password_text_cmd, - "password LINE", - "Assign the terminal connection password\n" - "The UNENCRYPTED (cleartext) line password\n") - /* VTY enable password set. */ DEFUN (config_enable_password, enable_password_cmd, - "enable password (8|) WORD", + "enable password [8] WORD", "Modify enable password parameters\n" "Assign the privileged level password\n" "Specifies a HIDDEN password will follow\n" "dummy string \n" "The HIDDEN 'enable' password string\n") { - /* Argument check. */ - if (argc == 0) - { - vty_out (vty, "Please specify password.%s", VTY_NEWLINE); - return CMD_WARNING; - } - /* Crypt type is specified. */ - if (argc == 2) + if (argc == 4) { - if (*argv[0] == '8') - { - if (host.enable) - XFREE (MTYPE_HOST, host.enable); - host.enable = NULL; + if (argv[2]->arg[0] == '8') + { + if (host.enable) + XFREE (MTYPE_HOST, host.enable); + host.enable = NULL; - if (host.enable_encrypt) - XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[1]); + if (host.enable_encrypt) + XFREE (MTYPE_HOST, host.enable_encrypt); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[3]->arg); - return CMD_SUCCESS; - } + return CMD_SUCCESS; + } else - { - vty_out (vty, "Unknown encryption type.%s", VTY_NEWLINE); - return CMD_WARNING; - } + { + vty_out (vty, "Unknown encryption type.%s", VTY_NEWLINE); + return CMD_WARNING; + } } - if (!isalnum ((int) *argv[0])) + if (!isalnum (argv[2]->arg[0])) { - vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + vty_out (vty, + "Please specify string starting with alphanumeric%s", VTY_NEWLINE); return CMD_WARNING; } @@ -3322,22 +1421,15 @@ DEFUN (config_enable_password, enable_password_cmd, if (host.encrypt) { if (host.enable_encrypt) - XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[0])); + XFREE (MTYPE_HOST, host.enable_encrypt); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[2]->arg)); } else - host.enable = XSTRDUP (MTYPE_HOST, argv[0]); + host.enable = XSTRDUP (MTYPE_HOST, argv[2]->arg); return CMD_SUCCESS; } -ALIAS (config_enable_password, - enable_password_text_cmd, - "enable password LINE", - "Modify enable password parameters\n" - "Assign the privileged level password\n" - "The UNENCRYPTED (cleartext) 'enable' password\n") - /* VTY enable password delete. */ DEFUN (no_config_enable_password, no_enable_password_cmd, "no enable password", @@ -3355,7 +1447,7 @@ DEFUN (no_config_enable_password, no_enable_password_cmd, return CMD_SUCCESS; } - + DEFUN (service_password_encrypt, service_password_encrypt_cmd, "service password-encryption", @@ -3370,13 +1462,13 @@ DEFUN (service_password_encrypt, if (host.password) { if (host.password_encrypt) - XFREE (MTYPE_HOST, host.password_encrypt); + XFREE (MTYPE_HOST, host.password_encrypt); host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (host.password)); } if (host.enable) { if (host.enable_encrypt) - XFREE (MTYPE_HOST, host.enable_encrypt); + XFREE (MTYPE_HOST, host.enable_encrypt); host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (host.enable)); } @@ -3407,7 +1499,7 @@ DEFUN (no_service_password_encrypt, } DEFUN (config_terminal_length, config_terminal_length_cmd, - "terminal length <0-512>", + "terminal length (0-512)", "Set terminal line parameters\n" "Set number of lines on a screen\n" "Number of lines on screen (0 for no pausing)\n") @@ -3415,7 +1507,7 @@ DEFUN (config_terminal_length, config_terminal_length_cmd, int lines; char *endptr = NULL; - lines = strtol (argv[0], &endptr, 10); + lines = strtol (argv[2]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -3437,7 +1529,7 @@ DEFUN (config_terminal_no_length, config_terminal_no_length_cmd, } DEFUN (service_terminal_length, service_terminal_length_cmd, - "service terminal-length <0-512>", + "service terminal-length (0-512)", "Set up miscellaneous service\n" "System wide terminal length configuration\n" "Number of lines of VTY (0 means no line control)\n") @@ -3445,7 +1537,7 @@ DEFUN (service_terminal_length, service_terminal_length_cmd, int lines; char *endptr = NULL; - lines = strtol (argv[0], &endptr, 10); + lines = strtol (argv[2]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -3457,7 +1549,7 @@ DEFUN (service_terminal_length, service_terminal_length_cmd, } DEFUN (no_service_terminal_length, no_service_terminal_length_cmd, - "no service terminal-length [<0-512>]", + "no service terminal-length [(0-512)]", NO_STR "Set up miscellaneous service\n" "System wide terminal length configuration\n" @@ -3468,15 +1560,15 @@ DEFUN (no_service_terminal_length, no_service_terminal_length_cmd, } DEFUN_HIDDEN (do_echo, - echo_cmd, - "echo .MESSAGE", - "Echo a message back to the vty\n" - "The message to echo\n") + echo_cmd, + "echo MESSAGE...", + "Echo a message back to the vty\n" + "The message to echo\n") { char *message; - vty_out (vty, "%s%s", ((message = argv_concat(argv, argc, 0)) ? message : ""), - VTY_NEWLINE); + vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 0)) ? message : ""), + VTY_NEWLINE); if (message) XFREE(MTYPE_TMP, message); return CMD_SUCCESS; @@ -3484,7 +1576,7 @@ DEFUN_HIDDEN (do_echo, DEFUN (config_logmsg, config_logmsg_cmd, - "logmsg "LOG_LEVELS" .MESSAGE", + "logmsg "LOG_LEVELS" MESSAGE...", "Send a message to enabled logging destinations\n" LOG_LEVEL_DESC "The message to send\n") @@ -3492,7 +1584,7 @@ DEFUN (config_logmsg, int level; char *message; - if ((level = level_match(argv[0])) == ZLOG_DISABLED) + if ((level = level_match(argv[1]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); @@ -3514,8 +1606,8 @@ DEFUN (show_logging, vty_out (vty, "disabled"); else vty_out (vty, "level %s, facility %s, ident %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_SYSLOG]], - facility_name(zl->facility), zl->ident); + zlog_priority[zl->maxlvl[ZLOG_DEST_SYSLOG]], + facility_name(zl->facility), zl->ident); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Stdout logging: "); @@ -3523,7 +1615,7 @@ DEFUN (show_logging, vty_out (vty, "disabled"); else vty_out (vty, "level %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]); + zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Monitor logging: "); @@ -3531,7 +1623,7 @@ DEFUN (show_logging, vty_out (vty, "disabled"); else vty_out (vty, "level %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]); + zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "File logging: "); @@ -3540,40 +1632,35 @@ DEFUN (show_logging, vty_out (vty, "disabled"); else vty_out (vty, "level %s, filename %s", - zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]], - zl->filename); + zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]], + zl->filename); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Protocol name: %s%s", - zlog_proto_names[zl->protocol], VTY_NEWLINE); + zlog_proto_names[zl->protocol], VTY_NEWLINE); vty_out (vty, "Record priority: %s%s", - (zl->record_priority ? "enabled" : "disabled"), VTY_NEWLINE); + (zl->record_priority ? "enabled" : "disabled"), VTY_NEWLINE); vty_out (vty, "Timestamp precision: %d%s", - zl->timestamp_precision, VTY_NEWLINE); + zl->timestamp_precision, VTY_NEWLINE); return CMD_SUCCESS; } DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout", - "Logging control\n" - "Set stdout logging level\n") -{ - zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); - return CMD_SUCCESS; -} - -DEFUN (config_log_stdout_level, - config_log_stdout_level_cmd, - "log stdout "LOG_LEVELS, + "log stdout ["LOG_LEVELS"]", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) { + if (argc == 2) + { + zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); + return CMD_SUCCESS; + } int level; - if ((level = level_match(argv[0])) == ZLOG_DISABLED) + if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_STDOUT, level); return CMD_SUCCESS; @@ -3581,11 +1668,11 @@ DEFUN (config_log_stdout_level, DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, - "no log stdout [LEVEL]", + "no log stdout ["LOG_LEVELS"]", NO_STR "Logging control\n" "Cancel logging to stdout\n" - "Logging level\n") + LOG_LEVEL_DESC) { zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED); return CMD_SUCCESS; @@ -3593,24 +1680,19 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, - "log monitor", - "Logging control\n" - "Set terminal line (monitor) logging level\n") -{ - zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); - return CMD_SUCCESS; -} - -DEFUN (config_log_monitor_level, - config_log_monitor_level_cmd, - "log monitor "LOG_LEVELS, + "log monitor ["LOG_LEVELS"]", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { + if (argc == 2) + { + zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); + return CMD_SUCCESS; + } int level; - if ((level = level_match(argv[0])) == ZLOG_DISABLED) + if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_MONITOR, level); return CMD_SUCCESS; @@ -3618,11 +1700,11 @@ DEFUN (config_log_monitor_level, DEFUN (no_config_log_monitor, no_config_log_monitor_cmd, - "no log monitor [LEVEL]", + "no log monitor ["LOG_LEVELS"]", NO_STR "Logging control\n" "Disable terminal line (monitor) logging\n" - "Logging level\n") + LOG_LEVEL_DESC) { zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED); return CMD_SUCCESS; @@ -3634,19 +1716,19 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) int ret; char *p = NULL; const char *fullpath; - + /* Path detection. */ if (! IS_DIRECTORY_SEP (*fname)) { char cwd[MAXPATHLEN+1]; cwd[MAXPATHLEN] = '\0'; - + if (getcwd (cwd, MAXPATHLEN) == NULL) { zlog_err ("config_log_file: Unable to alloc mem!"); return CMD_WARNING; } - + if ( (p = XMALLOC (MTYPE_TMP, strlen (cwd) + strlen (fname) + 2)) == NULL) { @@ -3680,36 +1762,32 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) DEFUN (config_log_file, config_log_file_cmd, - "log file FILENAME", - "Logging control\n" - "Logging to file\n" - "Logging filename\n") -{ - return set_log_file(vty, argv[0], zlog_default->default_lvl); -} - -DEFUN (config_log_file_level, - config_log_file_level_cmd, - "log file FILENAME "LOG_LEVELS, + "log file FILENAME [" LOG_LEVELS "]", "Logging control\n" "Logging to file\n" "Logging filename\n" LOG_LEVEL_DESC) { - int level; - - if ((level = level_match(argv[1])) == ZLOG_DISABLED) - return CMD_ERR_NO_MATCH; - return set_log_file(vty, argv[0], level); + if (argc == 4) + { + int level; + if ((level = level_match(argv[3]->arg)) == ZLOG_DISABLED) + return CMD_ERR_NO_MATCH; + return set_log_file(vty, argv[2]->arg, level); + } + else + return set_log_file(vty, argv[2]->arg, zlog_default->default_lvl); } DEFUN (no_config_log_file, no_config_log_file_cmd, - "no log file [FILENAME]", + "no log file [FILENAME [LEVEL]]", NO_STR "Logging control\n" "Cancel logging to file\n" - "Logging file name\n") + "Logging file name\n" + "Logging file name\n" + "Logging level\n") { zlog_reset_file (NULL); @@ -3721,52 +1799,37 @@ DEFUN (no_config_log_file, return CMD_SUCCESS; } -ALIAS (no_config_log_file, - no_config_log_file_level_cmd, - "no log file FILENAME LEVEL", - NO_STR - "Logging control\n" - "Cancel logging to file\n" - "Logging file name\n" - "Logging level\n") - DEFUN (config_log_syslog, config_log_syslog_cmd, - "log syslog", - "Logging control\n" - "Set syslog logging level\n") -{ - zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl); - return CMD_SUCCESS; -} - -DEFUN (config_log_syslog_level, - config_log_syslog_level_cmd, - "log syslog "LOG_LEVELS, + "log syslog [" LOG_LEVELS "]", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) { - int level; - - if ((level = level_match(argv[0])) == ZLOG_DISABLED) - return CMD_ERR_NO_MATCH; - zlog_set_level (NULL, ZLOG_DEST_SYSLOG, level); - return CMD_SUCCESS; + if (argc == 3) + { + int level; + if ((level = level_match (argv[2]->arg)) == ZLOG_DISABLED) + return CMD_ERR_NO_MATCH; + zlog_set_level (NULL, ZLOG_DEST_SYSLOG, level); + return CMD_SUCCESS; + } + else + { + zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl); + return CMD_SUCCESS; + } } DEFUN_DEPRECATED (config_log_syslog_facility, - config_log_syslog_facility_cmd, - "log syslog facility "LOG_FACILITIES, - "Logging control\n" - "Logging goes to syslog\n" - "(Deprecated) Facility parameter for syslog messages\n" - LOG_FACILITY_DESC) + config_log_syslog_facility_cmd, + "log syslog facility "LOG_FACILITIES, + "Logging control\n" + "Logging goes to syslog\n" + "(Deprecated) Facility parameter for syslog messages\n" + LOG_FACILITY_DESC) { - int facility; - - if ((facility = facility_match(argv[0])) < 0) - return CMD_ERR_NO_MATCH; + int facility = facility_match(argv[3]->arg); zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl); zlog_default->facility = facility; @@ -3775,25 +1838,17 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [LEVEL]", + "no log syslog [" LOG_FACILITIES "] ["LOG_LEVELS"]", NO_STR "Logging control\n" "Cancel logging to syslog\n" - "Logging level\n") + LOG_FACILITY_DESC + LOG_LEVEL_DESC) { zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED); return CMD_SUCCESS; } -ALIAS (no_config_log_syslog, - no_config_log_syslog_facility_cmd, - "no log syslog facility "LOG_FACILITIES, - NO_STR - "Logging control\n" - "Logging goes to syslog\n" - "Facility parameter for syslog messages\n" - LOG_FACILITY_DESC) - DEFUN (config_log_facility, config_log_facility_cmd, "log facility "LOG_FACILITIES, @@ -3801,37 +1856,35 @@ DEFUN (config_log_facility, "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) { - int facility; + int facility = facility_match(argv[2]->arg); - if ((facility = facility_match(argv[0])) < 0) - return CMD_ERR_NO_MATCH; zlog_default->facility = facility; return CMD_SUCCESS; } DEFUN (no_config_log_facility, no_config_log_facility_cmd, - "no log facility [FACILITY]", + "no log facility ["LOG_FACILITIES"]", NO_STR "Logging control\n" "Reset syslog facility to default (daemon)\n" - "Syslog facility\n") + LOG_FACILITY_DESC) { zlog_default->facility = LOG_DAEMON; return CMD_SUCCESS; } DEFUN_DEPRECATED (config_log_trap, - config_log_trap_cmd, - "log trap "LOG_LEVELS, - "Logging control\n" - "(Deprecated) Set logging level and default for all destinations\n" - LOG_LEVEL_DESC) + config_log_trap_cmd, + "log trap "LOG_LEVELS, + "Logging control\n" + "(Deprecated) Set logging level and default for all destinations\n" + LOG_LEVEL_DESC) { int new_level ; int i; - - if ((new_level = level_match(argv[0])) == ZLOG_DISABLED) + + if ((new_level = level_match(argv[2]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_default->default_lvl = new_level; @@ -3842,12 +1895,12 @@ DEFUN_DEPRECATED (config_log_trap, } DEFUN_DEPRECATED (no_config_log_trap, - no_config_log_trap_cmd, - "no log trap [LEVEL]", - NO_STR - "Logging control\n" - "Permit all logging information\n" - "Logging level\n") + no_config_log_trap_cmd, + "no log trap ["LOG_LEVELS"]", + NO_STR + "Logging control\n" + "Permit all logging information\n" + LOG_LEVEL_DESC) { zlog_default->default_lvl = LOG_DEBUG; return CMD_SUCCESS; @@ -3882,14 +1935,8 @@ DEFUN (config_log_timestamp_precision, "Set the timestamp precision\n" "Number of subsecond digits\n") { - if (argc != 1) - { - vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); - return CMD_WARNING; - } - VTY_GET_INTEGER_RANGE("Timestamp Precision", - zlog_default->timestamp_precision, argv[0], 0, 6); + zlog_default->timestamp_precision, argv[3]->arg, 0, 6); return CMD_SUCCESS; } @@ -3923,7 +1970,7 @@ DEFUN (banner_motd_file, "Banner from a file\n" "Filename\n") { - return cmd_banner_motd_file (argv[0]); + return cmd_banner_motd_file (argv[3]->arg); } DEFUN (banner_motd_default, @@ -3945,7 +1992,7 @@ DEFUN (no_banner_motd, "Strings for motd\n") { host.motd = NULL; - if (host.motdfile) + if (host.motdfile) XFREE (MTYPE_HOST, host.motdfile); host.motdfile = NULL; return CMD_SUCCESS; @@ -4000,9 +2047,6 @@ install_default (enum node_type node) install_element (node, &config_help_cmd); install_element (node, &config_list_cmd); - install_element (node, &config_write_terminal_cmd); - install_element (node, &config_write_file_cmd); - install_element (node, &config_write_memory_cmd); install_element (node, &config_write_cmd); install_element (node, &show_running_config_cmd); } @@ -4011,12 +2055,6 @@ install_default (enum node_type node) void cmd_init (int terminal) { - command_cr = XSTRDUP(MTYPE_CMD_TOKENS, ""); - token_cr.type = TOKEN_TERMINAL; - token_cr.terminal = TERMINAL_LITERAL; - token_cr.cmd = command_cr; - token_cr.desc = XSTRDUP(MTYPE_CMD_TOKENS, ""); - /* Allocate initial top vector of commands. */ cmdvec = vector_init (VECTOR_MIN_SIZE); @@ -4085,33 +2123,24 @@ cmd_init (int terminal) install_default (CONFIG_NODE); } - + install_element (CONFIG_NODE, &hostname_cmd); install_element (CONFIG_NODE, &no_hostname_cmd); if (terminal) { install_element (CONFIG_NODE, &password_cmd); - install_element (CONFIG_NODE, &password_text_cmd); install_element (CONFIG_NODE, &enable_password_cmd); - install_element (CONFIG_NODE, &enable_password_text_cmd); install_element (CONFIG_NODE, &no_enable_password_cmd); install_element (CONFIG_NODE, &config_log_stdout_cmd); - install_element (CONFIG_NODE, &config_log_stdout_level_cmd); install_element (CONFIG_NODE, &no_config_log_stdout_cmd); install_element (CONFIG_NODE, &config_log_monitor_cmd); - install_element (CONFIG_NODE, &config_log_monitor_level_cmd); install_element (CONFIG_NODE, &no_config_log_monitor_cmd); install_element (CONFIG_NODE, &config_log_file_cmd); - install_element (CONFIG_NODE, &config_log_file_level_cmd); install_element (CONFIG_NODE, &no_config_log_file_cmd); - install_element (CONFIG_NODE, &no_config_log_file_level_cmd); install_element (CONFIG_NODE, &config_log_syslog_cmd); - install_element (CONFIG_NODE, &config_log_syslog_level_cmd); - install_element (CONFIG_NODE, &config_log_syslog_facility_cmd); install_element (CONFIG_NODE, &no_config_log_syslog_cmd); - install_element (CONFIG_NODE, &no_config_log_syslog_facility_cmd); install_element (CONFIG_NODE, &config_log_facility_cmd); install_element (CONFIG_NODE, &no_config_log_facility_cmd); install_element (CONFIG_NODE, &config_log_trap_cmd); @@ -4131,7 +2160,7 @@ cmd_init (int terminal) install_element (VIEW_NODE, &show_thread_cpu_cmd); install_element (ENABLE_NODE, &show_thread_cpu_cmd); install_element (RESTRICTED_NODE, &show_thread_cpu_cmd); - + install_element (ENABLE_NODE, &clear_thread_cpu_cmd); install_element (VIEW_NODE, &show_work_queues_cmd); install_element (ENABLE_NODE, &show_work_queues_cmd); @@ -4142,62 +2171,54 @@ cmd_init (int terminal) srandom(time(NULL)); } -static void -cmd_terminate_token(struct cmd_token *token) +struct cmd_token * +new_cmd_token (enum cmd_token_type type, char *text, char *desc) { - unsigned int i, j; - vector keyword_vect; + struct cmd_token *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token)); + token->type = type; + token->text = text; + token->desc = desc; + token->arg = NULL; - if (token->multiple) - { - for (i = 0; i < vector_active(token->multiple); i++) - cmd_terminate_token(vector_slot(token->multiple, i)); - vector_free(token->multiple); - token->multiple = NULL; - } - - if (token->keyword) - { - for (i = 0; i < vector_active(token->keyword); i++) - { - keyword_vect = vector_slot(token->keyword, i); - for (j = 0; j < vector_active(keyword_vect); j++) - cmd_terminate_token(vector_slot(keyword_vect, j)); - vector_free(keyword_vect); - } - vector_free(token->keyword); - token->keyword = NULL; - } - - XFREE(MTYPE_CMD_TOKENS, token->cmd); - XFREE(MTYPE_CMD_TOKENS, token->desc); - - XFREE(MTYPE_CMD_TOKENS, token); + return token; } -static void -cmd_terminate_element(struct cmd_element *cmd) +void +del_cmd_token (struct cmd_token *token) { - unsigned int i; + if (!token) return; - if (cmd->tokens == NULL) - return; + if (token->text) + XFREE (MTYPE_CMD_TOKENS, token->text); + if (token->desc) + XFREE (MTYPE_CMD_TOKENS, token->desc); + if (token->arg) + XFREE (MTYPE_CMD_TOKENS, token->arg); - for (i = 0; i < vector_active(cmd->tokens); i++) - cmd_terminate_token(vector_slot(cmd->tokens, i)); + XFREE (MTYPE_CMD_TOKENS, token); +} - vector_free(cmd->tokens); - cmd->tokens = NULL; +struct cmd_token * +copy_cmd_token (struct cmd_token *token) +{ + struct cmd_token *copy = new_cmd_token (token->type, NULL, NULL); + copy->value = token->value; + copy->max = token->max; + copy->min = token->min; + copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; + copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_TOKENS, token->desc) : NULL; + copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_TOKENS, token->arg) : NULL; + + return copy; } void del_cmd_element(struct cmd_element *cmd) { if (!cmd) return; - free ((char*) cmd->string); - free ((char*) cmd->doc); - cmd_terminate_element(cmd); - free (cmd); + XFREE (MTYPE_CMD_TOKENS, cmd->string); + XFREE (MTYPE_CMD_TOKENS, cmd->doc); + XFREE (MTYPE_CMD_TOKENS, cmd); } struct cmd_element * @@ -4208,7 +2229,6 @@ copy_cmd_element(struct cmd_element *cmd) el->func = cmd->func; el->doc = cmd->doc ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->doc) : NULL; el->daemon = cmd->daemon; - el->tokens = cmd->tokens ? vector_copy(cmd->tokens) : NULL; el->attr = cmd->attr; return el; } @@ -4216,33 +2236,22 @@ copy_cmd_element(struct cmd_element *cmd) void cmd_terminate () { - unsigned int i, j; struct cmd_node *cmd_node; - struct cmd_element *cmd_element; - vector cmd_node_v; if (cmdvec) { - for (i = 0; i < vector_active (cmdvec); i++) + for (unsigned int i = 0; i < vector_active (cmdvec); i++) if ((cmd_node = vector_slot (cmdvec, i)) != NULL) - { - cmd_node_v = cmd_node->cmd_vector; - - for (j = 0; j < vector_active (cmd_node_v); j++) - if ((cmd_element = vector_slot (cmd_node_v, j)) != NULL) - cmd_terminate_element(cmd_element); - - vector_free (cmd_node_v); - } + { + // deleting the graph delets the cmd_element as well + graph_delete_graph (cmd_node->cmdgraph); + vector_free (cmd_node->cmd_vector); + } vector_free (cmdvec); cmdvec = NULL; } - if (command_cr) - XFREE(MTYPE_CMD_TOKENS, command_cr); - if (token_cr.desc) - XFREE(MTYPE_CMD_TOKENS, token_cr.desc); if (host.name) XFREE (MTYPE_HOST, host.name); if (host.password) diff --git a/lib/command.h b/lib/command.h index 6d0fb18061..786539034b 100644 --- a/lib/command.h +++ b/lib/command.h @@ -8,7 +8,7 @@ * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2, or (at your * option) any later version. - * + * * GNU Zebra is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -26,6 +26,7 @@ #include "vector.h" #include "vty.h" #include "lib/route_types.h" +#include "graph.h" /* Host configuration variable */ struct host @@ -60,74 +61,118 @@ struct host }; /* There are some command levels which called from command node. */ -enum node_type +enum node_type { - AUTH_NODE, /* Authentication mode of vty interface. */ - RESTRICTED_NODE, /* Restricted view mode */ - VIEW_NODE, /* View node. Default mode of vty interface. */ - AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ - ENABLE_NODE, /* Enable node. */ - CONFIG_NODE, /* Config node. Default mode of config file. */ - SERVICE_NODE, /* Service node. */ - DEBUG_NODE, /* Debug node. */ + AUTH_NODE, /* Authentication mode of vty interface. */ + RESTRICTED_NODE, /* Restricted view mode */ + VIEW_NODE, /* View node. Default mode of vty interface. */ + AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ + ENABLE_NODE, /* Enable node. */ + CONFIG_NODE, /* Config node. Default mode of config file. */ + SERVICE_NODE, /* Service node. */ + DEBUG_NODE, /* Debug node. */ VRF_DEBUG_NODE, /* Vrf Debug node. */ - AAA_NODE, /* AAA node. */ - KEYCHAIN_NODE, /* Key-chain node. */ - KEYCHAIN_KEY_NODE, /* Key-chain key node. */ - VRF_NODE, /* VRF mode node. */ - INTERFACE_NODE, /* Interface mode node. */ - ZEBRA_NODE, /* zebra connection node. */ - TABLE_NODE, /* rtm_table selection node. */ - RIP_NODE, /* RIP protocol mode node. */ - RIPNG_NODE, /* RIPng protocol mode node. */ - BGP_NODE, /* BGP protocol mode which includes BGP4+ */ - BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ - BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ - BGP_IPV6_NODE, /* BGP IPv6 address family */ - BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ - BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ - BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ - OSPF_NODE, /* OSPF protocol mode */ - OSPF6_NODE, /* OSPF protocol for IPv6 mode */ - ISIS_NODE, /* ISIS protocol mode */ - PIM_NODE, /* PIM protocol mode */ - MASC_NODE, /* MASC for multicast. */ - IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ - IP_NODE, /* Static ip route node. */ - ACCESS_NODE, /* Access list node. */ - PREFIX_NODE, /* Prefix list node. */ - ACCESS_IPV6_NODE, /* Access list node. */ - PREFIX_IPV6_NODE, /* Prefix list node. */ - AS_LIST_NODE, /* AS list node. */ - COMMUNITY_LIST_NODE, /* Community list node. */ - RMAP_NODE, /* Route map node. */ - SMUX_NODE, /* SNMP configuration node. */ - DUMP_NODE, /* Packet dump node. */ - FORWARDING_NODE, /* IP forwarding node. */ + AAA_NODE, /* AAA node. */ + KEYCHAIN_NODE, /* Key-chain node. */ + KEYCHAIN_KEY_NODE, /* Key-chain key node. */ + VRF_NODE, /* VRF mode node. */ + INTERFACE_NODE, /* Interface mode node. */ + ZEBRA_NODE, /* zebra connection node. */ + TABLE_NODE, /* rtm_table selection node. */ + RIP_NODE, /* RIP protocol mode node. */ + RIPNG_NODE, /* RIPng protocol mode node. */ + BGP_NODE, /* BGP protocol mode which includes BGP4+ */ + BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ + BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ + BGP_IPV6_NODE, /* BGP IPv6 address family */ + BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ + BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ + BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ + OSPF_NODE, /* OSPF protocol mode */ + OSPF6_NODE, /* OSPF protocol for IPv6 mode */ + ISIS_NODE, /* ISIS protocol mode */ + PIM_NODE, /* PIM protocol mode */ + MASC_NODE, /* MASC for multicast. */ + IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ + IP_NODE, /* Static ip route node. */ + ACCESS_NODE, /* Access list node. */ + PREFIX_NODE, /* Prefix list node. */ + ACCESS_IPV6_NODE, /* Access list node. */ + PREFIX_IPV6_NODE, /* Prefix list node. */ + AS_LIST_NODE, /* AS list node. */ + COMMUNITY_LIST_NODE, /* Community list node. */ + RMAP_NODE, /* Route map node. */ + SMUX_NODE, /* SNMP configuration node. */ + DUMP_NODE, /* Packet dump node. */ + FORWARDING_NODE, /* IP forwarding node. */ PROTOCOL_NODE, /* protocol filtering node */ - VTY_NODE, /* Vty node. */ + VTY_NODE, /* Vty node. */ }; /* Node which has some commands and prompt string and configuration function pointer . */ -struct cmd_node +struct cmd_node { /* Node index. */ - enum node_type node; + enum node_type node; /* Prompt character at vty interface. */ - const char *prompt; + const char *prompt; /* Is this node's configuration goes to vtysh ? */ int vtysh; - + /* Node's configuration write function */ int (*func) (struct vty *); + /* Node's command graph */ + struct graph *cmdgraph; + /* Vector of this node's command list. */ - vector cmd_vector; + vector cmd_vector; +}; + +/** + * Types for tokens. + * + * The type determines what kind of data the token can match (in the + * matching use case) or hold (in the argv use case). + */ +enum cmd_token_type +{ + WORD_TKN, // words + NUMBER_TKN, // integral numbers + VARIABLE_TKN, // almost anything + RANGE_TKN, // integer range + IPV4_TKN, // IPV4 addresses + IPV4_PREFIX_TKN, // IPV4 network prefixes + IPV6_TKN, // IPV6 prefixes + IPV6_PREFIX_TKN, // IPV6 network prefixes + + /* plumbing types */ + SELECTOR_TKN, // marks beginning of selector + OPTION_TKN, // marks beginning of option + NUL_TKN, // dummy token + START_TKN, // first token in line + END_TKN, // last token in line +}; + +/** + * Token struct. + */ +struct cmd_token +{ + enum cmd_token_type type; // token type + + char *text; // token text + char *desc; // token description + + long long value; // for numeric types + long long min, max; // for ranges + + char *arg; // user input that matches this token }; enum @@ -137,56 +182,15 @@ enum }; /* Structure of command element. */ -struct cmd_element +struct cmd_element { - const char *string; /* Command specification by string. */ - int (*func) (struct cmd_element *, struct vty *, int, const char *[]); - const char *doc; /* Documentation of this command. */ + const char *string; /* Command specification by string. */ + const char *doc; /* Documentation of this command. */ int daemon; /* Daemon to which this command belong. */ - vector tokens; /* Vector of cmd_tokens */ - u_char attr; /* Command attributes */ -}; + u_char attr; /* Command attributes */ - -enum cmd_token_type -{ - TOKEN_TERMINAL = 0, - TOKEN_MULTIPLE, - TOKEN_KEYWORD, -}; - -enum cmd_terminal_type -{ - _TERMINAL_BUG = 0, - TERMINAL_LITERAL, - TERMINAL_OPTION, - TERMINAL_VARIABLE, - TERMINAL_VARARG, - TERMINAL_RANGE, - TERMINAL_IPV4, - TERMINAL_IPV4_PREFIX, - TERMINAL_IPV6, - TERMINAL_IPV6_PREFIX, -}; - -/* argument to be recorded on argv[] if it's not a literal */ -#define TERMINAL_RECORD(t) ((t) >= TERMINAL_OPTION) - -/* Command description structure. */ -struct cmd_token -{ - enum cmd_token_type type; - enum cmd_terminal_type terminal; - - /* Used for type == MULTIPLE */ - vector multiple; /* vector of cmd_token, type == FINAL */ - - /* Used for type == KEYWORD */ - vector keyword; /* vector of vector of cmd_tokens */ - - /* Used for type == TERMINAL */ - char *cmd; /* Command string. */ - char *desc; /* Command's description. */ + /* handler function for command */ + int (*func) (struct cmd_element *, struct vty *, int, struct cmd_token *[]); }; /* Return value of the commands. */ @@ -207,7 +211,7 @@ struct cmd_token #define CMD_ARGC_MAX 25 /* Turn off these macros when uisng cpp with extract.pl */ -#ifndef VTYSH_EXTRACT_PL +#ifndef VTYSH_EXTRACT_PL /* helper defines for end-user DEFUN* macros */ #define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ @@ -221,179 +225,15 @@ struct cmd_token }; #define DEFUN_CMD_FUNC_DECL(funcname) \ - static int funcname (struct cmd_element *, struct vty *, int, const char *[]); + static int funcname (struct cmd_element *, struct vty *, int, struct cmd_token *[]); #define DEFUN_CMD_FUNC_TEXT(funcname) \ static int funcname \ (struct cmd_element *self __attribute__ ((unused)), \ struct vty *vty __attribute__ ((unused)), \ int argc __attribute__ ((unused)), \ - const char *argv[] __attribute__ ((unused)) ) + struct cmd_token *argv[] __attribute__ ((unused)) ) -/* DEFUN for vty command interafce. Little bit hacky ;-). - * - * DEFUN(funcname, cmdname, cmdstr, helpstr) - * - * funcname - * ======== - * - * Name of the function that will be defined. - * - * cmdname - * ======= - * - * Name of the struct that will be defined for the command. - * - * cmdstr - * ====== - * - * The cmdstr defines the command syntax. It is used by the vty subsystem - * and vtysh to perform matching and completion in the cli. So you have to take - * care to construct it adhering to the following grammar. The names used - * for the production rules losely represent the names used in lib/command.c - * - * cmdstr = cmd_token , { " " , cmd_token } ; - * - * cmd_token = cmd_terminal - * | cmd_multiple - * | cmd_keyword ; - * - * cmd_terminal_fixed = fixed_string - * | variable - * | range - * | ipv4 - * | ipv4_prefix - * | ipv6 - * | ipv6_prefix ; - * - * cmd_terminal = cmd_terminal_fixed - * | option - * | vararg ; - * - * multiple_part = cmd_terminal_fixed ; - * cmd_multiple = "(" , multiple_part , ( "|" | { "|" , multiple_part } ) , ")" ; - * - * keyword_part = fixed_string , { " " , ( cmd_terminal_fixed | cmd_multiple ) } ; - * cmd_keyword = "{" , keyword_part , { "|" , keyword_part } , "}" ; - * - * lowercase = "a" | ... | "z" ; - * uppercase = "A" | ... | "Z" ; - * digit = "0" | ... | "9" ; - * number = digit , { digit } ; - * - * fixed_string = (lowercase | digit) , { lowercase | digit | uppercase | "-" | "_" } ; - * variable = uppercase , { uppercase | "_" } ; - * range = "<" , number , "-" , number , ">" ; - * ipv4 = "A.B.C.D" ; - * ipv4_prefix = "A.B.C.D/M" ; - * ipv6 = "X:X::X:X" ; - * ipv6_prefix = "X:X::X:X/M" ; - * option = "[" , variable , "]" ; - * vararg = "." , variable ; - * - * To put that all in a textual description: A cmdstr is a sequence of tokens, - * separated by spaces. - * - * Terminal Tokens: - * - * A very simple cmdstring would be something like: "show ip bgp". It consists - * of three Terminal Tokens, each containing a fixed string. When this command - * is called, no arguments will be passed down to the function implementing it, - * as it only consists of fixed strings. - * - * Apart from fixed strings, Terminal Tokens can also contain variables: - * An example would be "show ip bgp A.B.C.D". This command expects an IPv4 - * as argument. As this is a variable, the IP address entered by the user will - * be passed down as an argument. Apart from two exceptions, the other options - * for Terminal Tokens behave exactly as we just discussed and only make a - * difference for the CLI. The two exceptions will be discussed in the next - * paragraphs. - * - * A Terminal Token can contain a so called option match. This is a simple - * string variable that the user may omit. An example would be: - * "show interface [IFNAME]". If the user calls this without an interface as - * argument, no arguments will be passed down to the function implementing - * this command. Otherwise, the interface name will be provided to the function - * as a regular argument. - - * Also, a Terminal Token can contain a so called vararg. This is used e.g. in - * "show ip bgp regexp .LINE". The last token is a vararg match and will - * consume all the arguments the user inputs on the command line and append - * those to the list of arguments passed down to the function implementing this - * command. (Therefore, it doesn't make much sense to have any tokens after a - * vararg because the vararg will already consume all the words the user entered - * in the CLI) - * - * Multiple Tokens: - * - * The Multiple Token type can be used if there are multiple possibilities what - * arguments may be used for a command, but it should map to the same function - * nonetheless. An example would be "ip route A.B.C.D/M (reject|blackhole)" - * In that case both "reject" and "blackhole" would be acceptable as last - * arguments. The words matched by Multiple Tokens are always added to the - * argument list, even if they are matched by fixed strings. Such a Multiple - * Token can contain almost any type of token that would also be acceptable - * for a Terminal Token, the exception are optional variables and varag. - * - * There is one special case that is used in some places of Quagga that should be - * pointed out here shortly. An example would be "password (8|) WORD". This - * construct is used to have fixed strings communicated as arguments. (The "8" - * will be passed down as an argument in this case) It does not mean that - * the "8" is optional. Another historic and possibly surprising property of - * this construct is that it consumes two parts of helpstr. (Help - * strings will be explained later) - * - * Keyword Tokens: - * - * There are commands that take a lot of different and possibly optional arguments. - * An example from ospf would be the "default-information originate" command. This - * command takes a lot of optional arguments that may be provided in any order. - * To accomodate such commands, the Keyword Token has been implemented. - * Using the keyword token, the "default-information originate" command and all - * its possible options can be represented using this single cmdstr: - * "default-information originate \ - * {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}" - * - * Keywords always start with a fixed string and may be followed by arguments. - * Except optional variables and vararg, everything is permitted here. - * - * For the special case of a keyword without arguments, either NULL or the - * keyword itself will be pushed as an argument, depending on whether the - * keyword is present. - * For the other keywords, arguments will be only pushed for - * variables/Multiple Tokens. If the keyword is not present, the arguments that - * would have been pushed will be substituted by NULL. - * - * A few examples: - * "default information originate metric-type 1 metric 1000" - * would yield the following arguments: - * { NULL, "1000", "1", NULL } - * - * "default information originate always route-map RMAP-DEFAULT" - * would yield the following arguments: - * { "always", NULL, NULL, "RMAP-DEFAULT" } - * - * helpstr - * ======= - * - * The helpstr is used to show a short explantion for the commands that - * are available when the user presses '?' on the CLI. It is the concatenation - * of the helpstrings for all the tokens that make up the command. - * - * There should be one helpstring for each token in the cmdstr except those - * containing other tokens, like Multiple or Keyword Tokens. For those, there - * will only be the helpstrings of the contained tokens. - * - * The individual helpstrings are expected to be in the same order as their - * respective Tokens appear in the cmdstr. They should each be terminated with - * a linefeed. The last helpstring should be terminated with a linefeed as well. - * - * Care should also be taken to avoid having similar tokens with different - * helpstrings. Imagine e.g. the commands "show ip ospf" and "show ip bgp". - * they both contain a helpstring for "show", but only one will be displayed - * when the user enters "sh?". If those two helpstrings differ, it is not - * defined which one will be shown and the behavior is therefore unpredictable. - */ #define DEFUN(funcname, cmdname, cmdstr, helpstr) \ DEFUN_CMD_FUNC_DECL(funcname) \ DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ @@ -506,41 +346,41 @@ struct cmd_token #define IP6_STR "IPv6 Information\n" #define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" #define OSPF6_ROUTER_STR "Enable a routing process\n" -#define OSPF6_INSTANCE_STR "<1-65535> Instance ID\n" -#define SECONDS_STR "<1-65535> Seconds\n" +#define OSPF6_INSTANCE_STR "(1-65535) Instance ID\n" +#define SECONDS_STR "(1-65535) Seconds\n" #define ROUTE_STR "Routing Table\n" #define PREFIX_LIST_STR "Build a prefix list\n" #define OSPF6_DUMP_TYPE_LIST \ -"(neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr)" +"" #define ISIS_STR "IS-IS information\n" #define AREA_TAG_STR "[area tag]\n" -#define COMMUNITY_AANN_STR "Community number where AA and NN are <0-65535>\n" -#define COMMUNITY_VAL_STR "Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive\n" +#define COMMUNITY_AANN_STR "Community number where AA and NN are (0-65535)\n" +#define COMMUNITY_VAL_STR "Community number in AA:NN format (where AA and NN are (0-65535)) or local-AS|no-advertise|no-export|internet or additive\n" #define CONF_BACKUP_EXT ".sav" /* IPv4 only machine should not accept IPv6 address for peer's IP address. So we replace VTY command string like below. */ #ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " -#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " +#define NEIGHBOR_CMD "neighbor " +#define NO_NEIGHBOR_CMD "no neighbor " #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " +#define NEIGHBOR_CMD2 "neighbor " +#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" #else #define NEIGHBOR_CMD "neighbor A.B.C.D " #define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " #define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " +#define NEIGHBOR_CMD2 "neighbor " +#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ /* Dynamic neighbor (listen range) configuration */ #ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) " +#define LISTEN_RANGE_CMD "bgp listen range " #define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" #else #define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " @@ -555,7 +395,7 @@ extern void install_element (enum node_type, struct cmd_element *); /* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated string with a space between each element (allocated using XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ -extern char *argv_concat (const char **argv, int argc, int shift); +extern char *argv_concat (struct cmd_token **argv, int argc, int shift); extern vector cmd_make_strvec (const char *); extern void cmd_free_strvec (vector); @@ -577,6 +417,14 @@ del_cmd_element(struct cmd_element *); struct cmd_element * copy_cmd_element(struct cmd_element *cmd); +/* memory management for cmd_token */ +struct cmd_token * +new_cmd_token (enum cmd_token_type, char *, char *); +void +del_cmd_token (struct cmd_token *); +struct cmd_token * +copy_cmd_token (struct cmd_token *); + /* Export typical functions. */ extern struct cmd_element config_end_cmd; extern struct cmd_element config_exit_cmd; @@ -591,8 +439,9 @@ extern void print_version (const char *); extern int cmd_banner_motd_file (const char *); /* struct host global, ick */ -extern struct host host; +extern struct host host; + +/* text for command */ +#define CMD_CR_TEXT "" -/* "" global */ -extern char *command_cr; #endif /* _ZEBRA_COMMAND_H */ diff --git a/lib/command_match.c b/lib/command_match.c index dce3292709..d7c2222ce6 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -25,7 +25,6 @@ #include #include "command_match.h" #include "command_parse.h" -#include "grammar_sandbox.h" #include "memory.h" /* matcher helper prototypes */ @@ -36,16 +35,16 @@ static struct list * command_match_r (struct graph_node *, vector, unsigned int); static int -score_precedence (enum cmd_token_type_t); +score_precedence (enum cmd_token_type); static enum match_type -min_match_level (enum cmd_token_type_t); +min_match_level (enum cmd_token_type); static void del_arglist (struct list *); -static struct cmd_token_t * -disambiguate_tokens (struct cmd_token_t *, struct cmd_token_t *, char *); +static struct cmd_token * +disambiguate_tokens (struct cmd_token *, struct cmd_token *, char *); static struct list * disambiguate (struct list *, struct list *, vector, unsigned int); @@ -55,7 +54,7 @@ compare_completions (const void *, const void *); /* token matcher prototypes */ static enum match_type -match_token (struct cmd_token_t *, char *); +match_token (struct cmd_token *, char *); static enum match_type match_ipv4 (const char *); @@ -70,16 +69,16 @@ static enum match_type match_ipv6_prefix (const char *); static enum match_type -match_range (struct cmd_token_t *, const char *); +match_range (struct cmd_token *, const char *); static enum match_type -match_word (struct cmd_token_t *, const char *); +match_word (struct cmd_token *, const char *); static enum match_type -match_number (struct cmd_token_t *, const char *); +match_number (struct cmd_token *, const char *); static enum match_type -match_variable (struct cmd_token_t *, const char *); +match_variable (struct cmd_token *, const char *); /* matching functions */ static enum matcher_rv matcher_rv; @@ -105,7 +104,7 @@ command_match (struct graph *cmdgraph, struct listnode *tail = listtail (*argv); // delete dummy start node - del_cmd_token ((struct cmd_token_t *) head->data); + del_cmd_token ((struct cmd_token *) head->data); list_delete_node (*argv, head); // get cmd_element out of list tail @@ -179,7 +178,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) assert (n < vector_active (vline)); // get the minimum match level that can count as a full match - struct cmd_token_t *token = start->data; + struct cmd_token *token = start->data; enum match_type minmatch = min_match_level (token->type); // get the current operating input token @@ -205,7 +204,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // if we've matched all input we're looking for END_TKN if (n+1 == vector_active (vline)) { - struct cmd_token_t *tok = gn->data; + struct cmd_token *tok = gn->data; if (tok->type == END_TKN) { currbest = list_new(); @@ -255,8 +254,8 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) else { // copy token, set arg and prepend to currbest - struct cmd_token_t *token = start->data; - struct cmd_token_t *copy = copy_cmd_token (token); + struct cmd_token *token = start->data; + struct cmd_token *copy = copy_cmd_token (token); copy->arg = XSTRDUP (MTYPE_CMD_TOKENS, input_token); list_add_node_prev (currbest, currbest->head, copy); matcher_rv = MATCHER_OK; @@ -301,7 +300,7 @@ command_complete (struct graph *graph, for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { - struct cmd_token_t *token = gn->data; + struct cmd_token *token = gn->data; switch (match_token (token, input_token)) { case partly_match: @@ -359,7 +358,7 @@ add_nexthops (struct list *list, struct graph_node *node) for (unsigned int i = 0; i < vector_active (node->to); i++) { child = vector_slot (node->to, i); - struct cmd_token_t *token = child->data; + struct cmd_token *token = child->data; switch (token->type) { case OPTION_TKN: @@ -384,7 +383,7 @@ add_nexthops (struct list *list, struct graph_node *node) * @return minimum match level needed to for a token to fully match */ static enum match_type -min_match_level (enum cmd_token_type_t type) +min_match_level (enum cmd_token_type type) { switch (type) { @@ -406,7 +405,7 @@ min_match_level (enum cmd_token_type_t type) * @return precedence score */ static int -score_precedence (enum cmd_token_type_t type) +score_precedence (enum cmd_token_type type) { switch (type) { @@ -437,9 +436,9 @@ score_precedence (enum cmd_token_type_t type) * @param[in] token the token being matched * @return the best-matching node, or NULL if the two are entirely ambiguous */ -static struct cmd_token_t * -disambiguate_tokens (struct cmd_token_t *first, - struct cmd_token_t *second, +static struct cmd_token * +disambiguate_tokens (struct cmd_token *first, + struct cmd_token *second, char *input_token) { // if the types are different, simply go off of type precedence @@ -465,8 +464,8 @@ disambiguate_tokens (struct cmd_token_t *first, /** * Picks the better of two possible matches for an input line. * - * @param[in] first candidate list of cmd_token_t matching vline - * @param[in] second candidate list of cmd_token_t matching vline + * @param[in] first candidate list of cmd_token matching vline + * @param[in] second candidate list of cmd_token matching vline * @param[in] vline the input line being matched * @param[in] n index into vline to start comparing at * @return the best-matching list, or NULL if the two are entirely ambiguous @@ -483,7 +482,7 @@ disambiguate (struct list *first, struct listnode *fnode = listhead (first), *snode = listhead (second); - struct cmd_token_t *ftok = listgetdata (fnode), + struct cmd_token *ftok = listgetdata (fnode), *stok = listgetdata (snode), *best = NULL; @@ -527,7 +526,7 @@ del_arglist (struct list *list) /*---------- token level matching functions ----------*/ static enum match_type -match_token (struct cmd_token_t *token, char *input_token) +match_token (struct cmd_token *token, char *input_token) { switch (token->type) { case WORD_TKN: @@ -761,7 +760,7 @@ match_ipv6_prefix (const char *str) #endif static enum match_type -match_range (struct cmd_token_t *token, const char *str) +match_range (struct cmd_token *token, const char *str) { assert (token->type == RANGE_TKN); @@ -782,7 +781,7 @@ match_range (struct cmd_token_t *token, const char *str) } static enum match_type -match_word (struct cmd_token_t *token, const char *word) +match_word (struct cmd_token *token, const char *word) { assert (token->type == WORD_TKN); @@ -804,7 +803,7 @@ match_word (struct cmd_token_t *token, const char *word) } static enum match_type -match_number (struct cmd_token_t *token, const char *word) +match_number (struct cmd_token *token, const char *word) { assert (token->type == NUMBER_TKN); @@ -819,7 +818,7 @@ match_number (struct cmd_token_t *token, const char *word) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" static enum match_type -match_variable (struct cmd_token_t *token, const char *word) +match_variable (struct cmd_token *token, const char *word) { assert (token->type == VARIABLE_TKN); diff --git a/lib/command_parse.y b/lib/command_parse.y index 1922ba2297..089b506b03 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -36,7 +36,6 @@ #include "command.h" #include "graph.h" #include "memory.h" - #include "grammar_sandbox.h" extern int yylex (void); @@ -115,11 +114,11 @@ add_edge_dedup (struct graph_node *, struct graph_node *); static int - cmp_token (struct cmd_token_t *, struct cmd_token_t *); + cmp_token (struct cmd_token *, struct cmd_token *); static struct graph_node * new_token_node (struct graph *, - enum cmd_token_type_t type, + enum cmd_token_type type, char *text, char *doc); static void @@ -250,7 +249,7 @@ placeholder_token: | RANGE { $$ = new_token_node (graph, RANGE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); - struct cmd_token_t *token = $$->data; + struct cmd_token *token = $$->data; // get the numbers out yylval.string++; @@ -263,7 +262,6 @@ placeholder_token: free ($1); } -; /* productions */ selector: '<' selector_seq_seq '>' @@ -453,9 +451,9 @@ doc_next() } static struct graph_node * -new_token_node (struct graph *graph, enum cmd_token_type_t type, char *text, char *doc) +new_token_node (struct graph *graph, enum cmd_token_type type, char *text, char *doc) { - struct cmd_token_t *token = new_cmd_token (type, text, doc); + struct cmd_token *token = new_cmd_token (type, text, doc); return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); } @@ -469,7 +467,7 @@ node_adjacent (struct graph_node *first, struct graph_node *second) for (unsigned int i = 0; i < vector_active (first->to); i++) { adj = vector_slot (first->to, i); - struct cmd_token_t *ftok = adj->data, + struct cmd_token *ftok = adj->data, *stok = second->data; if (cmp_token (ftok, stok)) return adj; @@ -503,7 +501,7 @@ add_edge_dedup (struct graph_node *from, struct graph_node *to) * for parsing purposes and determines overall graph structure. */ static int -cmp_token (struct cmd_token_t *first, struct cmd_token_t *second) +cmp_token (struct cmd_token *first, struct cmd_token *second) { // compare types if (first->type != second->type) return 0; diff --git a/lib/vty.c b/lib/vty.c index 831ae8e556..61b0c3b4be 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with GNU Zebra; see the file COPYING. If not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 02111-1307, USA. */ #include @@ -41,7 +41,7 @@ #include /* Vty events */ -enum event +enum event { VTY_SERV, VTY_READ, @@ -117,37 +117,37 @@ vty_out (struct vty *vty, const char *format, ...) /* Initial buffer is not enough. */ if (len < 0 || len >= size) - { - while (1) - { - if (len > -1) - size = len + 1; - else - size = size * 2; + { + while (1) + { + if (len > -1) + size = len + 1; + else + size = size * 2; - p = XREALLOC (MTYPE_VTY_OUT_BUF, p, size); - if (! p) - return -1; + p = XREALLOC (MTYPE_VTY_OUT_BUF, p, size); + if (! p) + return -1; - va_start (args, format); - len = vsnprintf (p, size, format, args); - va_end (args); + va_start (args, format); + len = vsnprintf (p, size, format, args); + va_end (args); - if (len > -1 && len < size) - break; - } - } + if (len > -1 && len < size) + break; + } + } /* When initial buffer is enough to store all output. */ if (! p) - p = buf; + p = buf; /* Pointer p must point out buffer. */ buffer_put (vty->obuf, (u_char *) p, len); /* If p is not different with buf, it is allocated buffer. */ if (p != buf) - XFREE (MTYPE_VTY_OUT_BUF, p); + XFREE (MTYPE_VTY_OUT_BUF, p); } return len; @@ -155,7 +155,7 @@ vty_out (struct vty *vty, const char *format, ...) static int vty_log_out (struct vty *vty, const char *level, const char *proto_str, - const char *format, struct timestamp_control *ctl, va_list va) + const char *format, struct timestamp_control *ctl, va_list va) { int ret; int len; @@ -189,13 +189,13 @@ vty_log_out (struct vty *vty, const char *level, const char *proto_str, if (write(vty->wfd, buf, len) < 0) { if (ERRNO_IO_RETRY(errno)) - /* Kernel buffer is full, probably too much debugging output, so just - drop the data and ignore. */ - return -1; + /* Kernel buffer is full, probably too much debugging output, so just + drop the data and ignore. */ + return -1; /* Fatal I/O error. */ vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ zlog_warn("%s: write failed to vty client fd %d, closing: %s", - __func__, vty->fd, safe_strerror(errno)); + __func__, vty->fd, safe_strerror(errno)); buffer_reset(vty->obuf); /* cannot call vty_close, because a parent routine may still try to access the vty struct */ @@ -211,7 +211,7 @@ void vty_time_print (struct vty *vty, int cr) { char buf[QUAGGA_TIMESTAMP_LEN]; - + if (quagga_timestamp(0, buf, sizeof(buf)) == 0) { zlog (NULL, LOG_INFO, "quagga_timestamp error"); @@ -236,20 +236,20 @@ vty_hello (struct vty *vty) f = fopen (host.motdfile, "r"); if (f) - { - while (fgets (buf, sizeof (buf), f)) - { - char *s; - /* work backwards to ignore trailling isspace() */ - for (s = buf + strlen (buf); (s > buf) && isspace ((int)*(s - 1)); - s--); - *s = '\0'; - vty_out (vty, "%s%s", buf, VTY_NEWLINE); - } - fclose (f); - } + { + while (fgets (buf, sizeof (buf), f)) + { + char *s; + /* work backwards to ignore trailling isspace() */ + for (s = buf + strlen (buf); (s > buf) && isspace ((int)*(s - 1)); + s--); + *s = '\0'; + vty_out (vty, "%s%s", buf, VTY_NEWLINE); + } + fclose (f); + } else - vty_out (vty, "MOTD file not found%s", VTY_NEWLINE); + vty_out (vty, "MOTD file not found%s", VTY_NEWLINE); } else if (host.motd) vty_out (vty, "%s", host.motd); @@ -266,10 +266,10 @@ vty_prompt (struct vty *vty) { hostname = host.name; if (!hostname) - { - uname (&names); - hostname = names.nodename; - } + { + uname (&names); + hostname = names.nodename; + } vty_out (vty, cmd_prompt (vty->node), hostname); } } @@ -322,7 +322,7 @@ vty_new () { struct vty *new = XCALLOC (MTYPE_VTY, sizeof (struct vty)); - new->obuf = buffer_new(0); /* Use default buffer size. */ + new->obuf = buffer_new(0); /* Use default buffer size. */ new->buf = XCALLOC (MTYPE_VTY, VTY_BUFSIZ); new->error_buf = XCALLOC (MTYPE_VTY, VTY_BUFSIZ); new->max = VTY_BUFSIZ; @@ -343,19 +343,19 @@ vty_auth (struct vty *vty, char *buf) { case AUTH_NODE: if (host.encrypt) - passwd = host.password_encrypt; + passwd = host.password_encrypt; else - passwd = host.password; + passwd = host.password; if (host.advanced) - next_node = host.enable ? VIEW_NODE : ENABLE_NODE; + next_node = host.enable ? VIEW_NODE : ENABLE_NODE; else - next_node = VIEW_NODE; + next_node = VIEW_NODE; break; case AUTH_ENABLE_NODE: if (host.encrypt) - passwd = host.enable_encrypt; + passwd = host.enable_encrypt; else - passwd = host.enable; + passwd = host.enable; next_node = ENABLE_NODE; break; } @@ -363,9 +363,9 @@ vty_auth (struct vty *vty, char *buf) if (passwd) { if (host.encrypt) - fail = strcmp (crypt(buf, passwd), passwd); + fail = strcmp (crypt(buf, passwd), passwd); else - fail = strcmp (buf, passwd); + fail = strcmp (buf, passwd); } else fail = 1; @@ -373,26 +373,26 @@ vty_auth (struct vty *vty, char *buf) if (! fail) { vty->fail = 0; - vty->node = next_node; /* Success ! */ + vty->node = next_node; /* Success ! */ } else { vty->fail++; if (vty->fail >= 3) - { - if (vty->node == AUTH_NODE) - { - vty_out (vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE); - vty->status = VTY_CLOSE; - } - else - { - /* AUTH_ENABLE_NODE */ - vty->fail = 0; - vty_out (vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE); - vty->node = restricted_mode ? RESTRICTED_NODE : VIEW_NODE; - } - } + { + if (vty->node == AUTH_NODE) + { + vty_out (vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE); + vty->status = VTY_CLOSE; + } + else + { + /* AUTH_ENABLE_NODE */ + vty->fail = 0; + vty_out (vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE); + vty->node = restricted_mode ? RESTRICTED_NODE : VIEW_NODE; + } + } } } @@ -419,7 +419,7 @@ vty_command (struct vty *vty, char *buf) if (cp != NULL && *cp != '\0') { unsigned i; - char vty_str[VTY_BUFSIZ]; + char vty_str[VTY_BUFSIZ]; char prompt_str[VTY_BUFSIZ]; /* format the base vty info */ @@ -461,14 +461,14 @@ vty_command (struct vty *vty, char *buf) protocolname = zlog_proto_names[zlog_default->protocol]; else protocolname = zlog_proto_names[ZLOG_NONE]; - + #ifdef CONSUMED_TIME_CHECK GETRUSAGE(&after); if ((realtime = thread_consumed_time(&after, &before, &cputime)) > - CONSUMED_TIME_CHECK) + CONSUMED_TIME_CHECK) /* Warn about CPU hog that must be fixed. */ zlog_warn("SLOW COMMAND: command took %lums (cpu time %lums): %s", - realtime/1000, cputime/1000, buf); + realtime/1000, cputime/1000, buf); } #endif /* CONSUMED_TIME_CHECK */ @@ -476,18 +476,18 @@ vty_command (struct vty *vty, char *buf) switch (ret) { case CMD_WARNING: - if (vty->type == VTY_FILE) - vty_out (vty, "Warning...%s", VTY_NEWLINE); - break; + if (vty->type == VTY_FILE) + vty_out (vty, "Warning...%s", VTY_NEWLINE); + break; case CMD_ERR_AMBIGUOUS: - vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); - break; + vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); + break; case CMD_ERR_NO_MATCH: - vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, VTY_NEWLINE); - break; + vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, VTY_NEWLINE); + break; case CMD_ERR_INCOMPLETE: - vty_out (vty, "%% Command incomplete.%s", VTY_NEWLINE); - break; + vty_out (vty, "%% Command incomplete.%s", VTY_NEWLINE); + break; } cmd_free_strvec (vline); @@ -685,7 +685,7 @@ vty_forward_word (struct vty *vty) { while (vty->cp != vty->length && vty->buf[vty->cp] != ' ') vty_forward_char (vty); - + while (vty->cp != vty->length && vty->buf[vty->cp] == ' ') vty_forward_char (vty); } @@ -782,14 +782,14 @@ vty_delete_char (struct vty *vty) } if (vty->cp == vty->length) - return; /* completion need here? */ + return; /* completion need here? */ size = vty->length - vty->cp; vty->length--; memmove (&vty->buf[vty->cp], &vty->buf[vty->cp + 1], size - 1); vty->buf[vty->length] = '\0'; - + if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE) return; @@ -819,7 +819,7 @@ vty_kill_line (struct vty *vty) int size; size = vty->length - vty->cp; - + if (size == 0) return; @@ -914,7 +914,7 @@ vty_complete_command (struct vty *vty) vector_set (vline, NULL); matched = cmd_complete_command_lib (vline, vty, &ret, 1); - + cmd_free_strvec (vline); vty_out (vty, "%s", VTY_NEWLINE); @@ -949,12 +949,12 @@ vty_complete_command (struct vty *vty) break; case CMD_COMPLETE_LIST_MATCH: for (i = 0; matched[i] != NULL; i++) - { - if (i != 0 && ((i % 6) == 0)) - vty_out (vty, "%s", VTY_NEWLINE); - vty_out (vty, "%-10s ", matched[i]); - XFREE (MTYPE_TMP, matched[i]); - } + { + if (i != 0 && ((i % 6) == 0)) + vty_out (vty, "%s", VTY_NEWLINE); + vty_out (vty, "%-10s ", matched[i]); + XFREE (MTYPE_TMP, matched[i]); + } vty_out (vty, "%s", VTY_NEWLINE); vty_prompt (vty); @@ -973,14 +973,12 @@ vty_complete_command (struct vty *vty) static void vty_describe_fold (struct vty *vty, int cmd_width, - unsigned int desc_width, struct cmd_token *token) + unsigned int desc_width, struct cmd_token *token) { char *buf; const char *cmd, *p; int pos; - cmd = token->cmd[0] == '.' ? token->cmd + 1 : token->cmd; - if (desc_width <= 0) { vty_out (vty, " %-*s %s%s", cmd_width, cmd, token->desc, VTY_NEWLINE); @@ -1028,7 +1026,7 @@ vty_describe_command (struct vty *vty) vline = vector_init (1); vector_set (vline, NULL); } - else + else if (isspace ((int) vty->buf[vty->length - 1])) vector_set (vline, NULL); @@ -1047,24 +1045,22 @@ vty_describe_command (struct vty *vty) vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE); goto out; break; - } + } /* Get width of command string. */ width = 0; for (i = 0; i < vector_active (describe); i++) if ((token = vector_slot (describe, i)) != NULL) { - unsigned int len; + unsigned int len; - if (token->cmd[0] == '\0') - continue; + if (token->text[0] == '\0') + continue; - len = strlen (token->cmd); - if (token->cmd[0] == '.') - len--; + len = strlen (token->text); - if (width < len) - width = len; + if (width < len) + width = len; } /* Get width of description string. */ @@ -1074,45 +1070,45 @@ vty_describe_command (struct vty *vty) for (i = 0; i < vector_active (describe); i++) if ((token = vector_slot (describe, i)) != NULL) { - if (token->cmd[0] == '\0') - continue; - - if (strcmp (token->cmd, command_cr) == 0) - { - token_cr = token; - continue; - } + if (token->text[0] == '\0') + continue; - if (!token->desc) - vty_out (vty, " %-s%s", - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd, - VTY_NEWLINE); - else if (desc_width >= strlen (token->desc)) - vty_out (vty, " %-*s %s%s", width, - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd, - token->desc, VTY_NEWLINE); - else - vty_describe_fold (vty, width, desc_width, token); + if (strcmp (token->text, CMD_CR_TEXT) == 0) + { + token_cr = token; + continue; + } + + if (!token->desc) + vty_out (vty, " %-s%s", + token->text, + VTY_NEWLINE); + else if (desc_width >= strlen (token->desc)) + vty_out (vty, " %-*s %s%s", width, + token->text, + token->desc, VTY_NEWLINE); + else + vty_describe_fold (vty, width, desc_width, token); #if 0 - vty_out (vty, " %-*s %s%s", width - desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd, - desc->str ? desc->str : "", VTY_NEWLINE); + vty_out (vty, " %-*s %s%s", width + desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd, + desc->str ? desc->str : "", VTY_NEWLINE); #endif /* 0 */ } if ((token = token_cr)) { if (!token->desc) - vty_out (vty, " %-s%s", - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd, - VTY_NEWLINE); + vty_out (vty, " %-s%s", + token->text, + VTY_NEWLINE); else if (desc_width >= strlen (token->desc)) - vty_out (vty, " %-*s %s%s", width, - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd, - token->desc, VTY_NEWLINE); + vty_out (vty, " %-*s %s%s", width, + token->text, + token->desc, VTY_NEWLINE); else - vty_describe_fold (vty, width, desc_width, token); + vty_describe_fold (vty, width, desc_width, token); } out: @@ -1217,41 +1213,41 @@ vty_telnet_option (struct vty *vty, unsigned char *buf, int nbytes) for (i = 0; i < nbytes; i++) { switch (buf[i]) - { - case IAC: - vty_out (vty, "IAC "); - break; - case WILL: - vty_out (vty, "WILL "); - break; - case WONT: - vty_out (vty, "WONT "); - break; - case DO: - vty_out (vty, "DO "); - break; - case DONT: - vty_out (vty, "DONT "); - break; - case SB: - vty_out (vty, "SB "); - break; - case SE: - vty_out (vty, "SE "); - break; - case TELOPT_ECHO: - vty_out (vty, "TELOPT_ECHO %s", VTY_NEWLINE); - break; - case TELOPT_SGA: - vty_out (vty, "TELOPT_SGA %s", VTY_NEWLINE); - break; - case TELOPT_NAWS: - vty_out (vty, "TELOPT_NAWS %s", VTY_NEWLINE); - break; - default: - vty_out (vty, "%x ", buf[i]); - break; - } + { + case IAC: + vty_out (vty, "IAC "); + break; + case WILL: + vty_out (vty, "WILL "); + break; + case WONT: + vty_out (vty, "WONT "); + break; + case DO: + vty_out (vty, "DO "); + break; + case DONT: + vty_out (vty, "DONT "); + break; + case SB: + vty_out (vty, "SB "); + break; + case SE: + vty_out (vty, "SE "); + break; + case TELOPT_ECHO: + vty_out (vty, "TELOPT_ECHO %s", VTY_NEWLINE); + break; + case TELOPT_SGA: + vty_out (vty, "TELOPT_SGA %s", VTY_NEWLINE); + break; + case TELOPT_NAWS: + vty_out (vty, "TELOPT_NAWS %s", VTY_NEWLINE); + break; + default: + vty_out (vty, "%x ", buf[i]); + break; + } } vty_out (vty, "%s", VTY_NEWLINE); @@ -1264,42 +1260,42 @@ vty_telnet_option (struct vty *vty, unsigned char *buf, int nbytes) vty->iac_sb_in_progress = 1; return 0; break; - case SE: + case SE: { - if (!vty->iac_sb_in_progress) - return 0; + if (!vty->iac_sb_in_progress) + return 0; - if ((vty->sb_len == 0) || (vty->sb_buf[0] == '\0')) - { - vty->iac_sb_in_progress = 0; - return 0; - } - switch (vty->sb_buf[0]) - { - case TELOPT_NAWS: - if (vty->sb_len != TELNET_NAWS_SB_LEN) - zlog_warn("RFC 1073 violation detected: telnet NAWS option " - "should send %d characters, but we received %lu", - TELNET_NAWS_SB_LEN, (u_long)vty->sb_len); - else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN) - zlog_err("Bug detected: sizeof(vty->sb_buf) %lu < %d, " - "too small to handle the telnet NAWS option", - (u_long)sizeof(vty->sb_buf), TELNET_NAWS_SB_LEN); - else - { - vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]); - vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]); + if ((vty->sb_len == 0) || (vty->sb_buf[0] == '\0')) + { + vty->iac_sb_in_progress = 0; + return 0; + } + switch (vty->sb_buf[0]) + { + case TELOPT_NAWS: + if (vty->sb_len != TELNET_NAWS_SB_LEN) + zlog_warn("RFC 1073 violation detected: telnet NAWS option " + "should send %d characters, but we received %lu", + TELNET_NAWS_SB_LEN, (u_long)vty->sb_len); + else if (sizeof(vty->sb_buf) < TELNET_NAWS_SB_LEN) + zlog_err("Bug detected: sizeof(vty->sb_buf) %lu < %d, " + "too small to handle the telnet NAWS option", + (u_long)sizeof(vty->sb_buf), TELNET_NAWS_SB_LEN); + else + { + vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]); + vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]); #ifdef TELNET_OPTION_DEBUG - vty_out(vty, "TELNET NAWS window size negotiation completed: " - "width %d, height %d%s", - vty->width, vty->height, VTY_NEWLINE); + vty_out(vty, "TELNET NAWS window size negotiation completed: " + "width %d, height %d%s", + vty->width, vty->height, VTY_NEWLINE); #endif - } - break; - } - vty->iac_sb_in_progress = 0; - return 0; - break; + } + break; + } + vty->iac_sb_in_progress = 0; + return 0; + break; } default: break; @@ -1324,7 +1320,7 @@ vty_execute (struct vty *vty) default: ret = vty_command (vty, vty->buf); if (vty->type == VTY_TERM) - vty_hist_add (vty); + vty_hist_add (vty); break; } @@ -1394,187 +1390,187 @@ vty_read (struct thread *thread) if ((nbytes = read (vty->fd, buf, VTY_READ_BUFSIZ)) <= 0) { if (nbytes < 0) - { - if (ERRNO_IO_RETRY(errno)) - { - vty_event (VTY_READ, vty_sock, vty); - return 0; - } - vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ - zlog_warn("%s: read error on vty client fd %d, closing: %s", - __func__, vty->fd, safe_strerror(errno)); + { + if (ERRNO_IO_RETRY(errno)) + { + vty_event (VTY_READ, vty_sock, vty); + return 0; + } + vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ + zlog_warn("%s: read error on vty client fd %d, closing: %s", + __func__, vty->fd, safe_strerror(errno)); buffer_reset(vty->obuf); - } + } vty->status = VTY_CLOSE; } - for (i = 0; i < nbytes; i++) + for (i = 0; i < nbytes; i++) { if (buf[i] == IAC) - { - if (!vty->iac) - { - vty->iac = 1; - continue; - } - else - { - vty->iac = 0; - } - } - + { + if (!vty->iac) + { + vty->iac = 1; + continue; + } + else + { + vty->iac = 0; + } + } + if (vty->iac_sb_in_progress && !vty->iac) - { - if (vty->sb_len < sizeof(vty->sb_buf)) - vty->sb_buf[vty->sb_len] = buf[i]; - vty->sb_len++; - continue; - } + { + if (vty->sb_len < sizeof(vty->sb_buf)) + vty->sb_buf[vty->sb_len] = buf[i]; + vty->sb_len++; + continue; + } if (vty->iac) - { - /* In case of telnet command */ - int ret = 0; - ret = vty_telnet_option (vty, buf + i, nbytes - i); - vty->iac = 0; - i += ret; - continue; - } - + { + /* In case of telnet command */ + int ret = 0; + ret = vty_telnet_option (vty, buf + i, nbytes - i); + vty->iac = 0; + i += ret; + continue; + } + if (vty->status == VTY_MORE) - { - switch (buf[i]) - { - case CONTROL('C'): - case 'q': - case 'Q': - vty_buffer_reset (vty); - break; + { + switch (buf[i]) + { + case CONTROL('C'): + case 'q': + case 'Q': + vty_buffer_reset (vty); + break; #if 0 /* More line does not work for "show ip bgp". */ - case '\n': - case '\r': - vty->status = VTY_MORELINE; - break; + case '\n': + case '\r': + vty->status = VTY_MORELINE; + break; #endif - default: - break; - } - continue; - } + default: + break; + } + continue; + } /* Escape character. */ if (vty->escape == VTY_ESCAPE) - { - vty_escape_map (buf[i], vty); - continue; - } + { + vty_escape_map (buf[i], vty); + continue; + } /* Pre-escape status. */ if (vty->escape == VTY_PRE_ESCAPE) - { - switch (buf[i]) - { - case '[': - vty->escape = VTY_ESCAPE; - break; - case 'b': - vty_backward_word (vty); - vty->escape = VTY_NORMAL; - break; - case 'f': - vty_forward_word (vty); - vty->escape = VTY_NORMAL; - break; - case 'd': - vty_forward_kill_word (vty); - vty->escape = VTY_NORMAL; - break; - case CONTROL('H'): - case 0x7f: - vty_backward_kill_word (vty); - vty->escape = VTY_NORMAL; - break; - default: - vty->escape = VTY_NORMAL; - break; - } - continue; - } + { + switch (buf[i]) + { + case '[': + vty->escape = VTY_ESCAPE; + break; + case 'b': + vty_backward_word (vty); + vty->escape = VTY_NORMAL; + break; + case 'f': + vty_forward_word (vty); + vty->escape = VTY_NORMAL; + break; + case 'd': + vty_forward_kill_word (vty); + vty->escape = VTY_NORMAL; + break; + case CONTROL('H'): + case 0x7f: + vty_backward_kill_word (vty); + vty->escape = VTY_NORMAL; + break; + default: + vty->escape = VTY_NORMAL; + break; + } + continue; + } switch (buf[i]) - { - case CONTROL('A'): - vty_beginning_of_line (vty); - break; - case CONTROL('B'): - vty_backward_char (vty); - break; - case CONTROL('C'): - vty_stop_input (vty); - break; - case CONTROL('D'): - vty_delete_char (vty); - break; - case CONTROL('E'): - vty_end_of_line (vty); - break; - case CONTROL('F'): - vty_forward_char (vty); - break; - case CONTROL('H'): - case 0x7f: - vty_delete_backward_char (vty); - break; - case CONTROL('K'): - vty_kill_line (vty); - break; - case CONTROL('N'): - vty_next_line (vty); - break; - case CONTROL('P'): - vty_previous_line (vty); - break; - case CONTROL('T'): - vty_transpose_chars (vty); - break; - case CONTROL('U'): - vty_kill_line_from_beginning (vty); - break; - case CONTROL('W'): - vty_backward_kill_word (vty); - break; - case CONTROL('Z'): - vty_end_config (vty); - break; - case '\n': - case '\r': - vty_out (vty, "%s", VTY_NEWLINE); - vty_execute (vty); - break; - case '\t': - vty_complete_command (vty); - break; - case '?': - if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE) - vty_self_insert (vty, buf[i]); - else - vty_describe_command (vty); - break; - case '\033': - if (i + 1 < nbytes && buf[i + 1] == '[') - { - vty->escape = VTY_ESCAPE; - i++; - } - else - vty->escape = VTY_PRE_ESCAPE; - break; - default: - if (buf[i] > 31 && buf[i] < 127) - vty_self_insert (vty, buf[i]); - break; - } + { + case CONTROL('A'): + vty_beginning_of_line (vty); + break; + case CONTROL('B'): + vty_backward_char (vty); + break; + case CONTROL('C'): + vty_stop_input (vty); + break; + case CONTROL('D'): + vty_delete_char (vty); + break; + case CONTROL('E'): + vty_end_of_line (vty); + break; + case CONTROL('F'): + vty_forward_char (vty); + break; + case CONTROL('H'): + case 0x7f: + vty_delete_backward_char (vty); + break; + case CONTROL('K'): + vty_kill_line (vty); + break; + case CONTROL('N'): + vty_next_line (vty); + break; + case CONTROL('P'): + vty_previous_line (vty); + break; + case CONTROL('T'): + vty_transpose_chars (vty); + break; + case CONTROL('U'): + vty_kill_line_from_beginning (vty); + break; + case CONTROL('W'): + vty_backward_kill_word (vty); + break; + case CONTROL('Z'): + vty_end_config (vty); + break; + case '\n': + case '\r': + vty_out (vty, "%s", VTY_NEWLINE); + vty_execute (vty); + break; + case '\t': + vty_complete_command (vty); + break; + case '?': + if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE) + vty_self_insert (vty, buf[i]); + else + vty_describe_command (vty); + break; + case '\033': + if (i + 1 < nbytes && buf[i + 1] == '[') + { + vty->escape = VTY_ESCAPE; + i++; + } + else + vty->escape = VTY_PRE_ESCAPE; + break; + default: + if (buf[i] > 31 && buf[i] < 127) + vty_self_insert (vty, buf[i]); + break; + } } /* Check status. */ @@ -1614,36 +1610,36 @@ vty_flush (struct thread *thread) flushrc = buffer_flush_available(vty->obuf, vty_sock); else if (vty->status == VTY_MORELINE) flushrc = buffer_flush_window(vty->obuf, vty_sock, vty->width, - 1, erase, 0); + 1, erase, 0); else flushrc = buffer_flush_window(vty->obuf, vty_sock, vty->width, - vty->lines >= 0 ? vty->lines : - vty->height, - erase, 0); + vty->lines >= 0 ? vty->lines : + vty->height, + erase, 0); switch (flushrc) { case BUFFER_ERROR: vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ zlog_warn("buffer_flush failed on vty client fd %d, closing", - vty->fd); + vty->fd); buffer_reset(vty->obuf); vty_close(vty); return 0; case BUFFER_EMPTY: if (vty->status == VTY_CLOSE) - vty_close (vty); + vty_close (vty); else - { - vty->status = VTY_NORMAL; - if (vty->lines == 0) - vty_event (VTY_READ, vty_sock, vty); - } + { + vty->status = VTY_NORMAL; + if (vty->lines == 0) + vty_event (VTY_READ, vty_sock, vty); + } break; case BUFFER_PENDING: /* There is more data waiting to be written. */ vty->status = VTY_MORE; if (vty->lines == 0) - vty_event (VTY_WRITE, vty_sock, vty); + vty_event (VTY_WRITE, vty_sock, vty); break; } @@ -1698,9 +1694,9 @@ vty_create (int vty_sock, union sockunion *su) if (restricted_mode) vty->node = RESTRICTED_NODE; else if (host.advanced) - vty->node = ENABLE_NODE; + vty->node = ENABLE_NODE; else - vty->node = VIEW_NODE; + vty->node = VIEW_NODE; } if (host.lines >= 0) vty->lines = host.lines; @@ -1709,12 +1705,12 @@ vty_create (int vty_sock, union sockunion *su) { /* Vty is not available if password isn't set. */ if (host.password == NULL && host.password_encrypt == NULL) - { - vty_out (vty, "Vty password is not set.%s", VTY_NEWLINE); - vty->status = VTY_CLOSE; - vty_close (vty); - return NULL; - } + { + vty_out (vty, "Vty password is not set.%s", VTY_NEWLINE); + vty->status = VTY_CLOSE; + vty_close (vty); + return NULL; + } } /* Say hello to the world. */ @@ -1834,17 +1830,17 @@ vty_accept (struct thread *thread) if (p.family == AF_INET && vty_accesslist_name) { if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && - (access_list_apply (acl, &p) == FILTER_DENY)) - { - zlog (NULL, LOG_INFO, "Vty connection refused from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); - close (vty_sock); - - /* continue accepting connections */ - vty_event (VTY_SERV, accept_sock, NULL); - - return 0; - } + (access_list_apply (acl, &p) == FILTER_DENY)) + { + zlog (NULL, LOG_INFO, "Vty connection refused from %s", + sockunion2str (&su, buf, SU_ADDRSTRLEN)); + close (vty_sock); + + /* continue accepting connections */ + vty_event (VTY_SERV, accept_sock, NULL); + + return 0; + } } #ifdef HAVE_IPV6 @@ -1852,29 +1848,29 @@ vty_accept (struct thread *thread) if (p.family == AF_INET6 && vty_ipv6_accesslist_name) { if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && - (access_list_apply (acl, &p) == FILTER_DENY)) - { - zlog (NULL, LOG_INFO, "Vty connection refused from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); - close (vty_sock); - - /* continue accepting connections */ - vty_event (VTY_SERV, accept_sock, NULL); - - return 0; - } + (access_list_apply (acl, &p) == FILTER_DENY)) + { + zlog (NULL, LOG_INFO, "Vty connection refused from %s", + sockunion2str (&su, buf, SU_ADDRSTRLEN)); + close (vty_sock); + + /* continue accepting connections */ + vty_event (VTY_SERV, accept_sock, NULL); + + return 0; + } } #endif /* HAVE_IPV6 */ - + on = 1; - ret = setsockopt (vty_sock, IPPROTO_TCP, TCP_NODELAY, - (char *) &on, sizeof (on)); + ret = setsockopt (vty_sock, IPPROTO_TCP, TCP_NODELAY, + (char *) &on, sizeof (on)); if (ret < 0) - zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s", - safe_strerror (errno)); + zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s", + safe_strerror (errno)); zlog (NULL, LOG_INFO, "Vty connection from %s", - sockunion2str (&su, buf, SU_ADDRSTRLEN)); + sockunion2str (&su, buf, SU_ADDRSTRLEN)); vty_create (vty_sock, &su); @@ -1913,14 +1909,14 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) { if (ainfo->ai_family != AF_INET #ifdef HAVE_IPV6 - && ainfo->ai_family != AF_INET6 + && ainfo->ai_family != AF_INET6 #endif /* HAVE_IPV6 */ - ) - continue; + ) + continue; sock = socket (ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol); if (sock < 0) - continue; + continue; sockopt_v6only (ainfo->ai_family, sock); sockopt_reuseaddr (sock); @@ -1928,17 +1924,17 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) ret = bind (sock, ainfo->ai_addr, ainfo->ai_addrlen); if (ret < 0) - { - close (sock); /* Avoid sd leak. */ - continue; - } + { + close (sock); /* Avoid sd leak. */ + continue; + } ret = listen (sock, 3); - if (ret < 0) - { - close (sock); /* Avoid sd leak. */ - continue; - } + if (ret < 0) + { + close (sock); /* Avoid sd leak. */ + continue; + } vty_event (VTY_SERV, sock, NULL); } @@ -1969,7 +1965,7 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family) case AF_INET6: naddr=&su.sin6.sin6_addr; break; -#endif +#endif } if(naddr) @@ -1977,11 +1973,11 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family) { case -1: zlog_err("bad address %s",addr); - naddr=NULL; - break; + naddr=NULL; + break; case 0: zlog_err("error translating address %s: %s",addr,safe_strerror(errno)); - naddr=NULL; + naddr=NULL; } /* Make new socket. */ @@ -1998,16 +1994,16 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family) if (ret < 0) { zlog_warn("can't bind socket"); - close (accept_sock); /* Avoid sd leak. */ + close (accept_sock); /* Avoid sd leak. */ return; } /* Listen socket under queue 3. */ ret = listen (accept_sock, 3); - if (ret < 0) + if (ret < 0) { zlog (NULL, LOG_WARNING, "can't listen socket"); - close (accept_sock); /* Avoid sd leak. */ + close (accept_sock); /* Avoid sd leak. */ return; } @@ -2029,7 +2025,7 @@ vty_serv_un (const char *path) struct sockaddr_un serv; mode_t old_mask; struct zprivs_ids_t ids; - + /* First of all, unlink existing socket */ unlink (path); @@ -2058,7 +2054,7 @@ vty_serv_un (const char *path) if (ret < 0) { zlog_err("Cannot bind path %s: %s", path, safe_strerror(errno)); - close (sock); /* Avoid sd leak. */ + close (sock); /* Avoid sd leak. */ return; } @@ -2066,14 +2062,14 @@ vty_serv_un (const char *path) if (ret < 0) { zlog_err("listen(fd %d) failed: %s", sock, safe_strerror(errno)); - close (sock); /* Avoid sd leak. */ + close (sock); /* Avoid sd leak. */ return; } umask (old_mask); zprivs_get_ids(&ids); - + if (ids.gid_vty > 0) { /* set group of socket */ @@ -2097,7 +2093,7 @@ vtysh_accept (struct thread *thread) int client_len; struct sockaddr_un client; struct vty *vty; - + accept_sock = THREAD_FD (thread); vty_event (VTYSH_SERV, accept_sock, NULL); @@ -2106,7 +2102,7 @@ vtysh_accept (struct thread *thread) client_len = sizeof (struct sockaddr_un); sock = accept (accept_sock, (struct sockaddr *) &client, - (socklen_t *) &client_len); + (socklen_t *) &client_len); if (sock < 0) { @@ -2121,7 +2117,7 @@ vtysh_accept (struct thread *thread) close (sock); return -1; } - + #ifdef VTYSH_DEBUG printf ("VTY shell accept\n"); #endif /* VTYSH_DEBUG */ @@ -2176,16 +2172,16 @@ vtysh_read (struct thread *thread) if ((nbytes = read (sock, buf, VTY_READ_BUFSIZ)) <= 0) { if (nbytes < 0) - { - if (ERRNO_IO_RETRY(errno)) - { - vty_event (VTYSH_READ, sock, vty); - return 0; - } - vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ - zlog_warn("%s: read failed on vtysh client fd %d, closing: %s", - __func__, sock, safe_strerror(errno)); - } + { + if (ERRNO_IO_RETRY(errno)) + { + vty_event (VTYSH_READ, sock, vty); + return 0; + } + vty->monitor = 0; /* disable monitoring to avoid infinite recursion */ + zlog_warn("%s: read failed on vtysh client fd %d, closing: %s", + __func__, sock, safe_strerror(errno)); + } buffer_reset(vty->obuf); vty_close (vty); #ifdef VTYSH_DEBUG @@ -2203,25 +2199,25 @@ vtysh_read (struct thread *thread) vty_ensure(vty, vty->length+1); vty->buf[vty->length++] = *p; if (*p == '\0') - { - /* Pass this line to parser. */ - ret = vty_execute (vty); - /* Note that vty_execute clears the command buffer and resets - vty->length to 0. */ + { + /* Pass this line to parser. */ + ret = vty_execute (vty); + /* Note that vty_execute clears the command buffer and resets + vty->length to 0. */ - /* Return result. */ + /* Return result. */ #ifdef VTYSH_DEBUG - printf ("result: %d\n", ret); - printf ("vtysh node: %d\n", vty->node); + printf ("result: %d\n", ret); + printf ("vtysh node: %d\n", vty->node); #endif /* VTYSH_DEBUG */ - header[3] = ret; - buffer_put(vty->obuf, header, 4); + header[3] = ret; + buffer_put(vty->obuf, header, 4); - if (!vty->t_write && (vtysh_flush(vty) < 0)) - /* Try to flush results; exit if a write error occurs. */ - return 0; - } + if (!vty->t_write && (vtysh_flush(vty) < 0)) + /* Try to flush results; exit if a write error occurs. */ + return 0; + } } vty_event (VTYSH_READ, sock, vty); @@ -2350,14 +2346,14 @@ vty_read_file (FILE *confp) vty->fd = STDIN_FILENO; vty->type = VTY_FILE; vty->node = CONFIG_NODE; - + /* Execute configuration file */ ret = config_from_file (vty, confp, &line_num); /* Flush any previous errors before printing messages below */ buffer_flush_all (vty->obuf, vty->fd); - if ( !((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO)) ) + if ( !((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO)) ) { switch (ret) { @@ -2369,7 +2365,7 @@ vty_read_file (FILE *confp) break; } fprintf (stderr, "*** Error occured processing line %u, below:\n%s\n", - line_num, vty->error_buf); + line_num, vty->error_buf); } vty_close (vty); @@ -2384,7 +2380,7 @@ vty_use_backup_config (char *fullpath) int tmp, sav; int c; char buffer[512]; - + fullpath_sav = malloc (strlen (fullpath) + strlen (CONF_BACKUP_EXT) + 1); strcpy (fullpath_sav, fullpath); strcat (fullpath_sav, CONF_BACKUP_EXT); @@ -2396,7 +2392,7 @@ vty_use_backup_config (char *fullpath) fullpath_tmp = malloc (strlen (fullpath) + 8); sprintf (fullpath_tmp, "%s.XXXXXX", fullpath); - + /* Open file to configuration write. */ tmp = mkstemp (fullpath_tmp); if (tmp < 0) @@ -2414,21 +2410,21 @@ vty_use_backup_config (char *fullpath) free (fullpath_tmp); return NULL; } - + while((c = read (sav, buffer, 512)) > 0) { if (write (tmp, buffer, c) <= 0) - { - free (fullpath_sav); - free (fullpath_tmp); - close (sav); - close (tmp); - return NULL; - } + { + free (fullpath_sav); + free (fullpath_tmp); + close (sav); + close (tmp); + return NULL; + } } close (sav); close (tmp); - + if (chmod(fullpath_tmp, CONFIGFILE_MASK) != 0) { unlink (fullpath_tmp); @@ -2436,12 +2432,12 @@ vty_use_backup_config (char *fullpath) free (fullpath_tmp); return NULL; } - + if (link (fullpath_tmp, fullpath) == 0) ret = fopen (fullpath, "r"); unlink (fullpath_tmp); - + free (fullpath_sav); free (fullpath_tmp); return ret; @@ -2463,12 +2459,12 @@ vty_read_config (char *config_file, if (! IS_DIRECTORY_SEP (config_file[0])) { if (getcwd (cwd, MAXPATHLEN) == NULL) - { - fprintf (stderr, "Failure to determine Current Working Directory %d!\n", errno); - exit (1); - } - tmp = XMALLOC (MTYPE_TMP, - strlen (cwd) + strlen (config_file) + 2); + { + fprintf (stderr, "Failure to determine Current Working Directory %d!\n", errno); + exit (1); + } + tmp = XMALLOC (MTYPE_TMP, + strlen (cwd) + strlen (config_file) + 2); sprintf (tmp, "%s/%s", cwd, config_file); fullpath = tmp; } @@ -2481,14 +2477,14 @@ vty_read_config (char *config_file, { fprintf (stderr, "%s: failed to open configuration file %s: %s\n", __func__, fullpath, safe_strerror (errno)); - + confp = vty_use_backup_config (fullpath); if (confp) fprintf (stderr, "WARNING: using backup configuration file!\n"); else { - fprintf (stderr, "can't open configuration file [%s]\n", - config_file); + fprintf (stderr, "can't open configuration file [%s]\n", + config_file); exit(1); } } @@ -2520,7 +2516,7 @@ vty_read_config (char *config_file, { ret = stat (integrate_default, &conf_stat); if (ret >= 0) - goto tmp_free_and_out; + goto tmp_free_and_out; } #endif /* VTYSH */ confp = fopen (config_default_dir, "r"); @@ -2528,7 +2524,7 @@ vty_read_config (char *config_file, { fprintf (stderr, "%s: failed to open configuration file %s: %s\n", __func__, config_default_dir, safe_strerror (errno)); - + confp = vty_use_backup_config (config_default_dir); if (confp) { @@ -2538,10 +2534,10 @@ vty_read_config (char *config_file, else { fprintf (stderr, "can't open configuration file [%s]\n", - config_default_dir); - goto tmp_free_and_out; + config_default_dir); + goto tmp_free_and_out; } - } + } else fullpath = config_default_dir; } @@ -2560,23 +2556,23 @@ tmp_free_and_out: /* Small utility function which output log to the VTY. */ void vty_log (const char *level, const char *proto_str, - const char *format, struct timestamp_control *ctl, va_list va) + const char *format, struct timestamp_control *ctl, va_list va) { unsigned int i; struct vty *vty; - + if (!vtyvec) return; for (i = 0; i < vector_active (vtyvec); i++) if ((vty = vector_slot (vtyvec, i)) != NULL) if (vty->monitor) - { - va_list ac; - va_copy(ac, va); - vty_log_out (vty, level, proto_str, format, ctl, ac); - va_end(ac); - } + { + va_list ac; + va_copy(ac, va); + vty_log_out (vty, level, proto_str, format, ctl, ac); + va_end(ac); + } } /* Async-signal-safe version of vty_log for fixed strings. */ @@ -2590,7 +2586,7 @@ vty_log_fixed (char *buf, size_t len) /* vty may not have been initialised */ if (!vtyvec) return; - + iov[0].iov_base = buf; iov[0].iov_len = len; iov[1].iov_base = crlf; @@ -2600,13 +2596,13 @@ vty_log_fixed (char *buf, size_t len) { struct vty *vty; if (((vty = vector_slot (vtyvec, i)) != NULL) && vty->monitor) - /* N.B. We don't care about the return code, since process is - most likely just about to die anyway. */ - if (writev(vty->wfd, iov, 2) == -1) - { - fprintf(stderr, "Failure to writev: %d\n", errno); - exit(-1); - } + /* N.B. We don't care about the return code, since process is + most likely just about to die anyway. */ + if (writev(vty->wfd, iov, 2) == -1) + { + fprintf(stderr, "Failure to writev: %d\n", errno); + exit(-1); + } } } @@ -2663,28 +2659,28 @@ vty_event (enum event event, int sock, struct vty *vty) /* Time out treatment. */ if (vty->v_timeout) - { - if (vty->t_timeout) - thread_cancel (vty->t_timeout); - vty->t_timeout = - thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout); - } + { + if (vty->t_timeout) + thread_cancel (vty->t_timeout); + vty->t_timeout = + thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout); + } break; case VTY_WRITE: if (! vty->t_write) - vty->t_write = thread_add_write (vty_master, vty_flush, vty, sock); + vty->t_write = thread_add_write (vty_master, vty_flush, vty, sock); break; case VTY_TIMEOUT_RESET: if (vty->t_timeout) - { - thread_cancel (vty->t_timeout); - vty->t_timeout = NULL; - } + { + thread_cancel (vty->t_timeout); + vty->t_timeout = NULL; + } if (vty->v_timeout) - { - vty->t_timeout = - thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout); - } + { + vty->t_timeout = + thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout); + } break; } } @@ -2700,8 +2696,8 @@ DEFUN (config_who, for (i = 0; i < vector_active (vtyvec); i++) if ((v = vector_slot (vtyvec, i)) != NULL) vty_out (vty, "%svty[%d] connected from %s.%s", - v->config ? "*" : " ", - i, v->address, VTY_NEWLINE); + v->config ? "*" : " ", + i, v->address, VTY_NEWLINE); return CMD_SUCCESS; } @@ -2794,7 +2790,7 @@ DEFUN (no_vty_access_class, if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) { vty_out (vty, "Access-class is not currently applied to vty%s", - VTY_NEWLINE); + VTY_NEWLINE); return CMD_WARNING; } @@ -2835,7 +2831,7 @@ DEFUN (no_vty_ipv6_access_class, (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", - VTY_NEWLINE); + VTY_NEWLINE); return CMD_WARNING; } @@ -2947,13 +2943,13 @@ DEFUN (show_history, for (index = vty->hindex + 1; index != vty->hindex;) { if (index == VTY_MAXHIST) - { - index = 0; - continue; - } + { + index = 0; + continue; + } if (vty->hist[index] != NULL) - vty_out (vty, " %s%s", vty->hist[index], VTY_NEWLINE); + vty_out (vty, " %s%s", vty->hist[index], VTY_NEWLINE); index++; } @@ -2980,22 +2976,22 @@ vty_config_write (struct vty *vty) if (vty_accesslist_name) vty_out (vty, " access-class %s%s", - vty_accesslist_name, VTY_NEWLINE); + vty_accesslist_name, VTY_NEWLINE); if (vty_ipv6_accesslist_name) vty_out (vty, " ipv6 access-class %s%s", - vty_ipv6_accesslist_name, VTY_NEWLINE); + vty_ipv6_accesslist_name, VTY_NEWLINE); /* exec-timeout */ if (vty_timeout_val != VTY_TIMEOUT_DEFAULT) - vty_out (vty, " exec-timeout %ld %ld%s", - vty_timeout_val / 60, - vty_timeout_val % 60, VTY_NEWLINE); + vty_out (vty, " exec-timeout %ld %ld%s", + vty_timeout_val / 60, + vty_timeout_val % 60, VTY_NEWLINE); /* login */ if (no_password_check) vty_out (vty, " no login%s", VTY_NEWLINE); - + if (restricted_mode != restricted_mode_default) { if (restricted_mode_default) @@ -3006,7 +3002,7 @@ vty_config_write (struct vty *vty) if (do_log_commands) vty_out (vty, "log commands%s", VTY_NEWLINE); - + vty_out (vty, "!%s", VTY_NEWLINE); return CMD_SUCCESS; @@ -3030,16 +3026,16 @@ vty_reset () for (i = 0; i < vector_active (vtyvec); i++) if ((vty = vector_slot (vtyvec, i)) != NULL) { - buffer_reset (vty->obuf); - vty->status = VTY_CLOSE; - vty_close (vty); + buffer_reset (vty->obuf); + vty->status = VTY_CLOSE; + vty_close (vty); } for (i = 0; i < vector_active (Vvty_serv_thread); i++) if ((vty_serv_thread = vector_slot (Vvty_serv_thread, i)) != NULL) { - thread_cancel (vty_serv_thread); - vector_slot (Vvty_serv_thread, i) = NULL; + thread_cancel (vty_serv_thread); + vector_slot (Vvty_serv_thread, i) = NULL; close (i); } @@ -3074,15 +3070,15 @@ vty_save_cwd (void) * Hence not worrying about it too much. */ if (!chdir (SYSCONFDIR)) - { - fprintf(stderr, "Failure to chdir to %s, errno: %d\n", SYSCONFDIR, errno); - exit(-1); - } + { + fprintf(stderr, "Failure to chdir to %s, errno: %d\n", SYSCONFDIR, errno); + exit(-1); + } if (getcwd (cwd, MAXPATHLEN) == NULL) - { - fprintf(stderr, "Failure to getcwd, errno: %d\n", errno); - exit(-1); - } + { + fprintf(stderr, "Failure to getcwd, errno: %d\n", errno); + exit(-1); + } } vty_cwd = XMALLOC (MTYPE_TMP, strlen (cwd) + 1); From 9c5f6b578e9c8df1186a89cee51c02348beb480a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 21:23:53 -0400 Subject: [PATCH 070/280] lib: Get thread.c to compile Signed-off-by: Donald Sharp --- lib/thread.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index a26eb6bfd2..27caa86308 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -305,9 +305,9 @@ DEFUN (show_thread_cpu, if (argc > 0) { filter = 0; - while (argv[0][i] != '\0') + while (argv[0]->arg[i] != '\0') { - switch ( argv[0][i] ) + switch ( argv[0]->arg[i] ) { case 'r': case 'R': @@ -342,7 +342,7 @@ DEFUN (show_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0], VTY_NEWLINE); + argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -387,9 +387,9 @@ DEFUN (clear_thread_cpu, if (argc > 0) { filter = 0; - while (argv[0][i] != '\0') + while (argv[0]->arg[i] != '\0') { - switch ( argv[0][i] ) + switch ( argv[0]->arg[i] ) { case 'r': case 'R': @@ -424,7 +424,7 @@ DEFUN (clear_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0], VTY_NEWLINE); + argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } } From 2511cb40e6b0e88620f26b3506b2a454a773c93d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 21:43:46 -0400 Subject: [PATCH 071/280] lib, zebra: Fixup if.c to work in the new regime Signed-off-by: Donald Sharp --- lib/if.c | 77 +++++++++++++++++------------------------------ lib/if.h | 3 -- lib/vrf.h | 2 +- zebra/interface.c | 1 - 4 files changed, 29 insertions(+), 54 deletions(-) diff --git a/lib/if.c b/lib/if.c index bd6079c0fd..01baa5392a 100644 --- a/lib/if.c +++ b/lib/if.c @@ -750,36 +750,37 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME", + "interface IFNAME" VRF_CMD_STR_OPT, "Select an interface to configure\n" - "Interface's name\n") + "Interface's name\n" + VRF_CMD_HELP_STR) { struct interface *ifp; size_t sl; vrf_id_t vrf_id = VRF_DEFAULT; - if ((sl = strlen(argv[0])) > INTERFACE_NAMSIZ) + if ((sl = strlen(argv[0]->arg)) > INTERFACE_NAMSIZ) { vty_out (vty, "%% Interface name %s is invalid: length exceeds " "%d characters%s", - argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE); + argv[0]->arg, INTERFACE_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } /*Pending: need proper vrf name based lookup/(possible creation of VRF) Imagine forward reference of a vrf by name in this interface config */ if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[1]->arg); #ifdef SUNOS_5 - ifp = if_sunwzebra_get (argv[0], sl, vrf_id); + ifp = if_sunwzebra_get (argv[0]->arg, sl, vrf_id); #else - ifp = if_get_by_name_len_vrf (argv[0], sl, vrf_id, 1); + ifp = if_get_by_name_len_vrf (argv[0]->arg, sl, vrf_id, 1); #endif /* SUNOS_5 */ if (!ifp) { - vty_out (vty, "%% interface %s not in %s%s", argv[0], argv[1], VTY_NEWLINE); + vty_out (vty, "%% interface %s not in %s%s", argv[0]->arg, argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } vty->index = ifp; @@ -788,32 +789,26 @@ DEFUN (interface, return CMD_SUCCESS; } -ALIAS (interface, - interface_vrf_cmd, - "interface IFNAME " VRF_CMD_STR, - "Select an interface to configure\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME", + "no interface IFNAME" VRF_CMD_STR_OPT, NO_STR "Delete a pseudo interface's configuration\n" - "Interface's name\n") + "Interface's name\n" + VRF_CMD_HELP_STR) { // deleting interface struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[1]->arg); - ifp = if_lookup_by_name_vrf (argv[0], vrf_id); + ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Interface %s does not exist%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Interface %s does not exist%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -829,32 +824,23 @@ DEFUN_NOSH (no_interface, return CMD_SUCCESS; } -ALIAS (no_interface, - no_interface_vrf_cmd, - "no interface IFNAME " VRF_CMD_STR, - NO_STR - "Delete a pseudo interface's configuration\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - DEFUN (vrf, vrf_cmd, - "vrf NAME", - "Select a VRF to configure\n" - "VRF's name\n") + VRF_CMD_STR, + VRF_CMD_HELP_STR) { struct vrf *vrfp; size_t sl; - if ((sl = strlen(argv[0])) > VRF_NAMSIZ) + if ((sl = strlen(argv[0]->arg)) > VRF_NAMSIZ) { vty_out (vty, "%% VRF name %s is invalid: length exceeds " "%d characters%s", - argv[0], VRF_NAMSIZ, VTY_NEWLINE); + argv[0]->arg, VRF_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } - vrfp = vrf_get (VRF_UNKNOWN, argv[0]); + vrfp = vrf_get (VRF_UNKNOWN, argv[0]->arg); vty->index = vrfp; vty->node = VRF_NODE; @@ -864,18 +850,17 @@ DEFUN (vrf, DEFUN_NOSH (no_vrf, no_vrf_cmd, - "no vrf NAME", + "no " VRF_CMD_STR, NO_STR - "Delete a pseudo VRF's configuration\n" - "VRF's name\n") + VRF_CMD_HELP_STR) { struct vrf *vrfp; - vrfp = vrf_list_lookup_by_name (argv[0]); + vrfp = vrf_list_lookup_by_name (argv[0]->arg); if (vrfp == NULL) { - vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% VRF %s does not exist%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -895,9 +880,10 @@ DEFUN_NOSH (no_vrf, /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address", + "show address" VRF_CMD_STR_OPT, SHOW_STR - "address\n") + "address\n" + VRF_CMD_HELP_STR) { struct listnode *node; struct listnode *node2; @@ -907,7 +893,7 @@ DEFUN (show_address, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { @@ -923,13 +909,6 @@ DEFUN (show_address, return CMD_SUCCESS; } -ALIAS (show_address, - show_address_vrf_cmd, - "show address " VRF_CMD_STR, - SHOW_STR - "address\n" - VRF_CMD_HELP_STR) - DEFUN (show_address_vrf_all, show_address_vrf_all_cmd, "show address " VRF_ALL_CMD_STR, diff --git a/lib/if.h b/lib/if.h index d1875e695a..4913d8c8b0 100644 --- a/lib/if.h +++ b/lib/if.h @@ -491,12 +491,9 @@ extern struct cmd_element interface_desc_cmd; extern struct cmd_element no_interface_desc_cmd; extern struct cmd_element interface_cmd; extern struct cmd_element no_interface_cmd; -extern struct cmd_element interface_vrf_cmd; -extern struct cmd_element no_interface_vrf_cmd; extern struct cmd_element interface_pseudo_cmd; extern struct cmd_element no_interface_pseudo_cmd; extern struct cmd_element show_address_cmd; -extern struct cmd_element show_address_vrf_cmd; extern struct cmd_element show_address_vrf_all_cmd; extern struct cmd_element vrf_cmd; extern struct cmd_element no_vrf_cmd; diff --git a/lib/vrf.h b/lib/vrf.h index dcc115563d..c4260769a6 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -50,7 +50,7 @@ enum { /* * The command strings */ - +#define VRF_CMD_STR_OPT "[vrf NAME]" #define VRF_CMD_STR "vrf NAME" #define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n" diff --git a/zebra/interface.c b/zebra/interface.c index 9be97e2214..0546cb8f9b 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -2960,7 +2960,6 @@ zebra_if_init (void) install_element (CONFIG_NODE, &zebra_interface_cmd); install_element (CONFIG_NODE, &zebra_interface_vrf_cmd); install_element (CONFIG_NODE, &no_interface_cmd); - install_element (CONFIG_NODE, &no_interface_vrf_cmd); install_default (INTERFACE_NODE); install_element (INTERFACE_NODE, &interface_desc_cmd); install_element (INTERFACE_NODE, &no_interface_desc_cmd); From c1ad0838e8de8184f6122b13472a60dbca009aa7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 21:49:32 -0400 Subject: [PATCH 072/280] lib: Fix vty.c to compile with new parser --- lib/vty.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index ff559d1705..150c33b5f4 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2746,7 +2746,7 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[0], NULL); + return exec_timeout (vty, argv[0]->arg, NULL); } DEFUN (exec_timeout_sec, @@ -2756,7 +2756,7 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[0], argv[1]); + return exec_timeout (vty, argv[0]->arg, argv[1]->arg); } DEFUN (no_exec_timeout, @@ -2778,7 +2778,7 @@ DEFUN (vty_access_class, if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]->arg); return CMD_SUCCESS; } @@ -2791,7 +2791,7 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) + if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]->arg))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2817,7 +2817,7 @@ DEFUN (vty_ipv6_access_class, if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]->arg); return CMD_SUCCESS; } @@ -2832,7 +2832,7 @@ DEFUN (no_vty_ipv6_access_class, "IPv6 access list\n") { if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) + (argc && strcmp(vty_ipv6_accesslist_name, argv[0]->arg))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); From 5720e4ff9518275b23c28a3107a46d833eb387fa Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 21:52:22 -0400 Subject: [PATCH 073/280] lib: Fixup ns.c --- lib/ns.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ns.c b/lib/ns.c index 556350ed17..e05ef391f4 100644 --- a/lib/ns.c +++ b/lib/ns.c @@ -559,12 +559,12 @@ DEFUN (ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]); + char *pathname = ns_netns_pathname (vty, argv[1]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); + VTY_GET_INTEGER ("NS ID", ns_id, argv[0]->arg); ns = ns_get (ns_id); if (ns->name && strcmp (ns->name, pathname) != 0) @@ -598,12 +598,12 @@ DEFUN (no_ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]); + char *pathname = ns_netns_pathname (vty, argv[1]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); + VTY_GET_INTEGER ("NS ID", ns_id, argv[0]->arg); ns = ns_lookup (ns_id); if (!ns) From c65a0fe1c664b5438a13aa1d756c121ff2fb7a80 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 21:58:16 -0400 Subject: [PATCH 074/280] lib: Fixup plist.c --- lib/plist.c | 208 ++++++++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index eedb830c1a..94556af9ee 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1415,8 +1415,8 @@ DEFUN (ip_prefix_list, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, - argv[1], argv[2], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, + argv[1]->arg, argv[2]->arg, NULL, NULL); } DEFUN (ip_prefix_list_ge, @@ -1431,8 +1431,8 @@ DEFUN (ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, NULL); } DEFUN (ip_prefix_list_ge_le, @@ -1449,8 +1449,8 @@ DEFUN (ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (ip_prefix_list_le, @@ -1465,8 +1465,8 @@ DEFUN (ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, argv[3]->arg); } DEFUN (ip_prefix_list_le_ge, @@ -1483,8 +1483,8 @@ DEFUN (ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[4]->arg, argv[3]->arg); } DEFUN (ip_prefix_list_seq, @@ -1500,8 +1500,8 @@ DEFUN (ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, NULL); } DEFUN (ip_prefix_list_seq_ge, @@ -1518,8 +1518,8 @@ DEFUN (ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, NULL); } DEFUN (ip_prefix_list_seq_ge_le, @@ -1538,8 +1538,8 @@ DEFUN (ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (ip_prefix_list_seq_le, @@ -1556,8 +1556,8 @@ DEFUN (ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ip_prefix_list_seq_le_ge, @@ -1576,8 +1576,8 @@ DEFUN (ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[5]->arg, argv[4]->arg); } DEFUN (no_ip_prefix_list, @@ -1588,7 +1588,7 @@ DEFUN (no_ip_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -1604,8 +1604,8 @@ DEFUN (no_ip_prefix_list_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_ge, @@ -1621,8 +1621,8 @@ DEFUN (no_ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, NULL); } DEFUN (no_ip_prefix_list_ge_le, @@ -1640,8 +1640,8 @@ DEFUN (no_ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_prefix_list_le, @@ -1657,8 +1657,8 @@ DEFUN (no_ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, argv[3]->arg); } DEFUN (no_ip_prefix_list_le_ge, @@ -1676,8 +1676,8 @@ DEFUN (no_ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[4]->arg, argv[3]->arg); } DEFUN (no_ip_prefix_list_seq, @@ -1694,8 +1694,8 @@ DEFUN (no_ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_seq_ge, @@ -1713,8 +1713,8 @@ DEFUN (no_ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_ip_prefix_list_seq_ge_le, @@ -1734,8 +1734,8 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ip_prefix_list_seq_le, @@ -1753,8 +1753,8 @@ DEFUN (no_ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ip_prefix_list_seq_le_ge, @@ -1774,8 +1774,8 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[5]->arg, argv[4]->arg); } DEFUN (ip_prefix_list_sequence_number, @@ -1812,7 +1812,7 @@ DEFUN (ip_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP, 0, argv[0]); + plist = prefix_list_get (AFI_IP, 0, argv[0]->arg); if (plist->desc) { @@ -1833,7 +1833,7 @@ DEFUN (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]); + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]->arg); } ALIAS (no_ip_prefix_list_description, @@ -1864,7 +1864,7 @@ DEFUN (show_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, normal_display); } DEFUN (show_ip_prefix_list_name_seq, @@ -1877,7 +1877,7 @@ DEFUN (show_ip_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, argv[1]->arg, sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1889,7 +1889,7 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1902,7 +1902,7 @@ DEFUN (show_ip_prefix_list_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1915,7 +1915,7 @@ DEFUN (show_ip_prefix_list_prefix_first_match, "IP prefix /, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, first_match_display); } DEFUN (show_ip_prefix_list_summary, @@ -1938,7 +1938,7 @@ DEFUN (show_ip_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, summary_display); } @@ -1962,7 +1962,7 @@ DEFUN (show_ip_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, detail_display); } DEFUN (clear_ip_prefix_list, @@ -1983,7 +1983,7 @@ DEFUN (clear_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL); + return vty_clear_prefix_list (vty, AFI_IP, argv[0]->arg, NULL); } DEFUN (clear_ip_prefix_list_name_prefix, @@ -1995,7 +1995,7 @@ DEFUN (clear_ip_prefix_list_name_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0], argv[1]); + return vty_clear_prefix_list (vty, AFI_IP, argv[0]->arg, argv[1]->arg); } #ifdef HAVE_IPV6 @@ -2010,8 +2010,8 @@ DEFUN (ipv6_prefix_list, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, - argv[1], argv[2], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, + argv[1]->arg, argv[2]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_ge, @@ -2026,8 +2026,8 @@ DEFUN (ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, NULL); } DEFUN (ipv6_prefix_list_ge_le, @@ -2045,8 +2045,8 @@ DEFUN (ipv6_prefix_list_ge_le, "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (ipv6_prefix_list_le, @@ -2061,8 +2061,8 @@ DEFUN (ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, argv[3]->arg); } DEFUN (ipv6_prefix_list_le_ge, @@ -2079,8 +2079,8 @@ DEFUN (ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[4]->arg, argv[3]->arg); } DEFUN (ipv6_prefix_list_seq, @@ -2096,8 +2096,8 @@ DEFUN (ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_seq_ge, @@ -2114,8 +2114,8 @@ DEFUN (ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, NULL); } DEFUN (ipv6_prefix_list_seq_ge_le, @@ -2134,8 +2134,8 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (ipv6_prefix_list_seq_le, @@ -2152,8 +2152,8 @@ DEFUN (ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ipv6_prefix_list_seq_le_ge, @@ -2172,8 +2172,8 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[5]->arg, argv[4]->arg); } DEFUN (no_ipv6_prefix_list, @@ -2184,7 +2184,7 @@ DEFUN (no_ipv6_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -2200,8 +2200,8 @@ DEFUN (no_ipv6_prefix_list_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_ge, @@ -2217,8 +2217,8 @@ DEFUN (no_ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, NULL); } DEFUN (no_ipv6_prefix_list_ge_le, @@ -2236,8 +2236,8 @@ DEFUN (no_ipv6_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_ipv6_prefix_list_le, @@ -2253,8 +2253,8 @@ DEFUN (no_ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, NULL, argv[3]->arg); } DEFUN (no_ipv6_prefix_list_le_ge, @@ -2272,8 +2272,8 @@ DEFUN (no_ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, + argv[2]->arg, argv[4]->arg, argv[3]->arg); } DEFUN (no_ipv6_prefix_list_seq, @@ -2290,8 +2290,8 @@ DEFUN (no_ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge, @@ -2309,8 +2309,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge_le, @@ -2330,8 +2330,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ipv6_prefix_list_seq_le, @@ -2349,8 +2349,8 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ipv6_prefix_list_seq_le_ge, @@ -2370,8 +2370,8 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[5]->arg, argv[4]->arg); } DEFUN (ipv6_prefix_list_sequence_number, @@ -2408,7 +2408,7 @@ DEFUN (ipv6_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP6, 0, argv[0]); + plist = prefix_list_get (AFI_IP6, 0, argv[0]->arg); if (plist->desc) { @@ -2429,7 +2429,7 @@ DEFUN (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]); + return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]->arg); } ALIAS (no_ipv6_prefix_list_description, @@ -2460,7 +2460,7 @@ DEFUN (show_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, normal_display); } DEFUN (show_ipv6_prefix_list_name_seq, @@ -2473,7 +2473,7 @@ DEFUN (show_ipv6_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2485,7 +2485,7 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2498,7 +2498,7 @@ DEFUN (show_ipv6_prefix_list_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2511,7 +2511,7 @@ DEFUN (show_ipv6_prefix_list_prefix_first_match, "IPv6 prefix /, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, first_match_display); } DEFUN (show_ipv6_prefix_list_summary, @@ -2534,7 +2534,7 @@ DEFUN (show_ipv6_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, summary_display); } DEFUN (show_ipv6_prefix_list_detail, @@ -2557,7 +2557,7 @@ DEFUN (show_ipv6_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, @@ -2578,7 +2578,7 @@ DEFUN (clear_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL); + return vty_clear_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL); } DEFUN (clear_ipv6_prefix_list_name_prefix, @@ -2590,7 +2590,7 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0], argv[1]); + return vty_clear_prefix_list (vty, AFI_IP6, argv[0]->arg, argv[1]->arg); } #endif /* HAVE_IPV6 */ From 9547b5d072195e77798edba0c0284a856a90c6fb Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 21 Sep 2016 23:55:29 +0000 Subject: [PATCH 075/280] lib: Update copyright headers Signed-off-by: Quentin Young --- lib/command.c | 46 ++++++++++++++++++++++++--------------------- lib/command_parse.y | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/command.c b/lib/command.c index b6f97c317e..9cdf0a5ff0 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1,25 +1,29 @@ /* - Command interpreter routine for virtual terminal [aka TeletYpe] - Copyright (C) 1997, 98, 99 Kunihiro Ishiguro - Copyright (C) 2013 by Open Source Routing. - Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") - -This file is part of GNU Zebra. - -GNU Zebra is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published -by the Free Software Foundation; either version 2, or (at your -option) any later version. - -GNU Zebra is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * CLI backend interface. + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * Copyright (C) 2013 by Open Source Routing. + * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ #include diff --git a/lib/command_parse.y b/lib/command_parse.y index 6a5d75aabf..d8ba98db86 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -2,7 +2,7 @@ * Command format string parser for CLI backend. * * -- - * Copyright (C) 2015 Cumulus Networks, Inc. + * Copyright (C) 2016 Cumulus Networks, Inc. * * This file is part of GNU Zebra. * From 287a4acf837fbb0a09e5e784134714e6fe2a84a8 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 21 Sep 2016 23:55:39 +0000 Subject: [PATCH 076/280] lib: Use listnode_add_before for prepending nodes Signed-off-by: Quentin Young --- lib/command_match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_match.c b/lib/command_match.c index dd68ca477e..65a5baa9ec 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -260,7 +260,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) struct cmd_token *token = start->data; struct cmd_token *copy = copy_cmd_token (token); copy->arg = XSTRDUP (MTYPE_CMD_TOKENS, input_token); - list_add_node_prev (currbest, currbest->head, copy); + listnode_add_before (currbest, currbest->head, copy); matcher_rv = MATCHER_OK; } } From ffc9de904b19ce03e41c6ebb533804c85001d1ce Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 00:27:22 +0000 Subject: [PATCH 077/280] lib: Remove NUMBER_TKN leftovers Signed-off-by: Quentin Young --- lib/command.h | 2 -- lib/command_parse.y | 4 ---- 2 files changed, 6 deletions(-) diff --git a/lib/command.h b/lib/command.h index ddb61c686f..eef4b558af 100644 --- a/lib/command.h +++ b/lib/command.h @@ -151,7 +151,6 @@ struct cmd_node enum cmd_token_type { WORD_TKN, // words - NUMBER_TKN, // integral numbers VARIABLE_TKN, // almost anything RANGE_TKN, // integer range IPV4_TKN, // IPV4 addresses @@ -177,7 +176,6 @@ struct cmd_token char *text; // token text char *desc; // token description - long long value; // for numeric types long long min, max; // for ranges char *arg; // user input that matches this token diff --git a/lib/command_parse.y b/lib/command_parse.y index d8ba98db86..63a6f83c35 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -521,10 +521,6 @@ cmp_token (struct cmd_token *first, struct cmd_token *second) if (first->min != second->min || first->max != second->max) return 0; break; - case NUMBER_TKN: - if (first->value != second->value) return 0; - break; - /* selectors and options should be equal if their subgraphs are equal, * but the graph isomorphism problem is not known to be solvable in * polynomial time so we consider selectors and options inequal in all From f68cec764abf50b35945b907a2e005bc50c50831 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 22:26:30 -0400 Subject: [PATCH 078/280] lib: Fixup more files --- lib/command.c | 4 +- lib/distribute.c | 48 ++++++++--------- lib/filter.c | 132 +++++++++++++++++++++++------------------------ lib/if_rmap.c | 12 ++--- lib/keychain.c | 76 +++++++++++++-------------- lib/routemap.c | 32 ++++++------ 6 files changed, 152 insertions(+), 152 deletions(-) diff --git a/lib/command.c b/lib/command.c index 9cdf0a5ff0..9ca8ea5407 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1325,7 +1325,7 @@ DEFUN (config_hostname, { struct cmd_token *word = argv[1]; - if (!isalpha((int) word->arg[0])) + if (!isalpha((int) word->arg)) { vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE); return CMD_WARNING; @@ -2011,7 +2011,7 @@ DEFUN (banner_motd_file, vty_out (vty, "%s does not exist", argv[3]->arg); else if (cmd == CMD_WARNING) vty_out (vty, "%s must be in %s", - argv[0], SYSCONFDIR); + argv[0]->arg, SYSCONFDIR); return cmd; } diff --git a/lib/distribute.c b/lib/distribute.c index d0d637fbb4..9ba88bf7e2 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -314,9 +314,9 @@ DEFUN (distribute_list_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -326,7 +326,7 @@ DEFUN (distribute_list_all, } /* Get interface name corresponding distribute list. */ - distribute_list_set (NULL, type, argv[0]); + distribute_list_set (NULL, type, argv[0]->arg); return CMD_SUCCESS; } @@ -352,9 +352,9 @@ DEFUN (no_distribute_list_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -363,7 +363,7 @@ DEFUN (no_distribute_list_all, return CMD_WARNING; } - ret = distribute_list_unset (NULL, type, argv[0]); + ret = distribute_list_unset (NULL, type, argv[0]->arg); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -393,9 +393,9 @@ DEFUN (distribute_list, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -404,7 +404,7 @@ DEFUN (distribute_list, } /* Get interface name corresponding distribute list. */ - distribute_list_set (argv[2], type, argv[0]); + distribute_list_set (argv[2]->arg, type, argv[0]->arg); return CMD_SUCCESS; } @@ -431,9 +431,9 @@ DEFUN (no_distribute_list, no_distribute_list_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -441,7 +441,7 @@ DEFUN (no_distribute_list, no_distribute_list_cmd, return CMD_WARNING; } - ret = distribute_list_unset (argv[2], type, argv[0]); + ret = distribute_list_unset (argv[2]->arg, type, argv[0]->arg); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -471,9 +471,9 @@ DEFUN (distribute_list_prefix_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -483,7 +483,7 @@ DEFUN (distribute_list_prefix_all, } /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (NULL, type, argv[0]); + distribute_list_prefix_set (NULL, type, argv[0]->arg); return CMD_SUCCESS; } @@ -511,9 +511,9 @@ DEFUN (no_distribute_list_prefix_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -522,7 +522,7 @@ DEFUN (no_distribute_list_prefix_all, return CMD_WARNING; } - ret = distribute_list_prefix_unset (NULL, type, argv[0]); + ret = distribute_list_prefix_unset (NULL, type, argv[0]->arg); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -553,9 +553,9 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -565,7 +565,7 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd, } /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (argv[2], type, argv[0]); + distribute_list_prefix_set (argv[2]->arg, type, argv[0]->arg); return CMD_SUCCESS; } @@ -593,9 +593,9 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -604,7 +604,7 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd, return CMD_WARNING; } - ret = distribute_list_prefix_unset (argv[2], type, argv[0]); + ret = distribute_list_prefix_unset (argv[2]->arg, type, argv[0]->arg); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); diff --git a/lib/filter.c b/lib/filter.c index e9ba715c92..9daecc08f5 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -713,7 +713,7 @@ DEFUN (access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, 0, 1); } @@ -727,7 +727,7 @@ DEFUN (access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -742,7 +742,7 @@ DEFUN (access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -756,7 +756,7 @@ DEFUN (access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); } @@ -772,7 +772,7 @@ DEFUN (no_access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, 0, 0); } @@ -787,7 +787,7 @@ DEFUN (no_access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -803,7 +803,7 @@ DEFUN (no_access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -818,7 +818,7 @@ DEFUN (no_access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); } @@ -837,8 +837,8 @@ DEFUN (access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], 1 ,1); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg, 1 ,1); } DEFUN (access_list_extended_mask_any, @@ -854,8 +854,8 @@ DEFUN (access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, "0.0.0.0", "255.255.255.255", 1, 1); } @@ -872,9 +872,9 @@ DEFUN (access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 1); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + "255.255.255.255", argv[2]->arg, + argv[3]->arg, 1, 1); } DEFUN (access_list_extended_any_any, @@ -889,7 +889,7 @@ DEFUN (access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -908,8 +908,8 @@ DEFUN (access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, "0.0.0.0", 1, 1); } @@ -927,9 +927,9 @@ DEFUN (access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 1); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + "0.0.0.0", argv[3]->arg, + argv[4]->arg, 1, 1); } DEFUN (access_list_extended_host_host, @@ -946,8 +946,8 @@ DEFUN (access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + "0.0.0.0", argv[3]->arg, "0.0.0.0", 1, 1); } @@ -964,8 +964,8 @@ DEFUN (access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + "255.255.255.255", argv[2]->arg, "0.0.0.0", 1, 1); } @@ -982,7 +982,7 @@ DEFUN (access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -1002,8 +1002,8 @@ DEFUN (no_access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], 1, 0); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg, 1, 0); } DEFUN (no_access_list_extended_mask_any, @@ -1020,8 +1020,8 @@ DEFUN (no_access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1039,9 +1039,9 @@ DEFUN (no_access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 0); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + "255.255.255.255", argv[2]->arg, + argv[3]->arg, 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1057,7 +1057,7 @@ DEFUN (no_access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1077,8 +1077,8 @@ DEFUN (no_access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, "0.0.0.0", 1, 0); } @@ -1097,9 +1097,9 @@ DEFUN (no_access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 0); + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + "0.0.0.0", argv[3]->arg, + argv[4]->arg, 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1117,8 +1117,8 @@ DEFUN (no_access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + "0.0.0.0", argv[3]->arg, "0.0.0.0", 1, 0); } @@ -1136,8 +1136,8 @@ DEFUN (no_access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + "255.255.255.255", argv[2]->arg, "0.0.0.0", 1, 0); } @@ -1155,7 +1155,7 @@ DEFUN (no_access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], + return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1251,7 +1251,7 @@ DEFUN (access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 0, 1); } DEFUN (access_list_exact, @@ -1264,7 +1264,7 @@ DEFUN (access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 1, 1); } DEFUN (access_list_any, @@ -1276,7 +1276,7 @@ DEFUN (access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, "0.0.0.0/0", 0, 1); } DEFUN (no_access_list, @@ -1289,7 +1289,7 @@ DEFUN (no_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 0, 0); } DEFUN (no_access_list_exact, @@ -1303,7 +1303,7 @@ DEFUN (no_access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 1, 0); } DEFUN (no_access_list_any, @@ -1316,7 +1316,7 @@ DEFUN (no_access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, "0.0.0.0/0", 0, 0); } DEFUN (no_access_list_all, @@ -1334,10 +1334,10 @@ DEFUN (no_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP, argv[0]); + access = access_list_lookup (AFI_IP, argv[0]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], + vty_out (vty, "%% access-list %s doesn't exist%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1369,7 +1369,7 @@ DEFUN (access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP, argv[0]); + access = access_list_get (AFI_IP, argv[0]->arg); if (access->remark) { @@ -1393,7 +1393,7 @@ DEFUN (no_access_list_remark, "IP zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP, argv[0]); + return vty_access_list_remark_unset (vty, AFI_IP, argv[0]->arg); } ALIAS (no_access_list_remark, @@ -1420,7 +1420,7 @@ DEFUN (ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1434,7 +1434,7 @@ DEFUN (ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 1, 1); } DEFUN (ipv6_access_list_any, @@ -1447,7 +1447,7 @@ DEFUN (ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 1); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, "::/0", 0, 1); } DEFUN (no_ipv6_access_list, @@ -1461,7 +1461,7 @@ DEFUN (no_ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 0, 0); } DEFUN (no_ipv6_access_list_exact, @@ -1476,7 +1476,7 @@ DEFUN (no_ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 1, 0); } DEFUN (no_ipv6_access_list_any, @@ -1490,7 +1490,7 @@ DEFUN (no_ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 0); + return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, "::/0", 0, 0); } @@ -1506,10 +1506,10 @@ DEFUN (no_ipv6_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP6, argv[0]); + access = access_list_lookup (AFI_IP6, argv[0]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], + vty_out (vty, "%% access-list %s doesn't exist%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1538,7 +1538,7 @@ DEFUN (ipv6_access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP6, argv[0]); + access = access_list_get (AFI_IP6, argv[0]->arg); if (access->remark) { @@ -1559,7 +1559,7 @@ DEFUN (no_ipv6_access_list_remark, "IPv6 zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]); + return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]->arg); } ALIAS (no_ipv6_access_list_remark, @@ -1705,7 +1705,7 @@ DEFUN (show_ip_access_list_name, "IP extended access list (expanded range)\n" "IP zebra access-list\n") { - return filter_show (vty, argv[0], AFI_IP); + return filter_show (vty, argv[0]->arg, AFI_IP); } #ifdef HAVE_IPV6 @@ -1727,7 +1727,7 @@ DEFUN (show_ipv6_access_list_name, "List IPv6 access lists\n" "IPv6 zebra access-list\n") { - return filter_show (vty, argv[0], AFI_IP6); + return filter_show (vty, argv[0]->arg, AFI_IP6); } #endif /* HAVE_IPV6 */ diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 736f2e237d..655da8c3d3 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -220,9 +220,9 @@ DEFUN (if_rmap, { enum if_rmap_type type; - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -230,7 +230,7 @@ DEFUN (if_rmap, return CMD_WARNING; } - if_rmap_set (argv[2], type, argv[0]); + if_rmap_set (argv[2]->arg, type, argv[0]->arg); return CMD_SUCCESS; } @@ -257,9 +257,9 @@ DEFUN (no_if_rmap, int ret; enum if_rmap_type type; - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[1]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[1]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -267,7 +267,7 @@ DEFUN (no_if_rmap, return CMD_WARNING; } - ret = if_rmap_unset (argv[2], type, argv[0]); + ret = if_rmap_unset (argv[2]->arg, type, argv[0]->arg); if (! ret) { vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); diff --git a/lib/keychain.c b/lib/keychain.c index ac2083cf4b..f18e42360c 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -239,7 +239,7 @@ DEFUN (key_chain, { struct keychain *keychain; - keychain = keychain_get (argv[0]); + keychain = keychain_get (argv[0]->arg); vty->index = keychain; vty->node = KEYCHAIN_NODE; @@ -256,11 +256,11 @@ DEFUN (no_key_chain, { struct keychain *keychain; - keychain = keychain_lookup (argv[0]); + keychain = keychain_lookup (argv[0]->arg); if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Can't find keychain %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -281,7 +281,7 @@ DEFUN (key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]); + VTY_GET_INTEGER ("key identifier", index, argv[0]->arg); key = key_get (keychain, index); vty->index_sub = key; vty->node = KEYCHAIN_KEY_NODE; @@ -302,7 +302,7 @@ DEFUN (no_key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]); + VTY_GET_INTEGER ("key identifier", index, argv[0]->arg); key = key_lookup (keychain, index); if (! key) { @@ -329,7 +329,7 @@ DEFUN (key_string, if (key->string) XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[0]); + key->string = XSTRDUP(MTYPE_KEY, argv[0]->arg); return CMD_SUCCESS; } @@ -556,8 +556,8 @@ DEFUN (accept_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); } DEFUN (accept_lifetime_day_month_month_day, @@ -577,8 +577,8 @@ DEFUN (accept_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); } DEFUN (accept_lifetime_month_day_day_month, @@ -598,8 +598,8 @@ DEFUN (accept_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], - argv[3], argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, argv[1]->arg, + argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); } DEFUN (accept_lifetime_month_day_month_day, @@ -619,8 +619,8 @@ DEFUN (accept_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], - argv[3], argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, argv[1]->arg, + argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); } DEFUN (accept_lifetime_infinite_day_month, @@ -637,8 +637,8 @@ DEFUN (accept_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[1], - argv[2], argv[3]); + return key_lifetime_infinite_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, + argv[2]->arg, argv[3]->arg); } DEFUN (accept_lifetime_infinite_month_day, @@ -655,8 +655,8 @@ DEFUN (accept_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[2], - argv[1], argv[3]); + return key_lifetime_infinite_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, + argv[1]->arg, argv[3]->arg); } DEFUN (accept_lifetime_duration_day_month, @@ -674,8 +674,8 @@ DEFUN (accept_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[1], - argv[2], argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, + argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (accept_lifetime_duration_month_day, @@ -693,8 +693,8 @@ DEFUN (accept_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[2], - argv[1], argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, + argv[1]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (send_lifetime_day_month_day_month, @@ -714,8 +714,8 @@ DEFUN (send_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); } DEFUN (send_lifetime_day_month_month_day, @@ -735,8 +735,8 @@ DEFUN (send_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); } DEFUN (send_lifetime_month_day_day_month, @@ -756,8 +756,8 @@ DEFUN (send_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, argv[3]->arg, + argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); } DEFUN (send_lifetime_month_day_month_day, @@ -777,8 +777,8 @@ DEFUN (send_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, argv[3]->arg, + argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); } DEFUN (send_lifetime_infinite_day_month, @@ -795,8 +795,8 @@ DEFUN (send_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg); } DEFUN (send_lifetime_infinite_month_day, @@ -813,8 +813,8 @@ DEFUN (send_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, + argv[3]->arg); } DEFUN (send_lifetime_duration_day_month, @@ -832,8 +832,8 @@ DEFUN (send_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg); } DEFUN (send_lifetime_duration_month_day, @@ -851,8 +851,8 @@ DEFUN (send_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, + argv[3]->arg, argv[4]->arg); } static struct cmd_node keychain_node = diff --git a/lib/routemap.c b/lib/routemap.c index 10e5ed304c..3f3e3c25a4 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1413,9 +1413,9 @@ DEFUN (route_map, char *endptr = NULL; /* Permit check. */ - if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) + if (strncmp (argv[1]->arg, "permit", strlen (argv[1]->arg)) == 0) permit = RMAP_PERMIT; - else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) + else if (strncmp (argv[1]->arg, "deny", strlen (argv[1]->arg)) == 0) permit = RMAP_DENY; else { @@ -1424,7 +1424,7 @@ DEFUN (route_map, } /* Preference check. */ - pref = strtoul (argv[2], &endptr, 10); + pref = strtoul (argv[2]->arg, &endptr, 10); if (pref == ULONG_MAX || *endptr != '\0') { vty_out (vty, "the fourth field must be positive integer%s", @@ -1438,7 +1438,7 @@ DEFUN (route_map, } /* Get route map. */ - map = route_map_get (argv[0]); + map = route_map_get (argv[0]->arg); index = route_map_index_get (map, permit, pref); vty->index = index; @@ -1455,11 +1455,11 @@ DEFUN (no_route_map_all, { struct route_map *map; - map = route_map_lookup_by_name (argv[0]); + map = route_map_lookup_by_name (argv[0]->arg); if (map == NULL) { vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1485,9 +1485,9 @@ DEFUN (no_route_map, char *endptr = NULL; /* Permit check. */ - if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) + if (strncmp (argv[1]->arg, "permit", strlen (argv[1]->arg)) == 0) permit = RMAP_PERMIT; - else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) + else if (strncmp (argv[1]->arg, "deny", strlen (argv[1]->arg)) == 0) permit = RMAP_DENY; else { @@ -1496,7 +1496,7 @@ DEFUN (no_route_map, } /* Preference. */ - pref = strtoul (argv[2], &endptr, 10); + pref = strtoul (argv[2]->arg, &endptr, 10); if (pref == ULONG_MAX || *endptr != '\0') { vty_out (vty, "the fourth field must be positive integer%s", @@ -1510,11 +1510,11 @@ DEFUN (no_route_map, } /* Existence check. */ - map = route_map_lookup_by_name (argv[0]); + map = route_map_lookup_by_name (argv[0]->arg); if (map == NULL) { vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1523,7 +1523,7 @@ DEFUN (no_route_map, if (index == NULL) { vty_out (vty, "%% Could not find route-map entry %s %s%s", - argv[0], argv[2], VTY_NEWLINE); + argv[0]->arg, argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1598,8 +1598,8 @@ DEFUN (rmap_onmatch_goto, return CMD_WARNING; } - if (argc == 1 && argv[0]) - VTY_GET_INTEGER_RANGE("route-map index", d, argv[0], 1, 65535); + if (argc == 1 && argv[0]->arg) + VTY_GET_INTEGER_RANGE("route-map index", d, argv[0]->arg, 1, 65535); else d = index->pref + 1; @@ -1671,7 +1671,7 @@ DEFUN (rmap_show_name, { const char *name = NULL; if (argc) - name = argv[0]; + name = argv[0]->arg; return vty_show_route_map (vty, name); } @@ -1699,7 +1699,7 @@ DEFUN (rmap_call, index->map->name); XFREE (MTYPE_ROUTE_MAP_NAME, index->nextrm); } - index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[0]); + index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[0]->arg); } /* Execute event hook. */ From 8a2d6083d6ca49f23668bfb4db83051ee03492d3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 23:20:02 -0400 Subject: [PATCH 079/280] lib: Fixup json code to use struct cmd_token --- lib/json.c | 5 +++-- lib/json.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/json.c b/lib/json.c index 58f0e995f2..d06bacece4 100644 --- a/lib/json.c +++ b/lib/json.c @@ -21,6 +21,7 @@ #include +#include "command.h" #include "lib/json.h" /* @@ -29,12 +30,12 @@ * what. */ int -use_json (const int argc, const char *argv[]) +use_json (const int argc, const struct cmd_token *argv[]) { if (argc == 0) return 0; - if (argv[argc-1] && strcmp(argv[argc-1], "json") == 0) + if (argv[argc-1]->arg && strcmp(argv[argc-1]->arg, "json") == 0) return 1; return 0; diff --git a/lib/json.h b/lib/json.h index 5dbad601a3..25fceb1053 100644 --- a/lib/json.h +++ b/lib/json.h @@ -28,7 +28,7 @@ #include #endif -extern int use_json(const int argc, const char *argv[]); +extern int use_json(const int argc, const struct cmd_token *argv[]); extern void json_object_string_add(struct json_object* obj, const char *key, const char *s); extern void json_object_int_add(struct json_object* obj, const char *key, From 5c94274ff77b7ba53a27ed68eb4b0bcdafba47b2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 23:29:43 -0400 Subject: [PATCH 080/280] zebra: Fixup to use the new parser --- zebra/debug.c | 22 +- zebra/interface.c | 60 ++--- zebra/irdp_interface.c | 18 +- zebra/router-id.c | 6 +- zebra/rtadv.c | 38 +-- zebra/test_main.c | 2 +- zebra/zebra_routemap.c | 134 +++++------ zebra/zebra_vty.c | 510 ++++++++++++++++++++--------------------- zebra/zserv.c | 2 +- 9 files changed, 396 insertions(+), 396 deletions(-) diff --git a/zebra/debug.c b/zebra/debug.c index cdf233879a..1849ebde61 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -131,11 +131,11 @@ DEFUN (debug_zebra_packet_direct, "Debug option set for send packet\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - if (strncmp ("detail", argv[0], strlen (argv[0])) == 0) + if (strncmp ("detail", argv[0]->arg, strlen (argv[0]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; } @@ -151,9 +151,9 @@ DEFUN (debug_zebra_packet_detail, "Debug option set detailed information\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; @@ -180,9 +180,9 @@ DEFUN (debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) + if (!argv[1]->arg || (argv[0]->arg && strncmp(argv[0]->arg, "recv", strlen(argv[0]->arg)) == 0)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) + if (!argv[0]->arg || (argv[1]->arg && strncmp(argv[1]->arg, "send", strlen(argv[1]->arg)) == 0)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } @@ -267,9 +267,9 @@ DEFUN (no_debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); return CMD_SUCCESS; } @@ -296,9 +296,9 @@ DEFUN (no_debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) + if (!argv[1]->arg || (argv[0]->arg && strncmp(argv[0]->arg, "recv", strlen(argv[0]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) + if (!argv[0]->arg || (argv[1]->arg && strncmp(argv[1]->arg, "send", strlen(argv[1]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } diff --git a/zebra/interface.c b/zebra/interface.c index 0546cb8f9b..5469f8c291 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1317,7 +1317,7 @@ DEFUN (show_interface, show_interface_cmd, interface_update_stats (); if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); /* All interface print. */ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) @@ -1370,13 +1370,13 @@ DEFUN (show_interface_name_vrf, interface_update_stats (); if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[1]->arg); /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0], vrf_id); + ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Can't find interface %s%s", argv[0], + vty_out (vty, "%% Can't find interface %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1403,7 +1403,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0], vrf_iter2id (iter)); + ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_iter2id (iter)); if (ifp) { if_dump_vty (vty, ifp); @@ -1413,7 +1413,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, if (!found) { - vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Can't find interface %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1476,7 +1476,7 @@ DEFUN (show_interface_desc, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); if_show_description (vty, vrf_id); @@ -1679,7 +1679,7 @@ DEFUN (bandwidth_if, unsigned int bandwidth; ifp = (struct interface *) vty->index; - bandwidth = strtol(argv[0], NULL, 10); + bandwidth = strtol(argv[0]->arg, NULL, 10); /* bandwidth range is <1-100000> */ if (bandwidth < 1 || bandwidth > 100000) @@ -1843,7 +1843,7 @@ DEFUN (link_params_metric, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t metric; - VTY_GET_ULONG("metric", metric, argv[0]); + VTY_GET_ULONG("metric", metric, argv[0]->arg); /* Update TE metric if needed */ link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE, metric); @@ -1876,7 +1876,7 @@ DEFUN (link_params_maxbw, float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[0]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1919,7 +1919,7 @@ DEFUN (link_params_max_rsv_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[0]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1954,14 +1954,14 @@ DEFUN (link_params_unrsv_bw, float bw; /* We don't have to consider about range check here. */ - if (sscanf (argv[0], "%d", &priority) != 1) + if (sscanf (argv[0]->arg, "%d", &priority) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); return CMD_WARNING; } - if (sscanf (argv[1], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1993,7 +1993,7 @@ DEFUN (link_params_admin_grp, struct if_link_params *iflp = if_link_params_get (ifp); unsigned long value; - if (sscanf (argv[0], "0x%lx", &value) != 1) + if (sscanf (argv[0]->arg, "0x%lx", &value) != 1) { vty_out (vty, "link_params_admin_grp: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2035,13 +2035,13 @@ DEFUN (link_params_inter_as, struct in_addr addr; u_int32_t as; - if (!inet_aton (argv[0], &addr)) + if (!inet_aton (argv[0]->arg, &addr)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_ULONG("AS number", as, argv[1]); + VTY_GET_ULONG("AS number", as, argv[1]->arg); /* Update Remote IP and Remote AS fields if needed */ if (IS_PARAM_UNSET(iflp, LP_RMT_AS) @@ -2096,7 +2096,7 @@ DEFUN (link_params_delay, u_int8_t update = 0; /* Get and Check new delay values */ - VTY_GET_ULONG("delay", delay, argv[0]); + VTY_GET_ULONG("delay", delay, argv[0]->arg); switch (argc) { case 1: @@ -2130,8 +2130,8 @@ DEFUN (link_params_delay, return CMD_WARNING; break; case 3: - VTY_GET_ULONG("minimum delay", low, argv[1]); - VTY_GET_ULONG("maximum delay", high, argv[2]); + VTY_GET_ULONG("minimum delay", low, argv[1]->arg); + VTY_GET_ULONG("maximum delay", high, argv[2]->arg); /* Check new delays value coherency */ if (delay <= low || delay >= high) { @@ -2209,7 +2209,7 @@ DEFUN (link_params_delay_var, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t value; - VTY_GET_ULONG("delay variation", value, argv[0]); + VTY_GET_ULONG("delay variation", value, argv[0]->arg); /* Update Delay Variation if needed */ link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value); @@ -2241,7 +2241,7 @@ DEFUN (link_params_pkt_loss, struct if_link_params *iflp = if_link_params_get (ifp); float fval; - if (sscanf (argv[0], "%g", &fval) != 1) + if (sscanf (argv[0]->arg, "%g", &fval) != 1) { vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2281,7 +2281,7 @@ DEFUN (link_params_res_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[0]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2327,7 +2327,7 @@ DEFUN (link_params_ava_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[0]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2373,7 +2373,7 @@ DEFUN (link_params_use_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[0]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2557,7 +2557,7 @@ DEFUN (ip_address, "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8)\n") { - return ip_address_install (vty, vty->index, argv[0], NULL, NULL); + return ip_address_install (vty, vty->index, argv[0]->arg, NULL, NULL); } DEFUN (no_ip_address, @@ -2568,7 +2568,7 @@ DEFUN (no_ip_address, "Set the IP address of an interface\n" "IP Address (e.g. 10.0.0.1/8)") { - return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL); + return ip_address_uninstall (vty, vty->index, argv[0]->arg, NULL, NULL); } @@ -2582,7 +2582,7 @@ DEFUN (ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_install (vty, vty->index, argv[0], NULL, argv[1]); + return ip_address_install (vty, vty->index, argv[0]->arg, NULL, argv[1]->arg); } DEFUN (no_ip_address_label, @@ -2595,7 +2595,7 @@ DEFUN (no_ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1]); + return ip_address_uninstall (vty, vty->index, argv[0]->arg, NULL, argv[1]->arg); } #endif /* HAVE_NETLINK */ @@ -2758,7 +2758,7 @@ DEFUN (ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_install (vty, vty->index, argv[0], NULL, NULL, 0); + return ipv6_address_install (vty, vty->index, argv[0]->arg, NULL, NULL, 0); } DEFUN (no_ipv6_address, @@ -2769,7 +2769,7 @@ DEFUN (no_ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0); + return ipv6_address_uninstall (vty, vty->index, argv[0]->arg, NULL, NULL, 0); } #endif /* HAVE_IPV6 */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 8fb4fcad10..cbc89dee79 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -480,7 +480,7 @@ DEFUN (ip_irdp_holdtime, zi=ifp->info; irdp=&zi->irdp; - irdp->Lifetime = atoi(argv[0]); + irdp->Lifetime = atoi(argv[0]->arg); return CMD_SUCCESS; } @@ -503,8 +503,8 @@ DEFUN (ip_irdp_minadvertinterval, zi=ifp->info; irdp=&zi->irdp; - if( (unsigned) atoi(argv[0]) <= irdp->MaxAdvertInterval) { - irdp->MinAdvertInterval = atoi(argv[0]); + if( (unsigned) atoi(argv[0]->arg) <= irdp->MaxAdvertInterval) { + irdp->MinAdvertInterval = atoi(argv[0]->arg); return CMD_SUCCESS; } @@ -537,8 +537,8 @@ DEFUN (ip_irdp_maxadvertinterval, irdp=&zi->irdp; - if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]) ) { - irdp->MaxAdvertInterval = atoi(argv[0]); + if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]->arg) ) { + irdp->MaxAdvertInterval = atoi(argv[0]->arg); return CMD_SUCCESS; } @@ -575,7 +575,7 @@ DEFUN (ip_irdp_preference, zi=ifp->info; irdp=&zi->irdp; - irdp->Preference = atoi(argv[0]); + irdp->Preference = atoi(argv[0]->arg); return CMD_SUCCESS; } @@ -605,10 +605,10 @@ DEFUN (ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0], &ip); + ret = inet_aton(argv[0]->arg, &ip); if(!ret) return CMD_WARNING; - pref = atoi(argv[1]); + pref = atoi(argv[1]->arg); for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv)) if(adv->ip.s_addr == ip.s_addr) @@ -649,7 +649,7 @@ DEFUN (no_ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0], &ip); + ret = inet_aton(argv[0]->arg, &ip); if (!ret) return CMD_WARNING; diff --git a/zebra/router-id.c b/zebra/router-id.c index d5d9652c59..9891b6ce01 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -223,7 +223,7 @@ DEFUN (router_id, struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; - rid.u.prefix4.s_addr = inet_addr (argv[0]); + rid.u.prefix4.s_addr = inet_addr (argv[0]->arg); if (!rid.u.prefix4.s_addr) return CMD_WARNING; @@ -231,7 +231,7 @@ DEFUN (router_id, rid.family = AF_INET; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[1]->arg); router_id_set (&rid, vrf_id); @@ -259,7 +259,7 @@ DEFUN (no_router_id, rid.family = AF_INET; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[1]->arg); router_id_set (&rid, vrf_id); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index ac297890a5..b84585405c 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -930,7 +930,7 @@ DEFUN (ipv6_nd_ra_interval_msec, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 70, 1800000); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0]->arg, 70, 1800000); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -965,7 +965,7 @@ DEFUN (ipv6_nd_ra_interval, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 1, 1800); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0]->arg, 1, 1800); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -1045,7 +1045,7 @@ DEFUN (ipv6_nd_ra_lifetime, ifp = (struct interface *) vty->index; zif = ifp->info; - VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000); + VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0]->arg, 0, 9000); /* The value to be placed in the Router Lifetime field * of Router Advertisements sent from the interface, @@ -1100,7 +1100,7 @@ DEFUN (ipv6_nd_reachable_time, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME); + VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0]->arg, 1, RTADV_MAX_REACHABLE_TIME); return CMD_SUCCESS; } @@ -1142,7 +1142,7 @@ DEFUN (ipv6_nd_homeagent_preference, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535); + VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0]->arg, 0, 65535); return CMD_SUCCESS; } @@ -1184,7 +1184,7 @@ DEFUN (ipv6_nd_homeagent_lifetime, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME); + VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0]->arg, 0, RTADV_MAX_HALIFETIME); return CMD_SUCCESS; } @@ -1390,7 +1390,7 @@ DEFUN (ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0], &rp.prefix); + ret = str2prefix_ipv6 (argv[0]->arg, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1405,19 +1405,19 @@ DEFUN (ipv6_nd_prefix, if (argc > 1) { - if ((isdigit((unsigned char)argv[1][0])) - || strncmp (argv[1], "i", 1) == 0) + if ((isdigit((unsigned char)argv[1]->arg[0])) + || strncmp (argv[1]->arg, "i", 1) == 0) { - if ( strncmp (argv[1], "i", 1) == 0) + if ( strncmp (argv[1]->arg, "i", 1) == 0) rp.AdvValidLifetime = UINT32_MAX; else - rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1], + rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1]->arg, (char **)NULL, 10); - if ( strncmp (argv[2], "i", 1) == 0) + if ( strncmp (argv[2]->arg, "i", 1) == 0) rp.AdvPreferredLifetime = UINT32_MAX; else - rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2], + rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2]->arg, (char **)NULL, 10); if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) @@ -1431,11 +1431,11 @@ DEFUN (ipv6_nd_prefix, { for (i = cursor; i < argc; i++) { - if (strncmp (argv[i], "of", 2) == 0) + if (strncmp (argv[i]->arg, "of", 2) == 0) rp.AdvOnLinkFlag = 0; - if (strncmp (argv[i], "no", 2) == 0) + if (strncmp (argv[i]->arg, "no", 2) == 0) rp.AdvAutonomousFlag = 0; - if (strncmp (argv[i], "ro", 2) == 0) + if (strncmp (argv[i]->arg, "ro", 2) == 0) rp.AdvRouterAddressFlag = 1; } } @@ -1619,7 +1619,7 @@ DEFUN (no_ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0], &rp.prefix); + ret = str2prefix_ipv6 (argv[0]->arg, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1810,7 +1810,7 @@ DEFUN (ipv6_nd_router_preference, while (0 != rtadv_pref_strs[i]) { - if (strncmp (argv[0], rtadv_pref_strs[i], 1) == 0) + if (strncmp (argv[0]->arg, rtadv_pref_strs[i], 1) == 0) { zif->rtadv.DefaultPreference = i; return CMD_SUCCESS; @@ -1861,7 +1861,7 @@ DEFUN (ipv6_nd_mtu, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535); + VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0]->arg, 1, 65535); return CMD_SUCCESS; } diff --git a/zebra/test_main.c b/zebra/test_main.c index bbaf450282..5bb4ee5402 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -136,7 +136,7 @@ DEFUN (test_interface_state, ifp->flags = IFF_BROADCAST|IFF_MULTICAST; } - switch (argv[0][0]) + switch (argv[0]->arg[0]) { case 'u': SET_FLAG (ifp->flags, IFF_UP); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index e6c5a3e917..87bbbba3ba 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -301,7 +301,7 @@ DEFUN (match_interface, "match first hop interface of route\n" "Interface name\n") { - return zebra_route_match_add (vty, vty->index, "interface", argv[0], + return zebra_route_match_add (vty, vty->index, "interface", argv[0]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -315,7 +315,7 @@ DEFUN (no_match_interface, if (argc == 0) return zebra_route_match_delete (vty, vty->index, "interface", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); + return zebra_route_match_delete (vty, vty->index, "interface", argv[0]->arg, RMAP_EVENT_MATCH_DELETED); } ALIAS (no_match_interface, @@ -333,7 +333,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return zebra_route_match_add (vty, vty->index, "tag", argv[0], + return zebra_route_match_add (vty, vty->index, "tag", argv[0]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -348,7 +348,7 @@ DEFUN (no_match_tag, return zebra_route_match_delete (vty, vty->index, "tag", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "tag", argv[0], + return zebra_route_match_delete (vty, vty->index, "tag", argv[0]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -369,7 +369,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED); + return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0]->arg, RMAP_EVENT_FILTER_ADDED); } DEFUN (no_match_ip_next_hop, @@ -384,7 +384,7 @@ DEFUN (no_match_ip_next_hop, return zebra_route_match_delete (vty, vty->index, "ip next-hop", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0], + return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -409,7 +409,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[0]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -427,7 +427,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, RMAP_EVENT_PLIST_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-list", argv[0], + "ip next-hop prefix-list", argv[0]->arg, RMAP_EVENT_PLIST_DELETED); } @@ -452,7 +452,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address", argv[0], + return zebra_route_match_add (vty, vty->index, "ip address", argv[0]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -468,7 +468,7 @@ DEFUN (no_match_ip_address, return zebra_route_match_delete (vty, vty->index, "ip address", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip address", argv[0], + return zebra_route_match_delete (vty, vty->index, "ip address", argv[0]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -493,7 +493,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[0]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_address_prefix_list, @@ -511,7 +511,7 @@ DEFUN (no_match_ip_address_prefix_list, RMAP_EVENT_PLIST_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip address prefix-list", argv[0], + "ip address prefix-list", argv[0]->arg, RMAP_EVENT_PLIST_DELETED); } @@ -535,7 +535,7 @@ DEFUN (match_ip_address_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-len", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[0]->arg, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_ip_address_prefix_len, @@ -553,7 +553,7 @@ DEFUN (no_match_ip_address_prefix_len, RMAP_EVENT_MATCH_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip address prefix-len", argv[0], + "ip address prefix-len", argv[0]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -576,7 +576,7 @@ DEFUN (match_ip_nexthop_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-len", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[0]->arg, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_ip_nexthop_prefix_len, @@ -594,7 +594,7 @@ DEFUN (no_match_ip_nexthop_prefix_len, RMAP_EVENT_MATCH_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-len", argv[0], + "ip next-hop prefix-len", argv[0]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -613,15 +613,15 @@ DEFUN (match_source_protocol, { int i; - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } return zebra_route_match_add (vty, vty->index, "source-protocol", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[0]->arg, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_source_protocol, @@ -635,16 +635,16 @@ DEFUN (no_match_source_protocol, if (argc >= 1) { - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } } return zebra_route_match_delete (vty, vty->index, - "source-protocol", argv[0] ? argv[0] : NULL, + "source-protocol", argv[0]->arg ? argv[0]->arg : NULL, RMAP_EVENT_MATCH_DELETED); } @@ -663,9 +663,9 @@ DEFUN (set_src, struct prefix p; vrf_iter_t iter; - if (inet_pton(AF_INET, argv[0], &src.ipv4) != 1) + if (inet_pton(AF_INET, argv[0]->arg, &src.ipv4) != 1) { - if (inet_pton(AF_INET6, argv[0], &src.ipv6) != 1) + if (inet_pton(AF_INET6, argv[0]->arg, &src.ipv6) != 1) { vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE); return CMD_WARNING; @@ -706,7 +706,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[0]); + return zebra_route_set_add (vty, vty->index, "src", argv[0]->arg); } DEFUN (no_set_src, @@ -719,7 +719,7 @@ DEFUN (no_set_src, if (argc == 0) return zebra_route_set_delete (vty, vty->index, "src", NULL); - return zebra_route_set_delete (vty, vty->index, "src", argv[0]); + return zebra_route_set_delete (vty, vty->index, "src", argv[0]->arg); } DEFUN (zebra_route_map_timer, @@ -730,7 +730,7 @@ DEFUN (zebra_route_map_timer, { u_int32_t rmap_delay_timer; - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0]->arg, 0, 600); zebra_route_map_set_delay_timer(rmap_delay_timer); return (CMD_SUCCESS); @@ -766,28 +766,28 @@ DEFUN (ip_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP][i]) { - if (strcmp(proto_rm[AFI_IP][i], argv[1]) == 0) + if (strcmp(proto_rm[AFI_IP][i], argv[1]->arg) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); } - proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[0]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -804,20 +804,20 @@ DEFUN (no_ip_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (!proto_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP][i]) == 0) || + if ((argc == 2 && strcmp(argv[1]->arg, proto_rm[AFI_IP][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); @@ -825,7 +825,7 @@ DEFUN (no_ip_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[0]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } return CMD_SUCCESS; @@ -879,28 +879,28 @@ DEFUN (ipv6_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP6][i]) { - if (strcmp(proto_rm[AFI_IP6][i], argv[1]) == 0) + if (strcmp(proto_rm[AFI_IP6][i], argv[1]->arg) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); } - proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[0]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -917,20 +917,20 @@ DEFUN (no_ipv6_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (!proto_rm[AFI_IP6][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP6][i]) == 0) || + if ((argc == 2 && strcmp(argv[1]->arg, proto_rm[AFI_IP6][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); @@ -938,7 +938,7 @@ DEFUN (no_ipv6_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[0]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } @@ -993,25 +993,25 @@ DEFUN (ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP][i]) { - if (strcmp(nht_rm[AFI_IP][i], argv[1]) == 0) + if (strcmp(nht_rm[AFI_IP][i], argv[1]->arg) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); } - nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; @@ -1027,20 +1027,20 @@ DEFUN (no_ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (!nht_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], nht_rm[AFI_IP][i]) == 0) || + if ((argc == 2 && strcmp(argv[1]->arg, nht_rm[AFI_IP][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); @@ -1097,19 +1097,19 @@ DEFUN (ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP6][i]) XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]); - nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; @@ -1125,20 +1125,20 @@ DEFUN (no_ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[0]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[0]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", VTY_NEWLINE); return CMD_WARNING; } - if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1], nht_rm[AFI_IP6][i])) + if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1]->arg, nht_rm[AFI_IP6][i])) { - vty_out (vty, "invalid route-map \"%s\"%s", argv[1], VTY_NEWLINE); + vty_out (vty, "invalid route-map \"%s\"%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index a7ee63d87f..8878d8ffe8 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -191,7 +191,7 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argc > 2 ? argv[2]->arg : NULL, NULL); } ALIAS (ip_mroute_dist, @@ -213,7 +213,7 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argc > 2 ? argv[2]->arg : NULL, NULL); } ALIAS (no_ip_mroute_dist, @@ -239,15 +239,15 @@ DEFUN (ip_multicast_mode, "Lookup both, use entry with longer prefix\n") { - if (!strncmp (argv[0], "u", 1)) + if (!strncmp (argv[0]->arg, "u", 1)) multicast_mode_ipv4_set (MCAST_URIB_ONLY); - else if (!strncmp (argv[0], "mrib-o", 6)) + else if (!strncmp (argv[0]->arg, "mrib-o", 6)) multicast_mode_ipv4_set (MCAST_MRIB_ONLY); - else if (!strncmp (argv[0], "mrib-t", 6)) + else if (!strncmp (argv[0]->arg, "mrib-t", 6)) multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); - else if (!strncmp (argv[0], "low", 3)) + else if (!strncmp (argv[0]->arg, "low", 3)) multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); - else if (!strncmp (argv[0], "lon", 3)) + else if (!strncmp (argv[0]->arg, "lon", 3)) multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); else { @@ -306,7 +306,7 @@ DEFUN (show_ip_rpf_addr, struct rib *rib; int ret; - ret = inet_aton (argv[0], &addr); + ret = inet_aton (argv[0]->arg, &addr); if (ret == 0) { vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); @@ -334,7 +334,7 @@ DEFUN (ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, NULL); } @@ -350,7 +350,7 @@ DEFUN (ip_route_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL); } @@ -365,7 +365,7 @@ DEFUN (ip_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL); } @@ -383,7 +383,7 @@ DEFUN (ip_route_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL); } @@ -396,7 +396,7 @@ DEFUN (ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, NULL, NULL); } @@ -412,7 +412,7 @@ DEFUN (ip_route_flags2_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL); } @@ -428,7 +428,7 @@ DEFUN (ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); } @@ -446,7 +446,7 @@ DEFUN (ip_route_mask_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); } @@ -462,7 +462,7 @@ DEFUN (ip_route_mask_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL); } @@ -481,7 +481,7 @@ DEFUN (ip_route_mask_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL); } @@ -495,7 +495,7 @@ DEFUN (ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, NULL); } @@ -511,7 +511,7 @@ DEFUN (ip_route_mask_flags2_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, NULL); } @@ -527,8 +527,8 @@ DEFUN (ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, + argv[2]->arg, NULL); } DEFUN (ip_route_tag_distance, @@ -545,8 +545,8 @@ DEFUN (ip_route_tag_distance, "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, + argv[3]->arg, NULL); } DEFUN (ip_route_flags_distance, @@ -561,8 +561,8 @@ DEFUN (ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, + argv[3]->arg, NULL); } DEFUN (ip_route_flags_tag_distance, @@ -579,8 +579,8 @@ DEFUN (ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, NULL); } DEFUN (ip_route_flags_distance2, @@ -593,8 +593,8 @@ DEFUN (ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, + argv[2]->arg, NULL); } DEFUN (ip_route_flags_tag_distance2, @@ -609,8 +609,8 @@ DEFUN (ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL); } DEFUN (ip_route_mask_distance, @@ -625,8 +625,8 @@ DEFUN (ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, + argv[3]->arg, NULL); } DEFUN (ip_route_mask_tag_distance, @@ -643,8 +643,8 @@ DEFUN (ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance, @@ -662,8 +662,8 @@ DEFUN (ip_route_mask_flags_tag_distance, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], - argv[5], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + argv[5]->arg, NULL); } @@ -680,8 +680,8 @@ DEFUN (ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, + argv[4]->arg, NULL); } DEFUN (ip_route_mask_flags_distance2, @@ -695,8 +695,8 @@ DEFUN (ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, + argv[3]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance2, @@ -712,8 +712,8 @@ DEFUN (ip_route_mask_flags_tag_distance2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, + argv[4]->arg, NULL); } DEFUN (no_ip_route, @@ -727,7 +727,7 @@ DEFUN (no_ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, NULL); } @@ -744,7 +744,7 @@ DEFUN (no_ip_route_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL); } @@ -784,7 +784,7 @@ DEFUN (no_ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, NULL, NULL, NULL, NULL); } @@ -800,7 +800,7 @@ DEFUN (no_ip_route_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[1], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, NULL, argv[1]->arg, NULL, NULL); } @@ -816,7 +816,7 @@ DEFUN (no_ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); } @@ -834,7 +834,7 @@ DEFUN (no_ip_route_mask_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); } @@ -877,7 +877,7 @@ DEFUN (no_ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -894,7 +894,7 @@ DEFUN (no_ip_route_mask_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, NULL); } @@ -910,8 +910,8 @@ DEFUN (no_ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, + argv[2]->arg, NULL); } DEFUN (no_ip_route_tag_distance, @@ -928,8 +928,8 @@ DEFUN (no_ip_route_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, + argv[3]->arg, NULL); } DEFUN (no_ip_route_flags_distance, @@ -945,8 +945,8 @@ DEFUN (no_ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, + argv[3]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance, @@ -964,8 +964,8 @@ DEFUN (no_ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, NULL); } DEFUN (no_ip_route_flags_distance2, @@ -979,8 +979,8 @@ DEFUN (no_ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, + argv[2]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance2, @@ -996,8 +996,8 @@ DEFUN (no_ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, + argv[3]->arg, NULL); } DEFUN (no_ip_route_mask_distance, @@ -1013,8 +1013,8 @@ DEFUN (no_ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, + argv[3]->arg, NULL); } DEFUN (no_ip_route_mask_tag_distance, @@ -1032,8 +1032,8 @@ DEFUN (no_ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance, @@ -1050,8 +1050,8 @@ DEFUN (no_ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, + argv[4]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance, @@ -1070,8 +1070,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], - argv[5], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + argv[5]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance2, @@ -1086,8 +1086,8 @@ DEFUN (no_ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, + argv[3]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance2, @@ -1104,8 +1104,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, + argv[4]->arg, NULL); } /* Static route configuration. */ @@ -1120,7 +1120,7 @@ DEFUN (ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg); } DEFUN (ip_route_tag_vrf, @@ -1136,7 +1136,7 @@ DEFUN (ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg); } DEFUN (ip_route_flags_vrf, @@ -1151,7 +1151,7 @@ DEFUN (ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (ip_route_flags_tag_vrf, @@ -1169,7 +1169,7 @@ DEFUN (ip_route_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ip_route_flags2_vrf, @@ -1182,7 +1182,7 @@ DEFUN (ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg); } DEFUN (ip_route_flags2_tag_vrf, @@ -1198,7 +1198,7 @@ DEFUN (ip_route_flags2_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg); } /* Mask as A.B.C.D format. */ @@ -1214,7 +1214,7 @@ DEFUN (ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); } DEFUN (ip_route_mask_tag_vrf, @@ -1232,7 +1232,7 @@ DEFUN (ip_route_mask_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ip_route_mask_flags_vrf, @@ -1248,7 +1248,7 @@ DEFUN (ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); } DEFUN (ip_route_mask_flags_tag_vrf, @@ -1267,7 +1267,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); } DEFUN (ip_route_mask_flags2_vrf, @@ -1281,7 +1281,7 @@ DEFUN (ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (ip_route_mask_flags2_tag_vrf, @@ -1297,7 +1297,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } /* Distance option value. */ @@ -1313,7 +1313,7 @@ DEFUN (ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (ip_route_tag_distance_vrf, @@ -1331,7 +1331,7 @@ DEFUN (ip_route_tag_distance_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (ip_route_flags_distance_vrf, @@ -1347,7 +1347,7 @@ DEFUN (ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (ip_route_flags_tag_distance_vrf, @@ -1365,7 +1365,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg,argv[5]->arg); } DEFUN (ip_route_flags_distance2_vrf, @@ -1379,7 +1379,7 @@ DEFUN (ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (ip_route_flags_tag_distance2_vrf, @@ -1395,7 +1395,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (ip_route_mask_distance_vrf, @@ -1411,7 +1411,7 @@ DEFUN (ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (ip_route_mask_tag_distance_vrf, @@ -1429,7 +1429,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (ip_route_mask_flags_tag_distance_vrf, @@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); } @@ -1466,7 +1466,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); } DEFUN (ip_route_mask_flags_distance2_vrf, @@ -1481,7 +1481,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (ip_route_mask_flags_tag_distance2_vrf, @@ -1498,7 +1498,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ip_route_vrf, @@ -1513,7 +1513,7 @@ DEFUN (no_ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg); } DEFUN (no_ip_route_flags_vrf, @@ -1529,7 +1529,7 @@ DEFUN (no_ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (no_ip_route_tag_vrf, @@ -1546,7 +1546,7 @@ DEFUN (no_ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg); } DEFUN (no_ip_route_flags_tag_vrf, @@ -1564,7 +1564,7 @@ DEFUN (no_ip_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ip_route_flags2_vrf, @@ -1578,7 +1578,7 @@ DEFUN (no_ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg); } DEFUN (no_ip_route_flags2_tag_vrf, @@ -1594,7 +1594,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg); } DEFUN (no_ip_route_mask_vrf, @@ -1610,7 +1610,7 @@ DEFUN (no_ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); } DEFUN (no_ip_route_mask_flags_vrf, @@ -1627,7 +1627,7 @@ DEFUN (no_ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); } DEFUN (no_ip_route_mask_tag_vrf, @@ -1645,7 +1645,7 @@ DEFUN (no_ip_route_mask_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ip_route_mask_flags_tag_vrf, @@ -1664,7 +1664,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); } DEFUN (no_ip_route_mask_flags2_vrf, @@ -1679,7 +1679,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (no_ip_route_mask_flags2_tag_vrf, @@ -1696,7 +1696,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } @@ -1713,7 +1713,7 @@ DEFUN (no_ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (no_ip_route_tag_distance_vrf, @@ -1731,7 +1731,7 @@ DEFUN (no_ip_route_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_route_flags_distance_vrf, @@ -1748,7 +1748,7 @@ DEFUN (no_ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_route_flags_tag_distance_vrf, @@ -1767,7 +1767,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg,argv[5]->arg); } DEFUN (no_ip_route_flags_distance2_vrf, @@ -1782,7 +1782,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (no_ip_route_flags_tag_distance2_vrf, @@ -1799,7 +1799,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2] , argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg , argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_route_mask_distance_vrf, @@ -1816,7 +1816,7 @@ DEFUN (no_ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_route_mask_tag_distance_vrf, @@ -1835,7 +1835,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ip_route_mask_flags_distance_vrf, @@ -1853,7 +1853,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance_vrf, @@ -1873,7 +1873,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); } DEFUN (no_ip_route_mask_flags_distance2_vrf, @@ -1889,7 +1889,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, @@ -1907,7 +1907,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } /* New RIB. Detailed information for IPv4 route. */ @@ -2433,7 +2433,7 @@ DEFUN (show_ip_route_vrf, if (argc == 1 && uj) return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj); else - return do_show_ip_route (vty, argv[0], SAFI_UNICAST, uj); + return do_show_ip_route (vty, argv[0]->arg, SAFI_UNICAST, uj); } DEFUN (show_ip_nht, @@ -2446,7 +2446,7 @@ DEFUN (show_ip_nht, vrf_id_t vrf_id = VRF_DEFAULT; if (argc) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); zebra_print_rnh_table(vrf_id, AF_INET, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -2491,7 +2491,7 @@ DEFUN (show_ipv6_nht, vrf_id_t vrf_id = VRF_DEFAULT; if (argc) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); zebra_print_rnh_table(vrf_id, AF_INET6, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -2606,11 +2606,11 @@ DEFUN (show_ip_route_tag, if (argc > 1) { - tag = atoi(argv[1]); - VRF_GET_ID (vrf_id, argv[0]); + tag = atoi(argv[1]->arg); + VRF_GET_ID (vrf_id, argv[0]->arg); } else - tag = atoi(argv[0]); + tag = atoi(argv[0]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2662,11 +2662,11 @@ DEFUN (show_ip_route_prefix_longer, if (argc > 1) { - ret = str2prefix (argv[1], &p); - VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]->arg); } else - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[0]->arg, &p); if (! ret) { @@ -2719,7 +2719,7 @@ DEFUN (show_ip_route_supernets, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2772,11 +2772,11 @@ DEFUN (show_ip_route_protocol, if (argc > 1) { - type = proto_redistnum (AFI_IP, argv[1]); - VRF_GET_ID (vrf_id, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[0]->arg); } else - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[0]->arg); if (type < 0) { @@ -2827,7 +2827,7 @@ DEFUN (show_ip_route_ospf_instance, int first = 1; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[0]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); if (! table) @@ -2864,11 +2864,11 @@ DEFUN (show_ip_route_addr, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); - ret = str2prefix_ipv4 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix_ipv4 (argv[1]->arg, &p); } else - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { @@ -2919,11 +2919,11 @@ DEFUN (show_ip_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); - ret = str2prefix_ipv4 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix_ipv4 (argv[1]->arg, &p); } else - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { @@ -3120,7 +3120,7 @@ DEFUN (show_ip_route_summary, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3154,7 +3154,7 @@ DEFUN (show_ip_route_summary_prefix, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3239,8 +3239,8 @@ DEFUN (show_ip_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]) - tag = atoi(argv[0]); + if (argv[0]->arg) + tag = atoi(argv[0]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -3293,7 +3293,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[0]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -3402,7 +3402,7 @@ DEFUN (show_ip_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[0]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -3455,7 +3455,7 @@ DEFUN (show_ip_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3496,7 +3496,7 @@ DEFUN (show_ip_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3755,7 +3755,7 @@ DEFUN (ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_tag, @@ -3769,7 +3769,7 @@ DEFUN (ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, NULL); } DEFUN (ipv6_route_flags, @@ -3783,7 +3783,7 @@ DEFUN (ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_flags_tag, @@ -3799,7 +3799,7 @@ DEFUN (ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname, @@ -3811,7 +3811,7 @@ DEFUN (ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_tag, ipv6_route_ifname_tag_cmd, @@ -3824,7 +3824,7 @@ DEFUN (ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname_flags, @@ -3838,7 +3838,7 @@ DEFUN (ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_flags_tag, @@ -3854,7 +3854,7 @@ DEFUN (ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL); } DEFUN (ipv6_route_pref, @@ -3867,7 +3867,7 @@ DEFUN (ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, NULL); } DEFUN (ipv6_route_pref_tag, @@ -3882,7 +3882,7 @@ DEFUN (ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, NULL); } DEFUN (ipv6_route_flags_pref, @@ -3897,7 +3897,7 @@ DEFUN (ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, NULL); } DEFUN (ipv6_route_flags_pref_tag, @@ -3914,7 +3914,7 @@ DEFUN (ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (ipv6_route_ifname_pref, @@ -3927,7 +3927,7 @@ DEFUN (ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL); } DEFUN (ipv6_route_ifname_pref_tag, @@ -3942,7 +3942,7 @@ DEFUN (ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref, @@ -3957,7 +3957,7 @@ DEFUN (ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref_tag, @@ -3974,7 +3974,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL); } DEFUN (no_ipv6_route, @@ -3987,7 +3987,7 @@ DEFUN (no_ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_tag, @@ -4002,7 +4002,7 @@ DEFUN (no_ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, NULL); } DEFUN (no_ipv6_route_flags, @@ -4017,7 +4017,7 @@ DEFUN (no_ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_flags_tag, @@ -4034,7 +4034,7 @@ DEFUN (no_ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname, @@ -4047,7 +4047,7 @@ DEFUN (no_ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_tag, @@ -4062,7 +4062,7 @@ DEFUN (no_ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags, @@ -4077,7 +4077,7 @@ DEFUN (no_ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags_tag, @@ -4094,7 +4094,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL); } DEFUN (no_ipv6_route_pref, @@ -4108,7 +4108,7 @@ DEFUN (no_ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, NULL); } DEFUN (no_ipv6_route_pref_tag, @@ -4124,7 +4124,7 @@ DEFUN (no_ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref, @@ -4140,8 +4140,8 @@ DEFUN (no_ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); + /* We do not care about argv[2]->arg */ + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref_tag, @@ -4159,8 +4159,8 @@ DEFUN (no_ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); + /* We do not care about argv[2]->arg */ + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref, @@ -4174,7 +4174,7 @@ DEFUN (no_ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref_tag, @@ -4190,7 +4190,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref, @@ -4206,7 +4206,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref_tag, @@ -4224,7 +4224,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL); } DEFUN (ipv6_route_vrf, @@ -4237,7 +4237,7 @@ DEFUN (ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, argv[2]->arg); } DEFUN (ipv6_route_tag_vrf, @@ -4252,7 +4252,7 @@ DEFUN (ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, argv[3]->arg); } DEFUN (ipv6_route_flags_vrf, @@ -4267,7 +4267,7 @@ DEFUN (ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (ipv6_route_flags_tag_vrf, @@ -4284,7 +4284,7 @@ DEFUN (ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ipv6_route_ifname_vrf, @@ -4297,7 +4297,7 @@ DEFUN (ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, @@ -4311,7 +4311,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (ipv6_route_ifname_flags_vrf, @@ -4326,7 +4326,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); } DEFUN (ipv6_route_ifname_flags_tag_vrf, @@ -4343,7 +4343,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); } DEFUN (ipv6_route_pref_vrf, @@ -4357,7 +4357,7 @@ DEFUN (ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (ipv6_route_pref_tag_vrf, @@ -4373,7 +4373,7 @@ DEFUN (ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (ipv6_route_flags_pref_vrf, @@ -4389,7 +4389,7 @@ DEFUN (ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (ipv6_route_flags_pref_tag_vrf, @@ -4407,7 +4407,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (ipv6_route_ifname_pref_vrf, @@ -4421,7 +4421,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (ipv6_route_ifname_pref_tag_vrf, @@ -4437,7 +4437,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (ipv6_route_ifname_flags_pref_vrf, @@ -4453,7 +4453,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); } DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, @@ -4471,7 +4471,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); } DEFUN (no_ipv6_route_vrf, @@ -4485,7 +4485,7 @@ DEFUN (no_ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, argv[2]->arg); } DEFUN (no_ipv6_route_tag_vrf, @@ -4501,7 +4501,7 @@ DEFUN (no_ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, argv[3]->arg); } DEFUN (no_ipv6_route_flags_vrf, @@ -4517,7 +4517,7 @@ DEFUN (no_ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); } DEFUN (no_ipv6_route_flags_tag_vrf, @@ -4535,7 +4535,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ipv6_route_ifname_vrf, @@ -4549,7 +4549,7 @@ DEFUN (no_ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); } DEFUN (no_ipv6_route_ifname_tag_vrf, @@ -4565,7 +4565,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); } DEFUN (no_ipv6_route_ifname_flags_vrf, @@ -4581,7 +4581,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); } DEFUN (no_ipv6_route_ifname_flags_tag_vrf, @@ -4599,7 +4599,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); } DEFUN (no_ipv6_route_pref_vrf, @@ -4614,7 +4614,7 @@ DEFUN (no_ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (no_ipv6_route_pref_tag_vrf, @@ -4631,7 +4631,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_ipv6_route_flags_pref_vrf, @@ -4648,8 +4648,8 @@ DEFUN (no_ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + /* We do not care about argv[2]->arg */ + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (no_ipv6_route_flags_pref_tag_vrf, @@ -4668,8 +4668,8 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + /* We do not care about argv[2]->arg */ + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ipv6_route_ifname_pref_vrf, @@ -4684,7 +4684,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); } DEFUN (no_ipv6_route_ifname_pref_tag_vrf, @@ -4701,7 +4701,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_vrf, @@ -4718,7 +4718,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, @@ -4737,7 +4737,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); } DEFUN (show_ipv6_route, @@ -4758,14 +4758,14 @@ DEFUN (show_ipv6_route, json_object *json_prefix = NULL; u_char uj = use_json(argc, argv); - if (argc > 0 && argv[0] && strcmp(argv[0], "json") != 0) + if (argc > 0 && argv[0]->arg && strcmp(argv[0]->arg, "json") != 0) { - if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0]))) + if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0]->arg))) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE); + vty_out (vty, "vrf %s not defined%s", argv[0]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -4774,7 +4774,7 @@ DEFUN (show_ipv6_route, if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE); + vty_out (vty, "vrf %s inactive%s", argv[0]->arg, VTY_NEWLINE); return CMD_SUCCESS; } else @@ -4860,11 +4860,11 @@ DEFUN (show_ipv6_route_tag, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); - tag = atoi(argv[1]); + VRF_GET_ID (vrf_id, argv[0]->arg); + tag = atoi(argv[1]->arg); } else - tag = atoi(argv[0]); + tag = atoi(argv[0]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -4916,11 +4916,11 @@ DEFUN (show_ipv6_route_prefix_longer, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); - ret = str2prefix (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix (argv[1]->arg, &p); } else - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[0]->arg, &p); if (! ret) { @@ -4974,11 +4974,11 @@ DEFUN (show_ipv6_route_protocol, if ( argc >1 ) { - VRF_GET_ID (vrf_id, argv[0]); - type = proto_redistnum (AFI_IP6, argv[1]); + VRF_GET_ID (vrf_id, argv[0]->arg); + type = proto_redistnum (AFI_IP6, argv[1]->arg); } else - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[0]->arg); if (type < 0) { @@ -5030,11 +5030,11 @@ DEFUN (show_ipv6_route_addr, if (argc > 1 ) { - VRF_GET_ID (vrf_id, argv[0]); - ret = str2prefix_ipv6 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix_ipv6 (argv[1]->arg, &p); } else - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[0]->arg, &p); if (ret <= 0) { @@ -5085,11 +5085,11 @@ DEFUN (show_ipv6_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); - ret = str2prefix_ipv6 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix_ipv6 (argv[1]->arg, &p); } else - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[0]->arg, &p); if (ret <= 0) { @@ -5137,7 +5137,7 @@ DEFUN (show_ipv6_route_summary, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5171,7 +5171,7 @@ DEFUN (show_ipv6_route_summary_prefix, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5211,7 +5211,7 @@ DEFUN (show_ipv6_mroute, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[0]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); if (! table) @@ -5303,8 +5303,8 @@ DEFUN (show_ipv6_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]) - tag = atoi(argv[0]); + if (argv[0]->arg) + tag = atoi(argv[0]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -5358,7 +5358,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[0]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -5413,7 +5413,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[0]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -5466,7 +5466,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[0]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); @@ -5507,7 +5507,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[0]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -5751,7 +5751,7 @@ DEFUN (ip_zebra_import_table_distance, int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[0]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5768,7 +5768,7 @@ DEFUN (ip_zebra_import_table_distance, } if (argc > 1) - VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); + VTY_GET_INTEGER_RANGE("distance", distance, argv[1]->arg, 1, 255); return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1)); } @@ -5796,7 +5796,7 @@ DEFUN (ip_zebra_import_table_distance_routemap, const char *rmap_name; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[0]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5814,11 +5814,11 @@ DEFUN (ip_zebra_import_table_distance_routemap, if (argc > 2) { - VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]); + VTY_GET_INTEGER_RANGE("distance", distance, argv[1]->arg, 1, 255); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]->arg); } else - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); } @@ -5843,7 +5843,7 @@ DEFUN (no_ip_zebra_import_table, u_int32_t table_id = 0; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[0]->arg); if (!is_zebra_valid_kernel_table(table_id)) { diff --git a/zebra/zserv.c b/zebra/zserv.c index 3402bf1dfb..c058588356 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2263,7 +2263,7 @@ DEFUN (config_table, "Configure target kernel routing table\n" "TABLE integer\n") { - zebrad.rtm_table_default = strtol (argv[0], (char**)0, 10); + zebrad.rtm_table_default = strtol (argv[0]->arg, (char**)0, 10); return CMD_SUCCESS; } From 0564b02e432cba04f1245a5df77c2cf2893b51a3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 23:35:51 -0400 Subject: [PATCH 081/280] pimd: Convert to the new way of working --- pimd/pim_cmd.c | 130 ++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 6cfed0f2c6..b5faf8ad12 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1534,7 +1534,7 @@ DEFUN (pim_interface, "Interface's name\n") { struct interface *ifp; - const char *ifname = argv[0]; + const char *ifname = argv[0]->arg; size_t sl; sl = strlen(ifname); @@ -2374,7 +2374,7 @@ DEFUN (show_ip_rib, char nexthop_addr_str[100]; int result; - addr_str = argv[0]; + addr_str = argv[0]->arg; result = inet_pton(AF_INET, addr_str, &addr); if (result <= 0) { vty_out(vty, "Bad unicast address %s: errno=%d: %s%s", @@ -2468,14 +2468,14 @@ DEFUN (ip_pim_rp, { int result; - result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr); + result = inet_pton(AF_INET, argv[0]->arg, &qpim_rp.rpf_addr.s_addr); if (result <= 0) { - vty_out(vty, "%% Bad RP address specified: %s", argv[0]); + vty_out(vty, "%% Bad RP address specified: %s", argv[0]->arg); return CMD_WARNING; } if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) { - vty_out(vty, "%% No Path to RP address specified: %s", argv[0]); + vty_out(vty, "%% No Path to RP address specified: %s", argv[0]->arg); return CMD_WARNING; } @@ -2533,7 +2533,7 @@ DEFUN (ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2562,7 +2562,7 @@ DEFUN (no_ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2658,7 +2658,7 @@ DEFUN (interface_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[0]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2667,7 +2667,7 @@ DEFUN (interface_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[1]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2705,7 +2705,7 @@ DEFUN (interface_no_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[0]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2714,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[1]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2887,7 +2887,7 @@ DEFUN (interface_ip_igmp_query_interval, return CMD_WARNING; } - query_interval = atoi(argv[0]); + query_interval = atoi(argv[0]->arg); query_interval_dsec = 10 * query_interval; /* @@ -2981,7 +2981,7 @@ DEFUN (interface_ip_igmp_query_max_response_time, return CMD_WARNING; } - query_max_response_time = atoi(argv[0]); + query_max_response_time = atoi(argv[0]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3075,7 +3075,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec, return CMD_WARNING; } - query_max_response_time_dsec = atoi(argv[0]); + query_max_response_time_dsec = atoi(argv[0]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3166,7 +3166,7 @@ DEFUN (interface_ip_pim_drprio, old_dr_prio = pim_ifp->pim_dr_priority; - pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10); + pim_ifp->pim_dr_priority = strtol(argv[0]->arg, NULL, 10); if (old_dr_prio != pim_ifp->pim_dr_priority) { if (pim_if_dr_election(ifp)) @@ -3355,7 +3355,7 @@ DEFUN (interface_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[0]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3363,7 +3363,7 @@ DEFUN (interface_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[1]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3401,7 +3401,7 @@ DEFUN (interface_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[0]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3409,7 +3409,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[1]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3417,7 +3417,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[2]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3452,7 +3452,7 @@ DEFUN (interface_no_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[0]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3460,7 +3460,7 @@ DEFUN (interface_no_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[1]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3499,7 +3499,7 @@ DEFUN (interface_no_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[0]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3507,7 +3507,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[1]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3515,7 +3515,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[2]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3550,10 +3550,10 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[0]->arg, NULL, 10); if (argc == 2) - pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10); + pim_ifp->pim_default_holdtime = strtol(argv[1]->arg, NULL, 10); return CMD_SUCCESS; } @@ -3856,12 +3856,12 @@ DEFUN (debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[0]->arg,"h",1) == 0) { PIM_DO_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[0]->arg,"j",1) == 0) { PIM_DO_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE); @@ -3894,12 +3894,12 @@ DEFUN (no_debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[0]->arg,"h",1) == 0) { PIM_DONT_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[0]->arg,"j",1) == 0) { PIM_DONT_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE); @@ -4138,7 +4138,7 @@ DEFUN (test_igmp_receive_report, struct in_addr *src_addr; int argi; - socket = argv[0]; + socket = argv[0]->arg; socket_fd = atoi(socket); igmp = find_igmp_sock_by_fd(socket_fd); if (!igmp) { @@ -4147,7 +4147,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[1]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4155,7 +4155,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - record_type_str = argv[2]; + record_type_str = argv[2]->arg; record_type = atoi(record_type_str); /* @@ -4183,7 +4183,7 @@ DEFUN (test_igmp_receive_report, sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); src_addr = sources; for (argi = 3; argi < argc; ++argi,++src_addr) { - src_str = argv[argi]; + src_str = argv[argi]->arg; result = inet_pton(AF_INET, src_str, src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4243,7 +4243,7 @@ DEFUN (test_pim_receive_dump, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4252,7 +4252,7 @@ DEFUN (test_pim_receive_dump, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[1]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4278,7 +4278,7 @@ DEFUN (test_pim_receive_dump, /* Scan LINE dump into buffer */ for (argi = 2; argi < argc; ++argi) { - const char *str = argv[argi]; + const char *str = argv[argi]->arg; int str_len = strlen(str); int str_last = str_len - 1; int i; @@ -4368,7 +4368,7 @@ DEFUN (test_pim_receive_hello, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4377,7 +4377,7 @@ DEFUN (test_pim_receive_hello, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[1]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4385,12 +4385,12 @@ DEFUN (test_pim_receive_hello, return CMD_WARNING; } - neigh_holdtime = atoi(argv[2]); - neigh_dr_priority = atoi(argv[3]); - neigh_generation_id = atoi(argv[4]); - neigh_propagation_delay = atoi(argv[5]); - neigh_override_interval = atoi(argv[6]); - neigh_can_disable_join_suppression = atoi(argv[7]); + neigh_holdtime = atoi(argv[2]->arg); + neigh_dr_priority = atoi(argv[3]->arg); + neigh_generation_id = atoi(argv[4]->arg); + neigh_propagation_delay = atoi(argv[5]->arg); + neigh_override_interval = atoi(argv[6]->arg); + neigh_can_disable_join_suppression = atoi(argv[7]->arg); /* Tweak IP header @@ -4409,7 +4409,7 @@ DEFUN (test_pim_receive_hello, /* Scan LINE addresses */ for (argi = 8; argi < argc; ++argi) { - const char *sec_str = argv[argi]; + const char *sec_str = argv[argi]->arg; struct in_addr sec_addr; result = inet_pton(AF_INET, sec_str, &sec_addr); if (result <= 0) { @@ -4494,7 +4494,7 @@ DEFUN (test_pim_receive_assert, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4503,7 +4503,7 @@ DEFUN (test_pim_receive_assert, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[1]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4512,7 +4512,7 @@ DEFUN (test_pim_receive_assert, } /* Group address */ - group_str = argv[2]; + group_str = argv[2]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4521,7 +4521,7 @@ DEFUN (test_pim_receive_assert, } /* Source address */ - source_str = argv[3]; + source_str = argv[3]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4529,9 +4529,9 @@ DEFUN (test_pim_receive_assert, return CMD_WARNING; } - assert_metric_preference = atoi(argv[4]); - assert_route_metric = atoi(argv[5]); - assert_rpt_bit_flag = atoi(argv[6]); + assert_metric_preference = atoi(argv[4]->arg); + assert_route_metric = atoi(argv[5]->arg); + assert_rpt_bit_flag = atoi(argv[6]->arg); remain = buf_pastend - buf; if (remain < (int) sizeof(struct ip)) { @@ -4580,7 +4580,7 @@ DEFUN (test_pim_receive_assert, } static int recv_joinprune(struct vty *vty, - const char *argv[], + struct cmd_token *argv[], int src_is_join) { uint8_t buf[1000]; @@ -4608,7 +4608,7 @@ static int recv_joinprune(struct vty *vty, uint16_t num_pruned; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4616,10 +4616,10 @@ static int recv_joinprune(struct vty *vty, return CMD_WARNING; } - neigh_holdtime = atoi(argv[1]); + neigh_holdtime = atoi(argv[1]->arg); /* Neighbor destination address */ - neigh_dst_str = argv[2]; + neigh_dst_str = argv[2]->arg; result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr); if (result <= 0) { vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s", @@ -4628,7 +4628,7 @@ static int recv_joinprune(struct vty *vty, } /* Neighbor source address */ - neigh_src_str = argv[3]; + neigh_src_str = argv[3]->arg; result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr); if (result <= 0) { vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s", @@ -4637,7 +4637,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast group address */ - group_str = argv[4]; + group_str = argv[4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4646,7 +4646,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast source address */ - source_str = argv[5]; + source_str = argv[5]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4819,7 +4819,7 @@ DEFUN (test_pim_receive_upcall, const char *source_str; int result; - upcall_type = argv[0]; + upcall_type = argv[0]->arg; if (upcall_type[0] == 'n') msg.im_msgtype = IGMPMSG_NOCACHE; @@ -4833,10 +4833,10 @@ DEFUN (test_pim_receive_upcall, return CMD_WARNING; } - msg.im_vif = atoi(argv[1]); + msg.im_vif = atoi(argv[1]->arg); /* Group address */ - group_str = argv[2]; + group_str = argv[2]->arg; result = inet_pton(AF_INET, group_str, &msg.im_dst); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4845,7 +4845,7 @@ DEFUN (test_pim_receive_upcall, } /* Source address */ - source_str = argv[3]; + source_str = argv[3]->arg; result = inet_pton(AF_INET, source_str, &msg.im_src); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", From 224a3ed809ae23539cd49b85ada8516cb0b0a762 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 23:41:24 -0400 Subject: [PATCH 082/280] ripd: Fixup code to work under new way --- ripd/rip_debug.c | 12 +++++------ ripd/rip_interface.c | 42 ++++++++++++++++++------------------- ripd/rip_offset.c | 8 +++---- ripd/rip_routemap.c | 42 ++++++++++++++++++------------------- ripd/rip_zebra.c | 50 ++++++++++++++++++++++---------------------- ripd/ripd.c | 26 +++++++++++------------ 6 files changed, 90 insertions(+), 90 deletions(-) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index a267874ade..d347bcb2aa 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -98,9 +98,9 @@ DEFUN (debug_rip_packet_direct, "RIP send packet\n") { rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -118,9 +118,9 @@ DEFUN_DEPRECATED (debug_rip_packet_detail, "Detailed information display\n") { rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -170,14 +170,14 @@ DEFUN (no_debug_rip_packet_direct, "RIP option set for receive packet\n" "RIP option set for send packet\n") { - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) { if (IS_RIP_DEBUG_RECV) rip_debug_packet &= ~RIP_DEBUG_SEND; else rip_debug_packet = 0; } - else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + else if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) { if (IS_RIP_DEBUG_SEND) rip_debug_packet &= ~RIP_DEBUG_RECV; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 09b35d00b9..b9f190d321 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1228,16 +1228,16 @@ DEFUN (rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret) ret = rip_enable_network_add ((struct prefix *) &p); else - ret = rip_enable_if_add (argv[0]); + ret = rip_enable_if_add (argv[0]->arg); if (ret < 0) { - vty_out (vty, "There is a same network configuration %s%s", argv[0], + vty_out (vty, "There is a same network configuration %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1257,16 +1257,16 @@ DEFUN (no_rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret) ret = rip_enable_network_delete ((struct prefix *) &p); else - ret = rip_enable_if_delete (argv[0]); + ret = rip_enable_if_delete (argv[0]->arg); if (ret < 0) { - vty_out (vty, "Can't find network configuration %s%s", argv[0], + vty_out (vty, "Can't find network configuration %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1284,7 +1284,7 @@ DEFUN (rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { @@ -1308,7 +1308,7 @@ DEFUN (no_rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret <= 0) { @@ -1338,12 +1338,12 @@ DEFUN (ip_rip_receive_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]) == 1) + if (atoi (argv[0]->arg) == 1) { ri->ri_receive = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]) == 2) + if (atoi (argv[0]->arg) == 2) { ri->ri_receive = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1440,12 +1440,12 @@ DEFUN (ip_rip_send_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]) == 1) + if (atoi (argv[0]->arg) == 1) { ri->ri_send = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]) == 2) + if (atoi (argv[0]->arg) == 2) { ri->ri_send = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1548,9 +1548,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("md5", argv[0], strlen (argv[0])) == 0) + if (strncmp ("md5", argv[0]->arg, strlen (argv[0]->arg)) == 0) auth_type = RIP_AUTH_MD5; - else if (strncmp ("text", argv[0], strlen (argv[0])) == 0) + else if (strncmp ("text", argv[0]->arg, strlen (argv[0]->arg)) == 0) auth_type = RIP_AUTH_SIMPLE_PASSWORD; else { @@ -1570,9 +1570,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("r", argv[1], 1) == 0) + if (strncmp ("r", argv[1]->arg, 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_SIZE; - else if (strncmp ("o", argv[1], 1) == 0) + else if (strncmp ("o", argv[1]->arg, 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; else return CMD_WARNING; @@ -1656,7 +1656,7 @@ DEFUN (ip_rip_authentication_string, ifp = (struct interface *)vty->index; ri = ifp->info; - if (strlen (argv[0]) > 16) + if (strlen (argv[0]->arg) > 16) { vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s", VTY_NEWLINE); @@ -1672,7 +1672,7 @@ DEFUN (ip_rip_authentication_string, if (ri->auth_str) free (ri->auth_str); - ri->auth_str = strdup (argv[0]); + ri->auth_str = strdup (argv[0]->arg); return CMD_SUCCESS; } @@ -1735,7 +1735,7 @@ DEFUN (ip_rip_authentication_key_chain, if (ri->key_chain) free (ri->key_chain); - ri->key_chain = strdup (argv[0]); + ri->key_chain = strdup (argv[0]->arg); return CMD_SUCCESS; } @@ -1867,7 +1867,7 @@ DEFUN (rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]; + const char *ifname = argv[0]->arg; if (!strcmp(ifname,"default")) { passive_default = 1; @@ -1888,7 +1888,7 @@ DEFUN (no_rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]; + const char *ifname = argv[0]->arg; if (!strcmp(ifname,"default")) { passive_default = 0; diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 0155f90ef0..4778505328 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -289,7 +289,7 @@ DEFUN (rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_set (vty, argv[0], argv[1], argv[2], NULL); + return rip_offset_list_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL); } DEFUN (rip_offset_list_ifname, @@ -302,7 +302,7 @@ DEFUN (rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_set (vty, argv[0], argv[1], argv[2], argv[3]); + return rip_offset_list_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg); } DEFUN (no_rip_offset_list, @@ -315,7 +315,7 @@ DEFUN (no_rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], NULL); + return rip_offset_list_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL); } DEFUN (no_rip_offset_list_ifname, @@ -329,7 +329,7 @@ DEFUN (no_rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); + return rip_offset_list_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg); } static int diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e7263ad7be..bbb0787dd7 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -742,7 +742,7 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "metric", argv[0]); + return rip_route_match_add (vty, vty->index, "metric", argv[0]->arg); } DEFUN (no_match_metric, @@ -755,7 +755,7 @@ DEFUN (no_match_metric, if (argc == 0) return rip_route_match_delete (vty, vty->index, "metric", NULL); - return rip_route_match_delete (vty, vty->index, "metric", argv[0]); + return rip_route_match_delete (vty, vty->index, "metric", argv[0]->arg); } ALIAS (no_match_metric, @@ -773,7 +773,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return rip_route_match_add (vty, vty->index, "interface", argv[0]); + return rip_route_match_add (vty, vty->index, "interface", argv[0]->arg); } DEFUN (no_match_interface, @@ -786,7 +786,7 @@ DEFUN (no_match_interface, if (argc == 0) return rip_route_match_delete (vty, vty->index, "interface", NULL); - return rip_route_match_delete (vty, vty->index, "interface", argv[0]); + return rip_route_match_delete (vty, vty->index, "interface", argv[0]->arg); } ALIAS (no_match_interface, @@ -807,7 +807,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_match_add (vty, vty->index, "ip next-hop", argv[0]->arg); } DEFUN (no_match_ip_next_hop, @@ -821,7 +821,7 @@ DEFUN (no_match_ip_next_hop, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip next-hop", NULL); - return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[0]->arg); } ALIAS (no_match_ip_next_hop, @@ -844,7 +844,7 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[0]); + return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[0]->arg); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -859,7 +859,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", NULL); - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[0]->arg); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -883,7 +883,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address", argv[0]); + return rip_route_match_add (vty, vty->index, "ip address", argv[0]->arg); } DEFUN (no_match_ip_address, @@ -897,7 +897,7 @@ DEFUN (no_match_ip_address, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip address", NULL); - return rip_route_match_delete (vty, vty->index, "ip address", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip address", argv[0]->arg); } ALIAS (no_match_ip_address, @@ -920,7 +920,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[0]); + return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[0]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -935,7 +935,7 @@ DEFUN (no_match_ip_address_prefix_list, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]->arg); } ALIAS (no_match_ip_address_prefix_list, @@ -955,7 +955,7 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "tag", argv[0]); + return rip_route_match_add (vty, vty->index, "tag", argv[0]->arg); } DEFUN (no_match_tag, @@ -968,7 +968,7 @@ DEFUN (no_match_tag, if (argc == 0) return rip_route_match_delete (vty, vty->index, "tag", NULL); - return rip_route_match_delete (vty, vty->index, "tag", argv[0]); + return rip_route_match_delete (vty, vty->index, "tag", argv[0]->arg); } ALIAS (no_match_tag, @@ -988,7 +988,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return rip_route_set_add (vty, vty->index, "metric", argv[0]); + return rip_route_set_add (vty, vty->index, "metric", argv[0]->arg); } ALIAS (set_metric, @@ -1008,7 +1008,7 @@ DEFUN (no_set_metric, if (argc == 0) return rip_route_set_delete (vty, vty->index, "metric", NULL); - return rip_route_set_delete (vty, vty->index, "metric", argv[0]); + return rip_route_set_delete (vty, vty->index, "metric", argv[0]->arg); } ALIAS (no_set_metric, @@ -1038,7 +1038,7 @@ DEFUN (set_ip_nexthop, union sockunion su; int ret; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[0]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE); @@ -1052,7 +1052,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return rip_route_set_add (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_set_add (vty, vty->index, "ip next-hop", argv[0]->arg); } DEFUN (no_set_ip_nexthop, @@ -1066,7 +1066,7 @@ DEFUN (no_set_ip_nexthop, if (argc == 0) return rip_route_set_delete (vty, vty->index, "ip next-hop", NULL); - return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[0]->arg); } ALIAS (no_set_ip_nexthop, @@ -1085,7 +1085,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return rip_route_set_add (vty, vty->index, "tag", argv[0]); + return rip_route_set_add (vty, vty->index, "tag", argv[0]->arg); } DEFUN (no_set_tag, @@ -1098,7 +1098,7 @@ DEFUN (no_set_tag, if (argc == 0) return rip_route_set_delete (vty, vty->index, "tag", NULL); - return rip_route_set_delete (vty, vty->index, "tag", argv[0]); + return rip_route_set_delete (vty, vty->index, "tag", argv[0]->arg); } ALIAS (no_set_tag, diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 6ca27d01dd..64d1a4dd36 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -367,7 +367,7 @@ DEFUN (rip_redistribute_type, for(i = 0; redist_type[i].str; i++) { - if (strncmp (redist_type[i].str, argv[0], + if (strncmp (redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, @@ -376,7 +376,7 @@ DEFUN (rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -393,7 +393,7 @@ DEFUN (no_rip_redistribute_type, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP); @@ -403,7 +403,7 @@ DEFUN (no_rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -420,17 +420,17 @@ DEFUN (rip_redistribute_type_routemap, int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { - rip_routemap_set (redist_type[i].type, argv[1]); + rip_routemap_set (redist_type[i].type, argv[1]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -449,17 +449,17 @@ DEFUN (no_rip_redistribute_type_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { - if (rip_routemap_unset (redist_type[i].type,argv[1])) + if (rip_routemap_unset (redist_type[i].type,argv[1]->arg)) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -476,10 +476,10 @@ DEFUN (rip_redistribute_type_metric, int i; int metric; - metric = atoi (argv[1]); + metric = atoi (argv[1]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); @@ -489,7 +489,7 @@ DEFUN (rip_redistribute_type_metric, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -508,17 +508,17 @@ DEFUN (no_rip_redistribute_type_metric, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[1]->arg))) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -537,21 +537,21 @@ DEFUN (rip_redistribute_type_metric_routemap, int i; int metric; - metric = atoi (argv[1]); + metric = atoi (argv[1]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); - rip_routemap_set (redist_type[i].type, argv[2]); + rip_routemap_set (redist_type[i].type, argv[2]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -574,14 +574,14 @@ DEFUN (no_rip_redistribute_type_metric_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[0]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[1]->arg))) return CMD_WARNING; - if (rip_routemap_unset (redist_type[i].type, argv[2])) + if (rip_routemap_unset (redist_type[i].type, argv[2]->arg)) { - rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1])); + rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1]->arg)); return CMD_WARNING; } rip_redistribute_unset (redist_type[i].type); @@ -589,7 +589,7 @@ DEFUN (no_rip_redistribute_type_metric_routemap, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; diff --git a/ripd/ripd.c b/ripd/ripd.c index 3a8cd80e7a..b8b992c2c7 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2949,7 +2949,7 @@ DEFUN (rip_version, { int version; - version = atoi (argv[0]); + version = atoi (argv[0]->arg); if (version != RIPv1 && version != RIPv2) { vty_out (vty, "invalid rip version %d%s", version, @@ -2992,7 +2992,7 @@ DEFUN (rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3028,7 +3028,7 @@ DEFUN (no_rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[0]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3040,7 +3040,7 @@ DEFUN (no_rip_route, node = route_node_lookup (rip->route, (struct prefix *) &p); if (! node) { - vty_out (vty, "Can't find route %s.%s", argv[0], + vty_out (vty, "Can't find route %s.%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -3079,7 +3079,7 @@ DEFUN (rip_default_metric, { if (rip) { - rip->default_metric = atoi (argv[0]); + rip->default_metric = atoi (argv[0]->arg); /* rip_update_default_metric (); */ } return CMD_SUCCESS; @@ -3123,21 +3123,21 @@ DEFUN (rip_timers, unsigned long RIP_TIMER_MAX = 2147483647; unsigned long RIP_TIMER_MIN = 5; - update = strtoul (argv[0], &endptr, 10); + update = strtoul (argv[0]->arg, &endptr, 10); if (update > RIP_TIMER_MAX || update < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "update timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - timeout = strtoul (argv[1], &endptr, 10); + timeout = strtoul (argv[1]->arg, &endptr, 10); if (timeout > RIP_TIMER_MAX || timeout < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "timeout timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - garbage = strtoul (argv[2], &endptr, 10); + garbage = strtoul (argv[2]->arg, &endptr, 10); if (garbage > RIP_TIMER_MAX || garbage < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "garbage timer value error%s", VTY_NEWLINE); @@ -3386,7 +3386,7 @@ DEFUN (rip_distance, "Administrative distance\n" "Distance value\n") { - rip->distance = atoi (argv[0]); + rip->distance = atoi (argv[0]->arg); return CMD_SUCCESS; } @@ -3408,7 +3408,7 @@ DEFUN (rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_set (vty, argv[0], argv[1], NULL); + rip_distance_set (vty, argv[0]->arg, argv[1]->arg, NULL); return CMD_SUCCESS; } @@ -3420,7 +3420,7 @@ DEFUN (no_rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_unset (vty, argv[0], argv[1], NULL); + rip_distance_unset (vty, argv[0]->arg, argv[1]->arg, NULL); return CMD_SUCCESS; } @@ -3432,7 +3432,7 @@ DEFUN (rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_set (vty, argv[0], argv[1], argv[2]); + rip_distance_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg); return CMD_SUCCESS; } @@ -3445,7 +3445,7 @@ DEFUN (no_rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_unset (vty, argv[0], argv[1], argv[2]); + rip_distance_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg); return CMD_SUCCESS; } From 38c249987301aac93bebc0cb7b51784d5827c066 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Sep 2016 23:46:23 -0400 Subject: [PATCH 083/280] isisd: Make work under new regime --- isisd/isis_redist.c | 46 +++++++++---------- isisd/isis_routemap.c | 20 ++++----- isisd/isis_te.c | 4 +- isisd/isis_vty.c | 102 +++++++++++++++++++++--------------------- isisd/isisd.c | 26 +++++------ 5 files changed, 99 insertions(+), 99 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 5311b5c69c..dd640d0bba 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -563,7 +563,7 @@ DEFUN (isis_redistribute, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[0]->arg); if (family < 0) return CMD_WARNING; @@ -571,13 +571,13 @@ DEFUN (isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) + if (!strcmp("level-1", argv[2]->arg)) level = 1; - else if (!strcmp("level-2", argv[2])) + else if (!strcmp("level-2", argv[2]->arg)) level = 2; else return CMD_WARNING; @@ -588,11 +588,11 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[3]) + if (argv[3]->arg) { char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') + metric = strtoul(argv[3]->arg, &endp, 10); + if (argv[3]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -600,7 +600,7 @@ DEFUN (isis_redistribute, metric = 0xffffffff; } - routemap = argv[4]; + routemap = argv[4]->arg; isis_redist_set(area, level, family, type, metric, routemap, 0); return 0; @@ -627,7 +627,7 @@ DEFUN (no_isis_redistribute, if (argc < 3) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[0]->arg); if (family < 0) return CMD_WARNING; @@ -635,13 +635,13 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) + if (!strcmp("level-1", argv[2]->arg)) level = 1; - else if (!strcmp("level-2", argv[2])) + else if (!strcmp("level-2", argv[2]->arg)) level = 2; else return CMD_WARNING; @@ -676,13 +676,13 @@ DEFUN (isis_default_originate, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[0]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) + if (!strcmp("level-1", argv[1]->arg)) level = 1; - else if (!strcmp("level-2", argv[1])) + else if (!strcmp("level-2", argv[1]->arg)) level = 2; else return CMD_WARNING; @@ -693,7 +693,7 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[2] && *argv[2] != '\0') + if (argv[2]->arg && *argv[2]->arg != '\0') originate_type = DEFAULT_ORIGINATE_ALWAYS; else originate_type = DEFAULT_ORIGINATE; @@ -704,11 +704,11 @@ DEFUN (isis_default_originate, vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE); } - if (argv[3]) + if (argv[3]->arg) { char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') + metric = strtoul(argv[3]->arg, &endp, 10); + if (argv[3]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -716,7 +716,7 @@ DEFUN (isis_default_originate, metric = 0xffffffff; } - routemap = argv[4]; + routemap = argv[4]->arg; isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type); return 0; @@ -741,13 +741,13 @@ DEFUN (no_isis_default_originate, if (argc < 2) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[0]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) + if (!strcmp("level-1", argv[1]->arg)) level = 1; - else if (!strcmp("level-2", argv[1])) + else if (!strcmp("level-2", argv[1]->arg)) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index fdc0100e77..f8a7e90065 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -354,7 +354,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address", argv[0]); + return isis_route_match_add(vty, vty->index, "ip address", argv[0]->arg); } DEFUN (no_match_ip_address, @@ -370,7 +370,7 @@ DEFUN (no_match_ip_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ip address", NULL); - return isis_route_match_delete(vty, vty->index, "ip address", argv[0]); + return isis_route_match_delete(vty, vty->index, "ip address", argv[0]->arg); } ALIAS (no_match_ip_address, @@ -392,7 +392,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]); + return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -406,7 +406,7 @@ DEFUN (no_match_ip_address_prefix_list, { if (argc == 0) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); + return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]->arg); } ALIAS (no_match_ip_address_prefix_list, @@ -429,7 +429,7 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]); + return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]->arg); } DEFUN (no_match_ipv6_address, @@ -443,7 +443,7 @@ DEFUN (no_match_ipv6_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); - return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]); + return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]->arg); } ALIAS (no_match_ipv6_address, @@ -465,7 +465,7 @@ DEFUN (match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]); + return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]->arg); } DEFUN (no_match_ipv6_address_prefix_list, @@ -479,7 +479,7 @@ DEFUN (no_match_ipv6_address_prefix_list, { if (argc == 0) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]); + return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]->arg); } ALIAS (no_match_ipv6_address_prefix_list, @@ -504,7 +504,7 @@ DEFUN (set_metric, "Metric vale for destination routing protocol\n" "Metric value\n") { - return isis_route_set_add(vty, vty->index, "metric", argv[0]); + return isis_route_set_add(vty, vty->index, "metric", argv[0]->arg); } DEFUN (no_set_metric, @@ -517,7 +517,7 @@ DEFUN (no_set_metric, { if (argc == 0) return isis_route_set_delete(vty, vty->index, "metric", NULL); - return isis_route_set_delete(vty, vty->index, "metric", argv[0]); + return isis_route_set_delete(vty, vty->index, "metric", argv[0]->arg); } ALIAS (no_set_metric, diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 022722f760..6e9d061ca2 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1167,7 +1167,7 @@ DEFUN (isis_mpls_te_router_addr, struct listnode *node; struct isis_area *area; - if (! inet_aton (argv[0], &value)) + if (! inet_aton (argv[0]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1329,7 +1329,7 @@ DEFUN (show_isis_mpls_te_interface, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[0]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 53c635ea61..6a8f951f99 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -64,8 +64,8 @@ DEFUN (ip_router_isis, struct interface *ifp; struct isis_circuit *circuit; struct isis_area *area; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[0]->arg; + const char *area_tag = argv[1]->arg; ifp = (struct interface *) vty->index; assert (ifp); @@ -118,8 +118,8 @@ DEFUN (no_ip_router_isis, struct interface *ifp; struct isis_area *area; struct isis_circuit *circuit; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[0]->arg; + const char *area_tag = argv[1]->arg; ifp = (struct interface *) vty->index; if (!ifp) @@ -132,7 +132,7 @@ DEFUN (no_ip_router_isis, if (!area) { vty_out (vty, "Can't find ISIS instance %s%s", - argv[0], VTY_NEWLINE); + argv[0]->arg, VTY_NEWLINE); return CMD_ERR_NO_MATCH; } @@ -204,7 +204,7 @@ DEFUN (isis_circuit_type, if (!circuit) return CMD_ERR_NO_MATCH; - is_type = string2circuit_t (argv[0]); + is_type = string2circuit_t (argv[0]->arg); if (!is_type) { vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); @@ -310,10 +310,10 @@ DEFUN (isis_passwd, if (!circuit) return CMD_ERR_NO_MATCH; - if (argv[0][0] == 'm') - rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]); + if (argv[0]->arg[0] == 'm') + rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]->arg); else - rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]); + rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]->arg); if (rv) { vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); @@ -361,7 +361,7 @@ DEFUN (isis_priority, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[0]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -413,7 +413,7 @@ DEFUN (isis_priority_l1, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[0]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -465,7 +465,7 @@ DEFUN (isis_priority_l2, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[0]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -517,7 +517,7 @@ DEFUN (isis_metric, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[0]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -581,7 +581,7 @@ DEFUN (isis_metric_l1, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[0]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -645,7 +645,7 @@ DEFUN (isis_metric_l2, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[0]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -710,7 +710,7 @@ DEFUN (isis_hello_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", @@ -764,7 +764,7 @@ DEFUN (isis_hello_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -818,7 +818,7 @@ DEFUN (isis_hello_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -870,7 +870,7 @@ DEFUN (isis_hello_multiplier, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[0]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -922,7 +922,7 @@ DEFUN (isis_hello_multiplier_l1, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[0]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -974,7 +974,7 @@ DEFUN (isis_hello_multiplier_l2, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[0]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -1060,7 +1060,7 @@ DEFUN (csnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1112,7 +1112,7 @@ DEFUN (csnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1164,7 +1164,7 @@ DEFUN (csnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1215,7 +1215,7 @@ DEFUN (psnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1267,7 +1267,7 @@ DEFUN (psnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1319,7 +1319,7 @@ DEFUN (psnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[0]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1409,7 +1409,7 @@ DEFUN (metric_style, assert(area); - if (strncmp (argv[0], "w", 1) == 0) + if (strncmp (argv[0]->arg, "w", 1) == 0) { isis_area_metricstyle_set(area, false, true); return CMD_SUCCESS; @@ -1419,9 +1419,9 @@ DEFUN (metric_style, if (ret != CMD_SUCCESS) return ret; - if (strncmp (argv[0], "t", 1) == 0) + if (strncmp (argv[0]->arg, "t", 1) == 0) isis_area_metricstyle_set(area, true, true); - else if (strncmp (argv[0], "n", 1) == 0) + else if (strncmp (argv[0]->arg, "n", 1) == 0) isis_area_metricstyle_set(area, true, false); return CMD_SUCCESS; @@ -1561,7 +1561,7 @@ DEFUN (area_lsp_mtu, { unsigned int lsp_mtu; - VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); + VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0]->arg, 128, 4352); return area_lsp_mtu_set(vty, lsp_mtu); } @@ -1601,7 +1601,7 @@ DEFUN (is_type, return CMD_ERR_NO_MATCH; } - type = string2circuit_t (argv[0]); + type = string2circuit_t (argv[0]->arg); if (!type) { vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); @@ -1684,7 +1684,7 @@ DEFUN (lsp_gen_interval, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); level = IS_LEVEL_1 | IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1724,7 +1724,7 @@ DEFUN (lsp_gen_interval_l1, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); level = IS_LEVEL_1; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1766,7 +1766,7 @@ DEFUN (lsp_gen_interval_l2, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1806,7 +1806,7 @@ DEFUN (spf_interval, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); area->min_spf_interval[0] = interval; area->min_spf_interval[1] = interval; @@ -1847,7 +1847,7 @@ DEFUN (spf_interval_l1, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); area->min_spf_interval[0] = interval; return CMD_SUCCESS; @@ -1888,7 +1888,7 @@ DEFUN (spf_interval_l2, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[0]->arg); area->min_spf_interval[1] = interval; return CMD_SUCCESS; @@ -1976,7 +1976,7 @@ DEFUN (max_lsp_lifetime, "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]->arg)); } DEFUN (no_max_lsp_lifetime, @@ -2002,7 +2002,7 @@ DEFUN (max_lsp_lifetime_l1, "Maximum LSP lifetime for Level 1 only\n" "LSP lifetime for Level 1 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0]->arg)); } DEFUN (no_max_lsp_lifetime_l1, @@ -2027,7 +2027,7 @@ DEFUN (max_lsp_lifetime_l2, "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime for Level 2 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0]->arg)); } DEFUN (no_max_lsp_lifetime_l2, @@ -2096,7 +2096,7 @@ DEFUN (lsp_refresh_interval, "LSP refresh interval\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]->arg)); } DEFUN (no_lsp_refresh_interval, @@ -2122,7 +2122,7 @@ DEFUN (lsp_refresh_interval_l1, "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0]->arg)); } DEFUN (no_lsp_refresh_interval_l1, @@ -2148,7 +2148,7 @@ DEFUN (lsp_refresh_interval_l2, "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0]->arg)); } DEFUN (no_lsp_refresh_interval_l2, @@ -2201,17 +2201,17 @@ DEFUN (area_passwd_md5, "Level-wide password\n") { u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strncmp(argv[2]->arg, "v", 1) == 0) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, - argv[1], snp_auth); + argv[1]->arg, snp_auth); } ALIAS (area_passwd_md5, @@ -2235,17 +2235,17 @@ DEFUN (area_passwd_clear, "Area password\n") { u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strncmp(argv[2]->arg, "v", 1) == 0) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, - argv[1], snp_auth); + argv[1]->arg, snp_auth); } ALIAS (area_passwd_clear, @@ -2267,7 +2267,7 @@ DEFUN (no_area_passwd, "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") { - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; struct isis_area *area = vty->index; if (!area) diff --git a/isisd/isisd.c b/isisd/isisd.c index 4d7f475616..845d6aa3f1 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -533,7 +533,7 @@ DEFUN (show_isis_interface_arg, "ISIS interface\n" "ISIS interface name\n") { - return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_interface_common (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -707,7 +707,7 @@ DEFUN (show_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_neighbor_common (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (clear_isis_neighbor, @@ -728,7 +728,7 @@ DEFUN (clear_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return clear_isis_neighbor_common (vty, argv[0]); + return clear_isis_neighbor_common (vty, argv[0]->arg); } /* @@ -1530,7 +1530,7 @@ DEFUN (show_database_lsp_brief, "IS-IS link state database\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF); + return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_BRIEF); } DEFUN (show_database_lsp_detail, @@ -1542,7 +1542,7 @@ DEFUN (show_database_lsp_detail, "LSP ID\n" "Detailed information\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (show_database_detail, @@ -1564,7 +1564,7 @@ DEFUN (show_database_detail_lsp, "Detailed information\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -1577,7 +1577,7 @@ DEFUN (router_isis, "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_get (vty, argv[0]); + return isis_area_get (vty, argv[0]->arg); } /* @@ -1588,7 +1588,7 @@ DEFUN (no_router_isis, "no router isis WORD", "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_destroy (vty, argv[0]); + return isis_area_destroy (vty, argv[0]->arg); } /* @@ -1600,7 +1600,7 @@ DEFUN (net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_net_title (vty, argv[0]); + return area_net_title (vty, argv[0]->arg); } /* @@ -1613,7 +1613,7 @@ DEFUN (no_net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_clear_net_title (vty, argv[0]); + return area_clear_net_title (vty, argv[0]->arg); } void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) @@ -1973,8 +1973,8 @@ DEFUN (topology_baseis, area = vty->index; assert (area); - if (sysid2buff (buff, argv[0])) - sysid2buff (area->topology_baseis, argv[0]); + if (sysid2buff (buff, argv[0]->arg)) + sysid2buff (area->topology_baseis, argv[0]->arg); return CMD_SUCCESS; } @@ -2016,7 +2016,7 @@ DEFUN (topology_basedynh, assert (area); /* I hope that it's enough. */ - area->topology_basedynh = strndup (argv[0], 16); + area->topology_basedynh = strndup (argv[0]->arg, 16); return CMD_SUCCESS; } From 69642336f03b4097a2122a05c92ab0bc5a1a8836 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 14:00:39 +0000 Subject: [PATCH 084/280] Added argv_translator.py Signed-off-by: Daniel Walton To use this run: ../tools/argv_translator.py bgp_route.c It will update the argv[] instances with the corrent index and adds '->arg' --- tools/argv_translator.py | 142 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100755 tools/argv_translator.py diff --git a/tools/argv_translator.py b/tools/argv_translator.py new file mode 100755 index 0000000000..791ae54b0e --- /dev/null +++ b/tools/argv_translator.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python + +import re +import sys +import os +from pprint import pformat + + +def token_is_variable(token): + + if token.isdigit(): + return True + + if token.startswith('('): + assert token.endswith(')'), "token %s should end with )" % token + return True + + if token.startswith('['): + assert token.endswith(']'), "token %s should end with ]" % token + return True + + if token.startswith('{'): + # I don't really care about checking for this I just put + # these asserts in here to bug sharpd + assert token.endswith('}'), "token %s should end with }" % token + return True + + assert '|' not in token, "Weird token %s has a | but does not start with [ or (" % token + + if token in ('WORD', + '.LINE', # where is this defined? + 'A.B.C.D', + 'A.B.C.D/M', + 'X:X::X:X', + 'X:X::X:X/M', + 'ASN:nn_or_IP-address:nn'): # where is this defined? + return True + + re_number_range = re.search('^<\d+-\d+>$', token) + if re_number_range: + return True + + return False + + +def get_argv_translator(line): + table = {} + line = line.strip() + assert line.startswith('"'), "line does not start with \"\n%s" % line + assert line.endswith('",'), "line does not end with \",\n%s" % line + + line = line[1:-2] + + funky_chars = ('+', '"') + for char in funky_chars: + if char in line: + raise Exception("Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % line) + + old_style_index = 0 + for (token_index, token) in enumerate(line.split()): + if token_is_variable(token): + # print "%s is a token" % token + table[old_style_index] = token_index + old_style_index += 1 + else: + # print "%s is NOT a token" % token + pass + + return table + + +def update_argvs(filename): + lines = [] + + with open(filename, 'r') as fh: + state = None + defun_line_number = None + cmd_string = None + argv_translator = {} + print_translator = False + + for (line_number, line) in enumerate(fh.readlines()): + new_line = line + + if state is None: + if line.startswith('DEFUN ('): + state = 'DEFUN_HEADER' + defun_line_number = line_number + + elif state == 'DEFUN_HEADER': + if line.startswith('DEFUN'): + raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number) + + elif line.startswith('ALIAS'): + raise Exception("ERROR on line %d, found ALIAS inside DEFUN" % line_number) + + elif line.strip() == '{': + state = 'DEFUN_BODY' + + elif line_number == defun_line_number + 2: + + # bgpd/bgp_vty.h + line = line.replace('" CMD_AS_RANGE "', '<1-4294967295>') + line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '<1-5000>') + line = line.replace('" BGP_INSTANCE_CMD "', '(view|vrf) WORD') + line = line.replace('" BGP_INSTANCE_ALL_CMD "', '(view|vrf) all') + argv_translator = get_argv_translator(line) + print_translator = True + + elif state == 'DEFUN_BODY': + if line.rstrip() == '}': + state = None + defun_line_number = None + cmd_string = None + argv_translator = {} + + elif 'argv[' in new_line: + for index in reversed(argv_translator.keys()): + old_argv = "argv[%d]" % index + new_argv = "argv[%d]->arg" % argv_translator[index] + new_line = new_line.replace(old_argv, new_argv) + + # uncomment to debug state machine + print "%5d %12s: %s" % (line_number, state, new_line.rstrip()) + if print_translator: + print "%s\n" % pformat(argv_translator) + print_translator = False + + lines.append(new_line) + + with open(filename, 'w') as fh: + for line in lines: + fh.write(line) + + +if __name__ == '__main__': + + filename = sys.argv[1] + if os.path.exists(filename): + update_argvs(filename) + else: + print "ERROR: could not find file %s" % filename From 4dcadbefd00d7c4c97a16f3adc591bd4478965df Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 15:15:50 +0000 Subject: [PATCH 085/280] bgpd: argv update for all but bgp_vty.c Signed-off-by: Daniel Walton --- bgpd/bgp_aspath.c | 1 + bgpd/bgp_attr.c | 1 + bgpd/bgp_community.c | 1 + bgpd/bgp_debug.c | 64 ++-- bgpd/bgp_dump.c | 8 +- bgpd/bgp_filter.c | 29 +- bgpd/bgp_fsm.c | 1 + bgpd/bgp_mplsvpn.c | 34 +-- bgpd/bgp_nexthop.c | 4 +- bgpd/bgp_route.c | 610 +++++++++++++++++++-------------------- bgpd/bgp_routemap.c | 221 +++++--------- bgpd/bgp_table.c | 1 + bgpd/bgpd.c | 2 +- lib/command.h | 14 +- lib/json.c | 2 +- lib/json.h | 2 +- tools/argv_translator.py | 59 +++- 17 files changed, 516 insertions(+), 538 deletions(-) diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index eca4441010..c33366f407 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "str.h" #include "log.h" #include "stream.h" +#include "command.h" #include "jhash.h" #include "queue.h" #include "filter.h" diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 3cb52ef911..936428e178 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "queue.h" #include "table.h" #include "filter.h" +#include "command.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 450cbddcfa..17a3d2fdae 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -20,6 +20,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include +#include "command.h" #include "hash.h" #include "memory.h" diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index dc0f539847..bf865afdcb 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -630,7 +630,7 @@ DEFUN (debug_bgp_neighbor_events_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[0]; + const char *host = argv[3]->arg; if (!bgp_debug_neighbor_events_peers) bgp_debug_neighbor_events_peers = list_new (); @@ -685,7 +685,7 @@ DEFUN (no_debug_bgp_neighbor_events_peer, "BGP neighbor on interface to debug\n") { int found_peer = 0; - const char *host = argv[0]; + const char *host = argv[4]->arg; if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers)) { @@ -774,7 +774,7 @@ DEFUN (debug_bgp_keepalive_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[0]; + const char *host = argv[3]->arg; if (!bgp_debug_keepalive_peers) bgp_debug_keepalive_peers = list_new (); @@ -829,7 +829,7 @@ DEFUN (no_debug_bgp_keepalive_peer, "BGP neighbor on interface to debug\n") { int found_peer = 0; - const char *host = argv[0]; + const char *host = argv[4]->arg; if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers)) { @@ -867,7 +867,7 @@ DEFUN (debug_bgp_bestpath_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[3]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -881,7 +881,7 @@ DEFUN (debug_bgp_bestpath_prefix, if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -894,7 +894,7 @@ DEFUN (debug_bgp_bestpath_prefix, else { TERM_DEBUG_ON (bestpath, BESTPATH); - vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[3]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -916,7 +916,7 @@ DEFUN (no_debug_bgp_bestpath_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[4]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -943,9 +943,9 @@ DEFUN (no_debug_bgp_bestpath_prefix, } if (found_prefix) - vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[4]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1006,21 +1006,21 @@ DEFUN (debug_bgp_update_direct, "Outbound updates\n") { - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[3]->arg, 1) == 0) bgp_debug_list_free(bgp_debug_update_in_peers); else bgp_debug_list_free(bgp_debug_update_out_peers); if (vty->node == CONFIG_NODE) { - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[3]->arg, 1) == 0) DEBUG_ON (update, UPDATE_IN); else DEBUG_ON (update, UPDATE_OUT); } else { - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[3]->arg, 1) == 0) { TERM_DEBUG_ON (update, UPDATE_IN); vty_out (vty, "BGP updates debugging is on (inbound)%s", VTY_NEWLINE); @@ -1046,7 +1046,7 @@ DEFUN (debug_bgp_update_direct_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[1]; + const char *host = argv[4]->arg; int inbound; if (!bgp_debug_update_in_peers) @@ -1055,7 +1055,7 @@ DEFUN (debug_bgp_update_direct_peer, if (!bgp_debug_update_out_peers) bgp_debug_update_out_peers = list_new (); - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[3]->arg, 1) == 0) inbound = 1; else inbound = 0; @@ -1117,12 +1117,12 @@ DEFUN (debug_bgp_update_direct_peer, if (inbound) { TERM_DEBUG_ON (update, UPDATE_IN); - vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[4]->arg, VTY_NEWLINE); } else { TERM_DEBUG_ON (update, UPDATE_OUT); - vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[4]->arg, VTY_NEWLINE); } } return CMD_SUCCESS; @@ -1138,7 +1138,7 @@ DEFUN (no_debug_bgp_update_direct, "Inbound updates\n" "Outbound updates\n") { - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[4]->arg, 1) == 0) { bgp_debug_list_free(bgp_debug_update_in_peers); @@ -1185,9 +1185,9 @@ DEFUN (no_debug_bgp_update_direct_peer, { int inbound; int found_peer = 0; - const char *host = argv[1]; + const char *host = argv[5]->arg; - if (strncmp ("i", argv[0], 1) == 0) + if (strncmp ("i", argv[4]->arg, 1) == 0) inbound = 1; else inbound = 0; @@ -1275,7 +1275,7 @@ DEFUN (debug_bgp_update_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[4]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1289,7 +1289,7 @@ DEFUN (debug_bgp_update_prefix, if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1302,7 +1302,7 @@ DEFUN (debug_bgp_update_prefix, else { TERM_DEBUG_ON (update, UPDATE_PREFIX); - vty_out (vty, "BGP updates debugging is on for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -1325,7 +1325,7 @@ DEFUN (no_debug_bgp_update_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[5]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1352,9 +1352,9 @@ DEFUN (no_debug_bgp_update_prefix, } if (found_prefix) - vty_out (vty, "BGP updates debugging is off for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1422,7 +1422,7 @@ DEFUN (debug_bgp_zebra_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[4]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1435,7 +1435,7 @@ DEFUN (debug_bgp_zebra_prefix, if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1446,7 +1446,7 @@ DEFUN (debug_bgp_zebra_prefix, else { TERM_DEBUG_ON (zebra, ZEBRA); - vty_out (vty, "BGP zebra debugging is on for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -1489,7 +1489,7 @@ DEFUN (no_debug_bgp_zebra_prefix, int ret; argv_p = prefix_new(); - ret = str2prefix (argv[0], argv_p); + ret = str2prefix (argv[5]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1514,9 +1514,9 @@ DEFUN (no_debug_bgp_zebra_prefix, } if (found_prefix) - vty_out (vty, "BGP zebra debugging is off for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_SUCCESS; } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index e219d5248e..52989385d1 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -742,7 +742,7 @@ DEFUN (dump_bgp_all, const struct bgp_dump_type_map *map = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[0], map->str) == 0) + if (strcmp(argv[2]->arg, map->str) == 0) bgp_dump_type = map->type; switch (bgp_dump_type) @@ -763,10 +763,10 @@ DEFUN (dump_bgp_all, /* When an interval is given */ if (argc == 3) - interval = argv[2]; + interval = argv[4]->arg; return bgp_dump_set (vty, bgp_dump_struct, bgp_dump_type, - argv[1], interval); + argv[3]->arg, interval); } DEFUN (no_dump_bgp_all, @@ -786,7 +786,7 @@ DEFUN (no_dump_bgp_all, struct bgp_dump *bgp_dump_struct = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[0], map->str) == 0) + if (strcmp(argv[3]->arg, map->str) == 0) bgp_dump_type = map->type; switch (bgp_dump_type) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 33877e7258..1235e50d22 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -426,7 +426,8 @@ as_list_dup_check (struct as_list *aslist, struct as_filter *new) return 0; } -DEFUN (ip_as_path, ip_as_path_cmd, +DEFUN (ip_as_path, + ip_as_path_cmd, "ip as-path access-list WORD (deny|permit) .LINE", IP_STR "BGP autonomous system path filter\n" @@ -443,9 +444,9 @@ DEFUN (ip_as_path, ip_as_path_cmd, char *regstr; /* Check the filter type. */ - if (strncmp (argv[1], "p", 1) == 0) + if (strncmp (argv[4]->arg, "p", 1) == 0) type = AS_FILTER_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) + else if (strncmp (argv[4]->arg, "d", 1) == 0) type = AS_FILTER_DENY; else { @@ -460,7 +461,7 @@ DEFUN (ip_as_path, ip_as_path_cmd, if (!regex) { XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[0], + vty_out (vty, "can't compile regexp %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -470,7 +471,7 @@ DEFUN (ip_as_path, ip_as_path_cmd, XFREE (MTYPE_TMP, regstr); /* Install new filter to the access_list. */ - aslist = as_list_get (argv[0]); + aslist = as_list_get (argv[3]->arg); /* Duplicate insertion check. */; if (as_list_dup_check (aslist, asfilter)) @@ -500,18 +501,18 @@ DEFUN (no_ip_as_path, regex_t *regex; /* Lookup AS list from AS path list. */ - aslist = as_list_lookup (argv[0]); + aslist = as_list_lookup (argv[4]->arg); if (aslist == NULL) { - vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[0], + vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } /* Check the filter type. */ - if (strncmp (argv[1], "p", 1) == 0) + if (strncmp (argv[5]->arg, "p", 1) == 0) type = AS_FILTER_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) + else if (strncmp (argv[5]->arg, "d", 1) == 0) type = AS_FILTER_DENY; else { @@ -526,7 +527,7 @@ DEFUN (no_ip_as_path, if (!regex) { XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[0], + vty_out (vty, "can't compile regexp %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -559,10 +560,10 @@ DEFUN (no_ip_as_path_all, { struct as_list *aslist; - aslist = as_list_lookup (argv[0]); + aslist = as_list_lookup (argv[4]->arg); if (aslist == NULL) { - vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[0], + vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -571,7 +572,7 @@ DEFUN (no_ip_as_path_all, /* Run hook function. */ if (as_list_master.delete_hook) - (*as_list_master.delete_hook) (argv[0]); + (*as_list_master.delete_hook) (argv[4]->arg); return CMD_SUCCESS; } @@ -629,7 +630,7 @@ DEFUN (show_ip_as_path_access_list, { struct as_list *aslist; - aslist = as_list_lookup (argv[0]); + aslist = as_list_lookup (argv[3]->arg); if (aslist) as_list_show (vty, aslist); diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f775bd048f..c4c3b0f62a 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -33,6 +33,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "workqueue.h" #include "queue.h" #include "filter.h" +#include "command.h" #include "lib/json.h" #include "bgpd/bgpd.h" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5c1df6715c..4721a2e8e1 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -360,7 +360,7 @@ DEFUN (vpnv4_network, "BGP tag\n" "tag value\n") { - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], NULL); + return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, NULL); } DEFUN (vpnv4_network_route_map, @@ -375,7 +375,7 @@ DEFUN (vpnv4_network_route_map, "route map\n" "route map name\n") { - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], argv[3]); + return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, argv[7]->arg); } /* For testing purpose, static route of MPLS-VPN. */ @@ -390,7 +390,7 @@ DEFUN (no_vpnv4_network, "BGP tag\n" "tag value\n") { - return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2]); + return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[2]->arg, argv[4]->arg, argv[6]->arg); } static int @@ -794,7 +794,7 @@ DEFUN (show_bgp_ipv4_vpn_rd, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -817,7 +817,7 @@ DEFUN (show_bgp_ipv6_vpn_rd, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (!ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -852,7 +852,7 @@ DEFUN (show_ip_bgp_vpnv4_rd, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -888,7 +888,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -915,7 +915,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, int ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[6]->arg, &su); if (ret < 0) { if (uj) @@ -927,7 +927,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -970,7 +970,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, struct prefix_rd prd; u_char uj = use_json(argc, argv); - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { if (uj) @@ -986,7 +986,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, return CMD_WARNING; } - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[7]->arg, &su); if (ret < 0) { if (uj) @@ -998,7 +998,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1039,7 +1039,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, union sockunion su; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[6]->arg, &su); if (ret < 0) { if (uj) @@ -1051,7 +1051,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -1093,7 +1093,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, union sockunion su; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[7]->arg, &su); if (ret < 0) { if (uj) @@ -1105,7 +1105,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -1124,7 +1124,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { if (uj) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 19f5428d88..caecd80e6e 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -520,7 +520,7 @@ DEFUN (show_ip_bgp_instance_nexthop, BGP_INSTANCE_HELP_STR "BGP nexthop table\n") { - return show_ip_bgp_nexthop_table (vty, argv[1], 0); + return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 0); } DEFUN (show_ip_bgp_instance_all_nexthop, @@ -545,7 +545,7 @@ DEFUN (show_ip_bgp_instance_nexthop_detail, BGP_INSTANCE_HELP_STR "BGP nexthop table\n") { - return show_ip_bgp_nexthop_table (vty, argv[1], 1); + return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 1); } void diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 67ea246c1e..2472511fe7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -20,7 +20,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include -#include "lib/json.h" #include "prefix.h" #include "linklist.h" #include "memory.h" @@ -37,6 +36,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "workqueue.h" #include "queue.h" #include "memory.h" +#include "lib/json.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" @@ -4265,7 +4265,7 @@ DEFUN (bgp_table_map, "Name of the route map\n") { return bgp_table_map_set (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); + bgp_node_afi (vty), bgp_node_safi (vty), argv[1]->arg); } DEFUN (no_bgp_table_map, no_bgp_table_map_cmd, @@ -4274,7 +4274,7 @@ DEFUN (no_bgp_table_map, "Name of the route map\n") { return bgp_table_map_unset (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[0]); + bgp_node_afi (vty), bgp_node_safi (vty), argv[2]->arg); } DEFUN (bgp_network, @@ -4283,7 +4283,7 @@ DEFUN (bgp_network, "Specify a network to announce via BGP\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_static_set (vty, vty->index, argv[0], + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP, bgp_node_safi (vty), NULL, 0); } @@ -4295,8 +4295,8 @@ DEFUN (bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[0], - AFI_IP, bgp_node_safi (vty), argv[1], 0); + return bgp_static_set (vty, vty->index, argv[1]->arg, + AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (bgp_network_backdoor, @@ -4306,7 +4306,7 @@ DEFUN (bgp_network_backdoor, "IP prefix /, e.g., 35.0.0.0/8\n" "Specify a BGP backdoor route\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -4321,7 +4321,7 @@ DEFUN (bgp_network_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4345,7 +4345,7 @@ DEFUN (bgp_network_mask_route_map, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4353,7 +4353,7 @@ DEFUN (bgp_network_mask_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[2], 0); + AFI_IP, bgp_node_safi (vty), argv[5]->arg, 0); } DEFUN (bgp_network_mask_backdoor, @@ -4368,7 +4368,7 @@ DEFUN (bgp_network_mask_backdoor, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4388,7 +4388,7 @@ DEFUN (bgp_network_mask_natural, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4410,7 +4410,7 @@ DEFUN (bgp_network_mask_natural_route_map, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4418,7 +4418,7 @@ DEFUN (bgp_network_mask_natural_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[1], 0); + AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (bgp_network_mask_natural_backdoor, @@ -4431,7 +4431,7 @@ DEFUN (bgp_network_mask_natural_backdoor, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4449,7 +4449,7 @@ DEFUN (no_bgp_network, "Specify a network to announce via BGP\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_static_unset (vty, vty->index, argv[0], AFI_IP, + return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); } @@ -4482,7 +4482,7 @@ DEFUN (no_bgp_network_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, argv[4]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4524,7 +4524,7 @@ DEFUN (no_bgp_network_mask_natural, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], NULL, prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4559,7 +4559,7 @@ DEFUN (ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix /\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP6, bgp_node_safi(vty), + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, bgp_node_safi(vty), NULL, 0); } @@ -4571,8 +4571,8 @@ DEFUN (ipv6_bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[0], AFI_IP6, - bgp_node_safi (vty), argv[1], 0); + return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, + bgp_node_safi (vty), argv[3]->arg, 0); } DEFUN (no_ipv6_bgp_network, @@ -4582,7 +4582,7 @@ DEFUN (no_ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix /\n") { - return bgp_static_unset (vty, vty->index, argv[0], AFI_IP6, bgp_node_safi(vty)); + return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP6, bgp_node_safi(vty)); } ALIAS (no_ipv6_bgp_network, @@ -5219,7 +5219,7 @@ DEFUN (aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), 0, 0); + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), 0, 0); } DEFUN (aggregate_address_mask, @@ -5232,7 +5232,7 @@ DEFUN (aggregate_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5251,7 +5251,7 @@ DEFUN (aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, 0); } @@ -5266,7 +5266,7 @@ DEFUN (aggregate_address_mask_summary_only, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5285,7 +5285,7 @@ DEFUN (aggregate_address_as_set, "Aggregate prefix\n" "Generate AS set path information\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), 0, AGGREGATE_AS_SET); } @@ -5300,7 +5300,7 @@ DEFUN (aggregate_address_mask_as_set, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5321,7 +5321,7 @@ DEFUN (aggregate_address_as_set_summary, "Generate AS set path information\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP, bgp_node_safi (vty), + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } @@ -5345,7 +5345,7 @@ DEFUN (aggregate_address_mask_as_set_summary, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); if (! ret) { @@ -5373,7 +5373,7 @@ DEFUN (no_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP, bgp_node_safi (vty)); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); } ALIAS (no_aggregate_address, @@ -5421,7 +5421,7 @@ DEFUN (no_aggregate_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[2]->arg, argv[3]->arg, prefix_str); if (! ret) { @@ -5477,7 +5477,7 @@ DEFUN (ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP6, SAFI_UNICAST, 0, 0); + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); } DEFUN (ipv6_aggregate_address_summary_only, @@ -5487,7 +5487,7 @@ DEFUN (ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, AGGREGATE_SUMMARY_ONLY, 0); } @@ -5498,7 +5498,7 @@ DEFUN (no_ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP6, SAFI_UNICAST); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } DEFUN (no_ipv6_aggregate_address_summary_only, @@ -5509,7 +5509,7 @@ DEFUN (no_ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_unset (vty, argv[0], AFI_IP6, SAFI_UNICAST); + return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } ALIAS (ipv6_aggregate_address, @@ -7947,7 +7947,7 @@ DEFUN (show_ip_bgp_ipv4, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -7973,7 +7973,7 @@ DEFUN (show_ip_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_route_pathtype, @@ -7989,10 +7989,10 @@ DEFUN (show_ip_bgp_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_safi_route_pathtype, @@ -8010,16 +8010,16 @@ DEFUN (show_bgp_ipv4_safi_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_prefix, @@ -8031,7 +8031,7 @@ DEFUN (show_bgp_ipv4_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_route, @@ -8043,7 +8043,7 @@ DEFUN (show_bgp_ipv6_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_prefix, @@ -8055,7 +8055,7 @@ DEFUN (show_bgp_ipv6_prefix, "IPv6 prefix /\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); } DEFUN (show_ip_bgp_ipv4_route, @@ -8072,10 +8072,10 @@ DEFUN (show_ip_bgp_ipv4_route, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } ALIAS (show_ip_bgp_ipv4_route, @@ -8100,7 +8100,7 @@ DEFUN (show_ip_bgp_vpnv4_all_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv4_vpn_route, @@ -8113,7 +8113,7 @@ DEFUN (show_bgp_ipv4_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_route, @@ -8126,7 +8126,7 @@ DEFUN (show_bgp_ipv6_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv4_vpn_rd_route, @@ -8144,13 +8144,13 @@ DEFUN (show_bgp_ipv4_vpn_rd_route, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_rd_route, @@ -8168,13 +8168,13 @@ DEFUN (show_bgp_ipv6_vpn_rd_route, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_route, @@ -8193,13 +8193,13 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, struct prefix_rd prd; u_char uj= use_json(argc, argv); - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); } DEFUN (show_ip_bgp_prefix, @@ -8211,7 +8211,7 @@ DEFUN (show_ip_bgp_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_prefix_pathtype, @@ -8226,10 +8226,10 @@ DEFUN (show_ip_bgp_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } DEFUN (show_ip_bgp_ipv4_prefix, @@ -8246,10 +8246,10 @@ DEFUN (show_ip_bgp_ipv4_prefix, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } ALIAS (show_ip_bgp_ipv4_prefix, @@ -8279,16 +8279,16 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_ip_bgp_ipv4_prefix_pathtype, @@ -8315,7 +8315,7 @@ DEFUN (show_ip_bgp_vpnv4_all_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_prefix, @@ -8333,13 +8333,13 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_view, @@ -8354,10 +8354,10 @@ DEFUN (show_ip_bgp_view, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[4]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8389,7 +8389,7 @@ DEFUN (show_ip_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_route_pathtype, @@ -8406,10 +8406,10 @@ DEFUN (show_ip_bgp_instance_route_pathtype, { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_ip_bgp_instance_prefix, @@ -8422,7 +8422,7 @@ DEFUN (show_ip_bgp_instance_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_prefix_pathtype, @@ -8438,10 +8438,10 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[6]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } #ifdef HAVE_IPV6 @@ -8475,7 +8475,7 @@ DEFUN (show_bgp_ipv6_safi, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[3]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -8512,7 +8512,7 @@ DEFUN (show_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_route, @@ -8527,10 +8527,10 @@ DEFUN (show_bgp_ipv6_safi_route, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } DEFUN (show_bgp_route_pathtype, @@ -8544,10 +8544,10 @@ DEFUN (show_bgp_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_route_pathtype, @@ -8575,16 +8575,16 @@ DEFUN (show_bgp_ipv6_safi_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8598,7 +8598,7 @@ DEFUN (show_ipv6_bgp_route, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_prefix, @@ -8609,7 +8609,7 @@ DEFUN (show_bgp_prefix, "IPv6 prefix /\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_prefix, @@ -8624,10 +8624,10 @@ DEFUN (show_bgp_ipv6_safi_prefix, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } DEFUN (show_bgp_prefix_pathtype, @@ -8641,10 +8641,10 @@ DEFUN (show_bgp_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_prefix_pathtype, @@ -8672,16 +8672,16 @@ DEFUN (show_bgp_ipv6_safi_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[2], "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8695,7 +8695,7 @@ DEFUN (show_ipv6_bgp_prefix, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_view, @@ -8709,10 +8709,10 @@ DEFUN (show_bgp_view, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8751,7 +8751,7 @@ DEFUN (show_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } ALIAS (show_bgp_instance_route, @@ -8776,10 +8776,10 @@ DEFUN (show_bgp_instance_route_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_instance_route_pathtype, @@ -8803,7 +8803,7 @@ DEFUN (show_bgp_instance_prefix, "IPv6 prefix /\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } ALIAS (show_bgp_instance_prefix, @@ -8828,10 +8828,10 @@ DEFUN (show_bgp_instance_prefix_pathtype, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[3], "b", 1) == 0) - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[5]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } ALIAS (show_bgp_instance_prefix_pathtype, @@ -8855,7 +8855,7 @@ DEFUN (show_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -8878,7 +8878,7 @@ DEFUN (show_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -8901,7 +8901,7 @@ DEFUN (show_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_route_map (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -8925,7 +8925,7 @@ DEFUN (show_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[1], argv[2], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, argv[3]->arg, argv[5]->arg, 0, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_instance_community_list, @@ -8948,7 +8948,7 @@ DEFUN (show_bgp_instance_prefix_longer, "IPv6 prefix /\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[1], argv[2], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -8987,7 +8987,7 @@ DEFUN (show_ipv6_mbgp_route, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } /* old command */ @@ -9001,13 +9001,13 @@ DEFUN (show_ipv6_mbgp_prefix, "JavaScript Object Notation\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } #endif static int -bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, +bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, safi_t safi, enum bgp_show_type type) { int i; @@ -9025,12 +9025,12 @@ bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, buffer_putc (b, ' '); else { - if ((strcmp (argv[i], "unicast") == 0) || (strcmp (argv[i], "multicast") == 0)) + if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) continue; first = 1; } - buffer_putstr (b, argv[i]); + buffer_putstr (b, argv[i]->arg); } buffer_putc (b, '\0'); @@ -9041,7 +9041,7 @@ bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi, XFREE(MTYPE_TMP, regstr); if (! regex) { - vty_out (vty, "Can't compile regexp %s%s", argv[0], + vty_out (vty, "Can't compile regexp %s%s", argv[0]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -9101,7 +9101,7 @@ DEFUN (show_ip_bgp_ipv4_regexp, "Display routes matching the AS path regular expression\n" "A regular-expression to match the BGP AS paths\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_MULTICAST, bgp_show_type_regexp); @@ -9196,7 +9196,7 @@ DEFUN (show_ip_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9210,7 +9210,7 @@ DEFUN (show_ip_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9224,7 +9224,7 @@ DEFUN (show_ip_bgp_flap_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_list); } @@ -9251,11 +9251,11 @@ DEFUN (show_ip_bgp_ipv4_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_list); - return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9268,7 +9268,7 @@ DEFUN (show_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9292,7 +9292,7 @@ DEFUN (show_ipv6_bgp_prefix_list, "IPv6 prefix-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9307,7 +9307,7 @@ DEFUN (show_ipv6_mbgp_prefix_list, "IPv6 prefix-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_list); } #endif /* HAVE_IPV6 */ @@ -9345,7 +9345,7 @@ DEFUN (show_ip_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9359,7 +9359,7 @@ DEFUN (show_ip_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9373,7 +9373,7 @@ DEFUN (show_ip_bgp_flap_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_filter_list); } @@ -9400,11 +9400,11 @@ DEFUN (show_ip_bgp_ipv4_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_filter_list); - return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9417,7 +9417,7 @@ DEFUN (show_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9441,7 +9441,7 @@ DEFUN (show_ipv6_bgp_filter_list, "Regular expression access list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9456,7 +9456,7 @@ DEFUN (show_ipv6_mbgp_filter_list, "Regular expression access list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_filter_list); } #endif /* HAVE_IPV6 */ @@ -9486,7 +9486,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, "Display detailed information about dampening\n" "Display detail of configured dampening parameters\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_MULTICAST); return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST); @@ -9505,7 +9505,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, "Display detailed information about dampening\n" "Display flap statistics of routes\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_flap_statistics, NULL, 0); @@ -9525,7 +9525,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, "Display detailed information about dampening\n" "Display paths suppressed due to dampening\n") { - if (strncmp(argv[0], "m", 1) == 0) + if (strncmp(argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_dampend_paths, NULL, 0); @@ -9567,7 +9567,7 @@ DEFUN (show_ip_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9581,7 +9581,7 @@ DEFUN (show_ip_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9595,7 +9595,7 @@ DEFUN (show_ip_bgp_flap_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_route_map); } @@ -9622,11 +9622,11 @@ DEFUN (show_ip_bgp_ipv4_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_route_map); - return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9638,7 +9638,7 @@ DEFUN (show_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9697,7 +9697,7 @@ DEFUN (show_ip_bgp_ipv4_cidr_only, "Address Family modifier\n" "Display only routes with non-natural netmasks\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_cidr_only, NULL, 0); @@ -9728,7 +9728,7 @@ DEFUN (show_ip_bgp_ipv4_community_all, "Address Family modifier\n" "Display routes matching the communities\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_community_all, NULL, 0); @@ -9787,7 +9787,7 @@ DEFUN (show_ipv6_mbgp_community_all, static int bgp_show_community (struct vty *vty, const char *view_name, int argc, - const char **argv, int exact, afi_t afi, safi_t safi) + struct cmd_token **argv, int exact, afi_t afi, safi_t safi) { struct community *com; struct buffer *b; @@ -9823,12 +9823,12 @@ bgp_show_community (struct vty *vty, const char *view_name, int argc, buffer_putc (b, ' '); else { - if ((strcmp (argv[i], "unicast") == 0) || (strcmp (argv[i], "multicast") == 0)) + if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) continue; first = 1; } - buffer_putstr (b, argv[i]); + buffer_putstr (b, argv[i]->arg); } buffer_putc (b, '\0'); @@ -9938,7 +9938,7 @@ DEFUN (show_ip_bgp_ipv4_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); @@ -10030,15 +10030,15 @@ DEFUN (show_bgp_instance_afi_safi_community_all, struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0); } @@ -10061,9 +10061,9 @@ DEFUN (show_bgp_instance_afi_safi_community, int afi; int safi; - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_community (vty, argv[1], argc-4, &argv[4], 0, afi, safi); + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + return bgp_show_community (vty, argv[3]->arg, argc, argv, 0, afi, safi); } ALIAS (show_bgp_instance_afi_safi_community, @@ -10233,7 +10233,7 @@ DEFUN (show_ip_bgp_ipv4_community_exact, "Do not export to next AS (well-known community)\n" "Exact match of the communities") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); @@ -10972,7 +10972,7 @@ DEFUN (show_ip_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_instance_community_list, @@ -10986,7 +10986,7 @@ DEFUN (show_ip_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[1], argv[2], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, argv[4]->arg, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list, @@ -11002,10 +11002,10 @@ DEFUN (show_ip_bgp_ipv4_community_list, "community-list number\n" "community-list name\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_MULTICAST); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_community_list_exact, @@ -11019,7 +11019,7 @@ DEFUN (show_ip_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list_exact, @@ -11036,10 +11036,10 @@ DEFUN (show_ip_bgp_ipv4_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_MULTICAST); + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_UNICAST); } #ifdef HAVE_IPV6 @@ -11052,7 +11052,7 @@ DEFUN (show_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[3]->arg, 0, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_community_list, @@ -11076,7 +11076,7 @@ DEFUN (show_ipv6_bgp_community_list, "community-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11090,7 +11090,7 @@ DEFUN (show_ipv6_mbgp_community_list, "community-list name\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 0, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_MULTICAST); } DEFUN (show_bgp_community_list_exact, @@ -11103,7 +11103,7 @@ DEFUN (show_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[3]->arg, 1, AFI_IP6, SAFI_UNICAST); } ALIAS (show_bgp_community_list_exact, @@ -11129,7 +11129,7 @@ DEFUN (show_ipv6_bgp_community_list_exact, "Exact match of the communities\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11144,7 +11144,7 @@ DEFUN (show_ipv6_mbgp_community_list_exact, "Exact match of the communities\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[0], 1, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_MULTICAST); } #endif /* HAVE_IPV6 */ @@ -11186,7 +11186,7 @@ DEFUN (show_ip_bgp_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11200,7 +11200,7 @@ DEFUN (show_ip_bgp_instance_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11214,7 +11214,7 @@ DEFUN (show_ip_bgp_flap_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_longer); } @@ -11241,11 +11241,11 @@ DEFUN (show_ip_bgp_ipv4_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, + if (strncmp (argv[4]->arg, "m", 1) == 0) + return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_longer); - return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11258,7 +11258,7 @@ DEFUN (show_ip_bgp_flap_address, "Display flap statistics of routes\n" "Network in the BGP routing table to display\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_address); } @@ -11281,7 +11281,7 @@ DEFUN (show_ip_bgp_flap_prefix, "Display flap statistics of routes\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix); } @@ -11304,7 +11304,7 @@ DEFUN (show_bgp_prefix_longer, "IPv6 prefix /\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11328,7 +11328,7 @@ DEFUN (show_ipv6_bgp_prefix_longer, "Display route and more specific routes\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11343,7 +11343,7 @@ DEFUN (show_ipv6_mbgp_prefix_longer, "Display route and more specific routes\n") { bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_longer); } #endif /* HAVE_IPV6 */ @@ -11758,7 +11758,7 @@ DEFUN (show_bgp_statistics, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[0], argv[1]); + return bgp_table_stats_vty (vty, NULL, argv[2]->arg, argv[3]->arg); } DEFUN (show_bgp_statistics_view, @@ -11775,7 +11775,7 @@ DEFUN (show_bgp_statistics_view, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[1], argv[2]); + return bgp_table_stats_vty (vty, NULL, argv[3]->arg, argv[4]->arg); } enum bgp_pcounts @@ -11985,7 +11985,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12009,7 +12009,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12032,7 +12032,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12056,7 +12056,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12082,11 +12082,11 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MULTICAST, uj); return bgp_peer_counts (vty, peer, AFI_IP, SAFI_UNICAST, uj); @@ -12111,7 +12111,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12374,10 +12374,10 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if (argc == 4 || (argc == 3 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12403,14 +12403,14 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 2 && argv[1] && strcmp(argv[1], "json") != 0) + if ((argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0) || (argc == 3)) - rmap_name = argv[1]; + rmap_name = argv[6]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12461,14 +12461,14 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 4) || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - rmap_name = argv[2]; + if ((argc == 4) || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) + rmap_name = argv[8]->arg; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); @@ -12508,10 +12508,10 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if (argc == 4 || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -12550,13 +12550,13 @@ DEFUN (show_bgp_neighbor_advertised_route, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (!peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + rmap_name = argv[5]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12606,7 +12606,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -12631,7 +12631,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); if (! peer) return CMD_WARNING; @@ -12655,7 +12655,7 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -12694,13 +12694,13 @@ DEFUN (show_ip_bgp_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) + rmap_name = argv[6]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); } @@ -12752,14 +12752,14 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - rmap_name = argv[2]; + if (argc == 4 || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) + rmap_name = argv[8]->arg; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); @@ -12805,14 +12805,14 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[4], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[7]->arg, uj); if (! peer) return CMD_WARNING; - afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - in = (strncmp (argv[5], "r", 1) == 0) ? 1 : 0; + afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + in = (strncmp (argv[8]->arg, "r", 1) == 0) ? 1 : 0; return peer_adj_routes (vty, peer, afi, safi, in, NULL, uj); } @@ -12837,10 +12837,10 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[4]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[0]); + peer = peer_lookup_by_conf_if (NULL, argv[4]->arg); if (! peer) { if (uj) @@ -12850,13 +12850,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[0]); + json_object_string_add(json_sub, "warningCause", argv[4]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[4]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -12927,10 +12927,10 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[6]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[1]); + peer = peer_lookup_by_conf_if (NULL, argv[6]->arg); if (! peer) { if (uj) @@ -12940,13 +12940,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[1]); + json_object_string_add(json_sub, "warningCause", argv[6]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[6]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -12969,7 +12969,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, } } - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) { sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_MULTICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); @@ -13037,13 +13037,13 @@ DEFUN (show_bgp_neighbor_received_routes, const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[1] && strcmp(argv[1], "json") != 0)) - rmap_name = argv[1]; + if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + rmap_name = argv[5]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, rmap_name, uj); } @@ -13080,10 +13080,10 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[3]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[0]); + peer = peer_lookup_by_conf_if (NULL, argv[3]->arg); if (! peer) { if (uj) @@ -13093,13 +13093,13 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[0]); + json_object_string_add(json_sub, "warningCause", argv[3]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13192,7 +13192,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13222,7 +13222,7 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, u_char uj = use_json(argc, argv); /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp == NULL) { if (uj) @@ -13234,14 +13234,14 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_object_free(json_no); } else - vty_out (vty, "Can't find BGP instance %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } - ret = str2sockunion (argv[2], &su); + ret = str2sockunion (argv[5]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[2]); + peer = peer_lookup_by_conf_if (bgp, argv[5]->arg); if (! peer) { if (uj) @@ -13251,13 +13251,13 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[2]); + json_object_string_add(json_sub, "warningCause", argv[5]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[2], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[5]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13346,7 +13346,7 @@ DEFUN (show_ip_bgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13371,7 +13371,7 @@ DEFUN (show_ip_bgp_instance_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); if (! peer) return CMD_WARNING; @@ -13395,7 +13395,7 @@ DEFUN (show_ip_bgp_neighbor_flap, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13419,7 +13419,7 @@ DEFUN (show_ip_bgp_neighbor_damp, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13446,11 +13446,11 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_MULTICAST, bgp_show_type_neighbor, uj); @@ -13475,7 +13475,7 @@ DEFUN (show_bgp_instance_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); if (! peer) return CMD_WARNING; @@ -13513,11 +13513,11 @@ DEFUN (show_bgp_instance_neighbor_damp, struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[3] && strcmp(argv[3], "json") == 0) - || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) + || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13556,11 +13556,11 @@ DEFUN (show_bgp_instance_neighbor_flap, struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[3] && strcmp(argv[3], "json") == 0) - || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0)) - peer = peer_lookup_in_view (vty, argv[1], argv[2], uj); + if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) + || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[1], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13598,7 +13598,7 @@ DEFUN (show_bgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); if (! peer) return CMD_WARNING; @@ -13651,7 +13651,7 @@ DEFUN (ipv6_mbgp_neighbor_routes, struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[0], uj); + peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); if (! peer) return CMD_WARNING; @@ -13913,9 +13913,9 @@ DEFUN (bgp_distance, bgp = vty->index; - bgp->distance_ebgp = atoi (argv[0]); - bgp->distance_ibgp = atoi (argv[1]); - bgp->distance_local = atoi (argv[2]); + bgp->distance_ebgp = atoi (argv[2]->arg); + bgp->distance_ibgp = atoi (argv[3]->arg); + bgp->distance_local = atoi (argv[4]->arg); return CMD_SUCCESS; } @@ -13953,7 +13953,7 @@ DEFUN (bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_set (vty, argv[0], argv[1], NULL); + bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, NULL); return CMD_SUCCESS; } @@ -13965,7 +13965,7 @@ DEFUN (no_bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_unset (vty, argv[0], argv[1], NULL); + bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, NULL); return CMD_SUCCESS; } @@ -13977,7 +13977,7 @@ DEFUN (bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_set (vty, argv[0], argv[1], argv[2]); + bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg); return CMD_SUCCESS; } @@ -13990,7 +13990,7 @@ DEFUN (no_bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_unset (vty, argv[0], argv[1], argv[2]); + bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg); return CMD_SUCCESS; } @@ -14012,14 +14012,14 @@ DEFUN (bgp_damp_set, if (argc == 4) { - half = atoi (argv[0]) * 60; - reuse = atoi (argv[1]); - suppress = atoi (argv[2]); - max = atoi (argv[3]) * 60; + half = atoi (argv[2]->arg) * 60; + reuse = atoi (argv[3]->arg); + suppress = atoi (argv[4]->arg); + max = atoi (argv[5]->arg) * 60; } else if (argc == 1) { - half = atoi (argv[0]) * 60; + half = atoi (argv[2]->arg) * 60; max = 4 * half; } @@ -14246,7 +14246,7 @@ DEFUN (clear_ip_bgp_dampening_prefix, "Clear route flap dampening information\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_clear_damp_route (vty, NULL, argv[0], AFI_IP, + return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -14259,7 +14259,7 @@ DEFUN (clear_ip_bgp_dampening_address, "Clear route flap dampening information\n" "Network to clear damping information\n") { - return bgp_clear_damp_route (vty, NULL, argv[0], AFI_IP, + return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0); } @@ -14276,7 +14276,7 @@ DEFUN (clear_ip_bgp_dampening_address_mask, int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[0], argv[1], prefix_str); + ret = netmask_str2prefix_str (argv[4]->arg, argv[5]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index fea9ae6b18..286975f4af 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3000,7 +3000,7 @@ DEFUN (match_peer, "IP address of peer\n" "IPv6 address of peer\n") { - return bgp_route_match_add (vty, vty->index, "peer", argv[0], + return bgp_route_match_add (vty, vty->index, "peer", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3022,11 +3022,7 @@ DEFUN (no_match_peer, MATCH_STR "Match peer address\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "peer", NULL, - RMAP_EVENT_MATCH_DELETED); - - return bgp_route_match_delete (vty, vty->index, "peer", argv[0], + return bgp_route_match_delete (vty, vty->index, "peer", argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3057,7 +3053,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip address", argv[0], + return bgp_route_match_add (vty, vty->index, "ip address", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3069,11 +3065,7 @@ DEFUN (no_match_ip_address, IP_STR "Match address of route\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "ip address", NULL, - RMAP_EVENT_FILTER_DELETED); - - return bgp_route_match_delete (vty, vty->index, "ip address", argv[0], + return bgp_route_match_delete (vty, vty->index, "ip address", argv[4]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -3098,7 +3090,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[0], + return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3110,11 +3102,7 @@ DEFUN (no_match_ip_next_hop, IP_STR "Match next-hop address of route\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL, - RMAP_EVENT_FILTER_DELETED); - - return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[0], + return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -3138,7 +3126,7 @@ DEFUN (match_probability, "Match portion of routes defined by percentage value\n" "Percentage of routes\n") { - return bgp_route_match_add (vty, vty->index, "probability", argv[0], + return bgp_route_match_add (vty, vty->index, "probability", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3149,7 +3137,7 @@ DEFUN (no_match_probability, MATCH_STR "Match portion of routes defined by percentage value\n") { - return bgp_route_match_delete (vty, vty->index, "probability", argc ? argv[0] : NULL, + return bgp_route_match_delete (vty, vty->index, "probability", argv[2]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3173,7 +3161,7 @@ DEFUN (match_ip_route_source, "IP access-list number (expanded range)\n" "IP standard access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip route-source", argv[0], + return bgp_route_match_add (vty, vty->index, "ip route-source", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3185,12 +3173,8 @@ DEFUN (no_match_ip_route_source, IP_STR "Match advertising source address of route\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "ip route-source", NULL, - RMAP_EVENT_FILTER_DELETED); - return bgp_route_match_delete (vty, vty->index, "ip route-source", - argv[0], RMAP_EVENT_FILTER_DELETED); + argv[4]->arg, RMAP_EVENT_FILTER_DELETED); } ALIAS (no_match_ip_route_source, @@ -3214,7 +3198,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return bgp_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_address_prefix_list, @@ -3227,8 +3211,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n") { return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", - argc == 0 ? NULL : argv[0], - RMAP_EVENT_PLIST_DELETED); + argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } ALIAS (no_match_ip_address_prefix_list, @@ -3251,7 +3234,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -3264,8 +3247,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n") { return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argc == 0 ? NULL : argv[0], - RMAP_EVENT_PLIST_DELETED); + argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -3288,7 +3270,7 @@ DEFUN (match_ip_route_source_prefix_list, "IP prefix-list name\n") { return bgp_route_match_add (vty, vty->index, "ip route-source prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_route_source_prefix_list, @@ -3301,8 +3283,7 @@ DEFUN (no_match_ip_route_source_prefix_list, "Match entries of prefix-lists\n") { return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list", - argc == 0 ? NULL : argv[0], - RMAP_EVENT_PLIST_DELETED); + argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } ALIAS (no_match_ip_route_source_prefix_list, @@ -3322,7 +3303,7 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return bgp_route_match_add (vty, vty->index, "metric", argv[0], + return bgp_route_match_add (vty, vty->index, "metric", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3334,7 +3315,7 @@ DEFUN (no_match_metric, "Match metric of route\n") { return bgp_route_match_delete (vty, vty->index, "metric", - argc == 0 ? NULL : argv[0], + argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3353,7 +3334,7 @@ DEFUN (match_local_pref, "Match local-preference of route\n" "Metric value\n") { - return bgp_route_match_add (vty, vty->index, "local-preference", argv[0], + return bgp_route_match_add (vty, vty->index, "local-preference", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3365,10 +3346,7 @@ DEFUN (no_match_local_pref, "Match local preference of route\n") { return bgp_route_match_delete (vty, vty->index, "local-preference", - argc == 0 ? NULL : argv[0], - RMAP_EVENT_MATCH_DELETED); - - return bgp_route_match_delete (vty, vty->index, "local-preference", argv[0], + argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3389,7 +3367,7 @@ DEFUN (match_community, "Community-list number (expanded)\n" "Community-list name\n") { - return bgp_route_match_add (vty, vty->index, "community", argv[0], + return bgp_route_match_add (vty, vty->index, "community", argv[2]->arg, RMAP_EVENT_CLIST_ADDED); } @@ -3407,9 +3385,9 @@ DEFUN (match_community_exact, char *argstr; argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[0]) + strlen ("exact-match") + 2); + strlen (argv[2]->arg) + strlen ("exact-match") + 2); - sprintf (argstr, "%s exact-match", argv[0]); + sprintf (argstr, "%s exact-match", argv[2]->arg); ret = bgp_route_match_add (vty, vty->index, "community", argstr, RMAP_EVENT_CLIST_ADDED); @@ -3460,7 +3438,7 @@ DEFUN (match_ecommunity, "Extended community-list number (expanded)\n" "Extended community-list name\n") { - return bgp_route_match_add (vty, vty->index, "extcommunity", argv[0], + return bgp_route_match_add (vty, vty->index, "extcommunity", argv[2]->arg, RMAP_EVENT_ECLIST_ADDED); } @@ -3492,7 +3470,7 @@ DEFUN (match_aspath, "Match BGP AS path list\n" "AS path access-list name\n") { - return bgp_route_match_add (vty, vty->index, "as-path", argv[0], + return bgp_route_match_add (vty, vty->index, "as-path", argv[2]->arg, RMAP_EVENT_ASLIST_ADDED); } @@ -3524,13 +3502,13 @@ DEFUN (match_origin, "local IGP\n" "unknown heritage\n") { - if (strncmp (argv[0], "igp", 2) == 0) + if (strncmp (argv[2]->arg, "igp", 2) == 0) return bgp_route_match_add (vty, vty->index, "origin", "igp", RMAP_EVENT_MATCH_ADDED); - if (strncmp (argv[0], "egp", 1) == 0) + if (strncmp (argv[2]->arg, "egp", 1) == 0) return bgp_route_match_add (vty, vty->index, "origin", "egp", RMAP_EVENT_MATCH_ADDED); - if (strncmp (argv[0], "incomplete", 2) == 0) + if (strncmp (argv[2]->arg, "incomplete", 2) == 0) return bgp_route_match_add (vty, vty->index, "origin", "incomplete", RMAP_EVENT_MATCH_ADDED); @@ -3565,7 +3543,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return bgp_route_match_add (vty, vty->index, "interface", argv[0], + return bgp_route_match_add (vty, vty->index, "interface", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3576,11 +3554,7 @@ DEFUN (no_match_interface, MATCH_STR "Match first hop interface of route\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "interface", NULL, - RMAP_EVENT_MATCH_DELETED); - - return bgp_route_match_delete (vty, vty->index, "interface", argv[0], + return bgp_route_match_delete (vty, vty->index, "interface", argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3599,7 +3573,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return bgp_route_match_add (vty, vty->index, "tag", argv[0], + return bgp_route_match_add (vty, vty->index, "tag", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3610,11 +3584,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - if (argc == 0) - return bgp_route_match_delete (vty, vty->index, "tag", NULL, - RMAP_EVENT_MATCH_DELETED); - - return bgp_route_match_delete (vty, vty->index, "tag", argv[0], + return bgp_route_match_delete (vty, vty->index, "tag", argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3638,7 +3608,7 @@ DEFUN (set_ip_nexthop, union sockunion su; int ret; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[3]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -3652,7 +3622,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[0]); + return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg); } DEFUN (set_ip_nexthop_peer, @@ -3684,10 +3654,7 @@ DEFUN (no_set_ip_nexthop, SET_STR "Next hop address\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); - - return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[0]); + return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } ALIAS (no_set_ip_nexthop, @@ -3715,7 +3682,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return bgp_route_set_add (vty, vty->index, "metric", argv[0]); + return bgp_route_set_add (vty, vty->index, "metric", argv[2]->arg); } ALIAS (set_metric, @@ -3741,10 +3708,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "metric", NULL); - - return bgp_route_set_delete (vty, vty->index, "metric", argv[0]); + return bgp_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, @@ -3762,7 +3726,7 @@ DEFUN (set_local_pref, "BGP local preference path attribute\n" "Preference value\n") { - return bgp_route_set_add (vty, vty->index, "local-preference", argv[0]); + return bgp_route_set_add (vty, vty->index, "local-preference", argv[2]->arg); } DEFUN (no_set_local_pref, @@ -3772,10 +3736,7 @@ DEFUN (no_set_local_pref, SET_STR "BGP local preference path attribute\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "local-preference", NULL); - - return bgp_route_set_delete (vty, vty->index, "local-preference", argv[0]); + return bgp_route_set_delete (vty, vty->index, "local-preference", argv[3]->arg); } ALIAS (no_set_local_pref, @@ -3793,7 +3754,7 @@ DEFUN (set_weight, "BGP weight for routing table\n" "Weight value\n") { - return bgp_route_set_add (vty, vty->index, "weight", argv[0]); + return bgp_route_set_add (vty, vty->index, "weight", argv[2]->arg); } DEFUN (no_set_weight, @@ -3803,10 +3764,7 @@ DEFUN (no_set_weight, SET_STR "BGP weight for routing table\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "weight", NULL); - - return bgp_route_set_delete (vty, vty->index, "weight", argv[0]); + return bgp_route_set_delete (vty, vty->index, "weight", argv[3]->arg); } ALIAS (no_set_weight, @@ -3855,9 +3813,6 @@ DEFUN (no_set_aspath_prepend, int ret; char *str; - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "as-path prepend", NULL); - str = argv_concat (argv, argc, 0); ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str); XFREE (MTYPE_TMP, str); @@ -3901,9 +3856,6 @@ DEFUN (no_set_aspath_exclude, int ret; char *str; - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "as-path exclude", NULL); - str = argv_concat (argv, argc, 0); ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str); XFREE (MTYPE_TMP, str); @@ -3939,7 +3891,7 @@ DEFUN (set_community, for (i = 0; i < argc; i++) { - if (strncmp (argv[i], "additive", strlen (argv[i])) == 0) + if (strncmp (argv[i]->arg, "additive", strlen (argv[i]->arg)) == 0) { additive = 1; continue; @@ -3950,29 +3902,29 @@ DEFUN (set_community, else first = 1; - if (strncmp (argv[i], "internet", strlen (argv[i])) == 0) + if (strncmp (argv[i]->arg, "internet", strlen (argv[i]->arg)) == 0) { buffer_putstr (b, "internet"); continue; } - if (strncmp (argv[i], "local-AS", strlen (argv[i])) == 0) + if (strncmp (argv[i]->arg, "local-AS", strlen (argv[i]->arg)) == 0) { buffer_putstr (b, "local-AS"); continue; } - if (strncmp (argv[i], "no-a", strlen ("no-a")) == 0 - && strncmp (argv[i], "no-advertise", strlen (argv[i])) == 0) + if (strncmp (argv[i]->arg, "no-a", strlen ("no-a")) == 0 + && strncmp (argv[i]->arg, "no-advertise", strlen (argv[i]->arg)) == 0) { buffer_putstr (b, "no-advertise"); continue; } - if (strncmp (argv[i], "no-e", strlen ("no-e"))== 0 - && strncmp (argv[i], "no-export", strlen (argv[i])) == 0) + if (strncmp (argv[i]->arg, "no-e", strlen ("no-e"))== 0 + && strncmp (argv[i]->arg, "no-export", strlen (argv[i]->arg)) == 0) { buffer_putstr (b, "no-export"); continue; } - buffer_putstr (b, argv[i]); + buffer_putstr (b, argv[i]->arg); } buffer_putc (b, '\0'); @@ -4060,9 +4012,9 @@ DEFUN (set_community_delete, { char *str; - str = XCALLOC (MTYPE_TMP, strlen (argv[0]) + strlen (" delete") + 1); - strcpy (str, argv[0]); - strcpy (str + strlen (argv[0]), " delete"); + str = XCALLOC (MTYPE_TMP, strlen (argv[2]->arg) + strlen (" delete") + 1); + strcpy (str, argv[2]->arg); + strcpy (str + strlen (argv[2]->arg), " delete"); bgp_route_set_add (vty, vty->index, "comm-list", str); @@ -4175,11 +4127,11 @@ DEFUN (set_origin, "local IGP\n" "unknown heritage\n") { - if (strncmp (argv[0], "igp", 2) == 0) + if (strncmp (argv[2]->arg, "igp", 2) == 0) return bgp_route_set_add (vty, vty->index, "origin", "igp"); - if (strncmp (argv[0], "egp", 1) == 0) + if (strncmp (argv[2]->arg, "egp", 1) == 0) return bgp_route_set_add (vty, vty->index, "origin", "egp"); - if (strncmp (argv[0], "incomplete", 2) == 0) + if (strncmp (argv[2]->arg, "incomplete", 2) == 0) return bgp_route_set_add (vty, vty->index, "origin", "incomplete"); return CMD_WARNING; @@ -4237,7 +4189,7 @@ DEFUN (set_aggregator_as, struct in_addr address; char *argstr; - ret = inet_aton (argv[1], &address); + ret = inet_aton (argv[4]->arg, &address); if (ret == 0) { vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE); @@ -4245,9 +4197,9 @@ DEFUN (set_aggregator_as, } argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[0]) + strlen (argv[1]) + 2); + strlen (argv[3]->arg) + strlen (argv[4]->arg) + 2); - sprintf (argstr, "%s %s", argv[0], argv[1]); + sprintf (argstr, "%s %s", argv[3]->arg, argv[4]->arg); ret = bgp_route_set_add (vty, vty->index, "aggregator as", argstr); @@ -4271,7 +4223,7 @@ DEFUN (no_set_aggregator_as, if (argv == 0) return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL); - ret = inet_aton (argv[1], &address); + ret = inet_aton (argv[5]->arg, &address); if (ret == 0) { vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE); @@ -4279,9 +4231,9 @@ DEFUN (no_set_aggregator_as, } argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[0]) + strlen (argv[1]) + 2); + strlen (argv[4]->arg) + strlen (argv[5]->arg) + 2); - sprintf (argstr, "%s %s", argv[0], argv[1]); + sprintf (argstr, "%s %s", argv[4]->arg, argv[5]->arg); ret = bgp_route_set_delete (vty, vty->index, "aggregator as", argstr); @@ -4307,7 +4259,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return bgp_route_set_add (vty, vty->index, "tag", argv[0]); + return bgp_route_set_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_set_tag, @@ -4317,10 +4269,7 @@ DEFUN (no_set_tag, SET_STR "Tag value for routing protocol\n") { - if (argc == 0) - bgp_route_set_delete(vty, vty->index, "tag", NULL); - - return bgp_route_set_delete (vty, vty->index, "tag", argv[0]); + return bgp_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_set_tag, @@ -4341,7 +4290,7 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[0], + return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -4354,7 +4303,7 @@ DEFUN (no_match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[0], + return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[4]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -4366,7 +4315,7 @@ DEFUN (match_ipv6_next_hop, "Match IPv6 next-hop address of route\n" "IPv6 address of next hop\n") { - return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[0], + return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[3]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -4379,7 +4328,7 @@ DEFUN (no_match_ipv6_next_hop, "Match IPv6 next-hop address of route\n" "IPv6 address of next hop\n") { - return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[0], + return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[4]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -4393,7 +4342,7 @@ DEFUN (match_ipv6_address_prefix_list, "IP prefix-list name\n") { return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ipv6_address_prefix_list, @@ -4407,7 +4356,7 @@ DEFUN (no_match_ipv6_address_prefix_list, "IP prefix-list name\n") { return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list", - argv[0], RMAP_EVENT_PLIST_DELETED); + argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } DEFUN (set_ipv6_nexthop_peer, @@ -4468,7 +4417,7 @@ DEFUN (set_ipv6_nexthop_global, struct in6_addr addr; int ret; - ret = inet_pton (AF_INET6, argv[0], &addr); + ret = inet_pton (AF_INET6, argv[4]->arg, &addr); if (!ret) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -4483,7 +4432,7 @@ DEFUN (set_ipv6_nexthop_global, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[0]); + return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[4]->arg); } DEFUN (no_set_ipv6_nexthop_global, @@ -4495,10 +4444,7 @@ DEFUN (no_set_ipv6_nexthop_global, "IPv6 next-hop address\n" "IPv6 global address\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); - - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[0]); + return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[5]->arg); } ALIAS (no_set_ipv6_nexthop_global, @@ -4523,7 +4469,7 @@ DEFUN (set_ipv6_nexthop_local, struct in6_addr addr; int ret; - ret = inet_pton (AF_INET6, argv[0], &addr); + ret = inet_pton (AF_INET6, argv[4]->arg, &addr); if (!ret) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -4535,7 +4481,7 @@ DEFUN (set_ipv6_nexthop_local, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]); + return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); } DEFUN (no_set_ipv6_nexthop_local, @@ -4547,10 +4493,7 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 next-hop address\n" "IPv6 local address\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); - - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[0]); + return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); } ALIAS (no_set_ipv6_nexthop_local, @@ -4572,7 +4515,7 @@ DEFUN (set_vpnv4_nexthop, "VPNv4 next-hop address\n" "IP address of next hop\n") { - return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[0]); + return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[3]->arg); } DEFUN (no_set_vpnv4_nexthop, @@ -4583,10 +4526,7 @@ DEFUN (no_set_vpnv4_nexthop, "VPNv4 information\n" "VPNv4 next-hop address\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); - - return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[0]); + return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[4]->arg); } ALIAS (no_set_vpnv4_nexthop, @@ -4605,7 +4545,7 @@ DEFUN (set_originator_id, "BGP originator ID attribute\n" "IP address of originator\n") { - return bgp_route_set_add (vty, vty->index, "originator-id", argv[0]); + return bgp_route_set_add (vty, vty->index, "originator-id", argv[2]->arg); } DEFUN (no_set_originator_id, @@ -4615,10 +4555,7 @@ DEFUN (no_set_originator_id, SET_STR "BGP originator ID attribute\n") { - if (argc == 0) - return bgp_route_set_delete (vty, vty->index, "originator-id", NULL); - - return bgp_route_set_delete (vty, vty->index, "originator-id", argv[0]); + return bgp_route_set_delete (vty, vty->index, "originator-id", argv[3]->arg); } ALIAS (no_set_originator_id, diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 114c6ef013..884523919e 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -26,6 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "vty.h" #include "queue.h" #include "filter.h" +#include "command.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index f4a16d6ba2..9a7b297fb3 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -20,7 +20,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include -#include "lib/json.h" #include "prefix.h" #include "thread.h" #include "buffer.h" @@ -43,6 +42,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "hash.h" #include "jhash.h" #include "table.h" +#include "lib/json.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" diff --git a/lib/command.h b/lib/command.h index eef4b558af..7b0fbfb780 100644 --- a/lib/command.h +++ b/lib/command.h @@ -372,25 +372,25 @@ struct cmd_element /* IPv4 only machine should not accept IPv6 address for peer's IP address. So we replace VTY command string like below. */ #ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor " -#define NO_NEIGHBOR_CMD "no neighbor " +#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " +#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " +#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " +#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" #else #define NEIGHBOR_CMD "neighbor A.B.C.D " #define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " #define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " +#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " +#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ /* Dynamic neighbor (listen range) configuration */ #ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range " +#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) " #define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" #else #define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " diff --git a/lib/json.c b/lib/json.c index d06bacece4..1d22180e10 100644 --- a/lib/json.c +++ b/lib/json.c @@ -30,7 +30,7 @@ * what. */ int -use_json (const int argc, const struct cmd_token *argv[]) +use_json (const int argc, struct cmd_token *argv[]) { if (argc == 0) return 0; diff --git a/lib/json.h b/lib/json.h index 25fceb1053..3fcfe340e9 100644 --- a/lib/json.h +++ b/lib/json.h @@ -28,7 +28,7 @@ #include #endif -extern int use_json(const int argc, const struct cmd_token *argv[]); +extern int use_json(const int argc, struct cmd_token *argv[]); extern void json_object_string_add(struct json_object* obj, const char *key, const char *s); extern void json_object_int_add(struct json_object* obj, const char *key, diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 791ae54b0e..bf892f872a 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -6,29 +6,30 @@ import os from pprint import pformat -def token_is_variable(token): +def token_is_variable(line_number, token): if token.isdigit(): return True if token.startswith('('): - assert token.endswith(')'), "token %s should end with )" % token + assert token.endswith(')'), "%d: token %s should end with )" % (line_number, token) return True if token.startswith('['): - assert token.endswith(']'), "token %s should end with ]" % token + assert token.endswith(']'), "%d: token %s should end with ]" % (line_number, token) return True if token.startswith('{'): # I don't really care about checking for this I just put # these asserts in here to bug sharpd - assert token.endswith('}'), "token %s should end with }" % token + assert token.endswith('}'), "%d: token %s should end with }" % (line_number, token) return True - assert '|' not in token, "Weird token %s has a | but does not start with [ or (" % token + assert '|' not in token, "%d: Weird token %s has a | but does not start with [ or (" % (line_number, token) if token in ('WORD', '.LINE', # where is this defined? + 'PATH', 'A.B.C.D', 'A.B.C.D/M', 'X:X::X:X', @@ -43,22 +44,22 @@ def token_is_variable(token): return False -def get_argv_translator(line): +def get_argv_translator(line_number, line): table = {} line = line.strip() - assert line.startswith('"'), "line does not start with \"\n%s" % line - assert line.endswith('",'), "line does not end with \",\n%s" % line + assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line) + assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line) line = line[1:-2] funky_chars = ('+', '"') for char in funky_chars: if char in line: - raise Exception("Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % line) + raise Exception("%d: Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % (line_number, line)) old_style_index = 0 for (token_index, token) in enumerate(line.split()): - if token_is_variable(token): + if token_is_variable(line_number, token): # print "%s is a token" % token table[old_style_index] = token_index old_style_index += 1 @@ -84,6 +85,7 @@ def update_argvs(filename): if state is None: if line.startswith('DEFUN ('): + assert line.count(',') == 1, "Too many commas in\n%s" % line state = 'DEFUN_HEADER' defun_line_number = line_number @@ -99,12 +101,45 @@ def update_argvs(filename): elif line_number == defun_line_number + 2: - # bgpd/bgp_vty.h + # in the middle line = line.replace('" CMD_AS_RANGE "', '<1-4294967295>') line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '<1-5000>') line = line.replace('" BGP_INSTANCE_CMD "', '(view|vrf) WORD') line = line.replace('" BGP_INSTANCE_ALL_CMD "', '(view|vrf) all') - argv_translator = get_argv_translator(line) + line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '<1-255>') + line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '(kernel|connected|static|rip|ospf|isis|pim|table)') + line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '(kernel|connected|static|ripng|ospf6|isis|table)') + + # endswith + line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') + line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' <1-5000>",') + line = line.replace('" BGP_INSTANCE_CMD,', ' (view|vrf) WORD",') + line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' (view|vrf) all",') + line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",') + line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",') + + line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",') + line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",') + line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",') + line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' (kernel|connected|static|ripng|ospf6|isis|table)",') + + # startswith + line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') + line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('NEIGHBOR_CMD "', '"neighbor (A.B.C.D|X:X::X:X) ') + + # solo + line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor (A.B.C.D|X:X::X:X|WORD)",') + line = line.replace('NEIGHBOR_CMD2,', '"neighbor (A.B.C.D|X:X::X:X|WORD)",') + line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor (A.B.C.D|X:X::X:X)",') + line = line.replace('NEIGHBOR_CMD,', '"neighbor (A.B.C.D|X:X::X:X)",') + + if line.rstrip().endswith('" ,'): + line = line.replace('" ,', '",') + + argv_translator = get_argv_translator(line_number, line) print_translator = True elif state == 'DEFUN_BODY': From afec25d91119fdc47e2086bb20158afdb8a23337 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:16:18 +0000 Subject: [PATCH 086/280] bgpd: more bgp_vty.c parser conversion Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 977 +++++++++++++++++++-------------------- tools/argv_translator.py | 3 +- 2 files changed, 487 insertions(+), 493 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 012d1d25a2..32506c4e24 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -20,8 +20,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include -#include "lib/json.h" #include "command.h" +#include "lib/json.h" #include "prefix.h" #include "plist.h" #include "buffer.h" @@ -614,7 +614,7 @@ DEFUN (bgp_config_type, "cisco\n" "zebra\n") { - if (strncmp (argv[0], "c", 1) == 0) + if (strncmp (argv[2]->arg, "c", 1) == 0) bgp_option_set (BGP_OPT_CONFIG_CISCO); else bgp_option_unset (BGP_OPT_CONFIG_CISCO); @@ -696,15 +696,15 @@ DEFUN (router_bgp, // "router bgp X" else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[2]->arg, 1, BGP_AS4_MAX); inst_type = BGP_INSTANCE_TYPE_DEFAULT; if (argc == 3) { - name = argv[2]; - if (!strcmp(argv[1], "vrf")) + name = argv[4]->arg; + if (!strcmp(argv[3]->arg, "vrf")) inst_type = BGP_INSTANCE_TYPE_VRF; - else if (!strcmp(argv[1], "view")) + else if (!strcmp(argv[3]->arg, "view")) inst_type = BGP_INSTANCE_TYPE_VIEW; } @@ -783,10 +783,10 @@ DEFUN (no_router_bgp, } else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); if (argc == 3) - name = argv[2]; + name = argv[5]->arg; /* Lookup bgp structure. */ bgp = bgp_lookup (as, name); @@ -834,7 +834,7 @@ DEFUN (bgp_router_id, bgp = vty->index; - ret = inet_aton (argv[0], &id); + ret = inet_aton (argv[2]->arg, &id); if (! ret) { vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); @@ -861,7 +861,7 @@ DEFUN (no_bgp_router_id, if (argc == 1) { - ret = inet_aton (argv[0], &id); + ret = inet_aton (argv[3]->arg, &id); if (! ret) { vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); @@ -904,7 +904,7 @@ DEFUN (bgp_cluster_id, bgp = vty->index; - ret = inet_aton (argv[0], &cluster); + ret = inet_aton (argv[2]->arg, &cluster); if (! ret) { vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); @@ -939,7 +939,7 @@ DEFUN (no_bgp_cluster_id, if (argc == 1) { - ret = inet_aton (argv[0], &cluster); + ret = inet_aton (argv[3]->arg, &cluster); if (! ret) { vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); @@ -982,7 +982,7 @@ DEFUN (bgp_confederation_identifier, bgp = vty->index; - VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); bgp_confederation_id_set (bgp, as); @@ -1031,7 +1031,7 @@ DEFUN (bgp_confederation_peers, for (i = 0; i < argc; i++) { - VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); if (bgp->as == as) { @@ -1062,7 +1062,7 @@ DEFUN (no_bgp_confederation_peers, for (i = 0; i < argc; i++) { - VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); bgp_confederation_peers_remove (bgp, as); } @@ -1145,7 +1145,7 @@ DEFUN (bgp_maxmed_admin_medv, bgp = vty->index; bgp->v_maxmed_admin = 1; - VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); + VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[3]->arg); bgp_maxmed_update(bgp); @@ -1200,7 +1200,7 @@ DEFUN (bgp_maxmed_onstartup, return CMD_WARNING; } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); + VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; bgp_maxmed_update(bgp); @@ -1227,8 +1227,8 @@ DEFUN (bgp_maxmed_onstartup_medv, return CMD_WARNING; } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); - VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); + VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); + VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[4]->arg); bgp_maxmed_update(bgp); @@ -1352,7 +1352,7 @@ DEFUN (bgp_update_delay, "Force initial delay for best-path and updates\n" "Seconds\n") { - return bgp_update_delay_config_vty(vty, argv[0], NULL); + return bgp_update_delay_config_vty(vty, argv[1]->arg, NULL); } DEFUN (bgp_update_delay_establish_wait, @@ -1363,7 +1363,7 @@ DEFUN (bgp_update_delay_establish_wait, "Wait for peers to be established\n" "Seconds\n") { - return bgp_update_delay_config_vty(vty, argv[0], argv[1]); + return bgp_update_delay_config_vty(vty, argv[1]->arg, argv[2]->arg); } /* Update-delay deconfiguration */ @@ -1418,7 +1418,7 @@ DEFUN (bgp_wpkt_quanta, "How many packets to write to peer socket per run\n" "Number of packets\n") { - return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); + return bgp_wpkt_quanta_config_vty(vty, argv[1]->arg, 1); } /* Update-delay deconfiguration */ @@ -1428,7 +1428,7 @@ DEFUN (no_bgp_wpkt_quanta, "How many packets to write to peer socket per run\n" "Number of packets\n") { - return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); + return bgp_wpkt_quanta_config_vty(vty, argv[2]->arg, 0); } static int @@ -1464,7 +1464,7 @@ DEFUN (bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - return bgp_coalesce_config_vty(vty, argv[0], 1); + return bgp_coalesce_config_vty(vty, argv[1]->arg, 1); } DEFUN (no_bgp_coalesce_time, @@ -1473,7 +1473,7 @@ DEFUN (no_bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - return bgp_coalesce_config_vty(vty, argv[0], 0); + return bgp_coalesce_config_vty(vty, argv[2]->arg, 0); } /* Maximum-paths configuration */ @@ -1483,7 +1483,7 @@ DEFUN (bgp_maxpaths, "Forward packets over multiple paths\n" "Number of paths\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); + return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[1]->arg, 0, 1); } DEFUN (bgp_maxpaths_ibgp, @@ -1493,7 +1493,7 @@ DEFUN (bgp_maxpaths_ibgp, "iBGP-multipath\n" "Number of paths\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); + return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, 0, 1); } DEFUN (bgp_maxpaths_ibgp_cluster, @@ -1504,7 +1504,7 @@ DEFUN (bgp_maxpaths_ibgp_cluster, "Number of paths\n" "Match the cluster length\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], + return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); } @@ -1594,8 +1594,8 @@ DEFUN (bgp_timers, bgp = vty->index; - VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); - VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); + VTY_GET_INTEGER ("keepalive", keepalive, argv[2]->arg); + VTY_GET_INTEGER ("holdtime", holdtime, argv[3]->arg); /* Holdtime value check. */ if (holdtime < 3 && holdtime != 0) @@ -1812,7 +1812,7 @@ DEFUN (bgp_graceful_restart_stalepath_time, if (! bgp) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); + VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[3]->arg, 1, 3600); bgp->stalepath_time = stalepath; return CMD_SUCCESS; } @@ -1832,7 +1832,7 @@ DEFUN (bgp_graceful_restart_restart_time, if (! bgp) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600); + VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[3]->arg, 1, 3600); bgp->restart_time = restart; return CMD_SUCCESS; } @@ -2075,7 +2075,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, /* no-as-set is now the default behavior so we can silently * ignore it */ - if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) + if (argv[4]->arg != NULL && strncmp (argv[4]->arg, "a", 1) == 0) bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); else bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; @@ -2148,7 +2148,7 @@ DEFUN (bgp_bestpath_med, bgp = vty->index; - if (strncmp (argv[0], "confed", 1) == 0) + if (strncmp (argv[3]->arg, "confed", 1) == 0) bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); else bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); @@ -2200,7 +2200,7 @@ DEFUN (no_bgp_bestpath_med, bgp = vty->index; - if (strncmp (argv[0], "confed", 1) == 0) + if (strncmp (argv[4]->arg, "confed", 1) == 0) bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); else bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); @@ -2361,7 +2361,7 @@ DEFUN (bgp_default_local_preference, bgp = vty->index; - VTY_GET_INTEGER ("local preference", local_pref, argv[0]); + VTY_GET_INTEGER ("local preference", local_pref, argv[3]->arg); bgp_default_local_preference_set (bgp, local_pref); bgp_clear_star_soft_in (vty, bgp->name); @@ -2408,7 +2408,7 @@ DEFUN (bgp_default_subgroup_pkt_queue_max, bgp = vty->index; - VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); + VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[3]->arg); bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); @@ -2495,7 +2495,7 @@ DEFUN (bgp_listen_limit, bgp = vty->index; - VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], + VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[3]->arg, BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); @@ -2576,10 +2576,10 @@ DEFUN (bgp_listen_range, bgp = vty->index; - //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); + //VTY_GET_IPV4_PREFIX ("listen range", range, argv[3]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[0], &range); + ret = str2prefix (argv[3]->arg, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2603,7 +2603,7 @@ DEFUN (bgp_listen_range, existing_group = listen_range_exists (bgp, &range, 1); if (existing_group) { - if (strcmp (existing_group->name, argv[1]) == 0) + if (strcmp (existing_group->name, argv[5]->arg) == 0) return CMD_SUCCESS; else { @@ -2621,7 +2621,7 @@ DEFUN (bgp_listen_range, return CMD_WARNING; } - group = peer_group_lookup (bgp, argv[1]); + group = peer_group_lookup (bgp, argv[5]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -2648,10 +2648,10 @@ DEFUN (no_bgp_listen_range, bgp = vty->index; - // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); + // VTY_GET_IPV4_PREFIX ("listen range", range, argv[4]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[0], &range); + ret = str2prefix (argv[4]->arg, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2672,7 +2672,7 @@ DEFUN (no_bgp_listen_range, apply_mask (&range); - group = peer_group_lookup (bgp, argv[1]); + group = peer_group_lookup (bgp, argv[6]->arg); if (! group) { vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); @@ -2823,7 +2823,7 @@ DEFUN (neighbor_remote_as, "Specify a BGP neighbor\n" AS_STR) { - return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); + return peer_remote_as_vty (vty, argv[1]->arg, argv[3]->arg, AFI_IP, SAFI_UNICAST); } static int @@ -2936,10 +2936,10 @@ DEFUN (neighbor_interface_config, "Enable BGP on interface\n") { if (argc == 2) - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, - argv[1], NULL); + return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, + argv[3]->arg, NULL); else - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, + return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, NULL, NULL); } @@ -2960,12 +2960,8 @@ DEFUN (neighbor_interface_config_v6only, "Enable BGP on interface\n" "Enable BGP with v6 link-local only\n") { - if (argc == 2) - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, - argv[1], NULL); - else - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, - NULL, NULL); + return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, + argv[5]->arg, NULL); } ALIAS (neighbor_interface_config_v6only, @@ -2986,8 +2982,8 @@ DEFUN (neighbor_interface_config_remote_as, "Enable BGP on interface\n" AS_STR) { - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, - NULL, argv[1]); + return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, + NULL, argv[4]->arg); } DEFUN (neighbor_interface_v6only_config_remote_as, @@ -2998,8 +2994,8 @@ DEFUN (neighbor_interface_v6only_config_remote_as, "Enable BGP on interface\n" AS_STR) { - return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, - NULL, argv[1]); + return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, + NULL, argv[5]->arg); } DEFUN (neighbor_peer_group, @@ -3014,14 +3010,14 @@ DEFUN (neighbor_peer_group, struct peer_group *group; bgp = vty->index; - peer = peer_lookup_by_conf_if (bgp, argv[0]); + peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); if (peer) { vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); return CMD_WARNING; } - group = peer_group_get (bgp, argv[0]); + group = peer_group_get (bgp, argv[1]->arg); if (! group) return CMD_WARNING; @@ -3041,11 +3037,11 @@ DEFUN (no_neighbor, struct peer *peer; struct peer *other; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[2]->arg, &su); if (ret < 0) { /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[0]); + peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); if (peer) { /* Request zebra to terminate IPv6 RAs on this interface. */ @@ -3055,7 +3051,7 @@ DEFUN (no_neighbor, return CMD_SUCCESS; } - group = peer_group_lookup (vty->index, argv[0]); + group = peer_group_lookup (vty->index, argv[2]->arg); if (group) peer_group_delete (group); else @@ -3106,7 +3102,7 @@ DEFUN (no_neighbor_interface_config, struct peer *peer; /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[0]); + peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); if (peer) { /* Request zebra to terminate IPv6 RAs on this interface. */ @@ -3181,7 +3177,7 @@ DEFUN (no_neighbor_peer_group, { struct peer_group *group; - group = peer_group_lookup (vty->index, argv[0]); + group = peer_group_lookup (vty->index, argv[2]->arg); if (group) peer_group_delete (group); else @@ -3205,14 +3201,14 @@ DEFUN (no_neighbor_interface_peer_group_remote_as, struct peer *peer; /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[0]); + peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); if (peer) { peer_as_change (peer, 0, AS_SPECIFIED); return CMD_SUCCESS; } - group = peer_group_lookup (vty->index, argv[0]); + group = peer_group_lookup (vty->index, argv[2]->arg); if (group) peer_group_remote_as_delete (group); else @@ -3234,11 +3230,11 @@ DEFUN (neighbor_local_as, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); + ret = peer_local_as_set (peer, atoi (argv[3]->arg), 0, 0); return bgp_vty_return (vty, ret); } @@ -3254,11 +3250,11 @@ DEFUN (neighbor_local_as_no_prepend, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); + ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 0); return bgp_vty_return (vty, ret); } @@ -3275,11 +3271,11 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); + ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 1); return bgp_vty_return (vty, ret); } @@ -3295,7 +3291,7 @@ DEFUN (no_neighbor_local_as, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -3343,7 +3339,7 @@ DEFUN (neighbor_solo, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; @@ -3362,7 +3358,7 @@ DEFUN (no_neighbor_solo, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -3381,11 +3377,11 @@ DEFUN (neighbor_password, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - ret = peer_password_set (peer, argv[1]); + ret = peer_password_set (peer, argv[3]->arg); return bgp_vty_return (vty, ret); } @@ -3400,7 +3396,7 @@ DEFUN (no_neighbor_password, struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -3427,7 +3423,7 @@ DEFUN (neighbor_activate, int ret; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; @@ -3450,7 +3446,7 @@ DEFUN (no_neighbor_activate, struct peer *peer; /* Lookup peer. */ - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -3479,13 +3475,13 @@ DEFUN (neighbor_set_peer_group, bgp = vty->index; peer = NULL; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[1]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[0]); + peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); if (!peer) { - vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -3508,7 +3504,7 @@ DEFUN (neighbor_set_peer_group, } } - group = peer_group_lookup (bgp, argv[1]); + group = peer_group_lookup (bgp, argv[3]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -3542,11 +3538,11 @@ DEFUN (no_neighbor_set_peer_group, bgp = vty->index; - peer = peer_lookup_vty (vty, argv[0]); + peer = peer_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; - group = peer_group_lookup (bgp, argv[1]); + group = peer_group_lookup (bgp, argv[4]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -3607,7 +3603,7 @@ DEFUN (neighbor_passive, NEIGHBOR_ADDR_STR2 "Don't send open messages to this neighbor\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_PASSIVE); } DEFUN (no_neighbor_passive, @@ -3618,7 +3614,7 @@ DEFUN (no_neighbor_passive, NEIGHBOR_ADDR_STR2 "Don't send open messages to this neighbor\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_PASSIVE); } /* neighbor shutdown. */ @@ -3629,7 +3625,7 @@ DEFUN (neighbor_shutdown, NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_SHUTDOWN); } DEFUN (no_neighbor_shutdown, @@ -3640,7 +3636,7 @@ DEFUN (no_neighbor_shutdown, NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_SHUTDOWN); } /* neighbor capability dynamic. */ @@ -3652,7 +3648,7 @@ DEFUN (neighbor_capability_dynamic, "Advertise capability to the peer\n" "Advertise dynamic capability to this neighbor\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); } DEFUN (no_neighbor_capability_dynamic, @@ -3664,7 +3660,7 @@ DEFUN (no_neighbor_capability_dynamic, "Advertise capability to the peer\n" "Advertise dynamic capability to this neighbor\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); } /* neighbor dont-capability-negotiate */ @@ -3675,7 +3671,7 @@ DEFUN (neighbor_dont_capability_negotiate, NEIGHBOR_ADDR_STR2 "Do not perform capability negotiation\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DONT_CAPABILITY); } DEFUN (no_neighbor_dont_capability_negotiate, @@ -3686,7 +3682,7 @@ DEFUN (no_neighbor_dont_capability_negotiate, NEIGHBOR_ADDR_STR2 "Do not perform capability negotiation\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DONT_CAPABILITY); } /* neighbor capability extended next hop encoding */ @@ -3698,7 +3694,7 @@ DEFUN (neighbor_capability_enhe, "Advertise capability to the peer\n" "Advertise extended next-hop capability to the peer\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_CAPABILITY_ENHE); } DEFUN (no_neighbor_capability_enhe, @@ -3710,7 +3706,7 @@ DEFUN (no_neighbor_capability_enhe, "Advertise capability to the peer\n" "Advertise extended next-hop capability to the peer\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_CAPABILITY_ENHE); } static int @@ -3761,16 +3757,16 @@ DEFUN (neighbor_capability_orf_prefix, { u_int16_t flag = 0; - if (strncmp (argv[1], "s", 1) == 0) + if (strncmp (argv[5]->arg, "s", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[1], "r", 1) == 0) + else if (strncmp (argv[5]->arg, "r", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[1], "b", 1) == 0) + else if (strncmp (argv[5]->arg, "b", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flag); } @@ -3789,16 +3785,16 @@ DEFUN (no_neighbor_capability_orf_prefix, { u_int16_t flag = 0; - if (strncmp (argv[1], "s", 1) == 0) + if (strncmp (argv[6]->arg, "s", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[1], "r", 1) == 0) + else if (strncmp (argv[6]->arg, "r", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[1], "b", 1) == 0) + else if (strncmp (argv[6]->arg, "b", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flag); } @@ -3810,7 +3806,7 @@ DEFUN (neighbor_nexthop_self, NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); } @@ -3823,7 +3819,7 @@ DEFUN (neighbor_nexthop_self_force, "Disable the next hop calculation for this neighbor\n" "Set the next hop to self for reflected routes\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_FORCE_NEXTHOP_SELF); } @@ -3836,7 +3832,7 @@ DEFUN (no_neighbor_nexthop_self, NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); } @@ -3850,7 +3846,7 @@ DEFUN (no_neighbor_nexthop_self_force, "Disable the next hop calculation for this neighbor\n" "Set the next hop to self for reflected routes\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_FORCE_NEXTHOP_SELF); } @@ -3863,7 +3859,7 @@ DEFUN (neighbor_as_override, NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_AS_OVERRIDE); } @@ -3876,7 +3872,7 @@ DEFUN (no_neighbor_as_override, NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_AS_OVERRIDE); } @@ -3889,7 +3885,7 @@ DEFUN (neighbor_remove_private_as, NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS); } @@ -3902,7 +3898,7 @@ DEFUN (neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL); } @@ -3915,7 +3911,7 @@ DEFUN (neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); } @@ -3929,7 +3925,7 @@ DEFUN (neighbor_remove_private_as_all_replace_as, "Apply to all AS numbers" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); } @@ -3942,7 +3938,7 @@ DEFUN (no_neighbor_remove_private_as, NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS); } @@ -3956,7 +3952,7 @@ DEFUN (no_neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL); } @@ -3970,7 +3966,7 @@ DEFUN (no_neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); } @@ -3985,7 +3981,7 @@ DEFUN (no_neighbor_remove_private_as_all_replace_as, "Apply to all AS numbers" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); } @@ -3999,7 +3995,7 @@ DEFUN (neighbor_send_community, NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); } @@ -4012,7 +4008,7 @@ DEFUN (no_neighbor_send_community, NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); } @@ -4028,16 +4024,16 @@ DEFUN (neighbor_send_community_type, "Send Extended Community attributes\n" "Send Standard Community attributes\n") { - if (strncmp (argv[1], "s", 1) == 0) - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + if (strncmp (argv[3]->arg, "s", 1) == 0) + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[1], "e", 1) == 0) - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + if (strncmp (argv[3]->arg, "e", 1) == 0) + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_EXT_COMMUNITY); - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_SEND_COMMUNITY| PEER_FLAG_SEND_EXT_COMMUNITY)); @@ -4054,16 +4050,16 @@ DEFUN (no_neighbor_send_community_type, "Send Extended Community attributes\n" "Send Standard Community attributes\n") { - if (strncmp (argv[1], "s", 1) == 0) - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + if (strncmp (argv[4]->arg, "s", 1) == 0) + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[1], "e", 1) == 0) - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + if (strncmp (argv[4]->arg, "e", 1) == 0) + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_EXT_COMMUNITY); - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_SEND_COMMUNITY | PEER_FLAG_SEND_EXT_COMMUNITY)); @@ -4078,7 +4074,7 @@ DEFUN (neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[0], + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SOFT_RECONFIG); } @@ -4092,7 +4088,7 @@ DEFUN (no_neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[0], + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SOFT_RECONFIG); } @@ -4107,11 +4103,11 @@ DEFUN (neighbor_route_reflector_client, struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REFLECTOR_CLIENT); } @@ -4124,7 +4120,7 @@ DEFUN (no_neighbor_route_reflector_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REFLECTOR_CLIENT); } @@ -4139,10 +4135,10 @@ DEFUN (neighbor_route_server_client, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_RSERVER_CLIENT); } @@ -4155,7 +4151,7 @@ DEFUN (no_neighbor_route_server_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_RSERVER_CLIENT); } @@ -4168,7 +4164,7 @@ DEFUN (neighbor_nexthop_local_unchanged, "Configure treatment of outgoing link-local nexthop attribute\n" "Leave link-local nexthop unchanged for this peer\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } @@ -4182,7 +4178,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, "Configure treatment of outgoing link-local-nexthop attribute\n" "Leave link-local nexthop unchanged for this peer\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } @@ -4194,7 +4190,7 @@ DEFUN (neighbor_attr_unchanged, NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_AS_PATH_UNCHANGED | PEER_FLAG_NEXTHOP_UNCHANGED | @@ -4213,14 +4209,14 @@ DEFUN (neighbor_attr_unchanged1, { u_int16_t flags = 0; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[3]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "next-hop", 1) == 0) + else if (strncmp (argv[3]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[3]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4236,12 +4232,12 @@ DEFUN (neighbor_attr_unchanged2, { u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - if (strncmp (argv[1], "next-hop", 1) == 0) + if (strncmp (argv[4]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[4]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4258,12 +4254,12 @@ DEFUN (neighbor_attr_unchanged3, { u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[4]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[4]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4279,12 +4275,12 @@ DEFUN (neighbor_attr_unchanged4, { u_int16_t flags = PEER_FLAG_MED_UNCHANGED; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[4]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "next-hop", 1) == 0) + else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4356,7 +4352,7 @@ DEFUN (no_neighbor_attr_unchanged, NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_AS_PATH_UNCHANGED | PEER_FLAG_NEXTHOP_UNCHANGED | @@ -4376,14 +4372,14 @@ DEFUN (no_neighbor_attr_unchanged1, { u_int16_t flags = 0; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[4]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "next-hop", 1) == 0) + else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[4]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4400,12 +4396,12 @@ DEFUN (no_neighbor_attr_unchanged2, { u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - if (strncmp (argv[1], "next-hop", 1) == 0) + if (strncmp (argv[5]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[5]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4422,12 +4418,12 @@ DEFUN (no_neighbor_attr_unchanged3, { u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[5]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "med", 1) == 0) + else if (strncmp (argv[5]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4444,12 +4440,12 @@ DEFUN (no_neighbor_attr_unchanged4, { u_int16_t flags = PEER_FLAG_MED_UNCHANGED; - if (strncmp (argv[1], "as-path", 1) == 0) + if (strncmp (argv[5]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[1], "next-hop", 1) == 0) + else if (strncmp (argv[5]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4562,7 +4558,7 @@ DEFUN (neighbor_ebgp_multihop, NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n") { - return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); + return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, NULL); } DEFUN (neighbor_ebgp_multihop_ttl, @@ -4573,7 +4569,7 @@ DEFUN (neighbor_ebgp_multihop_ttl, "Allow EBGP neighbors not on directly connected networks\n" "maximum hop count\n") { - return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); + return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, argv[3]->arg); } DEFUN (no_neighbor_ebgp_multihop, @@ -4584,7 +4580,7 @@ DEFUN (no_neighbor_ebgp_multihop, NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n") { - return peer_ebgp_multihop_unset_vty (vty, argv[0]); + return peer_ebgp_multihop_unset_vty (vty, argv[2]->arg); } ALIAS (no_neighbor_ebgp_multihop, @@ -4604,7 +4600,7 @@ DEFUN (neighbor_disable_connected_check, NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } DEFUN (no_neighbor_disable_connected_check, @@ -4615,7 +4611,7 @@ DEFUN (no_neighbor_disable_connected_check, NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } /* Enforce multihop. */ @@ -4646,7 +4642,7 @@ DEFUN (neighbor_description, struct peer *peer; char *str; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; @@ -4672,7 +4668,7 @@ DEFUN (no_neighbor_description, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -4736,7 +4732,7 @@ DEFUN (neighbor_update_source, "Source of routing updates\n" BGP_UPDATE_SOURCE_HELP_STR) { - return peer_update_source_vty (vty, argv[0], argv[1]); + return peer_update_source_vty (vty, argv[1]->arg, argv[3]->arg); } DEFUN (no_neighbor_update_source, @@ -4748,7 +4744,7 @@ DEFUN (no_neighbor_update_source, "Source of routing updates\n" BGP_UPDATE_SOURCE_HELP_STR) { - return peer_update_source_vty (vty, argv[0], NULL); + return peer_update_source_vty (vty, argv[2]->arg, NULL); } static int @@ -4779,7 +4775,7 @@ DEFUN (neighbor_default_originate, NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n") { - return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), NULL, 1); } @@ -4792,8 +4788,8 @@ DEFUN (neighbor_default_originate_rmap, "Route-map to specify criteria to originate default\n" "route-map name\n") { - return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], 1); + return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[4]->arg, 1); } DEFUN (no_neighbor_default_originate, @@ -4804,7 +4800,7 @@ DEFUN (no_neighbor_default_originate, NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n") { - return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_default_originate_set_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), NULL, 0); } @@ -4855,7 +4851,7 @@ DEFUN (neighbor_port, "Neighbor's BGP port\n" "TCP port number\n") { - return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); + return peer_port_vty (vty, argv[1]->arg, AFI_IP, argv[3]->arg); } DEFUN (no_neighbor_port, @@ -4866,7 +4862,7 @@ DEFUN (no_neighbor_port, NEIGHBOR_ADDR_STR "Neighbor's BGP port\n") { - return peer_port_vty (vty, argv[0], AFI_IP, NULL); + return peer_port_vty (vty, argv[2]->arg, AFI_IP, NULL); } ALIAS (no_neighbor_port, @@ -4919,7 +4915,7 @@ DEFUN (neighbor_weight, "Set default weight for routes from this neighbor\n" "default weight\n") { - return peer_weight_set_vty (vty, argv[0], argv[1]); + return peer_weight_set_vty (vty, argv[1]->arg, argv[3]->arg); } DEFUN (no_neighbor_weight, @@ -4930,7 +4926,7 @@ DEFUN (no_neighbor_weight, NEIGHBOR_ADDR_STR2 "Set default weight for routes from this neighbor\n") { - return peer_weight_unset_vty (vty, argv[0]); + return peer_weight_unset_vty (vty, argv[2]->arg); } ALIAS (no_neighbor_weight, @@ -4950,7 +4946,7 @@ DEFUN (neighbor_override_capability, NEIGHBOR_ADDR_STR2 "Override capability negotiation result\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); } DEFUN (no_neighbor_override_capability, @@ -4961,7 +4957,7 @@ DEFUN (no_neighbor_override_capability, NEIGHBOR_ADDR_STR2 "Override capability negotiation result\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); } DEFUN (neighbor_strict_capability, @@ -4971,7 +4967,7 @@ DEFUN (neighbor_strict_capability, NEIGHBOR_ADDR_STR "Strict capability negotiation match\n") { - return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); + return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_STRICT_CAP_MATCH); } DEFUN (no_neighbor_strict_capability, @@ -4982,7 +4978,7 @@ DEFUN (no_neighbor_strict_capability, NEIGHBOR_ADDR_STR "Strict capability negotiation match\n") { - return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); + return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_STRICT_CAP_MATCH); } static int @@ -5030,7 +5026,7 @@ DEFUN (neighbor_timers, "Keepalive interval\n" "Holdtime\n") { - return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); + return peer_timers_set_vty (vty, argv[1]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_neighbor_timers, @@ -5041,7 +5037,7 @@ DEFUN (no_neighbor_timers, NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n") { - return peer_timers_unset_vty (vty, argv[0]); + return peer_timers_unset_vty (vty, argv[2]->arg); } ALIAS (no_neighbor_timers, @@ -5097,7 +5093,7 @@ DEFUN (neighbor_timers_connect, "BGP connect timer\n" "Connect timer\n") { - return peer_timers_connect_set_vty (vty, argv[0], argv[1]); + return peer_timers_connect_set_vty (vty, argv[1]->arg, argv[4]->arg); } DEFUN (no_neighbor_timers_connect, @@ -5109,7 +5105,7 @@ DEFUN (no_neighbor_timers_connect, "BGP per neighbor timers\n" "BGP connect timer\n") { - return peer_timers_connect_unset_vty (vty, argv[0]); + return peer_timers_connect_unset_vty (vty, argv[2]->arg); } ALIAS (no_neighbor_timers_connect, @@ -5153,7 +5149,7 @@ DEFUN (neighbor_advertise_interval, "Minimum interval between sending BGP routing updates\n" "time in seconds\n") { - return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); + return peer_advertise_interval_vty (vty, argv[1]->arg, argv[3]->arg, 1); } DEFUN (no_neighbor_advertise_interval, @@ -5164,7 +5160,7 @@ DEFUN (no_neighbor_advertise_interval, NEIGHBOR_ADDR_STR2 "Minimum interval between sending BGP routing updates\n") { - return peer_advertise_interval_vty (vty, argv[0], NULL, 0); + return peer_advertise_interval_vty (vty, argv[2]->arg, NULL, 0); } ALIAS (no_neighbor_advertise_interval, @@ -5187,9 +5183,9 @@ DEFUN (bgp_set_route_map_delay_timer, { u_int32_t rmap_delay_timer; - if (argv[0]) + if (argv[3]->arg) { - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[3]->arg, 0, 600); bm->rmap_update_timer = rmap_delay_timer; /* if the dynamic update handling is being disabled, and a timer is @@ -5254,9 +5250,9 @@ DEFUN (neighbor_interface, "Interface name\n") { if (argc == 3) - return peer_interface_vty (vty, argv[0], argv[1]); + return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); else - return peer_interface_vty (vty, argv[0], argv[1]); + return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); } DEFUN (no_neighbor_interface, @@ -5268,7 +5264,7 @@ DEFUN (no_neighbor_interface, "Interface\n" "Interface name\n") { - return peer_interface_vty (vty, argv[0], NULL); + return peer_interface_vty (vty, argv[2]->arg, NULL); } /* Set distribute list to the peer. */ @@ -5331,8 +5327,8 @@ DEFUN (neighbor_distribute_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2]); + return peer_distribute_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); } DEFUN (no_neighbor_distribute_list, @@ -5348,8 +5344,8 @@ DEFUN (no_neighbor_distribute_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[2]); + return peer_distribute_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[5]->arg); } /* Set prefix list to the peer. */ @@ -5410,8 +5406,8 @@ DEFUN (neighbor_prefix_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2]); + return peer_prefix_list_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); } DEFUN (no_neighbor_prefix_list, @@ -5425,8 +5421,8 @@ DEFUN (no_neighbor_prefix_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[2]); + return peer_prefix_list_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[5]->arg); } static int @@ -5487,8 +5483,8 @@ DEFUN (neighbor_filter_list, "Filter incoming routes\n" "Filter outgoing routes\n") { - return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2]); + return peer_aslist_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); } DEFUN (no_neighbor_filter_list, @@ -5502,8 +5498,8 @@ DEFUN (no_neighbor_filter_list, "Filter incoming routes\n" "Filter outgoing routes\n") { - return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[2]); + return peer_aslist_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[5]->arg); } /* Set route-map to the peer. */ @@ -5564,8 +5560,8 @@ DEFUN (neighbor_route_map, "Apply map to incoming routes\n" "Apply map to outbound routes\n") { - return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2]); + return peer_route_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); } DEFUN (no_neighbor_route_map, @@ -5579,8 +5575,8 @@ DEFUN (no_neighbor_route_map, "Apply map to incoming routes\n" "Apply map to outbound routes\n") { - return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[2]); + return peer_route_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[5]->arg); } /* Set unsuppress-map to the peer. */ @@ -5625,8 +5621,8 @@ DEFUN (neighbor_unsuppress_map, "Route-map to selectively unsuppress suppressed routes\n" "Name of route map\n") { - return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1]); + return peer_unsuppress_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg); } DEFUN (no_neighbor_unsuppress_map, @@ -5638,7 +5634,7 @@ DEFUN (no_neighbor_unsuppress_map, "Route-map to selectively unsuppress suppressed routes\n" "Name of route map\n") { - return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_unsuppress_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty)); } @@ -5701,8 +5697,8 @@ DEFUN (neighbor_maximum_prefix, "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], NULL, 0, + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, NULL, 0, NULL); } @@ -5715,8 +5711,8 @@ DEFUN (neighbor_maximum_prefix_threshold, "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2], 0, + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, NULL); } @@ -5729,8 +5725,8 @@ DEFUN (neighbor_maximum_prefix_warning, "maximum no. of prefix limit\n" "Only give warning message when limit is exceeded\n") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], NULL, 1, + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, NULL, 1, NULL); } @@ -5744,8 +5740,8 @@ DEFUN (neighbor_maximum_prefix_threshold_warning, "Threshold value (%) at which to generate a warning msg\n" "Only give warning message when limit is exceeded\n") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2], 1, NULL); + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 1, NULL); } DEFUN (neighbor_maximum_prefix_restart, @@ -5758,8 +5754,8 @@ DEFUN (neighbor_maximum_prefix_restart, "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, NULL, 0, argv[5]->arg); } DEFUN (neighbor_maximum_prefix_threshold_restart, @@ -5773,8 +5769,8 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes") { - return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), - bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); + return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, argv[6]->arg); } DEFUN (no_neighbor_maximum_prefix, @@ -5785,7 +5781,7 @@ DEFUN (no_neighbor_maximum_prefix, NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n") { - return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_maximum_prefix_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty)); } @@ -5864,14 +5860,14 @@ DEFUN (neighbor_allowas_in, struct peer *peer; unsigned int allow_num; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; if (argc == 1) allow_num = 3; else - VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); + VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[3]->arg, 1, 10); ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), allow_num); @@ -5898,7 +5894,7 @@ DEFUN (no_neighbor_allowas_in, int ret; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -5926,11 +5922,11 @@ DEFUN (neighbor_ttl_security, struct peer *peer; int gtsm_hops; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); + VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[4]->arg, 1, 254); /* * If 'neighbor swpX', then this is for directly connected peers, @@ -5938,7 +5934,7 @@ DEFUN (neighbor_ttl_security, */ if (peer->conf_if && (gtsm_hops > 1)) { vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", - argv[0], VTY_NEWLINE); + argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -5955,7 +5951,7 @@ DEFUN (no_neighbor_ttl_security, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[2]->arg); if (! peer) return CMD_WARNING; @@ -5971,11 +5967,11 @@ DEFUN (neighbor_addpath_tx_all_paths, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_ALL_PATHS); } @@ -5988,7 +5984,7 @@ DEFUN (no_neighbor_addpath_tx_all_paths, NEIGHBOR_ADDR_STR2 "Use addpath to advertise all paths to a neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_ALL_PATHS); } @@ -6002,11 +5998,11 @@ DEFUN (neighbor_addpath_tx_bestpath_per_as, { struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[1]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); } @@ -6019,7 +6015,7 @@ DEFUN (no_neighbor_addpath_tx_bestpath_per_as, NEIGHBOR_ADDR_STR2 "Use addpath to advertise the bestpath per each neighboring AS\n") { - return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); } @@ -6044,7 +6040,7 @@ DEFUN (address_family_ipv4_safi, "Address Family modifier\n" "Address Family modifier\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2]->arg, "m", 1) == 0) vty->node = BGP_IPV4M_NODE; else vty->node = BGP_IPV4_NODE; @@ -6070,7 +6066,7 @@ DEFUN (address_family_ipv6_safi, "Address Family modifier\n" "Address Family modifier\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[2]->arg, "m", 1) == 0) vty->node = BGP_IPV6M_NODE; else vty->node = BGP_IPV6_NODE; @@ -6244,10 +6240,7 @@ DEFUN (clear_ip_bgp_all, BGP_STR "Clear all peers\n") { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); - - return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); + return bgp_clear_vty (vty, argv[4]->arg, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); } ALIAS (clear_ip_bgp_all, @@ -6304,7 +6297,7 @@ DEFUN (clear_ip_bgp_peer, if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); + return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[3]->arg); } ALIAS (clear_ip_bgp_peer, @@ -6370,7 +6363,7 @@ DEFUN (clear_ip_bgp_peer_group, if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); + return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[4]->arg); } ALIAS (clear_ip_bgp_peer_group, @@ -6486,7 +6479,7 @@ DEFUN (clear_ip_bgp_prefix, if (argc == 3) return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); - return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL); } ALIAS (clear_ip_bgp_prefix, @@ -6527,7 +6520,7 @@ DEFUN (clear_ip_bgp_as, if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); + return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[3]->arg); } ALIAS (clear_ip_bgp_as, @@ -6633,7 +6626,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); @@ -6654,11 +6647,11 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, "Address Family modifier\n" BGP_SOFT_OUT_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); - return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, + return bgp_clear_vty (vty, argv[3]->arg, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); } @@ -6835,10 +6828,10 @@ DEFUN (clear_bgp_ipv6_safi_prefix, "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - if (strncmp (argv[0], "m", 1) == 0) - return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); + if (strncmp (argv[3]->arg, "m", 1) == 0) + return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_MULTICAST, NULL); else - return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_UNICAST, NULL); } DEFUN (clear_bgp_instance_ipv6_safi_prefix, @@ -6852,10 +6845,10 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL); + if (strncmp (argv[5]->arg, "m", 1) == 0) + return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_MULTICAST, NULL); else - return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_UNICAST, NULL); } DEFUN (clear_ip_bgp_peer_soft_out, @@ -6874,7 +6867,7 @@ DEFUN (clear_ip_bgp_peer_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_soft_out, @@ -6924,12 +6917,12 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, @@ -6947,12 +6940,12 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_OUT, argv[5]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_OUT, argv[5]->arg); } ALIAS (clear_ip_bgp_peer_ipv4_soft_out, @@ -6997,7 +6990,7 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, BGP_SOFT_OUT_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, @@ -7025,7 +7018,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft_out, "Soft reconfig outbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_encap_soft_out, @@ -7055,7 +7048,7 @@ DEFUN (clear_bgp_peer_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[2]->arg); } ALIAS (clear_bgp_peer_soft_out, @@ -7155,7 +7148,7 @@ DEFUN (clear_ip_bgp_peer_group_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[4]->arg); } ALIAS (clear_ip_bgp_peer_group_soft_out, @@ -7205,12 +7198,12 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[6]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[4]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[4]->arg); } DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, @@ -7228,12 +7221,12 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[2]); + if (strncmp (argv[8]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_OUT, argv[6]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_OUT, argv[6]->arg); } ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, @@ -7278,7 +7271,7 @@ DEFUN (clear_bgp_peer_group_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_bgp_peer_group_soft_out, @@ -7416,7 +7409,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); @@ -7438,11 +7431,11 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); } @@ -7570,7 +7563,7 @@ DEFUN (clear_ip_bgp_as_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_as_soft_out, @@ -7616,12 +7609,12 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, @@ -7638,12 +7631,12 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[5]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[5]->arg); } ALIAS (clear_ip_bgp_as_ipv4_soft_out, @@ -7684,7 +7677,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, BGP_SOFT_OUT_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_as_vpnv4_soft_out, @@ -7711,7 +7704,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_out, "Soft reconfig outbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[3]->arg); } ALIAS (clear_ip_bgp_as_encap_soft_out, @@ -7739,7 +7732,7 @@ DEFUN (clear_bgp_as_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[0]); + BGP_CLEAR_SOFT_OUT, argv[2]->arg); } ALIAS (clear_bgp_as_soft_out, @@ -7889,7 +7882,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); @@ -7911,11 +7904,11 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); } @@ -7957,7 +7950,7 @@ DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); @@ -8142,7 +8135,7 @@ DEFUN (clear_ip_bgp_peer_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_soft_in, @@ -8190,7 +8183,7 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter, "Push out the existing ORF prefix-list\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } DEFUN (clear_ip_bgp_peer_ipv4_soft_in, @@ -8207,12 +8200,12 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, @@ -8230,12 +8223,12 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_IN, argv[5]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_IN, argv[5]->arg); } ALIAS (clear_ip_bgp_peer_ipv4_soft_in, @@ -8279,12 +8272,12 @@ DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out the existing ORF prefix-list\n") { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, @@ -8301,7 +8294,7 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, BGP_SOFT_IN_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, @@ -8329,7 +8322,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft_in, "Soft reconfig inbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_encap_soft_in, @@ -8359,7 +8352,7 @@ DEFUN (clear_bgp_peer_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[2]->arg); } ALIAS (clear_bgp_peer_soft_in, @@ -8455,7 +8448,7 @@ DEFUN (clear_bgp_peer_in_prefix_filter, "Push out the existing ORF prefix-list\n") { return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); } ALIAS (clear_bgp_peer_in_prefix_filter, @@ -8486,7 +8479,7 @@ DEFUN (clear_ip_bgp_peer_group_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[4]->arg); } ALIAS (clear_ip_bgp_peer_group_soft_in, @@ -8534,7 +8527,7 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, "Push out prefix-list ORF and do inbound soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); } DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, @@ -8551,12 +8544,12 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[6]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[4]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[4]->arg); } DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, @@ -8574,12 +8567,12 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[2]); + if (strncmp (argv[8]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_IN, argv[6]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_IN, argv[6]->arg); } ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, @@ -8623,12 +8616,12 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[6]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); } DEFUN (clear_bgp_peer_group_soft_in, @@ -8646,7 +8639,7 @@ DEFUN (clear_bgp_peer_group_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_bgp_peer_group_soft_in, @@ -8734,7 +8727,7 @@ DEFUN (clear_bgp_peer_group_in_prefix_filter, "Push out prefix-list ORF and do inbound soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } ALIAS (clear_bgp_peer_group_in_prefix_filter, @@ -8823,7 +8816,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); @@ -8845,11 +8838,11 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); } @@ -8891,7 +8884,7 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); @@ -9021,7 +9014,7 @@ DEFUN (clear_ip_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_as_soft_in, @@ -9065,7 +9058,7 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, "Push out prefix-list ORF and do inbound soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } DEFUN (clear_ip_bgp_as_ipv4_soft_in, @@ -9081,12 +9074,12 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, @@ -9103,12 +9096,12 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_IN, argv[5]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_IN, argv[5]->arg); } ALIAS (clear_ip_bgp_as_ipv4_soft_in, @@ -9149,12 +9142,12 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } DEFUN (clear_ip_bgp_as_vpnv4_soft_in, @@ -9170,7 +9163,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, BGP_SOFT_IN_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_as_vpnv4_soft_in, @@ -9197,7 +9190,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, "Soft reconfig inbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[3]->arg); } ALIAS (clear_ip_bgp_as_encap_soft_in, @@ -9225,7 +9218,7 @@ DEFUN (clear_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[0]); + BGP_CLEAR_SOFT_IN, argv[2]->arg); } ALIAS (clear_bgp_as_soft_in, @@ -9305,7 +9298,7 @@ DEFUN (clear_bgp_as_in_prefix_filter, "Push out prefix-list ORF and do inbound soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); } ALIAS (clear_bgp_as_in_prefix_filter, @@ -9359,7 +9352,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); @@ -9380,8 +9373,8 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, @@ -9477,7 +9470,7 @@ DEFUN (clear_ip_bgp_peer_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } ALIAS (clear_ip_bgp_peer_soft, @@ -9504,12 +9497,12 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, @@ -9526,12 +9519,12 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_BOTH, argv[5]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_BOTH, argv[5]->arg); } DEFUN (clear_ip_bgp_peer_vpnv4_soft, @@ -9547,7 +9540,7 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft, BGP_SOFT_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_ip_bgp_peer_encap_soft, @@ -9562,7 +9555,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft, "Soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_bgp_peer_soft, @@ -9580,7 +9573,7 @@ DEFUN (clear_bgp_peer_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[2]->arg); } ALIAS (clear_bgp_peer_soft, @@ -9632,7 +9625,7 @@ DEFUN (clear_ip_bgp_peer_group_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[4]->arg); } ALIAS (clear_ip_bgp_peer_group_soft, @@ -9659,12 +9652,12 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[6]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[4]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[4]->arg); } DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, @@ -9681,12 +9674,12 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[2]); + if (strncmp (argv[8]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_BOTH, argv[6]->arg); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_BOTH, argv[6]->arg); } DEFUN (clear_bgp_peer_group_soft, @@ -9703,7 +9696,7 @@ DEFUN (clear_bgp_peer_group_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } ALIAS (clear_bgp_peer_group_soft, @@ -9776,7 +9769,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); @@ -9797,11 +9790,11 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[2], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); } @@ -9863,7 +9856,7 @@ DEFUN (clear_ip_bgp_as_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } ALIAS (clear_ip_bgp_as_soft, @@ -9888,12 +9881,12 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[1], "m", 1) == 0) + if (strncmp (argv[5]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_ip_bgp_instance_as_ipv4_soft, @@ -9909,12 +9902,12 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[3], "m", 1) == 0) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[2]); + if (strncmp (argv[7]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_BOTH, argv[5]->arg); - return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[2]); + return bgp_clear_vty (vty, argv[4]->arg,AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_BOTH, argv[5]->arg); } DEFUN (clear_ip_bgp_as_vpnv4_soft, @@ -9929,7 +9922,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft, BGP_SOFT_STR) { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_ip_bgp_as_encap_soft, @@ -9944,7 +9937,7 @@ DEFUN (clear_ip_bgp_as_encap_soft, "Soft reconfig\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } DEFUN (clear_bgp_as_soft, @@ -9960,7 +9953,7 @@ DEFUN (clear_bgp_as_soft, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[0]); + BGP_CLEAR_SOFT_BOTH, argv[2]->arg); } ALIAS (clear_bgp_as_soft, @@ -10692,7 +10685,7 @@ DEFUN (show_ip_bgp_instance_summary, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); } DEFUN (show_ip_bgp_instance_all_summary, @@ -10724,7 +10717,7 @@ DEFUN (show_ip_bgp_ipv4_summary, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[4]->arg, "m", 1) == 0) return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); @@ -10782,10 +10775,10 @@ DEFUN (show_ip_bgp_instance_ipv4_summary, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[1], "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); + if (strncmp (argv[6]->arg, "m", 1) == 0) + return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, uj); else - return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); } ALIAS (show_ip_bgp_instance_ipv4_summary, @@ -10831,7 +10824,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary, struct prefix_rd prd; u_char uj = use_json(argc, argv); - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[5]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -10862,7 +10855,7 @@ DEFUN (show_bgp_instance_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); + return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); } DEFUN (show_bgp_instance_all_summary, @@ -10909,7 +10902,7 @@ DEFUN (show_bgp_ipv6_safi_summary, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[0], "m", 1) == 0) + if (strncmp (argv[3]->arg, "m", 1) == 0) return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); @@ -10928,10 +10921,10 @@ DEFUN (show_bgp_instance_ipv6_safi_summary, "JavaScript Object Notation\n") { u_char uj = use_json(argc, argv); - if (strncmp (argv[2], "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj); + if (strncmp (argv[5]->arg, "m", 1) == 0) + return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, uj); - return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, uj); } /* old command */ @@ -12950,7 +12943,7 @@ DEFUN (show_ip_bgp_instance_neighbors, { u_char uj = use_json(argc, argv); - return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL); + return bgp_show_neighbor_vty (vty, argv[4]->arg, show_all, NULL, uj, NULL); } DEFUN (show_ip_bgp_instance_all_neighbors, @@ -13003,7 +12996,7 @@ DEFUN (show_ip_bgp_instance_neighbors_peer, { u_char uj = use_json(argc, argv); - return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL); + return bgp_show_neighbor_vty (vty, argv[4]->arg, show_peer, argv[6]->arg, uj, NULL); } ALIAS (show_ip_bgp_instance_neighbors_peer, @@ -13159,7 +13152,7 @@ DEFUN (show_ip_bgp_instance_updgrps, BGP_INSTANCE_HELP_STR "Detailed info about dynamic update groups\n") { - return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0)); + return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, 0)); } DEFUN (show_ip_bgp_instance_all_updgrps, @@ -13193,7 +13186,7 @@ DEFUN (show_bgp_instance_ipv6_updgrps, BGP_INSTANCE_HELP_STR "Detailed info about v6 dynamic update groups\n") { - return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0)); + return (bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, 0)); } DEFUN (show_bgp_instance_all_ipv6_updgrps, @@ -13222,8 +13215,8 @@ DEFUN (show_bgp_updgrps, afi_t afi; safi_t safi; - afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); } @@ -13255,7 +13248,7 @@ DEFUN (show_ip_bgp_instance_updgrps_s, uint64_t subgrp_id; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id)); + return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, subgrp_id)); } DEFUN (show_bgp_ipv6_updgrps_s, @@ -13283,7 +13276,7 @@ DEFUN (show_bgp_instance_ipv6_updgrps_s, uint64_t subgrp_id; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id)); + return(bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, subgrp_id)); } DEFUN (show_bgp_updgrps_s, @@ -13302,8 +13295,8 @@ DEFUN (show_bgp_updgrps_s, safi_t safi; uint64_t subgrp_id; - afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); @@ -13337,7 +13330,7 @@ DEFUN (show_bgp_instance_updgrps_stats, { struct bgp *bgp; - bgp = bgp_lookup_by_name (argv[1]); + bgp = bgp_lookup_by_name (argv[3]->arg); if (bgp) update_group_show_stats(bgp, vty); @@ -13379,7 +13372,7 @@ DEFUN (show_ip_bgp_updgrps_adj, "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0); + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[4]->arg, 0); return CMD_SUCCESS; } @@ -13396,7 +13389,7 @@ DEFUN (show_ip_bgp_instance_updgrps_adj, "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0); + show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[6]->arg, 0); return CMD_SUCCESS; } @@ -13418,9 +13411,9 @@ DEFUN (show_bgp_updgrps_afi_adj, afi_t afi; safi_t safi; - afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0); + afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[5]->arg, 0); return CMD_SUCCESS; } @@ -13434,7 +13427,7 @@ DEFUN (show_bgp_updgrps_adj, "Announced routes\n" "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0); + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[3]->arg, 0); return CMD_SUCCESS; } @@ -13449,7 +13442,7 @@ DEFUN (show_bgp_instance_updgrps_adj, "Announced routes\n" "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0); + show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[5]->arg, 0); return CMD_SUCCESS; } @@ -13468,7 +13461,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, { uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[5]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); return CMD_SUCCESS; @@ -13490,9 +13483,9 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, { uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[7]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); return CMD_SUCCESS; } @@ -13516,9 +13509,9 @@ DEFUN (show_bgp_updgrps_afi_adj_s, safi_t safi; uint64_t subgrp_id; - afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); + afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); return CMD_SUCCESS; @@ -13537,7 +13530,7 @@ DEFUN (show_bgp_updgrps_adj_s, { uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[4]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); return CMD_SUCCESS; @@ -13557,9 +13550,9 @@ DEFUN (show_bgp_instance_updgrps_adj_s, { uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); return CMD_SUCCESS; } @@ -13744,7 +13737,7 @@ DEFUN (show_ip_bgp_instance_peer_groups, BGP_INSTANCE_HELP_STR "Detailed information on all BGP peer groups\n") { - return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL); + return bgp_show_peer_group_vty (vty, argv[4]->arg, show_all_groups, NULL); } DEFUN (show_ip_bgp_peer_group, @@ -13756,7 +13749,7 @@ DEFUN (show_ip_bgp_peer_group, "BGP peer-group name\n" "Detailed information on a BGP peer group\n") { - return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); + return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[4]->arg); } DEFUN (show_ip_bgp_instance_peer_group, @@ -13769,7 +13762,7 @@ DEFUN (show_ip_bgp_instance_peer_group, "BGP peer-group name\n" "Detailed information on a BGP peer group\n") { - return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]); + return bgp_show_peer_group_vty (vty, argv[4]->arg, show_peer_group, argv[6]->arg); } /* Redistribute VTY commands. */ @@ -13782,7 +13775,7 @@ DEFUN (bgp_redistribute_ipv4, { int type; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -13803,7 +13796,7 @@ DEFUN (bgp_redistribute_ipv4_rmap, int type; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -13811,7 +13804,7 @@ DEFUN (bgp_redistribute_ipv4_rmap, } red = bgp_redist_add(vty->index, AFI_IP, type, 0); - bgp_redistribute_rmap_set (red, argv[1]); + bgp_redistribute_rmap_set (red, argv[3]->arg); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -13827,13 +13820,13 @@ DEFUN (bgp_redistribute_ipv4_metric, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[1]); + VTY_GET_INTEGER ("metric", metric, argv[3]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); @@ -13854,16 +13847,16 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[2]); + VTY_GET_INTEGER ("metric", metric, argv[5]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); - bgp_redistribute_rmap_set (red, argv[1]); + bgp_redistribute_rmap_set (red, argv[3]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -13882,17 +13875,17 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[1]); + VTY_GET_INTEGER ("metric", metric, argv[3]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); - bgp_redistribute_rmap_set (red, argv[2]); + bgp_redistribute_rmap_set (red, argv[5]->arg); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -13907,9 +13900,9 @@ DEFUN (bgp_redistribute_ipv4_ospf, u_short instance; u_short protocol; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; @@ -13932,14 +13925,14 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap, u_short instance; int protocol; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); - bgp_redistribute_rmap_set (red, argv[2]); + bgp_redistribute_rmap_set (red, argv[4]->arg); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -13958,13 +13951,13 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric, u_short instance; int protocol; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); - VTY_GET_INTEGER ("metric", metric, argv[2]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("metric", metric, argv[4]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); @@ -13988,16 +13981,16 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, u_short instance; int protocol; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); - VTY_GET_INTEGER ("metric", metric, argv[3]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("metric", metric, argv[6]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); - bgp_redistribute_rmap_set (red, argv[2]); + bgp_redistribute_rmap_set (red, argv[4]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -14019,17 +14012,17 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, u_short instance; int protocol; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); - VTY_GET_INTEGER ("metric", metric, argv[2]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("metric", metric, argv[4]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); - bgp_redistribute_rmap_set (red, argv[3]); + bgp_redistribute_rmap_set (red, argv[6]->arg); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -14045,12 +14038,12 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, u_short instance; int protocol; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[2]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); } @@ -14111,7 +14104,7 @@ DEFUN (no_bgp_redistribute_ipv4, { int type; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[2]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14169,7 +14162,7 @@ DEFUN (bgp_redistribute_ipv6, { int type; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14191,7 +14184,7 @@ DEFUN (bgp_redistribute_ipv6_rmap, int type; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14199,7 +14192,7 @@ DEFUN (bgp_redistribute_ipv6_rmap, } red = bgp_redist_add(vty->index, AFI_IP6, type, 0); - bgp_redistribute_rmap_set (red, argv[1]); + bgp_redistribute_rmap_set (red, argv[3]->arg); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14215,13 +14208,13 @@ DEFUN (bgp_redistribute_ipv6_metric, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[1]); + VTY_GET_INTEGER ("metric", metric, argv[3]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); @@ -14242,16 +14235,16 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[2]); + VTY_GET_INTEGER ("metric", metric, argv[5]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); - bgp_redistribute_rmap_set (red, argv[1]); + bgp_redistribute_rmap_set (red, argv[3]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14270,17 +14263,17 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[1]); + VTY_GET_INTEGER ("metric", metric, argv[3]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); - bgp_redistribute_rmap_set (red, argv[2]); + bgp_redistribute_rmap_set (red, argv[5]->arg); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14293,7 +14286,7 @@ DEFUN (no_bgp_redistribute_ipv6, { int type; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[2]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -16617,7 +16610,7 @@ DEFUN (show_ip_community_list_arg, { struct community_list *list; - list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); + list = community_list_lookup (bgp_clist, argv[3]->arg, COMMUNITY_LIST_MASTER); if (! list) { vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); @@ -16630,7 +16623,7 @@ DEFUN (show_ip_community_list_arg, } static int -extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, +extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, int style, int reject_all_digit_name) { int ret; @@ -16678,7 +16671,7 @@ extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, } static int -extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, +extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, int style, int delete_all) { int ret; @@ -16994,7 +16987,7 @@ DEFUN (show_ip_extcommunity_list_arg, { struct community_list *list; - list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); + list = community_list_lookup (bgp_clist, argv[3]->arg, EXTCOMMUNITY_LIST_MASTER); if (! list) { vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index bf892f872a..f99316d905 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -29,6 +29,7 @@ def token_is_variable(line_number, token): if token in ('WORD', '.LINE', # where is this defined? + 'LINE', 'PATH', 'A.B.C.D', 'A.B.C.D/M', @@ -149,7 +150,7 @@ def update_argvs(filename): cmd_string = None argv_translator = {} - elif 'argv[' in new_line: + elif 'argv[' in new_line and '->arg' not in new_line: for index in reversed(argv_translator.keys()): old_argv = "argv[%d]" % index new_argv = "argv[%d]->arg" % argv_translator[index] From 66c1ec097ed75f7161d00f6fb9fe6e76b10e0a6e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:21:30 +0000 Subject: [PATCH 087/280] Revert "isisd: Make work under new regime" This reverts commit 38c249987301aac93bebc0cb7b51784d5827c066. --- isisd/isis_redist.c | 46 +++++++++---------- isisd/isis_routemap.c | 20 ++++----- isisd/isis_te.c | 4 +- isisd/isis_vty.c | 102 +++++++++++++++++++++--------------------- isisd/isisd.c | 26 +++++------ 5 files changed, 99 insertions(+), 99 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index dd640d0bba..5311b5c69c 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -563,7 +563,7 @@ DEFUN (isis_redistribute, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]->arg); + family = str2family(argv[0]); if (family < 0) return CMD_WARNING; @@ -571,13 +571,13 @@ DEFUN (isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]->arg); + type = proto_redistnum(afi, argv[1]); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2]->arg)) + if (!strcmp("level-1", argv[2])) level = 1; - else if (!strcmp("level-2", argv[2]->arg)) + else if (!strcmp("level-2", argv[2])) level = 2; else return CMD_WARNING; @@ -588,11 +588,11 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[3]->arg) + if (argv[3]) { char *endp; - metric = strtoul(argv[3]->arg, &endp, 10); - if (argv[3]->arg[0] == '\0' || *endp != '\0') + metric = strtoul(argv[3], &endp, 10); + if (argv[3][0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -600,7 +600,7 @@ DEFUN (isis_redistribute, metric = 0xffffffff; } - routemap = argv[4]->arg; + routemap = argv[4]; isis_redist_set(area, level, family, type, metric, routemap, 0); return 0; @@ -627,7 +627,7 @@ DEFUN (no_isis_redistribute, if (argc < 3) return CMD_WARNING; - family = str2family(argv[0]->arg); + family = str2family(argv[0]); if (family < 0) return CMD_WARNING; @@ -635,13 +635,13 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]->arg); + type = proto_redistnum(afi, argv[1]); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2]->arg)) + if (!strcmp("level-1", argv[2])) level = 1; - else if (!strcmp("level-2", argv[2]->arg)) + else if (!strcmp("level-2", argv[2])) level = 2; else return CMD_WARNING; @@ -676,13 +676,13 @@ DEFUN (isis_default_originate, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]->arg); + family = str2family(argv[0]); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1]->arg)) + if (!strcmp("level-1", argv[1])) level = 1; - else if (!strcmp("level-2", argv[1]->arg)) + else if (!strcmp("level-2", argv[1])) level = 2; else return CMD_WARNING; @@ -693,7 +693,7 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[2]->arg && *argv[2]->arg != '\0') + if (argv[2] && *argv[2] != '\0') originate_type = DEFAULT_ORIGINATE_ALWAYS; else originate_type = DEFAULT_ORIGINATE; @@ -704,11 +704,11 @@ DEFUN (isis_default_originate, vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE); } - if (argv[3]->arg) + if (argv[3]) { char *endp; - metric = strtoul(argv[3]->arg, &endp, 10); - if (argv[3]->arg[0] == '\0' || *endp != '\0') + metric = strtoul(argv[3], &endp, 10); + if (argv[3][0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -716,7 +716,7 @@ DEFUN (isis_default_originate, metric = 0xffffffff; } - routemap = argv[4]->arg; + routemap = argv[4]; isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type); return 0; @@ -741,13 +741,13 @@ DEFUN (no_isis_default_originate, if (argc < 2) return CMD_WARNING; - family = str2family(argv[0]->arg); + family = str2family(argv[0]); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1]->arg)) + if (!strcmp("level-1", argv[1])) level = 1; - else if (!strcmp("level-2", argv[1]->arg)) + else if (!strcmp("level-2", argv[1])) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index f8a7e90065..fdc0100e77 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -354,7 +354,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address", argv[0]->arg); + return isis_route_match_add(vty, vty->index, "ip address", argv[0]); } DEFUN (no_match_ip_address, @@ -370,7 +370,7 @@ DEFUN (no_match_ip_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ip address", NULL); - return isis_route_match_delete(vty, vty->index, "ip address", argv[0]->arg); + return isis_route_match_delete(vty, vty->index, "ip address", argv[0]); } ALIAS (no_match_ip_address, @@ -392,7 +392,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]->arg); + return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]); } DEFUN (no_match_ip_address_prefix_list, @@ -406,7 +406,7 @@ DEFUN (no_match_ip_address_prefix_list, { if (argc == 0) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]->arg); + return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); } ALIAS (no_match_ip_address_prefix_list, @@ -429,7 +429,7 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]->arg); + return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]); } DEFUN (no_match_ipv6_address, @@ -443,7 +443,7 @@ DEFUN (no_match_ipv6_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); - return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]->arg); + return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]); } ALIAS (no_match_ipv6_address, @@ -465,7 +465,7 @@ DEFUN (match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]->arg); + return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]); } DEFUN (no_match_ipv6_address_prefix_list, @@ -479,7 +479,7 @@ DEFUN (no_match_ipv6_address_prefix_list, { if (argc == 0) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]->arg); + return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]); } ALIAS (no_match_ipv6_address_prefix_list, @@ -504,7 +504,7 @@ DEFUN (set_metric, "Metric vale for destination routing protocol\n" "Metric value\n") { - return isis_route_set_add(vty, vty->index, "metric", argv[0]->arg); + return isis_route_set_add(vty, vty->index, "metric", argv[0]); } DEFUN (no_set_metric, @@ -517,7 +517,7 @@ DEFUN (no_set_metric, { if (argc == 0) return isis_route_set_delete(vty, vty->index, "metric", NULL); - return isis_route_set_delete(vty, vty->index, "metric", argv[0]->arg); + return isis_route_set_delete(vty, vty->index, "metric", argv[0]); } ALIAS (no_set_metric, diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 6e9d061ca2..022722f760 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1167,7 +1167,7 @@ DEFUN (isis_mpls_te_router_addr, struct listnode *node; struct isis_area *area; - if (! inet_aton (argv[0]->arg, &value)) + if (! inet_aton (argv[0], &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1329,7 +1329,7 @@ DEFUN (show_isis_mpls_te_interface, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[0])) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 6a8f951f99..53c635ea61 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -64,8 +64,8 @@ DEFUN (ip_router_isis, struct interface *ifp; struct isis_circuit *circuit; struct isis_area *area; - const char *af = argv[0]->arg; - const char *area_tag = argv[1]->arg; + const char *af = argv[0]; + const char *area_tag = argv[1]; ifp = (struct interface *) vty->index; assert (ifp); @@ -118,8 +118,8 @@ DEFUN (no_ip_router_isis, struct interface *ifp; struct isis_area *area; struct isis_circuit *circuit; - const char *af = argv[0]->arg; - const char *area_tag = argv[1]->arg; + const char *af = argv[0]; + const char *area_tag = argv[1]; ifp = (struct interface *) vty->index; if (!ifp) @@ -132,7 +132,7 @@ DEFUN (no_ip_router_isis, if (!area) { vty_out (vty, "Can't find ISIS instance %s%s", - argv[0]->arg, VTY_NEWLINE); + argv[0], VTY_NEWLINE); return CMD_ERR_NO_MATCH; } @@ -204,7 +204,7 @@ DEFUN (isis_circuit_type, if (!circuit) return CMD_ERR_NO_MATCH; - is_type = string2circuit_t (argv[0]->arg); + is_type = string2circuit_t (argv[0]); if (!is_type) { vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); @@ -310,10 +310,10 @@ DEFUN (isis_passwd, if (!circuit) return CMD_ERR_NO_MATCH; - if (argv[0]->arg[0] == 'm') - rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]->arg); + if (argv[0][0] == 'm') + rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]); else - rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]->arg); + rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]); if (rv) { vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); @@ -361,7 +361,7 @@ DEFUN (isis_priority, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]->arg); + prio = atoi (argv[0]); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -413,7 +413,7 @@ DEFUN (isis_priority_l1, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]->arg); + prio = atoi (argv[0]); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -465,7 +465,7 @@ DEFUN (isis_priority_l2, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]->arg); + prio = atoi (argv[0]); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -517,7 +517,7 @@ DEFUN (isis_metric, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]->arg); + met = atoi (argv[0]); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -581,7 +581,7 @@ DEFUN (isis_metric_l1, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]->arg); + met = atoi (argv[0]); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -645,7 +645,7 @@ DEFUN (isis_metric_l2, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]->arg); + met = atoi (argv[0]); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -710,7 +710,7 @@ DEFUN (isis_hello_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", @@ -764,7 +764,7 @@ DEFUN (isis_hello_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -818,7 +818,7 @@ DEFUN (isis_hello_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -870,7 +870,7 @@ DEFUN (isis_hello_multiplier, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]->arg); + mult = atoi (argv[0]); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -922,7 +922,7 @@ DEFUN (isis_hello_multiplier_l1, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]->arg); + mult = atoi (argv[0]); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -974,7 +974,7 @@ DEFUN (isis_hello_multiplier_l2, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]->arg); + mult = atoi (argv[0]); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -1060,7 +1060,7 @@ DEFUN (csnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1112,7 +1112,7 @@ DEFUN (csnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1164,7 +1164,7 @@ DEFUN (csnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1215,7 +1215,7 @@ DEFUN (psnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1267,7 +1267,7 @@ DEFUN (psnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1319,7 +1319,7 @@ DEFUN (psnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]->arg); + interval = atol (argv[0]); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1409,7 +1409,7 @@ DEFUN (metric_style, assert(area); - if (strncmp (argv[0]->arg, "w", 1) == 0) + if (strncmp (argv[0], "w", 1) == 0) { isis_area_metricstyle_set(area, false, true); return CMD_SUCCESS; @@ -1419,9 +1419,9 @@ DEFUN (metric_style, if (ret != CMD_SUCCESS) return ret; - if (strncmp (argv[0]->arg, "t", 1) == 0) + if (strncmp (argv[0], "t", 1) == 0) isis_area_metricstyle_set(area, true, true); - else if (strncmp (argv[0]->arg, "n", 1) == 0) + else if (strncmp (argv[0], "n", 1) == 0) isis_area_metricstyle_set(area, true, false); return CMD_SUCCESS; @@ -1561,7 +1561,7 @@ DEFUN (area_lsp_mtu, { unsigned int lsp_mtu; - VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0]->arg, 128, 4352); + VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); return area_lsp_mtu_set(vty, lsp_mtu); } @@ -1601,7 +1601,7 @@ DEFUN (is_type, return CMD_ERR_NO_MATCH; } - type = string2circuit_t (argv[0]->arg); + type = string2circuit_t (argv[0]); if (!type) { vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); @@ -1684,7 +1684,7 @@ DEFUN (lsp_gen_interval, int level; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); level = IS_LEVEL_1 | IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1724,7 +1724,7 @@ DEFUN (lsp_gen_interval_l1, int level; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); level = IS_LEVEL_1; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1766,7 +1766,7 @@ DEFUN (lsp_gen_interval_l2, int level; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1806,7 +1806,7 @@ DEFUN (spf_interval, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); area->min_spf_interval[0] = interval; area->min_spf_interval[1] = interval; @@ -1847,7 +1847,7 @@ DEFUN (spf_interval_l1, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); area->min_spf_interval[0] = interval; return CMD_SUCCESS; @@ -1888,7 +1888,7 @@ DEFUN (spf_interval_l2, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]->arg); + interval = atoi (argv[0]); area->min_spf_interval[1] = interval; return CMD_SUCCESS; @@ -1976,7 +1976,7 @@ DEFUN (max_lsp_lifetime, "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]->arg)); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); } DEFUN (no_max_lsp_lifetime, @@ -2002,7 +2002,7 @@ DEFUN (max_lsp_lifetime_l1, "Maximum LSP lifetime for Level 1 only\n" "LSP lifetime for Level 1 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0]->arg)); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0])); } DEFUN (no_max_lsp_lifetime_l1, @@ -2027,7 +2027,7 @@ DEFUN (max_lsp_lifetime_l2, "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime for Level 2 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0]->arg)); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0])); } DEFUN (no_max_lsp_lifetime_l2, @@ -2096,7 +2096,7 @@ DEFUN (lsp_refresh_interval, "LSP refresh interval\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]->arg)); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); } DEFUN (no_lsp_refresh_interval, @@ -2122,7 +2122,7 @@ DEFUN (lsp_refresh_interval_l1, "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0]->arg)); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0])); } DEFUN (no_lsp_refresh_interval_l1, @@ -2148,7 +2148,7 @@ DEFUN (lsp_refresh_interval_l2, "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0]->arg)); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0])); } DEFUN (no_lsp_refresh_interval_l2, @@ -2201,17 +2201,17 @@ DEFUN (area_passwd_md5, "Level-wide password\n") { u_char snp_auth = 0; - int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2]->arg, "v", 1) == 0) + if (strncmp(argv[2], "v", 1) == 0) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, - argv[1]->arg, snp_auth); + argv[1], snp_auth); } ALIAS (area_passwd_md5, @@ -2235,17 +2235,17 @@ DEFUN (area_passwd_clear, "Area password\n") { u_char snp_auth = 0; - int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2]->arg, "v", 1) == 0) + if (strncmp(argv[2], "v", 1) == 0) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, - argv[1]->arg, snp_auth); + argv[1], snp_auth); } ALIAS (area_passwd_clear, @@ -2267,7 +2267,7 @@ DEFUN (no_area_passwd, "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") { - int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; struct isis_area *area = vty->index; if (!area) diff --git a/isisd/isisd.c b/isisd/isisd.c index 845d6aa3f1..4d7f475616 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -533,7 +533,7 @@ DEFUN (show_isis_interface_arg, "ISIS interface\n" "ISIS interface name\n") { - return show_isis_interface_common (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); + return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); } /* @@ -707,7 +707,7 @@ DEFUN (show_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return show_isis_neighbor_common (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); + return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); } DEFUN (clear_isis_neighbor, @@ -728,7 +728,7 @@ DEFUN (clear_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return clear_isis_neighbor_common (vty, argv[0]->arg); + return clear_isis_neighbor_common (vty, argv[0]); } /* @@ -1530,7 +1530,7 @@ DEFUN (show_database_lsp_brief, "IS-IS link state database\n" "LSP ID\n") { - return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_BRIEF); + return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF); } DEFUN (show_database_lsp_detail, @@ -1542,7 +1542,7 @@ DEFUN (show_database_lsp_detail, "LSP ID\n" "Detailed information\n") { - return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); } DEFUN (show_database_detail, @@ -1564,7 +1564,7 @@ DEFUN (show_database_detail_lsp, "Detailed information\n" "LSP ID\n") { - return show_isis_database (vty, argv[0]->arg, ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); } /* @@ -1577,7 +1577,7 @@ DEFUN (router_isis, "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_get (vty, argv[0]->arg); + return isis_area_get (vty, argv[0]); } /* @@ -1588,7 +1588,7 @@ DEFUN (no_router_isis, "no router isis WORD", "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_destroy (vty, argv[0]->arg); + return isis_area_destroy (vty, argv[0]); } /* @@ -1600,7 +1600,7 @@ DEFUN (net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_net_title (vty, argv[0]->arg); + return area_net_title (vty, argv[0]); } /* @@ -1613,7 +1613,7 @@ DEFUN (no_net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_clear_net_title (vty, argv[0]->arg); + return area_clear_net_title (vty, argv[0]); } void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) @@ -1973,8 +1973,8 @@ DEFUN (topology_baseis, area = vty->index; assert (area); - if (sysid2buff (buff, argv[0]->arg)) - sysid2buff (area->topology_baseis, argv[0]->arg); + if (sysid2buff (buff, argv[0])) + sysid2buff (area->topology_baseis, argv[0]); return CMD_SUCCESS; } @@ -2016,7 +2016,7 @@ DEFUN (topology_basedynh, assert (area); /* I hope that it's enough. */ - area->topology_basedynh = strndup (argv[0]->arg, 16); + area->topology_basedynh = strndup (argv[0], 16); return CMD_SUCCESS; } From 30814472b65886b2cdf4b62ed3ccc8cd087aaf4b Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:21:43 +0000 Subject: [PATCH 088/280] Revert "ripd: Fixup code to work under new way" This reverts commit 224a3ed809ae23539cd49b85ada8516cb0b0a762. --- ripd/rip_debug.c | 12 +++++------ ripd/rip_interface.c | 42 ++++++++++++++++++------------------- ripd/rip_offset.c | 8 +++---- ripd/rip_routemap.c | 42 ++++++++++++++++++------------------- ripd/rip_zebra.c | 50 ++++++++++++++++++++++---------------------- ripd/ripd.c | 26 +++++++++++------------ 6 files changed, 90 insertions(+), 90 deletions(-) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index d347bcb2aa..a267874ade 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -98,9 +98,9 @@ DEFUN (debug_rip_packet_direct, "RIP send packet\n") { rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -118,9 +118,9 @@ DEFUN_DEPRECATED (debug_rip_packet_detail, "Detailed information display\n") { rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -170,14 +170,14 @@ DEFUN (no_debug_rip_packet_direct, "RIP option set for receive packet\n" "RIP option set for send packet\n") { - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) { if (IS_RIP_DEBUG_RECV) rip_debug_packet &= ~RIP_DEBUG_SEND; else rip_debug_packet = 0; } - else if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) { if (IS_RIP_DEBUG_SEND) rip_debug_packet &= ~RIP_DEBUG_RECV; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index b9f190d321..09b35d00b9 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1228,16 +1228,16 @@ DEFUN (rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret) ret = rip_enable_network_add ((struct prefix *) &p); else - ret = rip_enable_if_add (argv[0]->arg); + ret = rip_enable_if_add (argv[0]); if (ret < 0) { - vty_out (vty, "There is a same network configuration %s%s", argv[0]->arg, + vty_out (vty, "There is a same network configuration %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1257,16 +1257,16 @@ DEFUN (no_rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret) ret = rip_enable_network_delete ((struct prefix *) &p); else - ret = rip_enable_if_delete (argv[0]->arg); + ret = rip_enable_if_delete (argv[0]); if (ret < 0) { - vty_out (vty, "Can't find network configuration %s%s", argv[0]->arg, + vty_out (vty, "Can't find network configuration %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1284,7 +1284,7 @@ DEFUN (rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { @@ -1308,7 +1308,7 @@ DEFUN (no_rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { @@ -1338,12 +1338,12 @@ DEFUN (ip_rip_receive_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]->arg) == 1) + if (atoi (argv[0]) == 1) { ri->ri_receive = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]->arg) == 2) + if (atoi (argv[0]) == 2) { ri->ri_receive = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1440,12 +1440,12 @@ DEFUN (ip_rip_send_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]->arg) == 1) + if (atoi (argv[0]) == 1) { ri->ri_send = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]->arg) == 2) + if (atoi (argv[0]) == 2) { ri->ri_send = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1548,9 +1548,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("md5", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("md5", argv[0], strlen (argv[0])) == 0) auth_type = RIP_AUTH_MD5; - else if (strncmp ("text", argv[0]->arg, strlen (argv[0]->arg)) == 0) + else if (strncmp ("text", argv[0], strlen (argv[0])) == 0) auth_type = RIP_AUTH_SIMPLE_PASSWORD; else { @@ -1570,9 +1570,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("r", argv[1]->arg, 1) == 0) + if (strncmp ("r", argv[1], 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_SIZE; - else if (strncmp ("o", argv[1]->arg, 1) == 0) + else if (strncmp ("o", argv[1], 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; else return CMD_WARNING; @@ -1656,7 +1656,7 @@ DEFUN (ip_rip_authentication_string, ifp = (struct interface *)vty->index; ri = ifp->info; - if (strlen (argv[0]->arg) > 16) + if (strlen (argv[0]) > 16) { vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s", VTY_NEWLINE); @@ -1672,7 +1672,7 @@ DEFUN (ip_rip_authentication_string, if (ri->auth_str) free (ri->auth_str); - ri->auth_str = strdup (argv[0]->arg); + ri->auth_str = strdup (argv[0]); return CMD_SUCCESS; } @@ -1735,7 +1735,7 @@ DEFUN (ip_rip_authentication_key_chain, if (ri->key_chain) free (ri->key_chain); - ri->key_chain = strdup (argv[0]->arg); + ri->key_chain = strdup (argv[0]); return CMD_SUCCESS; } @@ -1867,7 +1867,7 @@ DEFUN (rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]->arg; + const char *ifname = argv[0]; if (!strcmp(ifname,"default")) { passive_default = 1; @@ -1888,7 +1888,7 @@ DEFUN (no_rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]->arg; + const char *ifname = argv[0]; if (!strcmp(ifname,"default")) { passive_default = 0; diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 4778505328..0155f90ef0 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -289,7 +289,7 @@ DEFUN (rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL); + return rip_offset_list_set (vty, argv[0], argv[1], argv[2], NULL); } DEFUN (rip_offset_list_ifname, @@ -302,7 +302,7 @@ DEFUN (rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg); + return rip_offset_list_set (vty, argv[0], argv[1], argv[2], argv[3]); } DEFUN (no_rip_offset_list, @@ -315,7 +315,7 @@ DEFUN (no_rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL); + return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], NULL); } DEFUN (no_rip_offset_list_ifname, @@ -329,7 +329,7 @@ DEFUN (no_rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg); + return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); } static int diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index bbb0787dd7..e7263ad7be 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -742,7 +742,7 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "metric", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "metric", argv[0]); } DEFUN (no_match_metric, @@ -755,7 +755,7 @@ DEFUN (no_match_metric, if (argc == 0) return rip_route_match_delete (vty, vty->index, "metric", NULL); - return rip_route_match_delete (vty, vty->index, "metric", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "metric", argv[0]); } ALIAS (no_match_metric, @@ -773,7 +773,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return rip_route_match_add (vty, vty->index, "interface", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "interface", argv[0]); } DEFUN (no_match_interface, @@ -786,7 +786,7 @@ DEFUN (no_match_interface, if (argc == 0) return rip_route_match_delete (vty, vty->index, "interface", NULL); - return rip_route_match_delete (vty, vty->index, "interface", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "interface", argv[0]); } ALIAS (no_match_interface, @@ -807,7 +807,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "ip next-hop", argv[0]); } DEFUN (no_match_ip_next_hop, @@ -821,7 +821,7 @@ DEFUN (no_match_ip_next_hop, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip next-hop", NULL); - return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[0]); } ALIAS (no_match_ip_next_hop, @@ -844,7 +844,7 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[0]); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -859,7 +859,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", NULL); - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[0]); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -883,7 +883,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "ip address", argv[0]); } DEFUN (no_match_ip_address, @@ -897,7 +897,7 @@ DEFUN (no_match_ip_address, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip address", NULL); - return rip_route_match_delete (vty, vty->index, "ip address", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "ip address", argv[0]); } ALIAS (no_match_ip_address, @@ -920,7 +920,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[0]); } DEFUN (no_match_ip_address_prefix_list, @@ -935,7 +935,7 @@ DEFUN (no_match_ip_address_prefix_list, if (argc == 0) return rip_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); } ALIAS (no_match_ip_address_prefix_list, @@ -955,7 +955,7 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "tag", argv[0]->arg); + return rip_route_match_add (vty, vty->index, "tag", argv[0]); } DEFUN (no_match_tag, @@ -968,7 +968,7 @@ DEFUN (no_match_tag, if (argc == 0) return rip_route_match_delete (vty, vty->index, "tag", NULL); - return rip_route_match_delete (vty, vty->index, "tag", argv[0]->arg); + return rip_route_match_delete (vty, vty->index, "tag", argv[0]); } ALIAS (no_match_tag, @@ -988,7 +988,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return rip_route_set_add (vty, vty->index, "metric", argv[0]->arg); + return rip_route_set_add (vty, vty->index, "metric", argv[0]); } ALIAS (set_metric, @@ -1008,7 +1008,7 @@ DEFUN (no_set_metric, if (argc == 0) return rip_route_set_delete (vty, vty->index, "metric", NULL); - return rip_route_set_delete (vty, vty->index, "metric", argv[0]->arg); + return rip_route_set_delete (vty, vty->index, "metric", argv[0]); } ALIAS (no_set_metric, @@ -1038,7 +1038,7 @@ DEFUN (set_ip_nexthop, union sockunion su; int ret; - ret = str2sockunion (argv[0]->arg, &su); + ret = str2sockunion (argv[0], &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE); @@ -1052,7 +1052,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return rip_route_set_add (vty, vty->index, "ip next-hop", argv[0]->arg); + return rip_route_set_add (vty, vty->index, "ip next-hop", argv[0]); } DEFUN (no_set_ip_nexthop, @@ -1066,7 +1066,7 @@ DEFUN (no_set_ip_nexthop, if (argc == 0) return rip_route_set_delete (vty, vty->index, "ip next-hop", NULL); - return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[0]->arg); + return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[0]); } ALIAS (no_set_ip_nexthop, @@ -1085,7 +1085,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return rip_route_set_add (vty, vty->index, "tag", argv[0]->arg); + return rip_route_set_add (vty, vty->index, "tag", argv[0]); } DEFUN (no_set_tag, @@ -1098,7 +1098,7 @@ DEFUN (no_set_tag, if (argc == 0) return rip_route_set_delete (vty, vty->index, "tag", NULL); - return rip_route_set_delete (vty, vty->index, "tag", argv[0]->arg); + return rip_route_set_delete (vty, vty->index, "tag", argv[0]); } ALIAS (no_set_tag, diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 64d1a4dd36..6ca27d01dd 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -367,7 +367,7 @@ DEFUN (rip_redistribute_type, for(i = 0; redist_type[i].str; i++) { - if (strncmp (redist_type[i].str, argv[0]->arg, + if (strncmp (redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, @@ -376,7 +376,7 @@ DEFUN (rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -393,7 +393,7 @@ DEFUN (no_rip_redistribute_type, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP); @@ -403,7 +403,7 @@ DEFUN (no_rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -420,17 +420,17 @@ DEFUN (rip_redistribute_type_routemap, int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { - rip_routemap_set (redist_type[i].type, argv[1]->arg); + rip_routemap_set (redist_type[i].type, argv[1]); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -449,17 +449,17 @@ DEFUN (no_rip_redistribute_type_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { - if (rip_routemap_unset (redist_type[i].type,argv[1]->arg)) + if (rip_routemap_unset (redist_type[i].type,argv[1])) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -476,10 +476,10 @@ DEFUN (rip_redistribute_type_metric, int i; int metric; - metric = atoi (argv[1]->arg); + metric = atoi (argv[1]); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); @@ -489,7 +489,7 @@ DEFUN (rip_redistribute_type_metric, } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -508,17 +508,17 @@ DEFUN (no_rip_redistribute_type_metric, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]->arg))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -537,21 +537,21 @@ DEFUN (rip_redistribute_type_metric_routemap, int i; int metric; - metric = atoi (argv[1]->arg); + metric = atoi (argv[1]); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); - rip_routemap_set (redist_type[i].type, argv[2]->arg); + rip_routemap_set (redist_type[i].type, argv[2]); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -574,14 +574,14 @@ DEFUN (no_rip_redistribute_type_metric_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0]->arg, + if (strncmp(redist_type[i].str, argv[0], redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]->arg))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) return CMD_WARNING; - if (rip_routemap_unset (redist_type[i].type, argv[2]->arg)) + if (rip_routemap_unset (redist_type[i].type, argv[2])) { - rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1]->arg)); + rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1])); return CMD_WARNING; } rip_redistribute_unset (redist_type[i].type); @@ -589,7 +589,7 @@ DEFUN (no_rip_redistribute_type_metric_routemap, } } - vty_out(vty, "Invalid type %s%s", argv[0]->arg, + vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; diff --git a/ripd/ripd.c b/ripd/ripd.c index b8b992c2c7..3a8cd80e7a 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2949,7 +2949,7 @@ DEFUN (rip_version, { int version; - version = atoi (argv[0]->arg); + version = atoi (argv[0]); if (version != RIPv1 && version != RIPv2) { vty_out (vty, "invalid rip version %d%s", version, @@ -2992,7 +2992,7 @@ DEFUN (rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3028,7 +3028,7 @@ DEFUN (no_rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3040,7 +3040,7 @@ DEFUN (no_rip_route, node = route_node_lookup (rip->route, (struct prefix *) &p); if (! node) { - vty_out (vty, "Can't find route %s.%s", argv[0]->arg, + vty_out (vty, "Can't find route %s.%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -3079,7 +3079,7 @@ DEFUN (rip_default_metric, { if (rip) { - rip->default_metric = atoi (argv[0]->arg); + rip->default_metric = atoi (argv[0]); /* rip_update_default_metric (); */ } return CMD_SUCCESS; @@ -3123,21 +3123,21 @@ DEFUN (rip_timers, unsigned long RIP_TIMER_MAX = 2147483647; unsigned long RIP_TIMER_MIN = 5; - update = strtoul (argv[0]->arg, &endptr, 10); + update = strtoul (argv[0], &endptr, 10); if (update > RIP_TIMER_MAX || update < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "update timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - timeout = strtoul (argv[1]->arg, &endptr, 10); + timeout = strtoul (argv[1], &endptr, 10); if (timeout > RIP_TIMER_MAX || timeout < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "timeout timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - garbage = strtoul (argv[2]->arg, &endptr, 10); + garbage = strtoul (argv[2], &endptr, 10); if (garbage > RIP_TIMER_MAX || garbage < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "garbage timer value error%s", VTY_NEWLINE); @@ -3386,7 +3386,7 @@ DEFUN (rip_distance, "Administrative distance\n" "Distance value\n") { - rip->distance = atoi (argv[0]->arg); + rip->distance = atoi (argv[0]); return CMD_SUCCESS; } @@ -3408,7 +3408,7 @@ DEFUN (rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_set (vty, argv[0]->arg, argv[1]->arg, NULL); + rip_distance_set (vty, argv[0], argv[1], NULL); return CMD_SUCCESS; } @@ -3420,7 +3420,7 @@ DEFUN (no_rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_unset (vty, argv[0]->arg, argv[1]->arg, NULL); + rip_distance_unset (vty, argv[0], argv[1], NULL); return CMD_SUCCESS; } @@ -3432,7 +3432,7 @@ DEFUN (rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_set (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg); + rip_distance_set (vty, argv[0], argv[1], argv[2]); return CMD_SUCCESS; } @@ -3445,7 +3445,7 @@ DEFUN (no_rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_unset (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg); + rip_distance_unset (vty, argv[0], argv[1], argv[2]); return CMD_SUCCESS; } From 5cee71fb644cdfe475263ee699522133f21ddd61 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:21:49 +0000 Subject: [PATCH 089/280] Revert "pimd: Convert to the new way of working" This reverts commit 0564b02e432cba04f1245a5df77c2cf2893b51a3. --- pimd/pim_cmd.c | 130 ++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index b5faf8ad12..6cfed0f2c6 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1534,7 +1534,7 @@ DEFUN (pim_interface, "Interface's name\n") { struct interface *ifp; - const char *ifname = argv[0]->arg; + const char *ifname = argv[0]; size_t sl; sl = strlen(ifname); @@ -2374,7 +2374,7 @@ DEFUN (show_ip_rib, char nexthop_addr_str[100]; int result; - addr_str = argv[0]->arg; + addr_str = argv[0]; result = inet_pton(AF_INET, addr_str, &addr); if (result <= 0) { vty_out(vty, "Bad unicast address %s: errno=%d: %s%s", @@ -2468,14 +2468,14 @@ DEFUN (ip_pim_rp, { int result; - result = inet_pton(AF_INET, argv[0]->arg, &qpim_rp.rpf_addr.s_addr); + result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr); if (result <= 0) { - vty_out(vty, "%% Bad RP address specified: %s", argv[0]->arg); + vty_out(vty, "%% Bad RP address specified: %s", argv[0]); return CMD_WARNING; } if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) { - vty_out(vty, "%% No Path to RP address specified: %s", argv[0]->arg); + vty_out(vty, "%% No Path to RP address specified: %s", argv[0]); return CMD_WARNING; } @@ -2533,7 +2533,7 @@ DEFUN (ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2562,7 +2562,7 @@ DEFUN (no_ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2658,7 +2658,7 @@ DEFUN (interface_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]->arg; + group_str = argv[0]; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2667,7 +2667,7 @@ DEFUN (interface_ip_igmp_join, } /* Source address */ - source_str = argv[1]->arg; + source_str = argv[1]; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2705,7 +2705,7 @@ DEFUN (interface_no_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]->arg; + group_str = argv[0]; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2714,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join, } /* Source address */ - source_str = argv[1]->arg; + source_str = argv[1]; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2887,7 +2887,7 @@ DEFUN (interface_ip_igmp_query_interval, return CMD_WARNING; } - query_interval = atoi(argv[0]->arg); + query_interval = atoi(argv[0]); query_interval_dsec = 10 * query_interval; /* @@ -2981,7 +2981,7 @@ DEFUN (interface_ip_igmp_query_max_response_time, return CMD_WARNING; } - query_max_response_time = atoi(argv[0]->arg); + query_max_response_time = atoi(argv[0]); /* It seems we don't need to check bounds since command.c does it @@ -3075,7 +3075,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec, return CMD_WARNING; } - query_max_response_time_dsec = atoi(argv[0]->arg); + query_max_response_time_dsec = atoi(argv[0]); /* It seems we don't need to check bounds since command.c does it @@ -3166,7 +3166,7 @@ DEFUN (interface_ip_pim_drprio, old_dr_prio = pim_ifp->pim_dr_priority; - pim_ifp->pim_dr_priority = strtol(argv[0]->arg, NULL, 10); + pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10); if (old_dr_prio != pim_ifp->pim_dr_priority) { if (pim_if_dr_election(ifp)) @@ -3355,7 +3355,7 @@ DEFUN (interface_ip_mroute, iif = vty->index; - oifname = argv[0]->arg; + oifname = argv[0]; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3363,7 +3363,7 @@ DEFUN (interface_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]->arg; + grp_str = argv[1]; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3401,7 +3401,7 @@ DEFUN (interface_ip_mroute_source, iif = vty->index; - oifname = argv[0]->arg; + oifname = argv[0]; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3409,7 +3409,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]->arg; + grp_str = argv[1]; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3417,7 +3417,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]->arg; + src_str = argv[2]; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3452,7 +3452,7 @@ DEFUN (interface_no_ip_mroute, iif = vty->index; - oifname = argv[0]->arg; + oifname = argv[0]; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3460,7 +3460,7 @@ DEFUN (interface_no_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]->arg; + grp_str = argv[1]; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3499,7 +3499,7 @@ DEFUN (interface_no_ip_mroute_source, iif = vty->index; - oifname = argv[0]->arg; + oifname = argv[0]; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3507,7 +3507,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]->arg; + grp_str = argv[1]; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3515,7 +3515,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]->arg; + src_str = argv[2]; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3550,10 +3550,10 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[0]->arg, NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10); if (argc == 2) - pim_ifp->pim_default_holdtime = strtol(argv[1]->arg, NULL, 10); + pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10); return CMD_SUCCESS; } @@ -3856,12 +3856,12 @@ DEFUN (debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0]->arg,"h",1) == 0) + if (strncmp(argv[0],"h",1) == 0) { PIM_DO_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE); } - else if (strncmp(argv[0]->arg,"j",1) == 0) + else if (strncmp(argv[0],"j",1) == 0) { PIM_DO_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE); @@ -3894,12 +3894,12 @@ DEFUN (no_debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0]->arg,"h",1) == 0) + if (strncmp(argv[0],"h",1) == 0) { PIM_DONT_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE); } - else if (strncmp(argv[0]->arg,"j",1) == 0) + else if (strncmp(argv[0],"j",1) == 0) { PIM_DONT_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE); @@ -4138,7 +4138,7 @@ DEFUN (test_igmp_receive_report, struct in_addr *src_addr; int argi; - socket = argv[0]->arg; + socket = argv[0]; socket_fd = atoi(socket); igmp = find_igmp_sock_by_fd(socket_fd); if (!igmp) { @@ -4147,7 +4147,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - grp_str = argv[1]->arg; + grp_str = argv[1]; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4155,7 +4155,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - record_type_str = argv[2]->arg; + record_type_str = argv[2]; record_type = atoi(record_type_str); /* @@ -4183,7 +4183,7 @@ DEFUN (test_igmp_receive_report, sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); src_addr = sources; for (argi = 3; argi < argc; ++argi,++src_addr) { - src_str = argv[argi]->arg; + src_str = argv[argi]; result = inet_pton(AF_INET, src_str, src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4243,7 +4243,7 @@ DEFUN (test_pim_receive_dump, int result; /* Find interface */ - ifname = argv[0]->arg; + ifname = argv[0]; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4252,7 +4252,7 @@ DEFUN (test_pim_receive_dump, } /* Neighbor address */ - neigh_str = argv[1]->arg; + neigh_str = argv[1]; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4278,7 +4278,7 @@ DEFUN (test_pim_receive_dump, /* Scan LINE dump into buffer */ for (argi = 2; argi < argc; ++argi) { - const char *str = argv[argi]->arg; + const char *str = argv[argi]; int str_len = strlen(str); int str_last = str_len - 1; int i; @@ -4368,7 +4368,7 @@ DEFUN (test_pim_receive_hello, int result; /* Find interface */ - ifname = argv[0]->arg; + ifname = argv[0]; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4377,7 +4377,7 @@ DEFUN (test_pim_receive_hello, } /* Neighbor address */ - neigh_str = argv[1]->arg; + neigh_str = argv[1]; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4385,12 +4385,12 @@ DEFUN (test_pim_receive_hello, return CMD_WARNING; } - neigh_holdtime = atoi(argv[2]->arg); - neigh_dr_priority = atoi(argv[3]->arg); - neigh_generation_id = atoi(argv[4]->arg); - neigh_propagation_delay = atoi(argv[5]->arg); - neigh_override_interval = atoi(argv[6]->arg); - neigh_can_disable_join_suppression = atoi(argv[7]->arg); + neigh_holdtime = atoi(argv[2]); + neigh_dr_priority = atoi(argv[3]); + neigh_generation_id = atoi(argv[4]); + neigh_propagation_delay = atoi(argv[5]); + neigh_override_interval = atoi(argv[6]); + neigh_can_disable_join_suppression = atoi(argv[7]); /* Tweak IP header @@ -4409,7 +4409,7 @@ DEFUN (test_pim_receive_hello, /* Scan LINE addresses */ for (argi = 8; argi < argc; ++argi) { - const char *sec_str = argv[argi]->arg; + const char *sec_str = argv[argi]; struct in_addr sec_addr; result = inet_pton(AF_INET, sec_str, &sec_addr); if (result <= 0) { @@ -4494,7 +4494,7 @@ DEFUN (test_pim_receive_assert, int result; /* Find interface */ - ifname = argv[0]->arg; + ifname = argv[0]; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4503,7 +4503,7 @@ DEFUN (test_pim_receive_assert, } /* Neighbor address */ - neigh_str = argv[1]->arg; + neigh_str = argv[1]; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4512,7 +4512,7 @@ DEFUN (test_pim_receive_assert, } /* Group address */ - group_str = argv[2]->arg; + group_str = argv[2]; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4521,7 +4521,7 @@ DEFUN (test_pim_receive_assert, } /* Source address */ - source_str = argv[3]->arg; + source_str = argv[3]; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4529,9 +4529,9 @@ DEFUN (test_pim_receive_assert, return CMD_WARNING; } - assert_metric_preference = atoi(argv[4]->arg); - assert_route_metric = atoi(argv[5]->arg); - assert_rpt_bit_flag = atoi(argv[6]->arg); + assert_metric_preference = atoi(argv[4]); + assert_route_metric = atoi(argv[5]); + assert_rpt_bit_flag = atoi(argv[6]); remain = buf_pastend - buf; if (remain < (int) sizeof(struct ip)) { @@ -4580,7 +4580,7 @@ DEFUN (test_pim_receive_assert, } static int recv_joinprune(struct vty *vty, - struct cmd_token *argv[], + const char *argv[], int src_is_join) { uint8_t buf[1000]; @@ -4608,7 +4608,7 @@ static int recv_joinprune(struct vty *vty, uint16_t num_pruned; /* Find interface */ - ifname = argv[0]->arg; + ifname = argv[0]; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4616,10 +4616,10 @@ static int recv_joinprune(struct vty *vty, return CMD_WARNING; } - neigh_holdtime = atoi(argv[1]->arg); + neigh_holdtime = atoi(argv[1]); /* Neighbor destination address */ - neigh_dst_str = argv[2]->arg; + neigh_dst_str = argv[2]; result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr); if (result <= 0) { vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s", @@ -4628,7 +4628,7 @@ static int recv_joinprune(struct vty *vty, } /* Neighbor source address */ - neigh_src_str = argv[3]->arg; + neigh_src_str = argv[3]; result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr); if (result <= 0) { vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s", @@ -4637,7 +4637,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast group address */ - group_str = argv[4]->arg; + group_str = argv[4]; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4646,7 +4646,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast source address */ - source_str = argv[5]->arg; + source_str = argv[5]; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4819,7 +4819,7 @@ DEFUN (test_pim_receive_upcall, const char *source_str; int result; - upcall_type = argv[0]->arg; + upcall_type = argv[0]; if (upcall_type[0] == 'n') msg.im_msgtype = IGMPMSG_NOCACHE; @@ -4833,10 +4833,10 @@ DEFUN (test_pim_receive_upcall, return CMD_WARNING; } - msg.im_vif = atoi(argv[1]->arg); + msg.im_vif = atoi(argv[1]); /* Group address */ - group_str = argv[2]->arg; + group_str = argv[2]; result = inet_pton(AF_INET, group_str, &msg.im_dst); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4845,7 +4845,7 @@ DEFUN (test_pim_receive_upcall, } /* Source address */ - source_str = argv[3]->arg; + source_str = argv[3]; result = inet_pton(AF_INET, source_str, &msg.im_src); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", From ed5c254baf80bca107c083c61b4bbb7118925a15 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:21:59 +0000 Subject: [PATCH 090/280] Revert "zebra: Fixup to use the new parser" This reverts commit 5c94274ff77b7ba53a27ed68eb4b0bcdafba47b2. --- zebra/debug.c | 22 +- zebra/interface.c | 60 ++--- zebra/irdp_interface.c | 18 +- zebra/router-id.c | 6 +- zebra/rtadv.c | 38 +-- zebra/test_main.c | 2 +- zebra/zebra_routemap.c | 134 +++++------ zebra/zebra_vty.c | 510 ++++++++++++++++++++--------------------- zebra/zserv.c | 2 +- 9 files changed, 396 insertions(+), 396 deletions(-) diff --git a/zebra/debug.c b/zebra/debug.c index 1849ebde61..cdf233879a 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -131,11 +131,11 @@ DEFUN (debug_zebra_packet_direct, "Debug option set for send packet\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - if (strncmp ("detail", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("detail", argv[0], strlen (argv[0])) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; } @@ -151,9 +151,9 @@ DEFUN (debug_zebra_packet_detail, "Debug option set detailed information\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; @@ -180,9 +180,9 @@ DEFUN (debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1]->arg || (argv[0]->arg && strncmp(argv[0]->arg, "recv", strlen(argv[0]->arg)) == 0)) + if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0]->arg || (argv[1]->arg && strncmp(argv[1]->arg, "send", strlen(argv[1]->arg)) == 0)) + if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } @@ -267,9 +267,9 @@ DEFUN (no_debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("send", argv[0], strlen (argv[0])) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0]->arg, strlen (argv[0]->arg)) == 0) + if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); return CMD_SUCCESS; } @@ -296,9 +296,9 @@ DEFUN (no_debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1]->arg || (argv[0]->arg && strncmp(argv[0]->arg, "recv", strlen(argv[0]->arg)) == 0)) + if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0]->arg || (argv[1]->arg && strncmp(argv[1]->arg, "send", strlen(argv[1]->arg)) == 0)) + if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } diff --git a/zebra/interface.c b/zebra/interface.c index 5469f8c291..0546cb8f9b 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1317,7 +1317,7 @@ DEFUN (show_interface, show_interface_cmd, interface_update_stats (); if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); /* All interface print. */ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) @@ -1370,13 +1370,13 @@ DEFUN (show_interface_name_vrf, interface_update_stats (); if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[1]); /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_id); + ifp = if_lookup_by_name_vrf (argv[0], vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Can't find interface %s%s", argv[0]->arg, + vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1403,7 +1403,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_iter2id (iter)); + ifp = if_lookup_by_name_vrf (argv[0], vrf_iter2id (iter)); if (ifp) { if_dump_vty (vty, ifp); @@ -1413,7 +1413,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, if (!found) { - vty_out (vty, "%% Can't find interface %s%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1476,7 +1476,7 @@ DEFUN (show_interface_desc, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); if_show_description (vty, vrf_id); @@ -1679,7 +1679,7 @@ DEFUN (bandwidth_if, unsigned int bandwidth; ifp = (struct interface *) vty->index; - bandwidth = strtol(argv[0]->arg, NULL, 10); + bandwidth = strtol(argv[0], NULL, 10); /* bandwidth range is <1-100000> */ if (bandwidth < 1 || bandwidth > 100000) @@ -1843,7 +1843,7 @@ DEFUN (link_params_metric, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t metric; - VTY_GET_ULONG("metric", metric, argv[0]->arg); + VTY_GET_ULONG("metric", metric, argv[0]); /* Update TE metric if needed */ link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE, metric); @@ -1876,7 +1876,7 @@ DEFUN (link_params_maxbw, float bw; - if (sscanf (argv[0]->arg, "%g", &bw) != 1) + if (sscanf (argv[0], "%g", &bw) != 1) { vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1919,7 +1919,7 @@ DEFUN (link_params_max_rsv_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0]->arg, "%g", &bw) != 1) + if (sscanf (argv[0], "%g", &bw) != 1) { vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1954,14 +1954,14 @@ DEFUN (link_params_unrsv_bw, float bw; /* We don't have to consider about range check here. */ - if (sscanf (argv[0]->arg, "%d", &priority) != 1) + if (sscanf (argv[0], "%d", &priority) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); return CMD_WARNING; } - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[1], "%g", &bw) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1993,7 +1993,7 @@ DEFUN (link_params_admin_grp, struct if_link_params *iflp = if_link_params_get (ifp); unsigned long value; - if (sscanf (argv[0]->arg, "0x%lx", &value) != 1) + if (sscanf (argv[0], "0x%lx", &value) != 1) { vty_out (vty, "link_params_admin_grp: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2035,13 +2035,13 @@ DEFUN (link_params_inter_as, struct in_addr addr; u_int32_t as; - if (!inet_aton (argv[0]->arg, &addr)) + if (!inet_aton (argv[0], &addr)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_ULONG("AS number", as, argv[1]->arg); + VTY_GET_ULONG("AS number", as, argv[1]); /* Update Remote IP and Remote AS fields if needed */ if (IS_PARAM_UNSET(iflp, LP_RMT_AS) @@ -2096,7 +2096,7 @@ DEFUN (link_params_delay, u_int8_t update = 0; /* Get and Check new delay values */ - VTY_GET_ULONG("delay", delay, argv[0]->arg); + VTY_GET_ULONG("delay", delay, argv[0]); switch (argc) { case 1: @@ -2130,8 +2130,8 @@ DEFUN (link_params_delay, return CMD_WARNING; break; case 3: - VTY_GET_ULONG("minimum delay", low, argv[1]->arg); - VTY_GET_ULONG("maximum delay", high, argv[2]->arg); + VTY_GET_ULONG("minimum delay", low, argv[1]); + VTY_GET_ULONG("maximum delay", high, argv[2]); /* Check new delays value coherency */ if (delay <= low || delay >= high) { @@ -2209,7 +2209,7 @@ DEFUN (link_params_delay_var, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t value; - VTY_GET_ULONG("delay variation", value, argv[0]->arg); + VTY_GET_ULONG("delay variation", value, argv[0]); /* Update Delay Variation if needed */ link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value); @@ -2241,7 +2241,7 @@ DEFUN (link_params_pkt_loss, struct if_link_params *iflp = if_link_params_get (ifp); float fval; - if (sscanf (argv[0]->arg, "%g", &fval) != 1) + if (sscanf (argv[0], "%g", &fval) != 1) { vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2281,7 +2281,7 @@ DEFUN (link_params_res_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0]->arg, "%g", &bw) != 1) + if (sscanf (argv[0], "%g", &bw) != 1) { vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2327,7 +2327,7 @@ DEFUN (link_params_ava_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0]->arg, "%g", &bw) != 1) + if (sscanf (argv[0], "%g", &bw) != 1) { vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2373,7 +2373,7 @@ DEFUN (link_params_use_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0]->arg, "%g", &bw) != 1) + if (sscanf (argv[0], "%g", &bw) != 1) { vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2557,7 +2557,7 @@ DEFUN (ip_address, "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8)\n") { - return ip_address_install (vty, vty->index, argv[0]->arg, NULL, NULL); + return ip_address_install (vty, vty->index, argv[0], NULL, NULL); } DEFUN (no_ip_address, @@ -2568,7 +2568,7 @@ DEFUN (no_ip_address, "Set the IP address of an interface\n" "IP Address (e.g. 10.0.0.1/8)") { - return ip_address_uninstall (vty, vty->index, argv[0]->arg, NULL, NULL); + return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL); } @@ -2582,7 +2582,7 @@ DEFUN (ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_install (vty, vty->index, argv[0]->arg, NULL, argv[1]->arg); + return ip_address_install (vty, vty->index, argv[0], NULL, argv[1]); } DEFUN (no_ip_address_label, @@ -2595,7 +2595,7 @@ DEFUN (no_ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_uninstall (vty, vty->index, argv[0]->arg, NULL, argv[1]->arg); + return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1]); } #endif /* HAVE_NETLINK */ @@ -2758,7 +2758,7 @@ DEFUN (ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_install (vty, vty->index, argv[0]->arg, NULL, NULL, 0); + return ipv6_address_install (vty, vty->index, argv[0], NULL, NULL, 0); } DEFUN (no_ipv6_address, @@ -2769,7 +2769,7 @@ DEFUN (no_ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_uninstall (vty, vty->index, argv[0]->arg, NULL, NULL, 0); + return ipv6_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0); } #endif /* HAVE_IPV6 */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index cbc89dee79..8fb4fcad10 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -480,7 +480,7 @@ DEFUN (ip_irdp_holdtime, zi=ifp->info; irdp=&zi->irdp; - irdp->Lifetime = atoi(argv[0]->arg); + irdp->Lifetime = atoi(argv[0]); return CMD_SUCCESS; } @@ -503,8 +503,8 @@ DEFUN (ip_irdp_minadvertinterval, zi=ifp->info; irdp=&zi->irdp; - if( (unsigned) atoi(argv[0]->arg) <= irdp->MaxAdvertInterval) { - irdp->MinAdvertInterval = atoi(argv[0]->arg); + if( (unsigned) atoi(argv[0]) <= irdp->MaxAdvertInterval) { + irdp->MinAdvertInterval = atoi(argv[0]); return CMD_SUCCESS; } @@ -537,8 +537,8 @@ DEFUN (ip_irdp_maxadvertinterval, irdp=&zi->irdp; - if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]->arg) ) { - irdp->MaxAdvertInterval = atoi(argv[0]->arg); + if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]) ) { + irdp->MaxAdvertInterval = atoi(argv[0]); return CMD_SUCCESS; } @@ -575,7 +575,7 @@ DEFUN (ip_irdp_preference, zi=ifp->info; irdp=&zi->irdp; - irdp->Preference = atoi(argv[0]->arg); + irdp->Preference = atoi(argv[0]); return CMD_SUCCESS; } @@ -605,10 +605,10 @@ DEFUN (ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0]->arg, &ip); + ret = inet_aton(argv[0], &ip); if(!ret) return CMD_WARNING; - pref = atoi(argv[1]->arg); + pref = atoi(argv[1]); for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv)) if(adv->ip.s_addr == ip.s_addr) @@ -649,7 +649,7 @@ DEFUN (no_ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0]->arg, &ip); + ret = inet_aton(argv[0], &ip); if (!ret) return CMD_WARNING; diff --git a/zebra/router-id.c b/zebra/router-id.c index 9891b6ce01..d5d9652c59 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -223,7 +223,7 @@ DEFUN (router_id, struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; - rid.u.prefix4.s_addr = inet_addr (argv[0]->arg); + rid.u.prefix4.s_addr = inet_addr (argv[0]); if (!rid.u.prefix4.s_addr) return CMD_WARNING; @@ -231,7 +231,7 @@ DEFUN (router_id, rid.family = AF_INET; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[1]); router_id_set (&rid, vrf_id); @@ -259,7 +259,7 @@ DEFUN (no_router_id, rid.family = AF_INET; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[1]); router_id_set (&rid, vrf_id); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index b84585405c..ac297890a5 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -930,7 +930,7 @@ DEFUN (ipv6_nd_ra_interval_msec, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0]->arg, 70, 1800000); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 70, 1800000); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -965,7 +965,7 @@ DEFUN (ipv6_nd_ra_interval, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0]->arg, 1, 1800); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 1, 1800); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -1045,7 +1045,7 @@ DEFUN (ipv6_nd_ra_lifetime, ifp = (struct interface *) vty->index; zif = ifp->info; - VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0]->arg, 0, 9000); + VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000); /* The value to be placed in the Router Lifetime field * of Router Advertisements sent from the interface, @@ -1100,7 +1100,7 @@ DEFUN (ipv6_nd_reachable_time, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0]->arg, 1, RTADV_MAX_REACHABLE_TIME); + VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME); return CMD_SUCCESS; } @@ -1142,7 +1142,7 @@ DEFUN (ipv6_nd_homeagent_preference, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535); return CMD_SUCCESS; } @@ -1184,7 +1184,7 @@ DEFUN (ipv6_nd_homeagent_lifetime, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0]->arg, 0, RTADV_MAX_HALIFETIME); + VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME); return CMD_SUCCESS; } @@ -1390,7 +1390,7 @@ DEFUN (ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0]->arg, &rp.prefix); + ret = str2prefix_ipv6 (argv[0], &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1405,19 +1405,19 @@ DEFUN (ipv6_nd_prefix, if (argc > 1) { - if ((isdigit((unsigned char)argv[1]->arg[0])) - || strncmp (argv[1]->arg, "i", 1) == 0) + if ((isdigit((unsigned char)argv[1][0])) + || strncmp (argv[1], "i", 1) == 0) { - if ( strncmp (argv[1]->arg, "i", 1) == 0) + if ( strncmp (argv[1], "i", 1) == 0) rp.AdvValidLifetime = UINT32_MAX; else - rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1]->arg, + rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1], (char **)NULL, 10); - if ( strncmp (argv[2]->arg, "i", 1) == 0) + if ( strncmp (argv[2], "i", 1) == 0) rp.AdvPreferredLifetime = UINT32_MAX; else - rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2]->arg, + rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2], (char **)NULL, 10); if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) @@ -1431,11 +1431,11 @@ DEFUN (ipv6_nd_prefix, { for (i = cursor; i < argc; i++) { - if (strncmp (argv[i]->arg, "of", 2) == 0) + if (strncmp (argv[i], "of", 2) == 0) rp.AdvOnLinkFlag = 0; - if (strncmp (argv[i]->arg, "no", 2) == 0) + if (strncmp (argv[i], "no", 2) == 0) rp.AdvAutonomousFlag = 0; - if (strncmp (argv[i]->arg, "ro", 2) == 0) + if (strncmp (argv[i], "ro", 2) == 0) rp.AdvRouterAddressFlag = 1; } } @@ -1619,7 +1619,7 @@ DEFUN (no_ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0]->arg, &rp.prefix); + ret = str2prefix_ipv6 (argv[0], &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1810,7 +1810,7 @@ DEFUN (ipv6_nd_router_preference, while (0 != rtadv_pref_strs[i]) { - if (strncmp (argv[0]->arg, rtadv_pref_strs[i], 1) == 0) + if (strncmp (argv[0], rtadv_pref_strs[i], 1) == 0) { zif->rtadv.DefaultPreference = i; return CMD_SUCCESS; @@ -1861,7 +1861,7 @@ DEFUN (ipv6_nd_mtu, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0]->arg, 1, 65535); + VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535); return CMD_SUCCESS; } diff --git a/zebra/test_main.c b/zebra/test_main.c index 5bb4ee5402..bbaf450282 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -136,7 +136,7 @@ DEFUN (test_interface_state, ifp->flags = IFF_BROADCAST|IFF_MULTICAST; } - switch (argv[0]->arg[0]) + switch (argv[0][0]) { case 'u': SET_FLAG (ifp->flags, IFF_UP); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 87bbbba3ba..e6c5a3e917 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -301,7 +301,7 @@ DEFUN (match_interface, "match first hop interface of route\n" "Interface name\n") { - return zebra_route_match_add (vty, vty->index, "interface", argv[0]->arg, + return zebra_route_match_add (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -315,7 +315,7 @@ DEFUN (no_match_interface, if (argc == 0) return zebra_route_match_delete (vty, vty->index, "interface", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "interface", argv[0]->arg, RMAP_EVENT_MATCH_DELETED); + return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); } ALIAS (no_match_interface, @@ -333,7 +333,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return zebra_route_match_add (vty, vty->index, "tag", argv[0]->arg, + return zebra_route_match_add (vty, vty->index, "tag", argv[0], RMAP_EVENT_MATCH_ADDED); } @@ -348,7 +348,7 @@ DEFUN (no_match_tag, return zebra_route_match_delete (vty, vty->index, "tag", NULL, RMAP_EVENT_MATCH_DELETED); - return zebra_route_match_delete (vty, vty->index, "tag", argv[0]->arg, + return zebra_route_match_delete (vty, vty->index, "tag", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -369,7 +369,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0]->arg, RMAP_EVENT_FILTER_ADDED); + return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED); } DEFUN (no_match_ip_next_hop, @@ -384,7 +384,7 @@ DEFUN (no_match_ip_next_hop, return zebra_route_match_delete (vty, vty->index, "ip next-hop", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0]->arg, + return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_DELETED); } @@ -409,7 +409,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0]->arg, RMAP_EVENT_PLIST_ADDED); + argv[0], RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -427,7 +427,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, RMAP_EVENT_PLIST_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-list", argv[0]->arg, + "ip next-hop prefix-list", argv[0], RMAP_EVENT_PLIST_DELETED); } @@ -452,7 +452,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address", argv[0]->arg, + return zebra_route_match_add (vty, vty->index, "ip address", argv[0], RMAP_EVENT_FILTER_ADDED); } @@ -468,7 +468,7 @@ DEFUN (no_match_ip_address, return zebra_route_match_delete (vty, vty->index, "ip address", NULL, RMAP_EVENT_FILTER_DELETED); - return zebra_route_match_delete (vty, vty->index, "ip address", argv[0]->arg, + return zebra_route_match_delete (vty, vty->index, "ip address", argv[0], RMAP_EVENT_FILTER_DELETED); } @@ -493,7 +493,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0]->arg, RMAP_EVENT_PLIST_ADDED); + argv[0], RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_address_prefix_list, @@ -511,7 +511,7 @@ DEFUN (no_match_ip_address_prefix_list, RMAP_EVENT_PLIST_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip address prefix-list", argv[0]->arg, + "ip address prefix-list", argv[0], RMAP_EVENT_PLIST_DELETED); } @@ -535,7 +535,7 @@ DEFUN (match_ip_address_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-len", - argv[0]->arg, RMAP_EVENT_MATCH_ADDED); + argv[0], RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_ip_address_prefix_len, @@ -553,7 +553,7 @@ DEFUN (no_match_ip_address_prefix_len, RMAP_EVENT_MATCH_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip address prefix-len", argv[0]->arg, + "ip address prefix-len", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -576,7 +576,7 @@ DEFUN (match_ip_nexthop_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-len", - argv[0]->arg, RMAP_EVENT_MATCH_ADDED); + argv[0], RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_ip_nexthop_prefix_len, @@ -594,7 +594,7 @@ DEFUN (no_match_ip_nexthop_prefix_len, RMAP_EVENT_MATCH_DELETED); return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-len", argv[0]->arg, + "ip next-hop prefix-len", argv[0], RMAP_EVENT_MATCH_DELETED); } @@ -613,15 +613,15 @@ DEFUN (match_source_protocol, { int i; - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } return zebra_route_match_add (vty, vty->index, "source-protocol", - argv[0]->arg, RMAP_EVENT_MATCH_ADDED); + argv[0], RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_source_protocol, @@ -635,16 +635,16 @@ DEFUN (no_match_source_protocol, if (argc >= 1) { - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } } return zebra_route_match_delete (vty, vty->index, - "source-protocol", argv[0]->arg ? argv[0]->arg : NULL, + "source-protocol", argv[0] ? argv[0] : NULL, RMAP_EVENT_MATCH_DELETED); } @@ -663,9 +663,9 @@ DEFUN (set_src, struct prefix p; vrf_iter_t iter; - if (inet_pton(AF_INET, argv[0]->arg, &src.ipv4) != 1) + if (inet_pton(AF_INET, argv[0], &src.ipv4) != 1) { - if (inet_pton(AF_INET6, argv[0]->arg, &src.ipv6) != 1) + if (inet_pton(AF_INET6, argv[0], &src.ipv6) != 1) { vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE); return CMD_WARNING; @@ -706,7 +706,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[0]->arg); + return zebra_route_set_add (vty, vty->index, "src", argv[0]); } DEFUN (no_set_src, @@ -719,7 +719,7 @@ DEFUN (no_set_src, if (argc == 0) return zebra_route_set_delete (vty, vty->index, "src", NULL); - return zebra_route_set_delete (vty, vty->index, "src", argv[0]->arg); + return zebra_route_set_delete (vty, vty->index, "src", argv[0]); } DEFUN (zebra_route_map_timer, @@ -730,7 +730,7 @@ DEFUN (zebra_route_map_timer, { u_int32_t rmap_delay_timer; - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0]->arg, 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); zebra_route_map_set_delay_timer(rmap_delay_timer); return (CMD_SUCCESS); @@ -766,28 +766,28 @@ DEFUN (ip_protocol, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP][i]) { - if (strcmp(proto_rm[AFI_IP][i], argv[1]->arg) == 0) + if (strcmp(proto_rm[AFI_IP][i], argv[1]) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); } - proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); + proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]->arg); + VRF_DEFAULT, argv[0]); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -804,20 +804,20 @@ DEFUN (no_ip_protocol, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (!proto_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1]->arg, proto_rm[AFI_IP][i]) == 0) || + if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); @@ -825,7 +825,7 @@ DEFUN (no_ip_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]->arg); + VRF_DEFAULT, argv[0]); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } return CMD_SUCCESS; @@ -879,28 +879,28 @@ DEFUN (ipv6_protocol, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP6][i]) { - if (strcmp(proto_rm[AFI_IP6][i], argv[1]->arg) == 0) + if (strcmp(proto_rm[AFI_IP6][i], argv[1]) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); } - proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); + proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]->arg); + VRF_DEFAULT, argv[0]); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -917,20 +917,20 @@ DEFUN (no_ipv6_protocol, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (!proto_rm[AFI_IP6][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1]->arg, proto_rm[AFI_IP6][i]) == 0) || + if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP6][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); @@ -938,7 +938,7 @@ DEFUN (no_ipv6_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]->arg); + VRF_DEFAULT, argv[0]); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } @@ -993,25 +993,25 @@ DEFUN (ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP][i]) { - if (strcmp(nht_rm[AFI_IP][i], argv[1]->arg) == 0) + if (strcmp(nht_rm[AFI_IP][i], argv[1]) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); } - nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); + nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; @@ -1027,20 +1027,20 @@ DEFUN (no_ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (!nht_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1]->arg, nht_rm[AFI_IP][i]) == 0) || + if ((argc == 2 && strcmp(argv[1], nht_rm[AFI_IP][i]) == 0) || (argc < 2)) { XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); @@ -1097,19 +1097,19 @@ DEFUN (ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP6][i]) XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]); - nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); + nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; @@ -1125,20 +1125,20 @@ DEFUN (no_ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0]->arg, "any") == 0) + if (strcasecmp(argv[0], "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]->arg); + i = proto_name2num(argv[0]); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0]->arg ? argv[0]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", VTY_NEWLINE); return CMD_WARNING; } - if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1]->arg, nht_rm[AFI_IP6][i])) + if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1], nht_rm[AFI_IP6][i])) { - vty_out (vty, "invalid route-map \"%s\"%s", argv[1]->arg, VTY_NEWLINE); + vty_out (vty, "invalid route-map \"%s\"%s", argv[1], VTY_NEWLINE); return CMD_WARNING; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 8878d8ffe8..a7ee63d87f 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -191,7 +191,7 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argc > 2 ? argv[2]->arg : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); } ALIAS (ip_mroute_dist, @@ -213,7 +213,7 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argc > 2 ? argv[2]->arg : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); } ALIAS (no_ip_mroute_dist, @@ -239,15 +239,15 @@ DEFUN (ip_multicast_mode, "Lookup both, use entry with longer prefix\n") { - if (!strncmp (argv[0]->arg, "u", 1)) + if (!strncmp (argv[0], "u", 1)) multicast_mode_ipv4_set (MCAST_URIB_ONLY); - else if (!strncmp (argv[0]->arg, "mrib-o", 6)) + else if (!strncmp (argv[0], "mrib-o", 6)) multicast_mode_ipv4_set (MCAST_MRIB_ONLY); - else if (!strncmp (argv[0]->arg, "mrib-t", 6)) + else if (!strncmp (argv[0], "mrib-t", 6)) multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); - else if (!strncmp (argv[0]->arg, "low", 3)) + else if (!strncmp (argv[0], "low", 3)) multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); - else if (!strncmp (argv[0]->arg, "lon", 3)) + else if (!strncmp (argv[0], "lon", 3)) multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); else { @@ -306,7 +306,7 @@ DEFUN (show_ip_rpf_addr, struct rib *rib; int ret; - ret = inet_aton (argv[0]->arg, &addr); + ret = inet_aton (argv[0], &addr); if (ret == 0) { vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); @@ -334,7 +334,7 @@ DEFUN (ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, NULL, NULL); } @@ -350,7 +350,7 @@ DEFUN (ip_route_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], NULL, NULL); } @@ -365,7 +365,7 @@ DEFUN (ip_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, NULL, NULL); } @@ -383,7 +383,7 @@ DEFUN (ip_route_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], NULL, NULL); } @@ -396,7 +396,7 @@ DEFUN (ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, NULL, NULL); } @@ -412,7 +412,7 @@ DEFUN (ip_route_flags2_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], NULL, NULL); } @@ -428,7 +428,7 @@ DEFUN (ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); } @@ -446,7 +446,7 @@ DEFUN (ip_route_mask_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); } @@ -462,7 +462,7 @@ DEFUN (ip_route_mask_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); } @@ -481,7 +481,7 @@ DEFUN (ip_route_mask_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); } @@ -495,7 +495,7 @@ DEFUN (ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); } @@ -511,7 +511,7 @@ DEFUN (ip_route_mask_flags2_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); } @@ -527,8 +527,8 @@ DEFUN (ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, - argv[2]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, + argv[2], NULL); } DEFUN (ip_route_tag_distance, @@ -545,8 +545,8 @@ DEFUN (ip_route_tag_distance, "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], + argv[3], NULL); } DEFUN (ip_route_flags_distance, @@ -561,8 +561,8 @@ DEFUN (ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, + argv[3], NULL); } DEFUN (ip_route_flags_tag_distance, @@ -579,8 +579,8 @@ DEFUN (ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], + argv[4], NULL); } DEFUN (ip_route_flags_distance2, @@ -593,8 +593,8 @@ DEFUN (ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, - argv[2]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, + argv[2], NULL); } DEFUN (ip_route_flags_tag_distance2, @@ -609,8 +609,8 @@ DEFUN (ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], + argv[3], NULL); } DEFUN (ip_route_mask_distance, @@ -625,8 +625,8 @@ DEFUN (ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, + argv[3], NULL); } DEFUN (ip_route_mask_tag_distance, @@ -643,8 +643,8 @@ DEFUN (ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], + argv[4], NULL); } DEFUN (ip_route_mask_flags_tag_distance, @@ -662,8 +662,8 @@ DEFUN (ip_route_mask_flags_tag_distance, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], + argv[5], NULL); } @@ -680,8 +680,8 @@ DEFUN (ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, + argv[4], NULL); } DEFUN (ip_route_mask_flags_distance2, @@ -695,8 +695,8 @@ DEFUN (ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, + argv[3], NULL); } DEFUN (ip_route_mask_flags_tag_distance2, @@ -712,8 +712,8 @@ DEFUN (ip_route_mask_flags_tag_distance2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], + argv[4], NULL); } DEFUN (no_ip_route, @@ -727,7 +727,7 @@ DEFUN (no_ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, NULL, NULL); } @@ -744,7 +744,7 @@ DEFUN (no_ip_route_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], NULL, NULL); } @@ -784,7 +784,7 @@ DEFUN (no_ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, NULL, NULL, NULL); } @@ -800,7 +800,7 @@ DEFUN (no_ip_route_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, NULL, argv[1]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[1], NULL, NULL); } @@ -816,7 +816,7 @@ DEFUN (no_ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); } @@ -834,7 +834,7 @@ DEFUN (no_ip_route_mask_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); } @@ -877,7 +877,7 @@ DEFUN (no_ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); } @@ -894,7 +894,7 @@ DEFUN (no_ip_route_mask_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); } @@ -910,8 +910,8 @@ DEFUN (no_ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, - argv[2]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, + argv[2], NULL); } DEFUN (no_ip_route_tag_distance, @@ -928,8 +928,8 @@ DEFUN (no_ip_route_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], + argv[3], NULL); } DEFUN (no_ip_route_flags_distance, @@ -945,8 +945,8 @@ DEFUN (no_ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, + argv[3], NULL); } DEFUN (no_ip_route_flags_tag_distance, @@ -964,8 +964,8 @@ DEFUN (no_ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], + argv[4], NULL); } DEFUN (no_ip_route_flags_distance2, @@ -979,8 +979,8 @@ DEFUN (no_ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, - argv[2]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, + argv[2], NULL); } DEFUN (no_ip_route_flags_tag_distance2, @@ -996,8 +996,8 @@ DEFUN (no_ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], + argv[3], NULL); } DEFUN (no_ip_route_mask_distance, @@ -1013,8 +1013,8 @@ DEFUN (no_ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, + argv[3], NULL); } DEFUN (no_ip_route_mask_tag_distance, @@ -1032,8 +1032,8 @@ DEFUN (no_ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], + argv[4], NULL); } DEFUN (no_ip_route_mask_flags_distance, @@ -1050,8 +1050,8 @@ DEFUN (no_ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, + argv[4], NULL); } DEFUN (no_ip_route_mask_flags_tag_distance, @@ -1070,8 +1070,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], + argv[5], NULL); } DEFUN (no_ip_route_mask_flags_distance2, @@ -1086,8 +1086,8 @@ DEFUN (no_ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, - argv[3]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, + argv[3], NULL); } DEFUN (no_ip_route_mask_flags_tag_distance2, @@ -1104,8 +1104,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, - argv[4]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], + argv[4], NULL); } /* Static route configuration. */ @@ -1120,7 +1120,7 @@ DEFUN (ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); } DEFUN (ip_route_tag_vrf, @@ -1136,7 +1136,7 @@ DEFUN (ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); } DEFUN (ip_route_flags_vrf, @@ -1151,7 +1151,7 @@ DEFUN (ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); } DEFUN (ip_route_flags_tag_vrf, @@ -1169,7 +1169,7 @@ DEFUN (ip_route_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); } DEFUN (ip_route_flags2_vrf, @@ -1182,7 +1182,7 @@ DEFUN (ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); } DEFUN (ip_route_flags2_tag_vrf, @@ -1198,7 +1198,7 @@ DEFUN (ip_route_flags2_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); } /* Mask as A.B.C.D format. */ @@ -1214,7 +1214,7 @@ DEFUN (ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); } DEFUN (ip_route_mask_tag_vrf, @@ -1232,7 +1232,7 @@ DEFUN (ip_route_mask_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); } DEFUN (ip_route_mask_flags_vrf, @@ -1248,7 +1248,7 @@ DEFUN (ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); } DEFUN (ip_route_mask_flags_tag_vrf, @@ -1267,7 +1267,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); } DEFUN (ip_route_mask_flags2_vrf, @@ -1281,7 +1281,7 @@ DEFUN (ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); } DEFUN (ip_route_mask_flags2_tag_vrf, @@ -1297,7 +1297,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); } /* Distance option value. */ @@ -1313,7 +1313,7 @@ DEFUN (ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); } DEFUN (ip_route_tag_distance_vrf, @@ -1331,7 +1331,7 @@ DEFUN (ip_route_tag_distance_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); } DEFUN (ip_route_flags_distance_vrf, @@ -1347,7 +1347,7 @@ DEFUN (ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); } DEFUN (ip_route_flags_tag_distance_vrf, @@ -1365,7 +1365,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg,argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); } DEFUN (ip_route_flags_distance2_vrf, @@ -1379,7 +1379,7 @@ DEFUN (ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); } DEFUN (ip_route_flags_tag_distance2_vrf, @@ -1395,7 +1395,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], argv[3], argv[4]); } DEFUN (ip_route_mask_distance_vrf, @@ -1411,7 +1411,7 @@ DEFUN (ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); } DEFUN (ip_route_mask_tag_distance_vrf, @@ -1429,7 +1429,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); } DEFUN (ip_route_mask_flags_tag_distance_vrf, @@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } @@ -1466,7 +1466,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); } DEFUN (ip_route_mask_flags_distance2_vrf, @@ -1481,7 +1481,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); } DEFUN (ip_route_mask_flags_tag_distance2_vrf, @@ -1498,7 +1498,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); } DEFUN (no_ip_route_vrf, @@ -1513,7 +1513,7 @@ DEFUN (no_ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); } DEFUN (no_ip_route_flags_vrf, @@ -1529,7 +1529,7 @@ DEFUN (no_ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); } DEFUN (no_ip_route_tag_vrf, @@ -1546,7 +1546,7 @@ DEFUN (no_ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); } DEFUN (no_ip_route_flags_tag_vrf, @@ -1564,7 +1564,7 @@ DEFUN (no_ip_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); } DEFUN (no_ip_route_flags2_vrf, @@ -1578,7 +1578,7 @@ DEFUN (no_ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); } DEFUN (no_ip_route_flags2_tag_vrf, @@ -1594,7 +1594,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); } DEFUN (no_ip_route_mask_vrf, @@ -1610,7 +1610,7 @@ DEFUN (no_ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); } DEFUN (no_ip_route_mask_flags_vrf, @@ -1627,7 +1627,7 @@ DEFUN (no_ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); } DEFUN (no_ip_route_mask_tag_vrf, @@ -1645,7 +1645,7 @@ DEFUN (no_ip_route_mask_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); } DEFUN (no_ip_route_mask_flags_tag_vrf, @@ -1664,7 +1664,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); } DEFUN (no_ip_route_mask_flags2_vrf, @@ -1679,7 +1679,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); } DEFUN (no_ip_route_mask_flags2_tag_vrf, @@ -1696,7 +1696,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); } @@ -1713,7 +1713,7 @@ DEFUN (no_ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); } DEFUN (no_ip_route_tag_distance_vrf, @@ -1731,7 +1731,7 @@ DEFUN (no_ip_route_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); } DEFUN (no_ip_route_flags_distance_vrf, @@ -1748,7 +1748,7 @@ DEFUN (no_ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); } DEFUN (no_ip_route_flags_tag_distance_vrf, @@ -1767,7 +1767,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg,argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); } DEFUN (no_ip_route_flags_distance2_vrf, @@ -1782,7 +1782,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); } DEFUN (no_ip_route_flags_tag_distance2_vrf, @@ -1799,7 +1799,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, NULL, NULL, argv[1]->arg, argv[2]->arg , argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2] , argv[3], argv[4]); } DEFUN (no_ip_route_mask_distance_vrf, @@ -1816,7 +1816,7 @@ DEFUN (no_ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); } DEFUN (no_ip_route_mask_tag_distance_vrf, @@ -1835,7 +1835,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); } DEFUN (no_ip_route_mask_flags_distance_vrf, @@ -1853,7 +1853,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); } DEFUN (no_ip_route_mask_flags_tag_distance_vrf, @@ -1873,7 +1873,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } DEFUN (no_ip_route_mask_flags_distance2_vrf, @@ -1889,7 +1889,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); } DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, @@ -1907,7 +1907,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); } /* New RIB. Detailed information for IPv4 route. */ @@ -2433,7 +2433,7 @@ DEFUN (show_ip_route_vrf, if (argc == 1 && uj) return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj); else - return do_show_ip_route (vty, argv[0]->arg, SAFI_UNICAST, uj); + return do_show_ip_route (vty, argv[0], SAFI_UNICAST, uj); } DEFUN (show_ip_nht, @@ -2446,7 +2446,7 @@ DEFUN (show_ip_nht, vrf_id_t vrf_id = VRF_DEFAULT; if (argc) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); zebra_print_rnh_table(vrf_id, AF_INET, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -2491,7 +2491,7 @@ DEFUN (show_ipv6_nht, vrf_id_t vrf_id = VRF_DEFAULT; if (argc) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); zebra_print_rnh_table(vrf_id, AF_INET6, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -2606,11 +2606,11 @@ DEFUN (show_ip_route_tag, if (argc > 1) { - tag = atoi(argv[1]->arg); - VRF_GET_ID (vrf_id, argv[0]->arg); + tag = atoi(argv[1]); + VRF_GET_ID (vrf_id, argv[0]); } else - tag = atoi(argv[0]->arg); + tag = atoi(argv[0]); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2662,11 +2662,11 @@ DEFUN (show_ip_route_prefix_longer, if (argc > 1) { - ret = str2prefix (argv[1]->arg, &p); - VRF_GET_ID (vrf_id, argv[0]->arg); + ret = str2prefix (argv[1], &p); + VRF_GET_ID (vrf_id, argv[0]); } else - ret = str2prefix (argv[0]->arg, &p); + ret = str2prefix (argv[0], &p); if (! ret) { @@ -2719,7 +2719,7 @@ DEFUN (show_ip_route_supernets, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2772,11 +2772,11 @@ DEFUN (show_ip_route_protocol, if (argc > 1) { - type = proto_redistnum (AFI_IP, argv[1]->arg); - VRF_GET_ID (vrf_id, argv[0]->arg); + type = proto_redistnum (AFI_IP, argv[1]); + VRF_GET_ID (vrf_id, argv[0]); } else - type = proto_redistnum (AFI_IP, argv[0]->arg); + type = proto_redistnum (AFI_IP, argv[0]); if (type < 0) { @@ -2827,7 +2827,7 @@ DEFUN (show_ip_route_ospf_instance, int first = 1; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[0]); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); if (! table) @@ -2864,11 +2864,11 @@ DEFUN (show_ip_route_addr, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]->arg); - ret = str2prefix_ipv4 (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { @@ -2919,11 +2919,11 @@ DEFUN (show_ip_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]->arg); - ret = str2prefix_ipv4 (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { @@ -3120,7 +3120,7 @@ DEFUN (show_ip_route_summary, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3154,7 +3154,7 @@ DEFUN (show_ip_route_summary_prefix, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3239,8 +3239,8 @@ DEFUN (show_ip_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]->arg) - tag = atoi(argv[0]->arg); + if (argv[0]) + tag = atoi(argv[0]); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -3293,7 +3293,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0]->arg, &p); + ret = str2prefix (argv[0], &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -3402,7 +3402,7 @@ DEFUN (show_ip_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP, argv[0]->arg); + type = proto_redistnum (AFI_IP, argv[0]); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -3455,7 +3455,7 @@ DEFUN (show_ip_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3496,7 +3496,7 @@ DEFUN (show_ip_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0]->arg, &p); + ret = str2prefix_ipv4 (argv[0], &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3755,7 +3755,7 @@ DEFUN (ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_tag, @@ -3769,7 +3769,7 @@ DEFUN (ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); } DEFUN (ipv6_route_flags, @@ -3783,7 +3783,7 @@ DEFUN (ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); } DEFUN (ipv6_route_flags_tag, @@ -3799,7 +3799,7 @@ DEFUN (ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); } DEFUN (ipv6_route_ifname, @@ -3811,7 +3811,7 @@ DEFUN (ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_tag, ipv6_route_ifname_tag_cmd, @@ -3824,7 +3824,7 @@ DEFUN (ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); } DEFUN (ipv6_route_ifname_flags, @@ -3838,7 +3838,7 @@ DEFUN (ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_flags_tag, @@ -3854,7 +3854,7 @@ DEFUN (ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); } DEFUN (ipv6_route_pref, @@ -3867,7 +3867,7 @@ DEFUN (ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); } DEFUN (ipv6_route_pref_tag, @@ -3882,7 +3882,7 @@ DEFUN (ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); } DEFUN (ipv6_route_flags_pref, @@ -3897,7 +3897,7 @@ DEFUN (ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); } DEFUN (ipv6_route_flags_pref_tag, @@ -3914,7 +3914,7 @@ DEFUN (ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); } DEFUN (ipv6_route_ifname_pref, @@ -3927,7 +3927,7 @@ DEFUN (ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); } DEFUN (ipv6_route_ifname_pref_tag, @@ -3942,7 +3942,7 @@ DEFUN (ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); } DEFUN (ipv6_route_ifname_flags_pref, @@ -3957,7 +3957,7 @@ DEFUN (ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); } DEFUN (ipv6_route_ifname_flags_pref_tag, @@ -3974,7 +3974,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); } DEFUN (no_ipv6_route, @@ -3987,7 +3987,7 @@ DEFUN (no_ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_tag, @@ -4002,7 +4002,7 @@ DEFUN (no_ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); } DEFUN (no_ipv6_route_flags, @@ -4017,7 +4017,7 @@ DEFUN (no_ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); } DEFUN (no_ipv6_route_flags_tag, @@ -4034,7 +4034,7 @@ DEFUN (no_ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); } DEFUN (no_ipv6_route_ifname, @@ -4047,7 +4047,7 @@ DEFUN (no_ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_tag, @@ -4062,7 +4062,7 @@ DEFUN (no_ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags, @@ -4077,7 +4077,7 @@ DEFUN (no_ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags_tag, @@ -4094,7 +4094,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); } DEFUN (no_ipv6_route_pref, @@ -4108,7 +4108,7 @@ DEFUN (no_ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); } DEFUN (no_ipv6_route_pref_tag, @@ -4124,7 +4124,7 @@ DEFUN (no_ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); } DEFUN (no_ipv6_route_flags_pref, @@ -4140,8 +4140,8 @@ DEFUN (no_ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - /* We do not care about argv[2]->arg */ - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, NULL); + /* We do not care about argv[2] */ + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); } DEFUN (no_ipv6_route_flags_pref_tag, @@ -4159,8 +4159,8 @@ DEFUN (no_ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - /* We do not care about argv[2]->arg */ - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); + /* We do not care about argv[2] */ + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); } DEFUN (no_ipv6_route_ifname_pref, @@ -4174,7 +4174,7 @@ DEFUN (no_ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); } DEFUN (no_ipv6_route_ifname_pref_tag, @@ -4190,7 +4190,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); } DEFUN (no_ipv6_route_ifname_flags_pref, @@ -4206,7 +4206,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); } DEFUN (no_ipv6_route_ifname_flags_pref_tag, @@ -4224,7 +4224,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); } DEFUN (ipv6_route_vrf, @@ -4237,7 +4237,7 @@ DEFUN (ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, argv[2]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); } DEFUN (ipv6_route_tag_vrf, @@ -4252,7 +4252,7 @@ DEFUN (ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, argv[3]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); } DEFUN (ipv6_route_flags_vrf, @@ -4267,7 +4267,7 @@ DEFUN (ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); } DEFUN (ipv6_route_flags_tag_vrf, @@ -4284,7 +4284,7 @@ DEFUN (ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); } DEFUN (ipv6_route_ifname_vrf, @@ -4297,7 +4297,7 @@ DEFUN (ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, @@ -4311,7 +4311,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); } DEFUN (ipv6_route_ifname_flags_vrf, @@ -4326,7 +4326,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); } DEFUN (ipv6_route_ifname_flags_tag_vrf, @@ -4343,7 +4343,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); } DEFUN (ipv6_route_pref_vrf, @@ -4357,7 +4357,7 @@ DEFUN (ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, argv[3]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); } DEFUN (ipv6_route_pref_tag_vrf, @@ -4373,7 +4373,7 @@ DEFUN (ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); } DEFUN (ipv6_route_flags_pref_vrf, @@ -4389,7 +4389,7 @@ DEFUN (ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); } DEFUN (ipv6_route_flags_pref_tag_vrf, @@ -4407,7 +4407,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); } DEFUN (ipv6_route_ifname_pref_vrf, @@ -4421,7 +4421,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); } DEFUN (ipv6_route_ifname_pref_tag_vrf, @@ -4437,7 +4437,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); } DEFUN (ipv6_route_ifname_flags_pref_vrf, @@ -4453,7 +4453,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); } DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, @@ -4471,7 +4471,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); + return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } DEFUN (no_ipv6_route_vrf, @@ -4485,7 +4485,7 @@ DEFUN (no_ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, NULL, argv[2]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); } DEFUN (no_ipv6_route_tag_vrf, @@ -4501,7 +4501,7 @@ DEFUN (no_ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, NULL, argv[3]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); } DEFUN (no_ipv6_route_flags_vrf, @@ -4517,7 +4517,7 @@ DEFUN (no_ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, NULL, argv[3]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); } DEFUN (no_ipv6_route_flags_tag_vrf, @@ -4535,7 +4535,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); } DEFUN (no_ipv6_route_ifname_vrf, @@ -4549,7 +4549,7 @@ DEFUN (no_ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, NULL, argv[3]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); } DEFUN (no_ipv6_route_ifname_tag_vrf, @@ -4565,7 +4565,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[4]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); } DEFUN (no_ipv6_route_ifname_flags_vrf, @@ -4581,7 +4581,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[4]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); } DEFUN (no_ipv6_route_ifname_flags_tag_vrf, @@ -4599,7 +4599,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); } DEFUN (no_ipv6_route_pref_vrf, @@ -4614,7 +4614,7 @@ DEFUN (no_ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, NULL, argv[2]->arg, argv[3]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); } DEFUN (no_ipv6_route_pref_tag_vrf, @@ -4631,7 +4631,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); } DEFUN (no_ipv6_route_flags_pref_vrf, @@ -4648,8 +4648,8 @@ DEFUN (no_ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2]->arg */ - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg); + /* We do not care about argv[2] */ + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); } DEFUN (no_ipv6_route_flags_pref_tag_vrf, @@ -4668,8 +4668,8 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2]->arg */ - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, NULL, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + /* We do not care about argv[2] */ + return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); } DEFUN (no_ipv6_route_ifname_pref_vrf, @@ -4684,7 +4684,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[4]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); } DEFUN (no_ipv6_route_ifname_pref_tag_vrf, @@ -4701,7 +4701,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[5]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); } DEFUN (no_ipv6_route_ifname_flags_pref_vrf, @@ -4718,7 +4718,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); } DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, @@ -4737,7 +4737,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg); + return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); } DEFUN (show_ipv6_route, @@ -4758,14 +4758,14 @@ DEFUN (show_ipv6_route, json_object *json_prefix = NULL; u_char uj = use_json(argc, argv); - if (argc > 0 && argv[0]->arg && strcmp(argv[0]->arg, "json") != 0) + if (argc > 0 && argv[0] && strcmp(argv[0], "json") != 0) { - if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0]->arg))) + if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0]))) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s not defined%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE); return CMD_SUCCESS; } @@ -4774,7 +4774,7 @@ DEFUN (show_ipv6_route, if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s inactive%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE); return CMD_SUCCESS; } else @@ -4860,11 +4860,11 @@ DEFUN (show_ipv6_route_tag, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]->arg); - tag = atoi(argv[1]->arg); + VRF_GET_ID (vrf_id, argv[0]); + tag = atoi(argv[1]); } else - tag = atoi(argv[0]->arg); + tag = atoi(argv[0]); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -4916,11 +4916,11 @@ DEFUN (show_ipv6_route_prefix_longer, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]->arg); - ret = str2prefix (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix (argv[1], &p); } else - ret = str2prefix (argv[0]->arg, &p); + ret = str2prefix (argv[0], &p); if (! ret) { @@ -4974,11 +4974,11 @@ DEFUN (show_ipv6_route_protocol, if ( argc >1 ) { - VRF_GET_ID (vrf_id, argv[0]->arg); - type = proto_redistnum (AFI_IP6, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[0]); + type = proto_redistnum (AFI_IP6, argv[1]); } else - type = proto_redistnum (AFI_IP6, argv[0]->arg); + type = proto_redistnum (AFI_IP6, argv[0]); if (type < 0) { @@ -5030,11 +5030,11 @@ DEFUN (show_ipv6_route_addr, if (argc > 1 ) { - VRF_GET_ID (vrf_id, argv[0]->arg); - ret = str2prefix_ipv6 (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[0]->arg, &p); + ret = str2prefix_ipv6 (argv[0], &p); if (ret <= 0) { @@ -5085,11 +5085,11 @@ DEFUN (show_ipv6_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]->arg); - ret = str2prefix_ipv6 (argv[1]->arg, &p); + VRF_GET_ID (vrf_id, argv[0]); + ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[0]->arg, &p); + ret = str2prefix_ipv6 (argv[0], &p); if (ret <= 0) { @@ -5137,7 +5137,7 @@ DEFUN (show_ipv6_route_summary, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5171,7 +5171,7 @@ DEFUN (show_ipv6_route_summary_prefix, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5211,7 +5211,7 @@ DEFUN (show_ipv6_mroute, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); if (! table) @@ -5303,8 +5303,8 @@ DEFUN (show_ipv6_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]->arg) - tag = atoi(argv[0]->arg); + if (argv[0]) + tag = atoi(argv[0]); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -5358,7 +5358,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0]->arg, &p); + ret = str2prefix (argv[0], &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -5413,7 +5413,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[0]->arg); + type = proto_redistnum (AFI_IP6, argv[0]); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -5466,7 +5466,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0]->arg, &p); + ret = str2prefix_ipv6 (argv[0], &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); @@ -5507,7 +5507,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0]->arg, &p); + ret = str2prefix_ipv6 (argv[0], &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -5751,7 +5751,7 @@ DEFUN (ip_zebra_import_table_distance, int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]->arg); + VTY_GET_INTEGER("table", table_id, argv[0]); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5768,7 +5768,7 @@ DEFUN (ip_zebra_import_table_distance, } if (argc > 1) - VTY_GET_INTEGER_RANGE("distance", distance, argv[1]->arg, 1, 255); + VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1)); } @@ -5796,7 +5796,7 @@ DEFUN (ip_zebra_import_table_distance_routemap, const char *rmap_name; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]->arg); + VTY_GET_INTEGER("table", table_id, argv[0]); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5814,11 +5814,11 @@ DEFUN (ip_zebra_import_table_distance_routemap, if (argc > 2) { - VTY_GET_INTEGER_RANGE("distance", distance, argv[1]->arg, 1, 255); - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]->arg); + VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]); } else - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]->arg); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); } @@ -5843,7 +5843,7 @@ DEFUN (no_ip_zebra_import_table, u_int32_t table_id = 0; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]->arg); + VTY_GET_INTEGER("table", table_id, argv[0]); if (!is_zebra_valid_kernel_table(table_id)) { diff --git a/zebra/zserv.c b/zebra/zserv.c index c058588356..3402bf1dfb 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2263,7 +2263,7 @@ DEFUN (config_table, "Configure target kernel routing table\n" "TABLE integer\n") { - zebrad.rtm_table_default = strtol (argv[0]->arg, (char**)0, 10); + zebrad.rtm_table_default = strtol (argv[0], (char**)0, 10); return CMD_SUCCESS; } From e4123a9bb5fa32f2132837e861c4f34a978f926e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:22:50 +0000 Subject: [PATCH 091/280] Revert "lib: Fixup more files" This reverts commit f68cec764abf50b35945b907a2e005bc50c50831. --- lib/command.c | 4 +- lib/distribute.c | 48 ++++++++--------- lib/filter.c | 132 +++++++++++++++++++++++------------------------ lib/if_rmap.c | 12 ++--- lib/keychain.c | 76 +++++++++++++-------------- lib/routemap.c | 32 ++++++------ 6 files changed, 152 insertions(+), 152 deletions(-) diff --git a/lib/command.c b/lib/command.c index 9ca8ea5407..9cdf0a5ff0 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1325,7 +1325,7 @@ DEFUN (config_hostname, { struct cmd_token *word = argv[1]; - if (!isalpha((int) word->arg)) + if (!isalpha((int) word->arg[0])) { vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE); return CMD_WARNING; @@ -2011,7 +2011,7 @@ DEFUN (banner_motd_file, vty_out (vty, "%s does not exist", argv[3]->arg); else if (cmd == CMD_WARNING) vty_out (vty, "%s must be in %s", - argv[0]->arg, SYSCONFDIR); + argv[0], SYSCONFDIR); return cmd; } diff --git a/lib/distribute.c b/lib/distribute.c index 9ba88bf7e2..d0d637fbb4 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -314,9 +314,9 @@ DEFUN (distribute_list_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -326,7 +326,7 @@ DEFUN (distribute_list_all, } /* Get interface name corresponding distribute list. */ - distribute_list_set (NULL, type, argv[0]->arg); + distribute_list_set (NULL, type, argv[0]); return CMD_SUCCESS; } @@ -352,9 +352,9 @@ DEFUN (no_distribute_list_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -363,7 +363,7 @@ DEFUN (no_distribute_list_all, return CMD_WARNING; } - ret = distribute_list_unset (NULL, type, argv[0]->arg); + ret = distribute_list_unset (NULL, type, argv[0]); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -393,9 +393,9 @@ DEFUN (distribute_list, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -404,7 +404,7 @@ DEFUN (distribute_list, } /* Get interface name corresponding distribute list. */ - distribute_list_set (argv[2]->arg, type, argv[0]->arg); + distribute_list_set (argv[2], type, argv[0]); return CMD_SUCCESS; } @@ -431,9 +431,9 @@ DEFUN (no_distribute_list, no_distribute_list_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -441,7 +441,7 @@ DEFUN (no_distribute_list, no_distribute_list_cmd, return CMD_WARNING; } - ret = distribute_list_unset (argv[2]->arg, type, argv[0]->arg); + ret = distribute_list_unset (argv[2], type, argv[0]); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -471,9 +471,9 @@ DEFUN (distribute_list_prefix_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -483,7 +483,7 @@ DEFUN (distribute_list_prefix_all, } /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (NULL, type, argv[0]->arg); + distribute_list_prefix_set (NULL, type, argv[0]); return CMD_SUCCESS; } @@ -511,9 +511,9 @@ DEFUN (no_distribute_list_prefix_all, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -522,7 +522,7 @@ DEFUN (no_distribute_list_prefix_all, return CMD_WARNING; } - ret = distribute_list_prefix_unset (NULL, type, argv[0]->arg); + ret = distribute_list_prefix_unset (NULL, type, argv[0]); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); @@ -553,9 +553,9 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -565,7 +565,7 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd, } /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (argv[2]->arg, type, argv[0]->arg); + distribute_list_prefix_set (argv[2], type, argv[0]); return CMD_SUCCESS; } @@ -593,9 +593,9 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd, enum distribute_type type; /* Check of distribute list type. */ - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = DISTRIBUTE_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = DISTRIBUTE_OUT; else { @@ -604,7 +604,7 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd, return CMD_WARNING; } - ret = distribute_list_prefix_unset (argv[2]->arg, type, argv[0]->arg); + ret = distribute_list_prefix_unset (argv[2], type, argv[0]); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); diff --git a/lib/filter.c b/lib/filter.c index 9daecc08f5..e9ba715c92 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -713,7 +713,7 @@ DEFUN (access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], NULL, NULL, 0, 1); } @@ -727,7 +727,7 @@ DEFUN (access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 1); } @@ -742,7 +742,7 @@ DEFUN (access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 1); } @@ -756,7 +756,7 @@ DEFUN (access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); } @@ -772,7 +772,7 @@ DEFUN (no_access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], NULL, NULL, 0, 0); } @@ -787,7 +787,7 @@ DEFUN (no_access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 0); } @@ -803,7 +803,7 @@ DEFUN (no_access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", NULL, NULL, 0, 0); } @@ -818,7 +818,7 @@ DEFUN (no_access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); } @@ -837,8 +837,8 @@ DEFUN (access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg, 1 ,1); + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5], 1 ,1); } DEFUN (access_list_extended_mask_any, @@ -854,8 +854,8 @@ DEFUN (access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], "0.0.0.0", "255.255.255.255", 1, 1); } @@ -872,9 +872,9 @@ DEFUN (access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", - "255.255.255.255", argv[2]->arg, - argv[3]->arg, 1, 1); + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + "255.255.255.255", argv[2], + argv[3], 1, 1); } DEFUN (access_list_extended_any_any, @@ -889,7 +889,7 @@ DEFUN (access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -908,8 +908,8 @@ DEFUN (access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], argv[4], "0.0.0.0", 1, 1); } @@ -927,9 +927,9 @@ DEFUN (access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - "0.0.0.0", argv[3]->arg, - argv[4]->arg, 1, 1); + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + "0.0.0.0", argv[3], + argv[4], 1, 1); } DEFUN (access_list_extended_host_host, @@ -946,8 +946,8 @@ DEFUN (access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - "0.0.0.0", argv[3]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + "0.0.0.0", argv[3], "0.0.0.0", 1, 1); } @@ -964,8 +964,8 @@ DEFUN (access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", - "255.255.255.255", argv[2]->arg, + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + "255.255.255.255", argv[2], "0.0.0.0", 1, 1); } @@ -982,7 +982,7 @@ DEFUN (access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -1002,8 +1002,8 @@ DEFUN (no_access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg, 1, 0); + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5], 1, 0); } DEFUN (no_access_list_extended_mask_any, @@ -1020,8 +1020,8 @@ DEFUN (no_access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1039,9 +1039,9 @@ DEFUN (no_access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", - "255.255.255.255", argv[2]->arg, - argv[3]->arg, 1, 0); + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + "255.255.255.255", argv[2], + argv[3], 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1057,7 +1057,7 @@ DEFUN (no_access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1077,8 +1077,8 @@ DEFUN (no_access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + argv[3], argv[4], "0.0.0.0", 1, 0); } @@ -1097,9 +1097,9 @@ DEFUN (no_access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - "0.0.0.0", argv[3]->arg, - argv[4]->arg, 1, 0); + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + "0.0.0.0", argv[3], + argv[4], 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1117,8 +1117,8 @@ DEFUN (no_access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, - "0.0.0.0", argv[3]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], + "0.0.0.0", argv[3], "0.0.0.0", 1, 0); } @@ -1136,8 +1136,8 @@ DEFUN (no_access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, "0.0.0.0", - "255.255.255.255", argv[2]->arg, + return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + "255.255.255.255", argv[2], "0.0.0.0", 1, 0); } @@ -1155,7 +1155,7 @@ DEFUN (no_access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0]->arg, argv[1]->arg, argv[2]->arg, + return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1251,7 +1251,7 @@ DEFUN (access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 0, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 1); } DEFUN (access_list_exact, @@ -1264,7 +1264,7 @@ DEFUN (access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 1, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 1); } DEFUN (access_list_any, @@ -1276,7 +1276,7 @@ DEFUN (access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, "0.0.0.0/0", 0, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 1); } DEFUN (no_access_list, @@ -1289,7 +1289,7 @@ DEFUN (no_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 0, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 0); } DEFUN (no_access_list_exact, @@ -1303,7 +1303,7 @@ DEFUN (no_access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, argv[2]->arg, 1, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 0); } DEFUN (no_access_list_any, @@ -1316,7 +1316,7 @@ DEFUN (no_access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP, "0.0.0.0/0", 0, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 0); } DEFUN (no_access_list_all, @@ -1334,10 +1334,10 @@ DEFUN (no_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP, argv[0]->arg); + access = access_list_lookup (AFI_IP, argv[0]); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1369,7 +1369,7 @@ DEFUN (access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP, argv[0]->arg); + access = access_list_get (AFI_IP, argv[0]); if (access->remark) { @@ -1393,7 +1393,7 @@ DEFUN (no_access_list_remark, "IP zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP, argv[0]->arg); + return vty_access_list_remark_unset (vty, AFI_IP, argv[0]); } ALIAS (no_access_list_remark, @@ -1420,7 +1420,7 @@ DEFUN (ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 0, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1434,7 +1434,7 @@ DEFUN (ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 1, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 1); } DEFUN (ipv6_access_list_any, @@ -1447,7 +1447,7 @@ DEFUN (ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, "::/0", 0, 1); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 1); } DEFUN (no_ipv6_access_list, @@ -1461,7 +1461,7 @@ DEFUN (no_ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 0, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 0); } DEFUN (no_ipv6_access_list_exact, @@ -1476,7 +1476,7 @@ DEFUN (no_ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, argv[2]->arg, 1, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 0); } DEFUN (no_ipv6_access_list_any, @@ -1490,7 +1490,7 @@ DEFUN (no_ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0]->arg, argv[1]->arg, AFI_IP6, "::/0", 0, 0); + return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 0); } @@ -1506,10 +1506,10 @@ DEFUN (no_ipv6_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP6, argv[0]->arg); + access = access_list_lookup (AFI_IP6, argv[0]); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1538,7 +1538,7 @@ DEFUN (ipv6_access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP6, argv[0]->arg); + access = access_list_get (AFI_IP6, argv[0]); if (access->remark) { @@ -1559,7 +1559,7 @@ DEFUN (no_ipv6_access_list_remark, "IPv6 zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]->arg); + return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]); } ALIAS (no_ipv6_access_list_remark, @@ -1705,7 +1705,7 @@ DEFUN (show_ip_access_list_name, "IP extended access list (expanded range)\n" "IP zebra access-list\n") { - return filter_show (vty, argv[0]->arg, AFI_IP); + return filter_show (vty, argv[0], AFI_IP); } #ifdef HAVE_IPV6 @@ -1727,7 +1727,7 @@ DEFUN (show_ipv6_access_list_name, "List IPv6 access lists\n" "IPv6 zebra access-list\n") { - return filter_show (vty, argv[0]->arg, AFI_IP6); + return filter_show (vty, argv[0], AFI_IP6); } #endif /* HAVE_IPV6 */ diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 655da8c3d3..736f2e237d 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -220,9 +220,9 @@ DEFUN (if_rmap, { enum if_rmap_type type; - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -230,7 +230,7 @@ DEFUN (if_rmap, return CMD_WARNING; } - if_rmap_set (argv[2]->arg, type, argv[0]->arg); + if_rmap_set (argv[2], type, argv[0]); return CMD_SUCCESS; } @@ -257,9 +257,9 @@ DEFUN (no_if_rmap, int ret; enum if_rmap_type type; - if (strncmp (argv[1]->arg, "i", 1) == 0) + if (strncmp (argv[1], "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1]->arg, "o", 1) == 0) + else if (strncmp (argv[1], "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -267,7 +267,7 @@ DEFUN (no_if_rmap, return CMD_WARNING; } - ret = if_rmap_unset (argv[2]->arg, type, argv[0]->arg); + ret = if_rmap_unset (argv[2], type, argv[0]); if (! ret) { vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); diff --git a/lib/keychain.c b/lib/keychain.c index f18e42360c..ac2083cf4b 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -239,7 +239,7 @@ DEFUN (key_chain, { struct keychain *keychain; - keychain = keychain_get (argv[0]->arg); + keychain = keychain_get (argv[0]); vty->index = keychain; vty->node = KEYCHAIN_NODE; @@ -256,11 +256,11 @@ DEFUN (no_key_chain, { struct keychain *keychain; - keychain = keychain_lookup (argv[0]->arg); + keychain = keychain_lookup (argv[0]); if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find keychain %s%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -281,7 +281,7 @@ DEFUN (key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[0]); key = key_get (keychain, index); vty->index_sub = key; vty->node = KEYCHAIN_KEY_NODE; @@ -302,7 +302,7 @@ DEFUN (no_key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[0]); key = key_lookup (keychain, index); if (! key) { @@ -329,7 +329,7 @@ DEFUN (key_string, if (key->string) XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[0]->arg); + key->string = XSTRDUP(MTYPE_KEY, argv[0]); return CMD_SUCCESS; } @@ -556,8 +556,8 @@ DEFUN (accept_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5], argv[6], argv[7]); } DEFUN (accept_lifetime_day_month_month_day, @@ -577,8 +577,8 @@ DEFUN (accept_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[6], argv[5], argv[7]); } DEFUN (accept_lifetime_month_day_day_month, @@ -598,8 +598,8 @@ DEFUN (accept_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, argv[1]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], + argv[3], argv[4], argv[5], argv[6], argv[7]); } DEFUN (accept_lifetime_month_day_month_day, @@ -619,8 +619,8 @@ DEFUN (accept_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, argv[1]->arg, - argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], + argv[3], argv[4], argv[6], argv[5], argv[7]); } DEFUN (accept_lifetime_infinite_day_month, @@ -637,8 +637,8 @@ DEFUN (accept_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, - argv[2]->arg, argv[3]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[1], + argv[2], argv[3]); } DEFUN (accept_lifetime_infinite_month_day, @@ -655,8 +655,8 @@ DEFUN (accept_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, - argv[1]->arg, argv[3]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[2], + argv[1], argv[3]); } DEFUN (accept_lifetime_duration_day_month, @@ -674,8 +674,8 @@ DEFUN (accept_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0]->arg, argv[1]->arg, - argv[2]->arg, argv[3]->arg, argv[4]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[1], + argv[2], argv[3], argv[4]); } DEFUN (accept_lifetime_duration_month_day, @@ -693,8 +693,8 @@ DEFUN (accept_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0]->arg, argv[2]->arg, - argv[1]->arg, argv[3]->arg, argv[4]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[2], + argv[1], argv[3], argv[4]); } DEFUN (send_lifetime_day_month_day_month, @@ -714,8 +714,8 @@ DEFUN (send_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], + argv[4], argv[5], argv[6], argv[7]); } DEFUN (send_lifetime_day_month_month_day, @@ -735,8 +735,8 @@ DEFUN (send_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], + argv[4], argv[6], argv[5], argv[7]); } DEFUN (send_lifetime_month_day_day_month, @@ -756,8 +756,8 @@ DEFUN (send_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], + argv[4], argv[5], argv[6], argv[7]); } DEFUN (send_lifetime_month_day_month_day, @@ -777,8 +777,8 @@ DEFUN (send_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[5]->arg, argv[7]->arg); + return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], + argv[4], argv[6], argv[5], argv[7]); } DEFUN (send_lifetime_infinite_day_month, @@ -795,8 +795,8 @@ DEFUN (send_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[1], argv[2], + argv[3]); } DEFUN (send_lifetime_infinite_month_day, @@ -813,8 +813,8 @@ DEFUN (send_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, - argv[3]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[2], argv[1], + argv[3]); } DEFUN (send_lifetime_duration_day_month, @@ -832,8 +832,8 @@ DEFUN (send_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[0], argv[1], argv[2], + argv[3], argv[4]); } DEFUN (send_lifetime_duration_month_day, @@ -851,8 +851,8 @@ DEFUN (send_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0]->arg, argv[2]->arg, argv[1]->arg, - argv[3]->arg, argv[4]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[0], argv[2], argv[1], + argv[3], argv[4]); } static struct cmd_node keychain_node = diff --git a/lib/routemap.c b/lib/routemap.c index 3f3e3c25a4..10e5ed304c 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1413,9 +1413,9 @@ DEFUN (route_map, char *endptr = NULL; /* Permit check. */ - if (strncmp (argv[1]->arg, "permit", strlen (argv[1]->arg)) == 0) + if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) permit = RMAP_PERMIT; - else if (strncmp (argv[1]->arg, "deny", strlen (argv[1]->arg)) == 0) + else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) permit = RMAP_DENY; else { @@ -1424,7 +1424,7 @@ DEFUN (route_map, } /* Preference check. */ - pref = strtoul (argv[2]->arg, &endptr, 10); + pref = strtoul (argv[2], &endptr, 10); if (pref == ULONG_MAX || *endptr != '\0') { vty_out (vty, "the fourth field must be positive integer%s", @@ -1438,7 +1438,7 @@ DEFUN (route_map, } /* Get route map. */ - map = route_map_get (argv[0]->arg); + map = route_map_get (argv[0]); index = route_map_index_get (map, permit, pref); vty->index = index; @@ -1455,11 +1455,11 @@ DEFUN (no_route_map_all, { struct route_map *map; - map = route_map_lookup_by_name (argv[0]->arg); + map = route_map_lookup_by_name (argv[0]); if (map == NULL) { vty_out (vty, "%% Could not find route-map %s%s", - argv[0]->arg, VTY_NEWLINE); + argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1485,9 +1485,9 @@ DEFUN (no_route_map, char *endptr = NULL; /* Permit check. */ - if (strncmp (argv[1]->arg, "permit", strlen (argv[1]->arg)) == 0) + if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) permit = RMAP_PERMIT; - else if (strncmp (argv[1]->arg, "deny", strlen (argv[1]->arg)) == 0) + else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) permit = RMAP_DENY; else { @@ -1496,7 +1496,7 @@ DEFUN (no_route_map, } /* Preference. */ - pref = strtoul (argv[2]->arg, &endptr, 10); + pref = strtoul (argv[2], &endptr, 10); if (pref == ULONG_MAX || *endptr != '\0') { vty_out (vty, "the fourth field must be positive integer%s", @@ -1510,11 +1510,11 @@ DEFUN (no_route_map, } /* Existence check. */ - map = route_map_lookup_by_name (argv[0]->arg); + map = route_map_lookup_by_name (argv[0]); if (map == NULL) { vty_out (vty, "%% Could not find route-map %s%s", - argv[0]->arg, VTY_NEWLINE); + argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -1523,7 +1523,7 @@ DEFUN (no_route_map, if (index == NULL) { vty_out (vty, "%% Could not find route-map entry %s %s%s", - argv[0]->arg, argv[2]->arg, VTY_NEWLINE); + argv[0], argv[2], VTY_NEWLINE); return CMD_WARNING; } @@ -1598,8 +1598,8 @@ DEFUN (rmap_onmatch_goto, return CMD_WARNING; } - if (argc == 1 && argv[0]->arg) - VTY_GET_INTEGER_RANGE("route-map index", d, argv[0]->arg, 1, 65535); + if (argc == 1 && argv[0]) + VTY_GET_INTEGER_RANGE("route-map index", d, argv[0], 1, 65535); else d = index->pref + 1; @@ -1671,7 +1671,7 @@ DEFUN (rmap_show_name, { const char *name = NULL; if (argc) - name = argv[0]->arg; + name = argv[0]; return vty_show_route_map (vty, name); } @@ -1699,7 +1699,7 @@ DEFUN (rmap_call, index->map->name); XFREE (MTYPE_ROUTE_MAP_NAME, index->nextrm); } - index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[0]->arg); + index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[0]); } /* Execute event hook. */ From 86c42eff78893c25a25384aac9a8e411b00b663c Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:22:59 +0000 Subject: [PATCH 092/280] Revert "lib: Fixup plist.c" This reverts commit c65a0fe1c664b5438a13aa1d756c121ff2fb7a80. --- lib/plist.c | 208 ++++++++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index 94556af9ee..eedb830c1a 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1415,8 +1415,8 @@ DEFUN (ip_prefix_list, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, - argv[1]->arg, argv[2]->arg, NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, + argv[1], argv[2], NULL, NULL); } DEFUN (ip_prefix_list_ge, @@ -1431,8 +1431,8 @@ DEFUN (ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[3], NULL); } DEFUN (ip_prefix_list_ge_le, @@ -1449,8 +1449,8 @@ DEFUN (ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[3], argv[4]); } DEFUN (ip_prefix_list_le, @@ -1465,8 +1465,8 @@ DEFUN (ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, argv[3]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], NULL, argv[3]); } DEFUN (ip_prefix_list_le_ge, @@ -1483,8 +1483,8 @@ DEFUN (ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[4]->arg, argv[3]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[4], argv[3]); } DEFUN (ip_prefix_list_seq, @@ -1500,8 +1500,8 @@ DEFUN (ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], NULL, NULL); } DEFUN (ip_prefix_list_seq_ge, @@ -1518,8 +1518,8 @@ DEFUN (ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[4], NULL); } DEFUN (ip_prefix_list_seq_ge_le, @@ -1538,8 +1538,8 @@ DEFUN (ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5]); } DEFUN (ip_prefix_list_seq_le, @@ -1556,8 +1556,8 @@ DEFUN (ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], NULL, argv[4]); } DEFUN (ip_prefix_list_seq_le_ge, @@ -1576,8 +1576,8 @@ DEFUN (ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[5]->arg, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[5], argv[4]); } DEFUN (no_ip_prefix_list, @@ -1588,7 +1588,7 @@ DEFUN (no_ip_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL, NULL, NULL, NULL); } @@ -1604,8 +1604,8 @@ DEFUN (no_ip_prefix_list_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], NULL, NULL); } DEFUN (no_ip_prefix_list_ge, @@ -1621,8 +1621,8 @@ DEFUN (no_ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[3], NULL); } DEFUN (no_ip_prefix_list_ge_le, @@ -1640,8 +1640,8 @@ DEFUN (no_ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[3], argv[4]); } DEFUN (no_ip_prefix_list_le, @@ -1657,8 +1657,8 @@ DEFUN (no_ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, argv[3]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], NULL, argv[3]); } DEFUN (no_ip_prefix_list_le_ge, @@ -1676,8 +1676,8 @@ DEFUN (no_ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[4]->arg, argv[3]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], + argv[2], argv[4], argv[3]); } DEFUN (no_ip_prefix_list_seq, @@ -1694,8 +1694,8 @@ DEFUN (no_ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], NULL, NULL); } DEFUN (no_ip_prefix_list_seq_ge, @@ -1713,8 +1713,8 @@ DEFUN (no_ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[4], NULL); } DEFUN (no_ip_prefix_list_seq_ge_le, @@ -1734,8 +1734,8 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5]); } DEFUN (no_ip_prefix_list_seq_le, @@ -1753,8 +1753,8 @@ DEFUN (no_ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], NULL, argv[4]); } DEFUN (no_ip_prefix_list_seq_le_ge, @@ -1774,8 +1774,8 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[5]->arg, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], + argv[3], argv[5], argv[4]); } DEFUN (ip_prefix_list_sequence_number, @@ -1812,7 +1812,7 @@ DEFUN (ip_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP, 0, argv[0]->arg); + plist = prefix_list_get (AFI_IP, 0, argv[0]); if (plist->desc) { @@ -1833,7 +1833,7 @@ DEFUN (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]->arg); + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]); } ALIAS (no_ip_prefix_list_description, @@ -1864,7 +1864,7 @@ DEFUN (show_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display); } DEFUN (show_ip_prefix_list_name_seq, @@ -1877,7 +1877,7 @@ DEFUN (show_ip_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, argv[1]->arg, sequential_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1889,7 +1889,7 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1902,7 +1902,7 @@ DEFUN (show_ip_prefix_list_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1915,7 +1915,7 @@ DEFUN (show_ip_prefix_list_prefix_first_match, "IP prefix /, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0]->arg, argv[1]->arg, first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display); } DEFUN (show_ip_prefix_list_summary, @@ -1938,7 +1938,7 @@ DEFUN (show_ip_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display); } @@ -1962,7 +1962,7 @@ DEFUN (show_ip_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0]->arg, NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display); } DEFUN (clear_ip_prefix_list, @@ -1983,7 +1983,7 @@ DEFUN (clear_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0]->arg, NULL); + return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL); } DEFUN (clear_ip_prefix_list_name_prefix, @@ -1995,7 +1995,7 @@ DEFUN (clear_ip_prefix_list_name_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0]->arg, argv[1]->arg); + return vty_clear_prefix_list (vty, AFI_IP, argv[0], argv[1]); } #ifdef HAVE_IPV6 @@ -2010,8 +2010,8 @@ DEFUN (ipv6_prefix_list, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, - argv[1]->arg, argv[2]->arg, NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, + argv[1], argv[2], NULL, NULL); } DEFUN (ipv6_prefix_list_ge, @@ -2026,8 +2026,8 @@ DEFUN (ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[3], NULL); } DEFUN (ipv6_prefix_list_ge_le, @@ -2045,8 +2045,8 @@ DEFUN (ipv6_prefix_list_ge_le, "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[3], argv[4]); } DEFUN (ipv6_prefix_list_le, @@ -2061,8 +2061,8 @@ DEFUN (ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, argv[3]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], NULL, argv[3]); } DEFUN (ipv6_prefix_list_le_ge, @@ -2079,8 +2079,8 @@ DEFUN (ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[4]->arg, argv[3]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[4], argv[3]); } DEFUN (ipv6_prefix_list_seq, @@ -2096,8 +2096,8 @@ DEFUN (ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], NULL, NULL); } DEFUN (ipv6_prefix_list_seq_ge, @@ -2114,8 +2114,8 @@ DEFUN (ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[4], NULL); } DEFUN (ipv6_prefix_list_seq_ge_le, @@ -2134,8 +2134,8 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5]); } DEFUN (ipv6_prefix_list_seq_le, @@ -2152,8 +2152,8 @@ DEFUN (ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], NULL, argv[4]); } DEFUN (ipv6_prefix_list_seq_le_ge, @@ -2172,8 +2172,8 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[5]->arg, argv[4]->arg); + return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[5], argv[4]); } DEFUN (no_ipv6_prefix_list, @@ -2184,7 +2184,7 @@ DEFUN (no_ipv6_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL, NULL, NULL, NULL); } @@ -2200,8 +2200,8 @@ DEFUN (no_ipv6_prefix_list_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], NULL, NULL); } DEFUN (no_ipv6_prefix_list_ge, @@ -2217,8 +2217,8 @@ DEFUN (no_ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[3], NULL); } DEFUN (no_ipv6_prefix_list_ge_le, @@ -2236,8 +2236,8 @@ DEFUN (no_ipv6_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[3]->arg, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[3], argv[4]); } DEFUN (no_ipv6_prefix_list_le, @@ -2253,8 +2253,8 @@ DEFUN (no_ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, NULL, argv[3]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], NULL, argv[3]); } DEFUN (no_ipv6_prefix_list_le_ge, @@ -2272,8 +2272,8 @@ DEFUN (no_ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, NULL, argv[1]->arg, - argv[2]->arg, argv[4]->arg, argv[3]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], + argv[2], argv[4], argv[3]); } DEFUN (no_ipv6_prefix_list_seq, @@ -2290,8 +2290,8 @@ DEFUN (no_ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], NULL, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge, @@ -2309,8 +2309,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[4], NULL); } DEFUN (no_ipv6_prefix_list_seq_ge_le, @@ -2330,8 +2330,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[5]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5]); } DEFUN (no_ipv6_prefix_list_seq_le, @@ -2349,8 +2349,8 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, NULL, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], NULL, argv[4]); } DEFUN (no_ipv6_prefix_list_seq_le_ge, @@ -2370,8 +2370,8 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[5]->arg, argv[4]->arg); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], + argv[3], argv[5], argv[4]); } DEFUN (ipv6_prefix_list_sequence_number, @@ -2408,7 +2408,7 @@ DEFUN (ipv6_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP6, 0, argv[0]->arg); + plist = prefix_list_get (AFI_IP6, 0, argv[0]); if (plist->desc) { @@ -2429,7 +2429,7 @@ DEFUN (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]->arg); + return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]); } ALIAS (no_ipv6_prefix_list_description, @@ -2460,7 +2460,7 @@ DEFUN (show_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display); } DEFUN (show_ipv6_prefix_list_name_seq, @@ -2473,7 +2473,7 @@ DEFUN (show_ipv6_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, sequential_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2485,7 +2485,7 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2498,7 +2498,7 @@ DEFUN (show_ipv6_prefix_list_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2511,7 +2511,7 @@ DEFUN (show_ipv6_prefix_list_prefix_first_match, "IPv6 prefix /, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0]->arg, argv[1]->arg, first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display); } DEFUN (show_ipv6_prefix_list_summary, @@ -2534,7 +2534,7 @@ DEFUN (show_ipv6_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display); } DEFUN (show_ipv6_prefix_list_detail, @@ -2557,7 +2557,7 @@ DEFUN (show_ipv6_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, @@ -2578,7 +2578,7 @@ DEFUN (clear_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0]->arg, NULL); + return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL); } DEFUN (clear_ipv6_prefix_list_name_prefix, @@ -2590,7 +2590,7 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0]->arg, argv[1]->arg); + return vty_clear_prefix_list (vty, AFI_IP6, argv[0], argv[1]); } #endif /* HAVE_IPV6 */ From 7d0ca51ac8538d3df7c21906cfe63932d7b6414b Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:23:08 +0000 Subject: [PATCH 093/280] Revert "lib: Fixup ns.c" This reverts commit 5720e4ff9518275b23c28a3107a46d833eb387fa. --- lib/ns.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ns.c b/lib/ns.c index e05ef391f4..556350ed17 100644 --- a/lib/ns.c +++ b/lib/ns.c @@ -559,12 +559,12 @@ DEFUN (ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]->arg); + char *pathname = ns_netns_pathname (vty, argv[1]); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); ns = ns_get (ns_id); if (ns->name && strcmp (ns->name, pathname) != 0) @@ -598,12 +598,12 @@ DEFUN (no_ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]->arg); + char *pathname = ns_netns_pathname (vty, argv[1]); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); ns = ns_lookup (ns_id); if (!ns) From 7e347cbe1616d9cdd89cc68f681f8a06f9f150fd Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:23:14 +0000 Subject: [PATCH 094/280] Revert "lib: Fix vty.c to compile with new parser" This reverts commit c1ad0838e8de8184f6122b13472a60dbca009aa7. --- lib/vty.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index 150c33b5f4..ff559d1705 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2746,7 +2746,7 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[0]->arg, NULL); + return exec_timeout (vty, argv[0], NULL); } DEFUN (exec_timeout_sec, @@ -2756,7 +2756,7 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[0]->arg, argv[1]->arg); + return exec_timeout (vty, argv[0], argv[1]); } DEFUN (no_exec_timeout, @@ -2778,7 +2778,7 @@ DEFUN (vty_access_class, if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]->arg); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); return CMD_SUCCESS; } @@ -2791,7 +2791,7 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]->arg))) + if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2817,7 +2817,7 @@ DEFUN (vty_ipv6_access_class, if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]->arg); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); return CMD_SUCCESS; } @@ -2832,7 +2832,7 @@ DEFUN (no_vty_ipv6_access_class, "IPv6 access list\n") { if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, argv[0]->arg))) + (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); From bcff2289ed40d7715011ba6cd01fe78c5e0f4108 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:23:21 +0000 Subject: [PATCH 095/280] Revert "lib, zebra: Fixup if.c to work in the new regime" This reverts commit 2511cb40e6b0e88620f26b3506b2a454a773c93d. --- lib/if.c | 77 ++++++++++++++++++++++++++++++----------------- lib/if.h | 3 ++ lib/vrf.h | 2 +- zebra/interface.c | 1 + 4 files changed, 54 insertions(+), 29 deletions(-) diff --git a/lib/if.c b/lib/if.c index 01baa5392a..bd6079c0fd 100644 --- a/lib/if.c +++ b/lib/if.c @@ -750,37 +750,36 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME" VRF_CMD_STR_OPT, + "interface IFNAME", "Select an interface to configure\n" - "Interface's name\n" - VRF_CMD_HELP_STR) + "Interface's name\n") { struct interface *ifp; size_t sl; vrf_id_t vrf_id = VRF_DEFAULT; - if ((sl = strlen(argv[0]->arg)) > INTERFACE_NAMSIZ) + if ((sl = strlen(argv[0])) > INTERFACE_NAMSIZ) { vty_out (vty, "%% Interface name %s is invalid: length exceeds " "%d characters%s", - argv[0]->arg, INTERFACE_NAMSIZ, VTY_NEWLINE); + argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } /*Pending: need proper vrf name based lookup/(possible creation of VRF) Imagine forward reference of a vrf by name in this interface config */ if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[1]); #ifdef SUNOS_5 - ifp = if_sunwzebra_get (argv[0]->arg, sl, vrf_id); + ifp = if_sunwzebra_get (argv[0], sl, vrf_id); #else - ifp = if_get_by_name_len_vrf (argv[0]->arg, sl, vrf_id, 1); + ifp = if_get_by_name_len_vrf (argv[0], sl, vrf_id, 1); #endif /* SUNOS_5 */ if (!ifp) { - vty_out (vty, "%% interface %s not in %s%s", argv[0]->arg, argv[1]->arg, VTY_NEWLINE); + vty_out (vty, "%% interface %s not in %s%s", argv[0], argv[1], VTY_NEWLINE); return CMD_WARNING; } vty->index = ifp; @@ -789,26 +788,32 @@ DEFUN (interface, return CMD_SUCCESS; } +ALIAS (interface, + interface_vrf_cmd, + "interface IFNAME " VRF_CMD_STR, + "Select an interface to configure\n" + "Interface's name\n" + VRF_CMD_HELP_STR) + DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME" VRF_CMD_STR_OPT, + "no interface IFNAME", NO_STR "Delete a pseudo interface's configuration\n" - "Interface's name\n" - VRF_CMD_HELP_STR) + "Interface's name\n") { // deleting interface struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]->arg); + VRF_GET_ID (vrf_id, argv[1]); - ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_id); + ifp = if_lookup_by_name_vrf (argv[0], vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Interface %s does not exist%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "%% Interface %s does not exist%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -824,23 +829,32 @@ DEFUN_NOSH (no_interface, return CMD_SUCCESS; } +ALIAS (no_interface, + no_interface_vrf_cmd, + "no interface IFNAME " VRF_CMD_STR, + NO_STR + "Delete a pseudo interface's configuration\n" + "Interface's name\n" + VRF_CMD_HELP_STR) + DEFUN (vrf, vrf_cmd, - VRF_CMD_STR, - VRF_CMD_HELP_STR) + "vrf NAME", + "Select a VRF to configure\n" + "VRF's name\n") { struct vrf *vrfp; size_t sl; - if ((sl = strlen(argv[0]->arg)) > VRF_NAMSIZ) + if ((sl = strlen(argv[0])) > VRF_NAMSIZ) { vty_out (vty, "%% VRF name %s is invalid: length exceeds " "%d characters%s", - argv[0]->arg, VRF_NAMSIZ, VTY_NEWLINE); + argv[0], VRF_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } - vrfp = vrf_get (VRF_UNKNOWN, argv[0]->arg); + vrfp = vrf_get (VRF_UNKNOWN, argv[0]); vty->index = vrfp; vty->node = VRF_NODE; @@ -850,17 +864,18 @@ DEFUN (vrf, DEFUN_NOSH (no_vrf, no_vrf_cmd, - "no " VRF_CMD_STR, + "no vrf NAME", NO_STR - VRF_CMD_HELP_STR) + "Delete a pseudo VRF's configuration\n" + "VRF's name\n") { struct vrf *vrfp; - vrfp = vrf_list_lookup_by_name (argv[0]->arg); + vrfp = vrf_list_lookup_by_name (argv[0]); if (vrfp == NULL) { - vty_out (vty, "%% VRF %s does not exist%s", argv[0]->arg, VTY_NEWLINE); + vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE); return CMD_WARNING; } @@ -880,10 +895,9 @@ DEFUN_NOSH (no_vrf, /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address" VRF_CMD_STR_OPT, + "show address", SHOW_STR - "address\n" - VRF_CMD_HELP_STR) + "address\n") { struct listnode *node; struct listnode *node2; @@ -893,7 +907,7 @@ DEFUN (show_address, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]->arg); + VRF_GET_ID (vrf_id, argv[0]); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { @@ -909,6 +923,13 @@ DEFUN (show_address, return CMD_SUCCESS; } +ALIAS (show_address, + show_address_vrf_cmd, + "show address " VRF_CMD_STR, + SHOW_STR + "address\n" + VRF_CMD_HELP_STR) + DEFUN (show_address_vrf_all, show_address_vrf_all_cmd, "show address " VRF_ALL_CMD_STR, diff --git a/lib/if.h b/lib/if.h index 4913d8c8b0..d1875e695a 100644 --- a/lib/if.h +++ b/lib/if.h @@ -491,9 +491,12 @@ extern struct cmd_element interface_desc_cmd; extern struct cmd_element no_interface_desc_cmd; extern struct cmd_element interface_cmd; extern struct cmd_element no_interface_cmd; +extern struct cmd_element interface_vrf_cmd; +extern struct cmd_element no_interface_vrf_cmd; extern struct cmd_element interface_pseudo_cmd; extern struct cmd_element no_interface_pseudo_cmd; extern struct cmd_element show_address_cmd; +extern struct cmd_element show_address_vrf_cmd; extern struct cmd_element show_address_vrf_all_cmd; extern struct cmd_element vrf_cmd; extern struct cmd_element no_vrf_cmd; diff --git a/lib/vrf.h b/lib/vrf.h index c4260769a6..dcc115563d 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -50,7 +50,7 @@ enum { /* * The command strings */ -#define VRF_CMD_STR_OPT "[vrf NAME]" + #define VRF_CMD_STR "vrf NAME" #define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n" diff --git a/zebra/interface.c b/zebra/interface.c index 0546cb8f9b..9be97e2214 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -2960,6 +2960,7 @@ zebra_if_init (void) install_element (CONFIG_NODE, &zebra_interface_cmd); install_element (CONFIG_NODE, &zebra_interface_vrf_cmd); install_element (CONFIG_NODE, &no_interface_cmd); + install_element (CONFIG_NODE, &no_interface_vrf_cmd); install_default (INTERFACE_NODE); install_element (INTERFACE_NODE, &interface_desc_cmd); install_element (INTERFACE_NODE, &no_interface_desc_cmd); From 5c307a08f2508b04f7ca27cb7b3c151656f54a29 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 18:23:29 +0000 Subject: [PATCH 096/280] Revert "lib: Get thread.c to compile" This reverts commit 9c5f6b578e9c8df1186a89cee51c02348beb480a. --- lib/thread.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index 27caa86308..a26eb6bfd2 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -305,9 +305,9 @@ DEFUN (show_thread_cpu, if (argc > 0) { filter = 0; - while (argv[0]->arg[i] != '\0') + while (argv[0][i] != '\0') { - switch ( argv[0]->arg[i] ) + switch ( argv[0][i] ) { case 'r': case 'R': @@ -342,7 +342,7 @@ DEFUN (show_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0]->arg, VTY_NEWLINE); + argv[0], VTY_NEWLINE); return CMD_WARNING; } } @@ -387,9 +387,9 @@ DEFUN (clear_thread_cpu, if (argc > 0) { filter = 0; - while (argv[0]->arg[i] != '\0') + while (argv[0][i] != '\0') { - switch ( argv[0]->arg[i] ) + switch ( argv[0][i] ) { case 'r': case 'R': @@ -424,7 +424,7 @@ DEFUN (clear_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0]->arg, VTY_NEWLINE); + argv[0], VTY_NEWLINE); return CMD_WARNING; } } From b87c0c3cf0281f5a18dc6641bfd62fa585fafdc3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 18:26:11 +0000 Subject: [PATCH 097/280] lib: Remove last remnants of NUMBER_TKN...again Signed-off-by: Quentin Young --- lib/command_match.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 65a5baa9ec..03efa93e04 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -418,8 +418,6 @@ score_precedence (enum cmd_token_type type) case IPV4_PREFIX_TKN: case IPV6_TKN: case IPV6_PREFIX_TKN: - case NUMBER_TKN: - return 1; case RANGE_TKN: return 2; case WORD_TKN: @@ -544,8 +542,6 @@ match_token (struct cmd_token *token, char *input_token) return match_ipv6_prefix (input_token); case RANGE_TKN: return match_range (token, input_token); - case NUMBER_TKN: - return match_number (token, input_token); case VARIABLE_TKN: return match_variable (token, input_token); case END_TKN: @@ -805,18 +801,6 @@ match_word (struct cmd_token *token, const char *word) return no_match; } -static enum match_type -match_number (struct cmd_token *token, const char *word) -{ - assert (token->type == NUMBER_TKN); - - if (!strcmp ("\0", word)) return no_match; - char *endptr; - long long num = strtoll (word, &endptr, 10); - if (endptr != '\0') return no_match; - return num == token->value ? exact_match : no_match; -} - #define VARIABLE_ALPHABET \ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" From bf2bfafd7e547081c1f792c766848b2b3b761090 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 19:15:24 +0000 Subject: [PATCH 098/280] ospfd: argv update for all but ospf_vty.c Signed-off-by: Daniel Walton --- lib/vty.c | 12 +- ospfd/ospf_bfd.c | 2 +- ospfd/ospf_dump.c | 186 ++++++++++----------- ospfd/ospf_nsm.c | 1 + ospfd/ospf_ri.c | 16 +- ospfd/ospf_routemap.c | 67 +++----- ospfd/ospf_te.c | 6 +- ospfd/ospf_vty.c | 347 +++++++++++++++++++-------------------- tools/argv_translator.py | 82 ++++++++- 9 files changed, 383 insertions(+), 336 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index ff559d1705..900183fe55 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2746,7 +2746,7 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[0], NULL); + return exec_timeout (vty, argv[1]->arg, NULL); } DEFUN (exec_timeout_sec, @@ -2756,7 +2756,7 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[0], argv[1]); + return exec_timeout (vty, argv[1]->arg, argv[2]->arg); } DEFUN (no_exec_timeout, @@ -2778,7 +2778,7 @@ DEFUN (vty_access_class, if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[1]->arg); return CMD_SUCCESS; } @@ -2791,7 +2791,7 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[0]))) + if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[2]->arg))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2817,7 +2817,7 @@ DEFUN (vty_ipv6_access_class, if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[0]); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[2]->arg); return CMD_SUCCESS; } @@ -2832,7 +2832,7 @@ DEFUN (no_vty_ipv6_access_class, "IPv6 access list\n") { if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, argv[0]))) + (argc && strcmp(vty_ipv6_accesslist_name, argv[3]->arg))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index c87bcb0afb..dd44ab2ac1 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -395,7 +395,7 @@ DEFUN (ip_ospf_bfd_param, assert (ifp); - if ((ret = bfd_validate_param (vty, argv[0], argv[1], argv[2], &dm_val, + if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index a53c726853..583a4d85d9 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -760,7 +760,7 @@ ospf_packet_dump (struct stream *s) */ static int debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { int type = 0; int flag = 0; @@ -769,17 +769,17 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, assert (argc > arg_base + 0); /* Check packet type. */ - if (strncmp (argv[arg_base + 0], "h", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0], "d", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0], "ls-r", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0], "ls-u", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0], "ls-a", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) type = OSPF_DEBUG_ALL; /* Default, both send and recv. */ @@ -789,17 +789,17 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, /* send or recv. */ if (argc >= arg_base + 2) { - if (strncmp (argv[arg_base + 1], "s", 1) == 0) + if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) flag = OSPF_DEBUG_SEND; - else if (strncmp (argv[arg_base + 1], "r", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) flag = OSPF_DEBUG_RECV; - else if (strncmp (argv[arg_base + 1], "d", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; } /* detail. */ if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2], "d", 1) == 0) + if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) flag |= OSPF_DEBUG_DETAIL; for (i = 0; i < 5; i++) @@ -878,7 +878,7 @@ DEFUN (debug_ospf_instance_packet, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -921,7 +921,7 @@ ALIAS (debug_ospf_instance_packet, static int no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { int type = 0; int flag = 0; @@ -930,17 +930,17 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, assert (argc > arg_base + 0); /* Check packet type. */ - if (strncmp (argv[arg_base + 0], "h", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0], "d", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0], "ls-r", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0], "ls-u", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0], "ls-a", 4) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) type = OSPF_DEBUG_ALL; /* Default, both send and recv. */ @@ -950,17 +950,17 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, /* send or recv. */ if (argc == arg_base + 2) { - if (strncmp (argv[arg_base + 1], "s", 1) == 0) + if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1], "r", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1], "d", 1) == 0) + else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) flag = OSPF_DEBUG_DETAIL | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; } /* detail. */ if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2], "d", 1) == 0) + if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) flag = OSPF_DEBUG_DETAIL; for (i = 0; i < 5; i++) @@ -1050,7 +1050,7 @@ DEFUN (no_debug_ospf_instance_packet, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1095,7 +1095,7 @@ ALIAS (no_debug_ospf_instance_packet, static int -debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1103,11 +1103,11 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_ON (ism, ISM_TIMERS); } @@ -1119,11 +1119,11 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_ON (ism, ISM_TIMERS); } @@ -1160,7 +1160,7 @@ DEFUN (debug_ospf_instance_ism, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1180,7 +1180,7 @@ ALIAS (debug_ospf_instance_ism, static int no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1188,11 +1188,11 @@ no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_OFF (ism, ISM_TIMERS); } return CMD_SUCCESS; @@ -1203,11 +1203,11 @@ no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF (ism, ISM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_OFF (ism, ISM_TIMERS); } @@ -1247,7 +1247,7 @@ DEFUN (no_debug_ospf_instance_ism, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1267,7 +1267,7 @@ ALIAS (no_debug_ospf_instance_ism, "ISM Timer Information\n") static int -debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1275,11 +1275,11 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_ON (nsm, NSM_TIMERS); } @@ -1291,11 +1291,11 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_ON (nsm, NSM_TIMERS); } @@ -1332,7 +1332,7 @@ DEFUN (debug_ospf_instance_nsm, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1351,7 +1351,7 @@ ALIAS (debug_ospf_instance_nsm, "NSM Timer Information\n") static int -no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char **argv) +no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1359,11 +1359,11 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char ** DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) DEBUG_OFF (nsm, NSM_TIMERS); } @@ -1375,11 +1375,11 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, const char ** TERM_DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "s", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0], "t", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) TERM_DEBUG_OFF (nsm, NSM_TIMERS); } @@ -1419,7 +1419,7 @@ DEFUN (no_debug_ospf_instance_nsm, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1440,7 +1440,7 @@ ALIAS (no_debug_ospf_instance_nsm, static int -debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1448,13 +1448,13 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **arg DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_ON (lsa, LSA_REFRESH); } @@ -1466,13 +1466,13 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **arg TERM_DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) TERM_DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) TERM_DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_ON (lsa, LSA_REFRESH); } @@ -1510,7 +1510,7 @@ DEFUN (debug_ospf_instance_lsa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1530,7 +1530,7 @@ ALIAS (debug_ospf_instance_lsa, "LSA Refresh\n") static int -no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char **argv) +no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1538,13 +1538,13 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char ** DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_OFF (lsa, LSA_REFRESH); } @@ -1556,13 +1556,13 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, const char ** TERM_DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "g", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0], "f", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0], "i", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_OFF (lsa, LSA_REFRESH); } @@ -1603,7 +1603,7 @@ DEFUN (no_debug_ospf_instance_lsa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1625,7 +1625,7 @@ ALIAS (no_debug_ospf_instance_lsa, static int -debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **argv) +debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1633,9 +1633,9 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **a DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } @@ -1647,9 +1647,9 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, const char **a TERM_DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } @@ -1685,7 +1685,7 @@ DEFUN (debug_ospf_instance_zebra, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1704,7 +1704,7 @@ ALIAS (debug_ospf_instance_zebra, static int no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, - const char **argv) + struct cmd_token **argv) { if (vty->node == CONFIG_NODE) { @@ -1712,9 +1712,9 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } @@ -1726,9 +1726,9 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0], "i", 1) == 0) + if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0], "r", 1) == 0) + else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } @@ -1767,7 +1767,7 @@ DEFUN (no_debug_ospf_instance_zebra, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1823,7 +1823,7 @@ DEFUN (debug_ospf_instance_event, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1844,7 +1844,7 @@ DEFUN (no_debug_ospf_instance_event, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1891,7 +1891,7 @@ DEFUN (debug_ospf_instance_nssa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1912,7 +1912,7 @@ DEFUN (no_debug_ospf_instance_nssa, { u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -2133,7 +2133,7 @@ DEFUN (show_debugging_ospf_instance, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL ) return CMD_SUCCESS; diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index c6b55b0746..17cc1f66c2 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -33,6 +33,7 @@ #include "stream.h" #include "table.h" #include "log.h" +#include "command.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_interface.h" diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 8fefd2bdb8..0ea25ceb94 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1190,7 +1190,7 @@ DEFUN (router_info, /* Check and get Area value if present */ if (argc == 1) { - if (!inet_aton (argv[0], &OspfRI.area_id)) + if (!inet_aton (argv[2]->arg, &OspfRI.area_id)) { vty_out (vty, "Please specify Router Info Area by A.B.C.D%s", VTY_NEWLINE); @@ -1276,7 +1276,7 @@ DEFUN (pce_address, struct in_addr value; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (!inet_aton (argv[0], &value)) + if (!inet_aton (argv[2]->arg, &value)) { vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1323,7 +1323,7 @@ DEFUN (pce_path_scope, uint32_t scope; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (sscanf (argv[0], "0x%x", &scope) != 1) + if (sscanf (argv[2]->arg, "0x%x", &scope) != 1) { vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1373,7 +1373,7 @@ DEFUN (pce_domain, struct listnode *node; struct ri_pce_subtlv_domain *domain; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[3]->arg, "%d", &as) != 1) { vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1410,7 +1410,7 @@ DEFUN (no_pce_domain, uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[4]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1441,7 +1441,7 @@ DEFUN (pce_neigbhor, struct listnode *node; struct ri_pce_subtlv_neighbor *neighbor; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[3]->arg, "%d", &as) != 1) { vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1478,7 +1478,7 @@ DEFUN (no_pce_neighbor, uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "%d", &as) != 1) + if (sscanf (argv[4]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1506,7 +1506,7 @@ DEFUN (pce_cap_flag, uint32_t cap; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[0], "0x%x", &cap) != 1) + if (sscanf (argv[2]->arg, "0x%x", &cap) != 1) { vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index b2f1c67126..1836660844 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -700,7 +700,7 @@ DEFUN (match_ip_nexthop, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[0]); + return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); } DEFUN (no_match_ip_nexthop, @@ -711,10 +711,7 @@ DEFUN (no_match_ip_nexthop, IP_STR "Match next-hop address of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip next-hop", NULL); - - return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[0]); + return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } ALIAS (no_match_ip_nexthop, @@ -738,7 +735,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return ospf_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0]); + argv[4]->arg); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -750,11 +747,8 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match next-hop address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - NULL); return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argv[0]); + argv[5]->arg); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -777,7 +771,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip address", argv[0]); + return ospf_route_match_add (vty, vty->index, "ip address", argv[3]->arg); } DEFUN (no_match_ip_address, @@ -788,10 +782,7 @@ DEFUN (no_match_ip_address, IP_STR "Match address of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip address", NULL); - - return ospf_route_match_delete (vty, vty->index, "ip address", argv[0]); + return ospf_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); } ALIAS (no_match_ip_address, @@ -815,7 +806,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return ospf_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0]); + argv[4]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -827,11 +818,8 @@ DEFUN (no_match_ip_address_prefix_list, "Match address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", - NULL); return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", - argv[0]); + argv[5]->arg); } ALIAS (no_match_ip_address_prefix_list, @@ -851,7 +839,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return ospf_route_match_add (vty, vty->index, "interface", argv[0]); + return ospf_route_match_add (vty, vty->index, "interface", argv[2]->arg); } DEFUN (no_match_interface, @@ -861,10 +849,7 @@ DEFUN (no_match_interface, MATCH_STR "Match first hop interface of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "interface", NULL); - - return ospf_route_match_delete (vty, vty->index, "interface", argv[0]); + return ospf_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } ALIAS (no_match_interface, @@ -882,7 +867,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return ospf_route_match_add (vty, vty->index, "tag", argv[0]); + return ospf_route_match_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_match_tag, @@ -892,10 +877,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - if (argc == 0) - return ospf_route_match_delete (vty, vty->index, "tag", NULL); - - return ospf_route_match_delete (vty, vty->index, "tag", argv[0]); + return ospf_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_match_tag, @@ -913,7 +895,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return ospf_route_set_add (vty, vty->index, "metric", argv[0]); + return ospf_route_set_add (vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_set_metric, @@ -923,10 +905,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { - if (argc == 0) - return ospf_route_set_delete (vty, vty->index, "metric", NULL); - - return ospf_route_set_delete (vty, vty->index, "metric", argv[0]); + return ospf_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, @@ -945,12 +924,12 @@ DEFUN (set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - if (strcmp (argv[0], "1") == 0) + if (strcmp (argv[2]->arg, "1") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-1"); - if (strcmp (argv[0], "2") == 0) + if (strcmp (argv[2]->arg, "2") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-2"); - return ospf_route_set_add (vty, vty->index, "metric-type", argv[0]); + return ospf_route_set_add (vty, vty->index, "metric-type", argv[2]->arg); } DEFUN (no_set_metric_type, @@ -960,10 +939,7 @@ DEFUN (no_set_metric_type, SET_STR "Type of metric for destination routing protocol\n") { - if (argc == 0) - return ospf_route_set_delete (vty, vty->index, "metric-type", NULL); - - return ospf_route_set_delete (vty, vty->index, "metric-type", argv[0]); + return ospf_route_set_delete (vty, vty->index, "metric-type", argv[3]->arg); } ALIAS (no_set_metric_type, @@ -982,7 +958,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return ospf_route_set_add (vty, vty->index, "tag", argv[0]); + return ospf_route_set_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_set_tag, @@ -992,10 +968,7 @@ DEFUN (no_set_tag, SET_STR "Tag value for routing protocol\n") { - if (argc == 0) - ospf_route_set_delete(vty, vty->index, "tag", NULL); - - return ospf_route_set_delete (vty, vty->index, "tag", argv[0]); + return ospf_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_set_tag, diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 12d589cd99..4b02475267 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2346,7 +2346,7 @@ DEFUN (ospf_mpls_te_router_addr, if (!ospf) return CMD_SUCCESS; - if (! inet_aton (argv[0], &value)) + if (! inet_aton (argv[2]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -2480,7 +2480,7 @@ DEFUN (ospf_mpls_te_inter_as_area, "OSPF area ID in IP format\n" "OSPF area ID as decimal value\n") { - return set_inter_as_mode (vty, "area", argv[0]); + return set_inter_as_mode (vty, "area", argv[3]->arg); } DEFUN (no_ospf_mpls_te_inter_as, @@ -2636,7 +2636,7 @@ DEFUN (show_ip_ospf_mpls_te_link, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[5]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_link_sub (vty, ifp); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1b26c67866..30c63ea353 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -21,7 +21,6 @@ */ #include -#include #include #include "memory.h" @@ -33,6 +32,7 @@ #include "plist.h" #include "log.h" #include "zclient.h" +#include #include "ospfd/ospfd.h" #include "ospfd/ospf_asbr.h" @@ -199,7 +199,7 @@ DEFUN (no_router_ospf, u_short instance = 0; if (argc) - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; @@ -233,7 +233,7 @@ DEFUN (ospf_router_id, if (!ospf) return CMD_SUCCESS; - ret = inet_aton (argv[0], &router_id); + ret = inet_aton (argv[2]->arg, &router_id); if (!ret) { vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); @@ -383,7 +383,7 @@ DEFUN (ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[2]->arg); params = IF_DEF_PARAMS (ifp); @@ -465,7 +465,7 @@ DEFUN (no_ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[3]->arg); params = IF_DEF_PARAMS (ifp); @@ -551,8 +551,8 @@ DEFUN (ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[3]->arg); ret = ospf_network_set (ospf, &p, area_id); if (ret == 0) @@ -590,8 +590,8 @@ DEFUN (no_ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[4]->arg); ret = ospf_network_unset (ospf, &p, area_id); if (ret == 0) @@ -623,8 +623,8 @@ DEFUN (ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); if (argc > 2) @@ -687,8 +687,8 @@ DEFUN (ospf_area_range_not_advertise, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); ospf_area_range_set (ospf, area_id, &p, 0); @@ -713,8 +713,8 @@ DEFUN (no_ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); ospf_area_range_unset (ospf, area_id, &p); @@ -777,9 +777,9 @@ DEFUN (ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[5]->arg); ospf_area_range_substitute_set (ospf, area_id, &p, &s); @@ -806,9 +806,9 @@ DEFUN (no_ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); - VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[6]->arg); ospf_area_range_substitute_unset (ospf, area_id, &p); @@ -1087,14 +1087,14 @@ DEFUN (ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); + ret = ospf_str2area_id (argv[1]->arg, &vl_config.area_id, &vl_config.format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); return CMD_WARNING; } - ret = inet_aton (argv[1], &vl_config.vl_peer); + ret = inet_aton (argv[3]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1225,7 +1225,7 @@ DEFUN (no_ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); + ret = ospf_str2area_id (argv[2]->arg, &vl_config.area_id, &format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1239,7 +1239,7 @@ DEFUN (no_ospf_area_vlink, return CMD_WARNING; } - ret = inet_aton (argv[1], &vl_config.vl_peer); + ret = inet_aton (argv[4]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1566,15 +1566,15 @@ DEFUN (ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); - if (strncmp (argv[1], "de", 2) == 0) + if (strncmp (argv[3]->arg, "de", 2) == 0) mode = OSPF_SHORTCUT_DEFAULT; - else if (strncmp (argv[1], "di", 2) == 0) + else if (strncmp (argv[3]->arg, "di", 2) == 0) mode = OSPF_SHORTCUT_DISABLE; - else if (strncmp (argv[1], "e", 1) == 0) + else if (strncmp (argv[3]->arg, "e", 1) == 0) mode = OSPF_SHORTCUT_ENABLE; else return CMD_WARNING; @@ -1608,7 +1608,7 @@ DEFUN (no_ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (!area) @@ -1635,7 +1635,7 @@ DEFUN (ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1666,7 +1666,7 @@ DEFUN (ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1697,7 +1697,7 @@ DEFUN (no_ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); ospf_area_stub_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1722,7 +1722,7 @@ DEFUN (no_ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); ospf_area_no_summary_unset (ospf, area_id); return CMD_SUCCESS; @@ -1845,7 +1845,7 @@ DEFUN (no_ospf_area_nssa, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[2]->arg); ospf_area_nssa_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1887,8 +1887,8 @@ DEFUN (ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); - VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[1]->arg); + VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[3]->arg, 0, 16777215); area = ospf_area_get (ospf, area_id, format); @@ -1931,8 +1931,8 @@ DEFUN (no_ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); - VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[1], 0, OSPF_LS_INFINITY); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[2]->arg); + VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[4]->arg, 0, OSPF_LS_INFINITY); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -1978,7 +1978,7 @@ DEFUN (ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_export_list_set (ospf, area, argv[1]); @@ -2004,7 +2004,7 @@ DEFUN (no_ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2033,7 +2033,7 @@ DEFUN (ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_import_list_set (ospf, area, argv[1]); @@ -2059,7 +2059,7 @@ DEFUN (no_ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2091,17 +2091,17 @@ DEFUN (ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); - plist = prefix_list_lookup (AFI_IP, argv[1]); - if (strncmp (argv[2], "in", 2) == 0) + plist = prefix_list_lookup (AFI_IP, argv[4]->arg); + if (strncmp (argv[5]->arg, "in", 2) == 0) { PREFIX_LIST_IN (area) = plist; if (PREFIX_NAME_IN (area)) free (PREFIX_NAME_IN (area)); - PREFIX_NAME_IN (area) = strdup (argv[1]); + PREFIX_NAME_IN (area) = strdup (argv[4]->arg); ospf_schedule_abr_task (ospf); } else @@ -2110,7 +2110,7 @@ DEFUN (ospf_area_filter_list, if (PREFIX_NAME_OUT (area)) free (PREFIX_NAME_OUT (area)); - PREFIX_NAME_OUT (area) = strdup (argv[1]); + PREFIX_NAME_OUT (area) = strdup (argv[4]->arg); ospf_schedule_abr_task (ospf); } @@ -2138,15 +2138,15 @@ DEFUN (no_ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) return CMD_SUCCESS; - if (strncmp (argv[2], "in", 2) == 0) + if (strncmp (argv[6]->arg, "in", 2) == 0) { if (PREFIX_NAME_IN (area)) - if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) + if (strcmp (PREFIX_NAME_IN (area), argv[5]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_IN (area) = NULL; @@ -2160,7 +2160,7 @@ DEFUN (no_ospf_area_filter_list, else { if (PREFIX_NAME_OUT (area)) - if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) + if (strcmp (PREFIX_NAME_OUT (area), argv[5]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_OUT (area) = NULL; @@ -2193,7 +2193,7 @@ DEFUN (ospf_area_authentication_message_digest, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -2217,7 +2217,7 @@ DEFUN (ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_SIMPLE; @@ -2242,7 +2242,7 @@ DEFUN (no_ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2272,13 +2272,13 @@ DEFUN (ospf_abr_type, if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[0], "c", 1) == 0) + if (strncmp (argv[2]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[0], "i", 1) == 0) + else if (strncmp (argv[2]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[0], "sh", 2) == 0) + else if (strncmp (argv[2]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[0], "st", 2) == 0) + else if (strncmp (argv[2]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2309,13 +2309,13 @@ DEFUN (no_ospf_abr_type, if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[0], "c", 1) == 0) + if (strncmp (argv[3]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[0], "i", 1) == 0) + else if (strncmp (argv[3]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[0], "sh", 2) == 0) + else if (strncmp (argv[3]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[0], "st", 2) == 0) + else if (strncmp (argv[3]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2484,7 +2484,7 @@ DEFUN (ospf_timers_min_ls_interval, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA interval", interval, argv[0]); + VTY_GET_INTEGER ("LSA interval", interval, argv[4]->arg); ospf->min_ls_interval = interval; @@ -2536,7 +2536,7 @@ DEFUN (ospf_timers_min_ls_arrival, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[0], 0, 1000); + VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[3]->arg, 0, 1000); ospf->min_ls_arrival = arrival; @@ -2588,9 +2588,9 @@ DEFUN (ospf_timers_throttle_spf, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000); return ospf_timers_spf_set (vty, delay, hold, max); } @@ -2640,7 +2640,7 @@ DEFUN (ospf_timers_lsa, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg); ospf->min_ls_arrival = minarrival; @@ -2699,7 +2699,7 @@ DEFUN (ospf_neighbor, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); if (argc > 1) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); @@ -2750,10 +2750,10 @@ DEFUN (ospf_neighbor_poll_interval, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); if (argc > 1) - VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); + VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[3]->arg, 1, 65535); if (argc > 2) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); @@ -2790,7 +2790,7 @@ DEFUN (no_ospf_neighbor, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[2]->arg); (void)ospf_nbr_nbma_unset (ospf, nbr_addr); @@ -2837,7 +2837,8 @@ ALIAS (no_ospf_neighbor, "Dead Neighbor Polling interval\n" "Seconds\n") -DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, +DEFUN (ospf_refresh_timer, + ospf_refresh_timer_cmd, "refresh timer <10-1800>", "Adjust refresh parameters\n" "Set refresh timer\n" @@ -2849,7 +2850,7 @@ DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, if (!ospf) return CMD_SUCCESS; - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[2]->arg, 10, 1800); interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY; ospf_timers_refresh_set (ospf, interval); @@ -2857,7 +2858,8 @@ DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, return CMD_SUCCESS; } -DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, +DEFUN (no_ospf_refresh_timer, + no_ospf_refresh_timer_val_cmd, "no refresh timer <10-1800>", "Adjust refresh parameters\n" "Unset refresh timer\n" @@ -2871,7 +2873,7 @@ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, if (argc == 1) { - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[3]->arg, 10, 1800); if (ospf->lsa_refresh_interval != interval || interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) @@ -2904,7 +2906,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth, if (!ospf) return CMD_SUCCESS; - refbw = strtol (argv[0], NULL, 10); + refbw = strtol (argv[2]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); @@ -2970,7 +2972,7 @@ DEFUN (ospf_write_multiplier, if (!ospf) return CMD_SUCCESS; - write_oi_count = strtol (argv[0], NULL, 10); + write_oi_count = strtol (argv[2]->arg, NULL, 10); if (write_oi_count < 1 || write_oi_count > 100) { vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE); @@ -3614,7 +3616,7 @@ DEFUN (show_ip_ospf_instance, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4026,7 +4028,7 @@ DEFUN (show_ip_ospf_instance_interface, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4182,7 +4184,7 @@ DEFUN (show_ip_ospf_instance_neighbor, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4294,7 +4296,7 @@ DEFUN (show_ip_ospf_instance_neighbor_all, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4388,7 +4390,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4754,7 +4756,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4845,7 +4847,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4944,7 +4946,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5046,7 +5048,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5841,7 +5843,7 @@ DEFUN (show_ip_ospf_instance_database, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5997,7 +5999,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -6036,7 +6038,7 @@ DEFUN (ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6049,7 +6051,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle null authentication */ - if ( argv[0][0] == 'n' ) + if ( argv[3]->arg[0] == 'n' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_NULL; @@ -6057,7 +6059,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle message-digest authentication */ - if ( argv[0][0] == 'm' ) + if ( argv[3]->arg[0] == 'm' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -6095,7 +6097,7 @@ DEFUN (ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[3]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6143,7 +6145,7 @@ DEFUN (no_ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6167,11 +6169,11 @@ DEFUN (no_ip_ospf_authentication_args, } else { - if ( argv[0][0] == 'n' ) + if ( argv[4]->arg[0] == 'n' ) { auth_type = OSPF_AUTH_NULL; } - else if ( argv[0][0] == 'm' ) + else if ( argv[4]->arg[0] == 'm' ) { auth_type = OSPF_AUTH_CRYPTOGRAPHIC; } @@ -6243,7 +6245,7 @@ DEFUN (no_ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6345,7 +6347,7 @@ DEFUN (ip_ospf_authentication_key, } memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); + strncpy ((char *) params->auth_simple, argv[4]->arg, OSPF_AUTH_SIMPLE_SIZE); SET_IF_PARAM (params, auth_simple); return CMD_SUCCESS; @@ -6485,7 +6487,7 @@ DEFUN (ip_ospf_message_digest_key, ospf_if_update_params (ifp, addr); } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[3]->arg, NULL, 10); if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) { vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); @@ -6495,7 +6497,7 @@ DEFUN (ip_ospf_message_digest_key, ck = ospf_crypt_key_new (); ck->key_id = (u_char) key_id; memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, argv[6]->arg, OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (params->auth_crypt, ck); SET_IF_PARAM (params, auth_crypt); @@ -6559,7 +6561,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[4]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6611,7 +6613,7 @@ DEFUN (no_ip_ospf_message_digest_key, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6624,7 +6626,7 @@ DEFUN (no_ip_ospf_message_digest_key, return CMD_SUCCESS; } - key_id = strtol (argv[0], NULL, 10); + key_id = strtol (argv[4]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6677,7 +6679,7 @@ DEFUN (ip_ospf_cost, params = IF_DEF_PARAMS (ifp); - cost = strtol (argv[0], NULL, 10); + cost = strtol (argv[3]->arg, NULL, 10); /* cost range is <1-65535>. */ if (cost < 1 || cost > 65535) @@ -6688,7 +6690,7 @@ DEFUN (ip_ospf_cost, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6750,7 +6752,7 @@ DEFUN (no_ip_ospf_cost, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6822,7 +6824,7 @@ DEFUN (no_ip_ospf_cost2, * of N already configured for the interface. Thus the first argument * is always checked to be a number, but is ignored after that. */ - cost = strtol (argv[0], NULL, 10); + cost = strtol (argv[4]->arg, NULL, 10); if (cost < 1 || cost > 65535) { vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); @@ -6990,9 +6992,9 @@ DEFUN (ip_ospf_dead_interval, "Address of interface\n") { if (argc == 2) - return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); + return ospf_vty_dead_interval_set (vty, argv[3]->arg, argv[4]->arg, NULL); else - return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); + return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL); } ALIAS (ip_ospf_dead_interval, @@ -7022,9 +7024,9 @@ DEFUN (ip_ospf_dead_interval_minimal, "Address of interface\n") { if (argc == 2) - return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); + return ospf_vty_dead_interval_set (vty, NULL, argv[6]->arg, argv[5]->arg); else - return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); + return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg); } ALIAS (ip_ospf_dead_interval_minimal, @@ -7059,7 +7061,7 @@ DEFUN (no_ip_ospf_dead_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7170,7 +7172,7 @@ DEFUN (ip_ospf_hello_interval, params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* HelloInterval range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7181,7 +7183,7 @@ DEFUN (ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7234,7 +7236,7 @@ DEFUN (no_ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7305,13 +7307,13 @@ DEFUN (ip_ospf_network, return CMD_WARNING; } - if (strncmp (argv[0], "b", 1) == 0) + if (strncmp (argv[3]->arg, "b", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; - else if (strncmp (argv[0], "n", 1) == 0) + else if (strncmp (argv[3]->arg, "n", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; - else if (strncmp (argv[0], "point-to-m", 10) == 0) + else if (strncmp (argv[3]->arg, "point-to-m", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; - else if (strncmp (argv[0], "point-to-p", 10) == 0) + else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; if (IF_DEF_PARAMS (ifp)->type == old_type) @@ -7432,7 +7434,7 @@ DEFUN (ip_ospf_priority, params = IF_DEF_PARAMS (ifp); - priority = strtol (argv[0], NULL, 10); + priority = strtol (argv[3]->arg, NULL, 10); /* Router Priority range is <0-255>. */ if (priority < 0 || priority > 255) @@ -7443,7 +7445,7 @@ DEFUN (ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7512,7 +7514,7 @@ DEFUN (no_ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[5]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7594,7 +7596,7 @@ DEFUN (ip_ospf_retransmit_interval, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* Retransmit Interval range is <3-65535>. */ if (seconds < 3 || seconds > 65535) @@ -7606,7 +7608,7 @@ DEFUN (ip_ospf_retransmit_interval, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7752,7 +7754,7 @@ DEFUN (ip_ospf_transmit_delay, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[0], NULL, 10); + seconds = strtol (argv[3]->arg, NULL, 10); /* Transmit Delay range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7763,7 +7765,7 @@ DEFUN (ip_ospf_transmit_delay, if (argc == 2) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7911,7 +7913,7 @@ DEFUN (ip_ospf_area, u_short instance = 0; if (argc == 2) - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); ospf = ospf_lookup_instance (instance); if (ospf == NULL) @@ -8026,7 +8028,7 @@ DEFUN (no_ip_ospf_instance_area, struct ospf_if_params *params; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; @@ -8056,8 +8058,7 @@ ALIAS (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPFD - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8084,13 +8085,13 @@ DEFUN (ospf_redistribute_source, return CMD_SUCCESS; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[1]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; /* Get metric value. */ - if (argv[1] != NULL) - if (!str2metric (argv[1], &metric)) + if (argv[2]->arg != NULL) + if (!str2metric (argv[2]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8110,8 +8111,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPFD - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8129,7 +8129,7 @@ DEFUN (no_ospf_redistribute_source, if (!ospf) return CMD_SUCCESS; - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[2]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; @@ -8143,8 +8143,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute (ospf|table) <1-65535>" - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -8167,12 +8166,12 @@ DEFUN (ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[1]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); if (!ospf) return CMD_SUCCESS; @@ -8192,8 +8191,8 @@ DEFUN (ospf_redistribute_instance_source, } /* Get metric value. */ - if (argv[2] != NULL) - if (!str2metric (argv[2], &metric)) + if (argv[3]->arg != NULL) + if (!str2metric (argv[3]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8212,8 +8211,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute (ospf|table) <1-65535>" - " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR REDIST_STR "Open Shortest Path First\n" @@ -8235,12 +8233,12 @@ DEFUN (no_ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[0], "o", 1) == 0) + if (strncmp(argv[2]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[1]); + VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) { @@ -8279,11 +8277,11 @@ DEFUN (ospf_distribute_list_out, return CMD_SUCCESS; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[1]); + source = proto_redistnum(AFI_IP, argv[4]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_set (ospf, source, argv[0]); + return ospf_distribute_list_out_set (ospf, source, argv[1]->arg); } DEFUN (no_ospf_distribute_list_out, @@ -8301,18 +8299,17 @@ DEFUN (no_ospf_distribute_list_out, if (!ospf) return CMD_SUCCESS; - source = proto_redistnum(AFI_IP, argv[1]); + source = proto_redistnum(AFI_IP, argv[5]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_unset (ospf, source, argv[0]); + return ospf_distribute_list_out_unset (ospf, source, argv[2]->arg); } /* Default information originate. */ DEFUN (ospf_default_information_originate, ospf_default_information_originate_cmd, - "default-information originate " - "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", "Control distribution of default information\n" "Distribute a default route\n" "Always advertise default route\n" @@ -8337,7 +8334,7 @@ DEFUN (ospf_default_information_originate, return CMD_WARNING; /* this should not happen */ /* Check whether "always" was specified */ - if (argv[0] != NULL) + if (argv[2]->arg != NULL) default_originate = DEFAULT_ORIGINATE_ALWAYS; red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); @@ -8363,8 +8360,7 @@ DEFUN (ospf_default_information_originate, DEFUN (no_ospf_default_information_originate, no_ospf_default_information_originate_cmd, - "no default-information originate" - "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR "Control distribution of default information\n" "Distribute a default route\n" @@ -8417,7 +8413,7 @@ DEFUN (ospf_default_metric, if (!ospf) return CMD_SUCCESS; - if (!str2metric (argv[0], &metric)) + if (!str2metric (argv[1]->arg, &metric)) return CMD_WARNING; ospf->default_metric = metric; @@ -8459,7 +8455,7 @@ DEFUN (ospf_distance, if (!ospf) return CMD_SUCCESS; - ospf->distance_all = atoi (argv[0]); + ospf->distance_all = atoi (argv[1]->arg); return CMD_SUCCESS; } @@ -8505,7 +8501,7 @@ DEFUN (no_ospf_distance_ospf, if (!ospf) return CMD_SUCCESS; - if (argv[0] != NULL) + if (argv[3]->arg != NULL) ospf->distance_intra = 0; if (argv[1] != NULL) @@ -8514,7 +8510,7 @@ DEFUN (no_ospf_distance_ospf, if (argv[2] != NULL) ospf->distance_external = 0; - if (argv[0] || argv[1] || argv[2]) + if (argv[3]->arg || argv[1] || argv[2]) return CMD_SUCCESS; /* If no arguments are given, clear all distance information */ @@ -8527,8 +8523,7 @@ DEFUN (no_ospf_distance_ospf, DEFUN (ospf_distance_ospf, ospf_distance_ospf_cmd, - "distance ospf " - "{intra-area <1-255>|inter-area <1-255>|external <1-255>}", + "distance ospf {intra-area <1-255>|inter-area <1-255>|external <1-255>}", "Define an administrative distance\n" "OSPF Administrative distance\n" "Intra-area routes\n" @@ -8546,15 +8541,15 @@ DEFUN (ospf_distance_ospf, if (argc < 3) /* should not happen */ return CMD_WARNING; - if (!argv[0] && !argv[1] && !argv[2]) + if (!argv[2]->arg && !argv[1] && !argv[2]) { vty_out(vty, "%% Command incomplete. (Arguments required)%s", VTY_NEWLINE); return CMD_WARNING; } - if (argv[0] != NULL) - ospf->distance_intra = atoi(argv[0]); + if (argv[2]->arg != NULL) + ospf->distance_intra = atoi(argv[2]->arg); if (argv[1] != NULL) ospf->distance_inter = atoi(argv[1]); @@ -8577,7 +8572,7 @@ DEFUN (ospf_distance_source, if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); + ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, NULL); return CMD_SUCCESS; } @@ -8595,7 +8590,7 @@ DEFUN (no_ospf_distance_source, if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); + ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, NULL); return CMD_SUCCESS; } @@ -8613,7 +8608,7 @@ DEFUN (ospf_distance_source_access_list, if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); + ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, argv[3]->arg); return CMD_SUCCESS; } @@ -8632,7 +8627,7 @@ DEFUN (no_ospf_distance_source_access_list, if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); + ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, argv[4]->arg); return CMD_SUCCESS; } @@ -8654,7 +8649,7 @@ DEFUN (ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[3]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8704,7 +8699,7 @@ DEFUN (no_ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[0], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8815,7 +8810,7 @@ DEFUN (ospf_max_metric_router_lsa_startup, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); + VTY_GET_INTEGER ("stub-router startup period", seconds, argv[3]->arg); ospf->stub_router_startup_time = seconds; @@ -8883,7 +8878,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); + VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[3]->arg); ospf->stub_router_shutdown_time = seconds; @@ -9146,7 +9141,7 @@ DEFUN (show_ip_ospf_instance_border_routers, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -9208,7 +9203,7 @@ DEFUN (show_ip_ospf_instance_route, struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -10272,7 +10267,7 @@ DEFUN (clear_ip_ospf_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else ospf_interface_clear(ifp); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index f99316d905..8547715d34 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -30,6 +30,7 @@ def token_is_variable(line_number, token): if token in ('WORD', '.LINE', # where is this defined? 'LINE', + 'BITPATTERN', 'PATH', 'A.B.C.D', 'A.B.C.D/M', @@ -45,6 +46,78 @@ def token_is_variable(line_number, token): return False + tokens = [] + + +def line_to_tokens(text): + """ + Most of the time whitespace can be used to split tokens + (set|clear) clagd-enable (no|yes) + + tokens + - (set|clear) + - + - clagd-enable + - (no|yes) + + But if we are dealing with multiword keywords, such as "soft in", that approach + does not work. We can only split on whitespaces if we are not inside a () or [] + bgp (|||*) [soft in|soft out] + + tokens: + - bgp + - (|||*) + - [soft in|soft out] + """ + tokens = [] + token_index = 0 + token_text = [] + parens = 0 + curlys = 0 + brackets = 0 + less_greater = 0 + + for char in text: + if char == ' ': + if parens == 0 and brackets == 0 and curlys == 0 and less_greater == 0: + tokens.append(''.join(token_text)) + token_index += 1 + token_text = [] + else: + token_text.append(char) + else: + if char == '(': + parens += 1 + + elif char == ')': + parens -= 1 + + elif char == '[': + brackets += 1 + + elif char == ']': + brackets -= 1 + + elif char == '{': + curlys += 1 + + elif char == '}': + curlys -= 1 + + elif char == '<': + less_greater += 1 + + elif char == '>': + less_greater -= 1 + + token_text.append(char) + + if token_text: + tokens.append(''.join(token_text)) + + return tokens + + def get_argv_translator(line_number, line): table = {} line = line.strip() @@ -59,7 +132,7 @@ def get_argv_translator(line_number, line): raise Exception("%d: Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % (line_number, line)) old_style_index = 0 - for (token_index, token) in enumerate(line.split()): + for (token_index, token) in enumerate(line_to_tokens(line)): if token_is_variable(line_number, token): # print "%s is a token" % token table[old_style_index] = token_index @@ -110,6 +183,8 @@ def update_argvs(filename): line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '<1-255>') line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '(kernel|connected|static|rip|ospf|isis|pim|table)') line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '(kernel|connected|static|ripng|ospf6|isis|table)') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '(kernel|connected|static|rip|isis|bgp|pim|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -118,13 +193,16 @@ def update_argvs(filename): line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' (view|vrf) all",') line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",') line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",') + line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '<2-255> <50-60000> <50-60000>",') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",') line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",') line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' (kernel|connected|static|ripng|ospf6|isis|table)",') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' (kernel|connected|static|rip|isis|bgp|pim|table)",') - # startswith + # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor (A.B.C.D|X:X::X:X|WORD) ') line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ') From 8b3f0677108242c08a944cc9c114011958410809 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 20:00:23 +0000 Subject: [PATCH 099/280] zebra: argv update for all but zebra_vty.c Signed-off-by: Daniel Walton --- tools/argv_translator.py | 24 +- zebra/debug.c | 22 +- zebra/interface.c | 69 +++--- zebra/irdp_interface.c | 18 +- zebra/router-id.c | 2 +- zebra/rtadv.c | 33 ++- zebra/test_main.c | 2 +- zebra/zebra_routemap.c | 90 ++++---- zebra/zebra_vty.c | 476 +++++++++++++++++++-------------------- 9 files changed, 378 insertions(+), 358 deletions(-) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 8547715d34..f21e99d089 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -30,6 +30,11 @@ def token_is_variable(line_number, token): if token in ('WORD', '.LINE', # where is this defined? 'LINE', + 'BANDWIDTH', + 'INTERFACE', + 'PERCENTAGE', + 'IFNAME', + 'NAME', 'BITPATTERN', 'PATH', 'A.B.C.D', @@ -133,12 +138,15 @@ def get_argv_translator(line_number, line): old_style_index = 0 for (token_index, token) in enumerate(line_to_tokens(line)): + if not token: + continue + if token_is_variable(line_number, token): - # print "%s is a token" % token + print "%s is a token" % token table[old_style_index] = token_index old_style_index += 1 else: - # print "%s is NOT a token" % token + print "%s is NOT a token" % token pass return table @@ -159,7 +167,7 @@ def update_argvs(filename): if state is None: if line.startswith('DEFUN ('): - assert line.count(',') == 1, "Too many commas in\n%s" % line + assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) state = 'DEFUN_HEADER' defun_line_number = line_number @@ -185,6 +193,10 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '(kernel|connected|static|ripng|ospf6|isis|table)') line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '(kernel|connected|static|rip|isis|bgp|pim|table)') + line = line.replace('" VRF_CMD_STR "', 'vrf NAME') + line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all') + line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)') + line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -201,6 +213,12 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",') line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' (kernel|connected|static|ripng|ospf6|isis|table)",') line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' (kernel|connected|static|rip|isis|bgp|pim|table)",') + line = line.replace('" VRF_CMD_STR,', ' vrf NAME",') + line = line.replace('" VRF_ALL_CMD_STR,', ' vrf all",') + line = line.replace('" QUAGGA_IP_REDIST_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table)",') + line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table)",') + line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)",') + line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') diff --git a/zebra/debug.c b/zebra/debug.c index cdf233879a..fb3887c678 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -131,11 +131,11 @@ DEFUN (debug_zebra_packet_direct, "Debug option set for send packet\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - if (strncmp ("detail", argv[0], strlen (argv[0])) == 0) + if (strncmp ("detail", argv[3]->arg, strlen (argv[3]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; } @@ -151,9 +151,9 @@ DEFUN (debug_zebra_packet_detail, "Debug option set detailed information\n") { zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; @@ -180,9 +180,9 @@ DEFUN (debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) + if (argv[4]->arg && strncmp(argv[4]->arg, "recv", strlen(argv[4]->arg)) == 0) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) + if (!argv[4]->arg || strncmp(argv[4]->arg, "send", strlen(argv[4]->arg)) == 0) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } @@ -267,9 +267,9 @@ DEFUN (no_debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); return CMD_SUCCESS; } @@ -296,9 +296,9 @@ DEFUN (no_debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1] || (argv[0] && strncmp(argv[0], "recv", strlen(argv[0])) == 0)) + if (!argv[1] || (argv[5]->arg && strncmp(argv[5]->arg, "recv", strlen(argv[5]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[0] || (argv[1] && strncmp(argv[1], "send", strlen(argv[1])) == 0)) + if (!argv[5]->arg || (argv[5]->arg && strncmp(argv[5]->arg, "send", strlen(argv[5]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } diff --git a/zebra/interface.c b/zebra/interface.c index 9be97e2214..737bf9665e 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1305,7 +1305,8 @@ struct cmd_node vrf_node = }; /* Show all interfaces to vty. */ -DEFUN (show_interface, show_interface_cmd, +DEFUN (show_interface, + show_interface_cmd, "show interface", SHOW_STR "Interface status and configuration\n") @@ -1317,7 +1318,7 @@ DEFUN (show_interface, show_interface_cmd, interface_update_stats (); if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[2]->arg); /* All interface print. */ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) @@ -1334,7 +1335,8 @@ ALIAS (show_interface, VRF_CMD_HELP_STR) /* Show all interfaces to vty. */ -DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd, +DEFUN (show_interface_vrf_all, + show_interface_vrf_all_cmd, "show interface " VRF_ALL_CMD_STR, SHOW_STR "Interface status and configuration\n" @@ -1370,13 +1372,13 @@ DEFUN (show_interface_name_vrf, interface_update_stats (); if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + VRF_GET_ID (vrf_id, argv[3]->arg); /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0], vrf_id); + ifp = if_lookup_by_name_vrf (argv[2]->arg, vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Can't find interface %s%s", argv[0], + vty_out (vty, "%% Can't find interface %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1386,7 +1388,8 @@ DEFUN (show_interface_name_vrf, } /* Show specified interface to vty. */ -DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, +DEFUN (show_interface_name_vrf_all, + show_interface_name_vrf_all_cmd, "show interface IFNAME " VRF_ALL_CMD_STR, SHOW_STR "Interface status and configuration\n" @@ -1403,7 +1406,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[0], vrf_iter2id (iter)); + ifp = if_lookup_by_name_vrf (argv[2]->arg, vrf_iter2id (iter)); if (ifp) { if_dump_vty (vty, ifp); @@ -1413,7 +1416,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, if (!found) { - vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Can't find interface %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1476,7 +1479,7 @@ DEFUN (show_interface_desc, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); if_show_description (vty, vrf_id); @@ -1679,7 +1682,7 @@ DEFUN (bandwidth_if, unsigned int bandwidth; ifp = (struct interface *) vty->index; - bandwidth = strtol(argv[0], NULL, 10); + bandwidth = strtol(argv[1]->arg, NULL, 10); /* bandwidth range is <1-100000> */ if (bandwidth < 1 || bandwidth > 100000) @@ -1843,7 +1846,7 @@ DEFUN (link_params_metric, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t metric; - VTY_GET_ULONG("metric", metric, argv[0]); + VTY_GET_ULONG("metric", metric, argv[1]->arg); /* Update TE metric if needed */ link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE, metric); @@ -1876,7 +1879,7 @@ DEFUN (link_params_maxbw, float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1919,7 +1922,7 @@ DEFUN (link_params_max_rsv_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1954,14 +1957,14 @@ DEFUN (link_params_unrsv_bw, float bw; /* We don't have to consider about range check here. */ - if (sscanf (argv[0], "%d", &priority) != 1) + if (sscanf (argv[1]->arg, "%d", &priority) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); return CMD_WARNING; } - if (sscanf (argv[1], "%g", &bw) != 1) + if (sscanf (argv[2]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1993,7 +1996,7 @@ DEFUN (link_params_admin_grp, struct if_link_params *iflp = if_link_params_get (ifp); unsigned long value; - if (sscanf (argv[0], "0x%lx", &value) != 1) + if (sscanf (argv[1]->arg, "0x%lx", &value) != 1) { vty_out (vty, "link_params_admin_grp: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2035,13 +2038,13 @@ DEFUN (link_params_inter_as, struct in_addr addr; u_int32_t as; - if (!inet_aton (argv[0], &addr)) + if (!inet_aton (argv[1]->arg, &addr)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_ULONG("AS number", as, argv[1]); + VTY_GET_ULONG("AS number", as, argv[3]->arg); /* Update Remote IP and Remote AS fields if needed */ if (IS_PARAM_UNSET(iflp, LP_RMT_AS) @@ -2096,7 +2099,7 @@ DEFUN (link_params_delay, u_int8_t update = 0; /* Get and Check new delay values */ - VTY_GET_ULONG("delay", delay, argv[0]); + VTY_GET_ULONG("delay", delay, argv[1]->arg); switch (argc) { case 1: @@ -2130,8 +2133,8 @@ DEFUN (link_params_delay, return CMD_WARNING; break; case 3: - VTY_GET_ULONG("minimum delay", low, argv[1]); - VTY_GET_ULONG("maximum delay", high, argv[2]); + VTY_GET_ULONG("minimum delay", low, argv[3]->arg); + VTY_GET_ULONG("maximum delay", high, argv[5]->arg); /* Check new delays value coherency */ if (delay <= low || delay >= high) { @@ -2209,7 +2212,7 @@ DEFUN (link_params_delay_var, struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t value; - VTY_GET_ULONG("delay variation", value, argv[0]); + VTY_GET_ULONG("delay variation", value, argv[1]->arg); /* Update Delay Variation if needed */ link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value); @@ -2241,7 +2244,7 @@ DEFUN (link_params_pkt_loss, struct if_link_params *iflp = if_link_params_get (ifp); float fval; - if (sscanf (argv[0], "%g", &fval) != 1) + if (sscanf (argv[1]->arg, "%g", &fval) != 1) { vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2281,7 +2284,7 @@ DEFUN (link_params_res_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2327,7 +2330,7 @@ DEFUN (link_params_ava_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2373,7 +2376,7 @@ DEFUN (link_params_use_bw, struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[0], "%g", &bw) != 1) + if (sscanf (argv[1]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2557,7 +2560,7 @@ DEFUN (ip_address, "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8)\n") { - return ip_address_install (vty, vty->index, argv[0], NULL, NULL); + return ip_address_install (vty, vty->index, argv[2]->arg, NULL, NULL); } DEFUN (no_ip_address, @@ -2568,7 +2571,7 @@ DEFUN (no_ip_address, "Set the IP address of an interface\n" "IP Address (e.g. 10.0.0.1/8)") { - return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL); + return ip_address_uninstall (vty, vty->index, argv[3]->arg, NULL, NULL); } @@ -2582,7 +2585,7 @@ DEFUN (ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_install (vty, vty->index, argv[0], NULL, argv[1]); + return ip_address_install (vty, vty->index, argv[2]->arg, NULL, argv[4]->arg); } DEFUN (no_ip_address_label, @@ -2595,7 +2598,7 @@ DEFUN (no_ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1]); + return ip_address_uninstall (vty, vty->index, argv[3]->arg, NULL, argv[5]->arg); } #endif /* HAVE_NETLINK */ @@ -2758,7 +2761,7 @@ DEFUN (ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_install (vty, vty->index, argv[0], NULL, NULL, 0); + return ipv6_address_install (vty, vty->index, argv[2]->arg, NULL, NULL, 0); } DEFUN (no_ipv6_address, @@ -2769,7 +2772,7 @@ DEFUN (no_ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0); + return ipv6_address_uninstall (vty, vty->index, argv[3]->arg, NULL, NULL, 0); } #endif /* HAVE_IPV6 */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 8fb4fcad10..d41373369e 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -480,7 +480,7 @@ DEFUN (ip_irdp_holdtime, zi=ifp->info; irdp=&zi->irdp; - irdp->Lifetime = atoi(argv[0]); + irdp->Lifetime = atoi(argv[3]->arg); return CMD_SUCCESS; } @@ -503,8 +503,8 @@ DEFUN (ip_irdp_minadvertinterval, zi=ifp->info; irdp=&zi->irdp; - if( (unsigned) atoi(argv[0]) <= irdp->MaxAdvertInterval) { - irdp->MinAdvertInterval = atoi(argv[0]); + if( (unsigned) atoi(argv[3]->arg) <= irdp->MaxAdvertInterval) { + irdp->MinAdvertInterval = atoi(argv[3]->arg); return CMD_SUCCESS; } @@ -537,8 +537,8 @@ DEFUN (ip_irdp_maxadvertinterval, irdp=&zi->irdp; - if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]) ) { - irdp->MaxAdvertInterval = atoi(argv[0]); + if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[3]->arg) ) { + irdp->MaxAdvertInterval = atoi(argv[3]->arg); return CMD_SUCCESS; } @@ -575,7 +575,7 @@ DEFUN (ip_irdp_preference, zi=ifp->info; irdp=&zi->irdp; - irdp->Preference = atoi(argv[0]); + irdp->Preference = atoi(argv[3]->arg); return CMD_SUCCESS; } @@ -605,10 +605,10 @@ DEFUN (ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0], &ip); + ret = inet_aton(argv[3]->arg, &ip); if(!ret) return CMD_WARNING; - pref = atoi(argv[1]); + pref = atoi(argv[5]->arg); for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv)) if(adv->ip.s_addr == ip.s_addr) @@ -649,7 +649,7 @@ DEFUN (no_ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[0], &ip); + ret = inet_aton(argv[4]->arg, &ip); if (!ret) return CMD_WARNING; diff --git a/zebra/router-id.c b/zebra/router-id.c index d5d9652c59..fbd9e2b0cf 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -223,7 +223,7 @@ DEFUN (router_id, struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; - rid.u.prefix4.s_addr = inet_addr (argv[0]); + rid.u.prefix4.s_addr = inet_addr (argv[1]->arg); if (!rid.u.prefix4.s_addr) return CMD_WARNING; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index ac297890a5..331838e92a 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -930,7 +930,7 @@ DEFUN (ipv6_nd_ra_interval_msec, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 70, 1800000); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[4]->arg, 70, 1800000); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -965,7 +965,7 @@ DEFUN (ipv6_nd_ra_interval, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 1, 1800); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[3]->arg, 1, 1800); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -1045,7 +1045,7 @@ DEFUN (ipv6_nd_ra_lifetime, ifp = (struct interface *) vty->index; zif = ifp->info; - VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000); + VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[3]->arg, 0, 9000); /* The value to be placed in the Router Lifetime field * of Router Advertisements sent from the interface, @@ -1100,7 +1100,7 @@ DEFUN (ipv6_nd_reachable_time, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME); + VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[3]->arg, 1, RTADV_MAX_REACHABLE_TIME); return CMD_SUCCESS; } @@ -1142,7 +1142,7 @@ DEFUN (ipv6_nd_homeagent_preference, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535); + VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[3]->arg, 0, 65535); return CMD_SUCCESS; } @@ -1184,7 +1184,7 @@ DEFUN (ipv6_nd_homeagent_lifetime, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME); + VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[3]->arg, 0, RTADV_MAX_HALIFETIME); return CMD_SUCCESS; } @@ -1366,8 +1366,7 @@ DEFUN (no_ipv6_nd_other_config_flag, DEFUN (ipv6_nd_prefix, ipv6_nd_prefix_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", + "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Prefix information\n" @@ -1390,7 +1389,7 @@ DEFUN (ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0], &rp.prefix); + ret = str2prefix_ipv6 (argv[3]->arg, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1405,19 +1404,19 @@ DEFUN (ipv6_nd_prefix, if (argc > 1) { - if ((isdigit((unsigned char)argv[1][0])) - || strncmp (argv[1], "i", 1) == 0) + if ((isdigit((unsigned char)argv[4]->arg[0])) + || strncmp (argv[4]->arg, "i", 1) == 0) { - if ( strncmp (argv[1], "i", 1) == 0) + if ( strncmp (argv[4]->arg, "i", 1) == 0) rp.AdvValidLifetime = UINT32_MAX; else - rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1], + rp.AdvValidLifetime = (u_int32_t) strtoll (argv[4]->arg, (char **)NULL, 10); - if ( strncmp (argv[2], "i", 1) == 0) + if ( strncmp (argv[5]->arg, "i", 1) == 0) rp.AdvPreferredLifetime = UINT32_MAX; else - rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2], + rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[5]->arg, (char **)NULL, 10); if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) @@ -1810,7 +1809,7 @@ DEFUN (ipv6_nd_router_preference, while (0 != rtadv_pref_strs[i]) { - if (strncmp (argv[0], rtadv_pref_strs[i], 1) == 0) + if (strncmp (argv[3]->arg, rtadv_pref_strs[i], 1) == 0) { zif->rtadv.DefaultPreference = i; return CMD_SUCCESS; @@ -1861,7 +1860,7 @@ DEFUN (ipv6_nd_mtu, { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535); + VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[3]->arg, 1, 65535); return CMD_SUCCESS; } diff --git a/zebra/test_main.c b/zebra/test_main.c index bbaf450282..722151288b 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -136,7 +136,7 @@ DEFUN (test_interface_state, ifp->flags = IFF_BROADCAST|IFF_MULTICAST; } - switch (argv[0][0]) + switch (argv[1]->arg[0]) { case 'u': SET_FLAG (ifp->flags, IFF_UP); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index e6c5a3e917..c70b207d64 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -301,7 +301,7 @@ DEFUN (match_interface, "match first hop interface of route\n" "Interface name\n") { - return zebra_route_match_add (vty, vty->index, "interface", argv[0], + return zebra_route_match_add (vty, vty->index, "interface", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -333,7 +333,7 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return zebra_route_match_add (vty, vty->index, "tag", argv[0], + return zebra_route_match_add (vty, vty->index, "tag", argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -369,7 +369,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED); + return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } DEFUN (no_match_ip_next_hop, @@ -409,7 +409,7 @@ DEFUN (match_ip_next_hop_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -452,7 +452,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address", argv[0], + return zebra_route_match_add (vty, vty->index, "ip address", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -493,7 +493,7 @@ DEFUN (match_ip_address_prefix_list, "IP prefix-list name\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-list", - argv[0], RMAP_EVENT_PLIST_ADDED); + argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ip_address_prefix_list, @@ -613,15 +613,15 @@ DEFUN (match_source_protocol, { int i; - i = proto_name2num(argv[0]); + i = proto_name2num(argv[2]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", VTY_NEWLINE); return CMD_WARNING; } return zebra_route_match_add (vty, vty->index, "source-protocol", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[2]->arg, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_source_protocol, @@ -635,16 +635,16 @@ DEFUN (no_match_source_protocol, if (argc >= 1) { - i = proto_name2num(argv[0]); + i = proto_name2num(argv[3]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[3]->arg ? argv[3]->arg : "", VTY_NEWLINE); return CMD_WARNING; } } return zebra_route_match_delete (vty, vty->index, - "source-protocol", argv[0] ? argv[0] : NULL, + "source-protocol", argv[3]->arg ? argv[3]->arg : NULL, RMAP_EVENT_MATCH_DELETED); } @@ -663,9 +663,9 @@ DEFUN (set_src, struct prefix p; vrf_iter_t iter; - if (inet_pton(AF_INET, argv[0], &src.ipv4) != 1) + if (inet_pton(AF_INET, argv[2]->arg, &src.ipv4) != 1) { - if (inet_pton(AF_INET6, argv[0], &src.ipv6) != 1) + if (inet_pton(AF_INET6, argv[2]->arg, &src.ipv6) != 1) { vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE); return CMD_WARNING; @@ -706,7 +706,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[0]); + return zebra_route_set_add (vty, vty->index, "src", argv[2]->arg); } DEFUN (no_set_src, @@ -719,7 +719,7 @@ DEFUN (no_set_src, if (argc == 0) return zebra_route_set_delete (vty, vty->index, "src", NULL); - return zebra_route_set_delete (vty, vty->index, "src", argv[0]); + return zebra_route_set_delete (vty, vty->index, "src", argv[3]->arg); } DEFUN (zebra_route_map_timer, @@ -730,7 +730,7 @@ DEFUN (zebra_route_map_timer, { u_int32_t rmap_delay_timer; - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[3]->arg, 0, 600); zebra_route_map_set_delay_timer(rmap_delay_timer); return (CMD_SUCCESS); @@ -766,13 +766,13 @@ DEFUN (ip_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[2]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[2]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -787,7 +787,7 @@ DEFUN (ip_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[2]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -804,13 +804,13 @@ DEFUN (no_ip_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[4]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[4]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -825,7 +825,7 @@ DEFUN (no_ip_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[4]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } return CMD_SUCCESS; @@ -879,13 +879,13 @@ DEFUN (ipv6_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[2]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[2]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -900,7 +900,7 @@ DEFUN (ipv6_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[2]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -917,13 +917,13 @@ DEFUN (no_ipv6_protocol, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[4]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[4]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -938,7 +938,7 @@ DEFUN (no_ipv6_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[0]); + VRF_DEFAULT, argv[4]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } @@ -993,13 +993,13 @@ DEFUN (ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[2]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[2]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -1027,13 +1027,13 @@ DEFUN (no_ip_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[4]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[4]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -1097,13 +1097,13 @@ DEFUN (ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[2]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[2]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -1125,13 +1125,13 @@ DEFUN (no_ipv6_protocol_nht_rmap, { int i; - if (strcasecmp(argv[0], "any") == 0) + if (strcasecmp(argv[4]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[0]); + i = proto_name2num(argv[4]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", VTY_NEWLINE); return CMD_WARNING; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index a7ee63d87f..dfcf1829d1 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -191,7 +191,7 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argc > 2 ? argv[4]->arg : NULL, NULL); } ALIAS (ip_mroute_dist, @@ -213,7 +213,7 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argc > 2 ? argv[2] : NULL, NULL); + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argc > 2 ? argv[5]->arg : NULL, NULL); } ALIAS (no_ip_mroute_dist, @@ -239,15 +239,15 @@ DEFUN (ip_multicast_mode, "Lookup both, use entry with longer prefix\n") { - if (!strncmp (argv[0], "u", 1)) + if (!strncmp (argv[3]->arg, "u", 1)) multicast_mode_ipv4_set (MCAST_URIB_ONLY); - else if (!strncmp (argv[0], "mrib-o", 6)) + else if (!strncmp (argv[3]->arg, "mrib-o", 6)) multicast_mode_ipv4_set (MCAST_MRIB_ONLY); - else if (!strncmp (argv[0], "mrib-t", 6)) + else if (!strncmp (argv[3]->arg, "mrib-t", 6)) multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); - else if (!strncmp (argv[0], "low", 3)) + else if (!strncmp (argv[3]->arg, "low", 3)) multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); - else if (!strncmp (argv[0], "lon", 3)) + else if (!strncmp (argv[3]->arg, "lon", 3)) multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); else { @@ -306,7 +306,7 @@ DEFUN (show_ip_rpf_addr, struct rib *rib; int ret; - ret = inet_aton (argv[0], &addr); + ret = inet_aton (argv[3]->arg, &addr); if (ret == 0) { vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); @@ -334,7 +334,7 @@ DEFUN (ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, NULL, NULL); } @@ -350,7 +350,7 @@ DEFUN (ip_route_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, NULL, NULL); } @@ -365,7 +365,7 @@ DEFUN (ip_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL); } @@ -383,7 +383,7 @@ DEFUN (ip_route_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, NULL, NULL); } @@ -396,7 +396,7 @@ DEFUN (ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, NULL, NULL); } @@ -412,7 +412,7 @@ DEFUN (ip_route_flags2_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, NULL, NULL); } @@ -428,7 +428,7 @@ DEFUN (ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL); } @@ -446,7 +446,7 @@ DEFUN (ip_route_mask_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, NULL); } @@ -462,7 +462,7 @@ DEFUN (ip_route_mask_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL); } @@ -481,7 +481,7 @@ DEFUN (ip_route_mask_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, NULL); } @@ -495,7 +495,7 @@ DEFUN (ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL); } @@ -511,7 +511,7 @@ DEFUN (ip_route_mask_flags2_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, NULL); } @@ -527,8 +527,8 @@ DEFUN (ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, + argv[4]->arg, NULL); } DEFUN (ip_route_tag_distance, @@ -545,8 +545,8 @@ DEFUN (ip_route_tag_distance, "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, + argv[6]->arg, NULL); } DEFUN (ip_route_flags_distance, @@ -561,8 +561,8 @@ DEFUN (ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, + argv[5]->arg, NULL); } DEFUN (ip_route_flags_tag_distance, @@ -579,8 +579,8 @@ DEFUN (ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, + argv[7]->arg, NULL); } DEFUN (ip_route_flags_distance2, @@ -593,8 +593,8 @@ DEFUN (ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, + argv[4]->arg, NULL); } DEFUN (ip_route_flags_tag_distance2, @@ -609,8 +609,8 @@ DEFUN (ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, + argv[6]->arg, NULL); } DEFUN (ip_route_mask_distance, @@ -625,8 +625,8 @@ DEFUN (ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, + argv[5]->arg, NULL); } DEFUN (ip_route_mask_tag_distance, @@ -643,8 +643,8 @@ DEFUN (ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, + argv[7]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance, @@ -662,8 +662,8 @@ DEFUN (ip_route_mask_flags_tag_distance, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], - argv[5], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[8]->arg, + argv[9]->arg, NULL); } @@ -680,8 +680,8 @@ DEFUN (ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, + argv[6]->arg, NULL); } DEFUN (ip_route_mask_flags_distance2, @@ -695,8 +695,8 @@ DEFUN (ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, + argv[5]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance2, @@ -712,8 +712,8 @@ DEFUN (ip_route_mask_flags_tag_distance2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, + argv[7]->arg, NULL); } DEFUN (no_ip_route, @@ -727,7 +727,7 @@ DEFUN (no_ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL, NULL); } @@ -744,7 +744,7 @@ DEFUN (no_ip_route_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, NULL, NULL); } @@ -784,7 +784,7 @@ DEFUN (no_ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, NULL, NULL, NULL, NULL); } @@ -800,7 +800,7 @@ DEFUN (no_ip_route_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, NULL, argv[1], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, NULL, NULL); } @@ -816,7 +816,7 @@ DEFUN (no_ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, NULL); } @@ -834,7 +834,7 @@ DEFUN (no_ip_route_mask_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, NULL); } @@ -877,7 +877,7 @@ DEFUN (no_ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, NULL, + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -894,7 +894,7 @@ DEFUN (no_ip_route_mask_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, NULL, argv[2], + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, NULL, NULL); } @@ -910,8 +910,8 @@ DEFUN (no_ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, + argv[5]->arg, NULL); } DEFUN (no_ip_route_tag_distance, @@ -928,8 +928,8 @@ DEFUN (no_ip_route_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, + argv[7]->arg, NULL); } DEFUN (no_ip_route_flags_distance, @@ -945,8 +945,8 @@ DEFUN (no_ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, + argv[6]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance, @@ -964,8 +964,8 @@ DEFUN (no_ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, + argv[8]->arg, NULL); } DEFUN (no_ip_route_flags_distance2, @@ -979,8 +979,8 @@ DEFUN (no_ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, - argv[2], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, + argv[5]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance2, @@ -996,8 +996,8 @@ DEFUN (no_ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, + argv[7]->arg, NULL); } DEFUN (no_ip_route_mask_distance, @@ -1013,8 +1013,8 @@ DEFUN (no_ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, + argv[6]->arg, NULL); } DEFUN (no_ip_route_mask_tag_distance, @@ -1032,8 +1032,8 @@ DEFUN (no_ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, + argv[8]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance, @@ -1050,8 +1050,8 @@ DEFUN (no_ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, + argv[7]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance, @@ -1070,8 +1070,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], - argv[5], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, + argv[9]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance2, @@ -1086,8 +1086,8 @@ DEFUN (no_ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, - argv[3], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, + argv[6]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance2, @@ -1104,8 +1104,8 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], - argv[4], NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, + argv[8]->arg, NULL); } /* Static route configuration. */ @@ -1120,7 +1120,7 @@ DEFUN (ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, NULL, argv[6]->arg); } DEFUN (ip_route_tag_vrf, @@ -1136,7 +1136,7 @@ DEFUN (ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, NULL, argv[8]->arg); } DEFUN (ip_route_flags_vrf, @@ -1151,7 +1151,7 @@ DEFUN (ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[7]->arg); } DEFUN (ip_route_flags_tag_vrf, @@ -1169,7 +1169,7 @@ DEFUN (ip_route_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (ip_route_flags2_vrf, @@ -1182,7 +1182,7 @@ DEFUN (ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, NULL, argv[6]->arg); } DEFUN (ip_route_flags2_tag_vrf, @@ -1198,7 +1198,7 @@ DEFUN (ip_route_flags2_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, NULL, argv[8]->arg); } /* Mask as A.B.C.D format. */ @@ -1214,7 +1214,7 @@ DEFUN (ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); } DEFUN (ip_route_mask_tag_vrf, @@ -1232,7 +1232,7 @@ DEFUN (ip_route_mask_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (ip_route_mask_flags_vrf, @@ -1248,7 +1248,7 @@ DEFUN (ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); } DEFUN (ip_route_mask_flags_tag_vrf, @@ -1267,7 +1267,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (ip_route_mask_flags2_vrf, @@ -1281,7 +1281,7 @@ DEFUN (ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); } DEFUN (ip_route_mask_flags2_tag_vrf, @@ -1297,7 +1297,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); } /* Distance option value. */ @@ -1313,7 +1313,7 @@ DEFUN (ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[7]->arg); } DEFUN (ip_route_tag_distance_vrf, @@ -1331,7 +1331,7 @@ DEFUN (ip_route_tag_distance_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, argv[6]->arg, argv[9]->arg); } DEFUN (ip_route_flags_distance_vrf, @@ -1347,7 +1347,7 @@ DEFUN (ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (ip_route_flags_tag_distance_vrf, @@ -1365,7 +1365,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[7]->arg,argv[10]->arg); } DEFUN (ip_route_flags_distance2_vrf, @@ -1379,7 +1379,7 @@ DEFUN (ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, argv[4]->arg, argv[7]->arg); } DEFUN (ip_route_flags_tag_distance2_vrf, @@ -1395,7 +1395,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL, argv[1], argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, argv[6]->arg, argv[9]->arg); } DEFUN (ip_route_mask_distance_vrf, @@ -1411,7 +1411,7 @@ DEFUN (ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (ip_route_mask_tag_distance_vrf, @@ -1429,7 +1429,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (ip_route_mask_flags_tag_distance_vrf, @@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); } @@ -1466,7 +1466,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (ip_route_mask_flags_distance2_vrf, @@ -1481,7 +1481,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (ip_route_mask_flags_tag_distance2_vrf, @@ -1498,7 +1498,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (no_ip_route_vrf, @@ -1513,7 +1513,7 @@ DEFUN (no_ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); } DEFUN (no_ip_route_flags_vrf, @@ -1529,7 +1529,7 @@ DEFUN (no_ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); } DEFUN (no_ip_route_tag_vrf, @@ -1546,7 +1546,7 @@ DEFUN (no_ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (no_ip_route_flags_tag_vrf, @@ -1564,7 +1564,7 @@ DEFUN (no_ip_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (no_ip_route_flags2_vrf, @@ -1578,7 +1578,7 @@ DEFUN (no_ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, NULL, argv[2]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); } DEFUN (no_ip_route_flags2_tag_vrf, @@ -1594,7 +1594,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2], NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (no_ip_route_mask_vrf, @@ -1610,7 +1610,7 @@ DEFUN (no_ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[8]->arg); } DEFUN (no_ip_route_mask_flags_vrf, @@ -1627,7 +1627,7 @@ DEFUN (no_ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[9]->arg); } DEFUN (no_ip_route_mask_tag_vrf, @@ -1645,7 +1645,7 @@ DEFUN (no_ip_route_mask_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (no_ip_route_mask_flags_tag_vrf, @@ -1664,7 +1664,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[11]->arg); } DEFUN (no_ip_route_mask_flags2_vrf, @@ -1679,7 +1679,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[8]->arg); } DEFUN (no_ip_route_mask_flags2_tag_vrf, @@ -1696,7 +1696,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); } @@ -1713,7 +1713,7 @@ DEFUN (no_ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (no_ip_route_tag_distance_vrf, @@ -1731,7 +1731,7 @@ DEFUN (no_ip_route_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2], argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (no_ip_route_flags_distance_vrf, @@ -1748,7 +1748,7 @@ DEFUN (no_ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (no_ip_route_flags_tag_distance_vrf, @@ -1767,7 +1767,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], argv[2], argv[3], argv[4],argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg,argv[11]->arg); } DEFUN (no_ip_route_flags_distance2_vrf, @@ -1782,7 +1782,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], NULL, argv[2], argv[3]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (no_ip_route_flags_tag_distance2_vrf, @@ -1799,7 +1799,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2] , argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg , argv[7]->arg, argv[10]->arg); } DEFUN (no_ip_route_mask_distance_vrf, @@ -1816,7 +1816,7 @@ DEFUN (no_ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (no_ip_route_mask_tag_distance_vrf, @@ -1835,7 +1835,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[11]->arg); } DEFUN (no_ip_route_mask_flags_distance_vrf, @@ -1853,7 +1853,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[10]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance_vrf, @@ -1873,7 +1873,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); } DEFUN (no_ip_route_mask_flags_distance2_vrf, @@ -1889,7 +1889,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, @@ -1907,7 +1907,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); } /* New RIB. Detailed information for IPv4 route. */ @@ -2433,7 +2433,7 @@ DEFUN (show_ip_route_vrf, if (argc == 1 && uj) return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj); else - return do_show_ip_route (vty, argv[0], SAFI_UNICAST, uj); + return do_show_ip_route (vty, argv[5]->arg, SAFI_UNICAST, uj); } DEFUN (show_ip_nht, @@ -2607,10 +2607,10 @@ DEFUN (show_ip_route_tag, if (argc > 1) { tag = atoi(argv[1]); - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[4]->arg); } else - tag = atoi(argv[0]); + tag = atoi(argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2663,10 +2663,10 @@ DEFUN (show_ip_route_prefix_longer, if (argc > 1) { ret = str2prefix (argv[1], &p); - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); } else - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[3]->arg, &p); if (! ret) { @@ -2773,10 +2773,10 @@ DEFUN (show_ip_route_protocol, if (argc > 1) { type = proto_redistnum (AFI_IP, argv[1]); - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[4]->arg); } else - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[4]->arg); if (type < 0) { @@ -2827,7 +2827,7 @@ DEFUN (show_ip_route_ospf_instance, int first = 1; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[0]); + VTY_GET_INTEGER ("Instance", instance, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); if (! table) @@ -2864,11 +2864,11 @@ DEFUN (show_ip_route_addr, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[3]->arg, &p); if (ret <= 0) { @@ -2919,11 +2919,11 @@ DEFUN (show_ip_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[3]->arg, &p); if (ret <= 0) { @@ -3239,8 +3239,8 @@ DEFUN (show_ip_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]) - tag = atoi(argv[0]); + if (argv[6]->arg) + tag = atoi(argv[6]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -3293,7 +3293,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[5]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -3332,7 +3332,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route " VRF_ALL_CMD_STR " supernets-only", + "show ip route " VRF_ALL_CMD_STR " supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -3402,7 +3402,7 @@ DEFUN (show_ip_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP, argv[0]); + type = proto_redistnum (AFI_IP, argv[7]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -3455,7 +3455,7 @@ DEFUN (show_ip_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[6]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3496,7 +3496,7 @@ DEFUN (show_ip_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[5]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3755,7 +3755,7 @@ DEFUN (ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_tag, @@ -3769,7 +3769,7 @@ DEFUN (ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, NULL); } DEFUN (ipv6_route_flags, @@ -3783,7 +3783,7 @@ DEFUN (ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_flags_tag, @@ -3799,7 +3799,7 @@ DEFUN (ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname, @@ -3811,7 +3811,7 @@ DEFUN (ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_tag, ipv6_route_ifname_tag_cmd, @@ -3824,7 +3824,7 @@ DEFUN (ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname_flags, @@ -3838,7 +3838,7 @@ DEFUN (ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_flags_tag, @@ -3854,7 +3854,7 @@ DEFUN (ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, NULL); } DEFUN (ipv6_route_pref, @@ -3867,7 +3867,7 @@ DEFUN (ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, NULL); } DEFUN (ipv6_route_pref_tag, @@ -3882,7 +3882,7 @@ DEFUN (ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, NULL); } DEFUN (ipv6_route_flags_pref, @@ -3897,7 +3897,7 @@ DEFUN (ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, NULL); } DEFUN (ipv6_route_flags_pref_tag, @@ -3914,7 +3914,7 @@ DEFUN (ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, NULL); } DEFUN (ipv6_route_ifname_pref, @@ -3927,7 +3927,7 @@ DEFUN (ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, NULL); } DEFUN (ipv6_route_ifname_pref_tag, @@ -3942,7 +3942,7 @@ DEFUN (ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref, @@ -3957,7 +3957,7 @@ DEFUN (ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref_tag, @@ -3974,7 +3974,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, NULL); } DEFUN (no_ipv6_route, @@ -3987,7 +3987,7 @@ DEFUN (no_ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_tag, @@ -4002,7 +4002,7 @@ DEFUN (no_ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, NULL); } DEFUN (no_ipv6_route_flags, @@ -4017,7 +4017,7 @@ DEFUN (no_ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_flags_tag, @@ -4034,7 +4034,7 @@ DEFUN (no_ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname, @@ -4047,7 +4047,7 @@ DEFUN (no_ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_tag, @@ -4062,7 +4062,7 @@ DEFUN (no_ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags, @@ -4077,7 +4077,7 @@ DEFUN (no_ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags_tag, @@ -4094,7 +4094,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, NULL); } DEFUN (no_ipv6_route_pref, @@ -4108,7 +4108,7 @@ DEFUN (no_ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, NULL); } DEFUN (no_ipv6_route_pref_tag, @@ -4124,7 +4124,7 @@ DEFUN (no_ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref, @@ -4140,8 +4140,8 @@ DEFUN (no_ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], NULL); + /* We do not care about argv[5]->arg */ + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref_tag, @@ -4159,8 +4159,8 @@ DEFUN (no_ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL); + /* We do not care about argv[5]->arg */ + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref, @@ -4174,7 +4174,7 @@ DEFUN (no_ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref_tag, @@ -4190,7 +4190,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref, @@ -4206,7 +4206,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref_tag, @@ -4224,7 +4224,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, NULL); } DEFUN (ipv6_route_vrf, @@ -4237,7 +4237,7 @@ DEFUN (ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, argv[6]->arg); } DEFUN (ipv6_route_tag_vrf, @@ -4252,7 +4252,7 @@ DEFUN (ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, argv[8]->arg); } DEFUN (ipv6_route_flags_vrf, @@ -4267,7 +4267,7 @@ DEFUN (ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); } DEFUN (ipv6_route_flags_tag_vrf, @@ -4284,7 +4284,7 @@ DEFUN (ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (ipv6_route_ifname_vrf, @@ -4297,7 +4297,7 @@ DEFUN (ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, @@ -4311,7 +4311,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (ipv6_route_ifname_flags_vrf, @@ -4326,7 +4326,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); } DEFUN (ipv6_route_ifname_flags_tag_vrf, @@ -4343,7 +4343,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (ipv6_route_pref_vrf, @@ -4357,7 +4357,7 @@ DEFUN (ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, argv[7]->arg); } DEFUN (ipv6_route_pref_tag_vrf, @@ -4373,7 +4373,7 @@ DEFUN (ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, argv[9]->arg); } DEFUN (ipv6_route_flags_pref_vrf, @@ -4389,7 +4389,7 @@ DEFUN (ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (ipv6_route_flags_pref_tag_vrf, @@ -4407,7 +4407,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (ipv6_route_ifname_pref_vrf, @@ -4421,7 +4421,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (ipv6_route_ifname_pref_tag_vrf, @@ -4437,7 +4437,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (ipv6_route_ifname_flags_pref_vrf, @@ -4453,7 +4453,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, @@ -4471,7 +4471,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); } DEFUN (no_ipv6_route_vrf, @@ -4485,7 +4485,7 @@ DEFUN (no_ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, argv[2]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, argv[7]->arg); } DEFUN (no_ipv6_route_tag_vrf, @@ -4501,7 +4501,7 @@ DEFUN (no_ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, argv[9]->arg); } DEFUN (no_ipv6_route_flags_vrf, @@ -4517,7 +4517,7 @@ DEFUN (no_ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[8]->arg); } DEFUN (no_ipv6_route_flags_tag_vrf, @@ -4535,7 +4535,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (no_ipv6_route_ifname_vrf, @@ -4549,7 +4549,7 @@ DEFUN (no_ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, argv[3]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[8]->arg); } DEFUN (no_ipv6_route_ifname_tag_vrf, @@ -4565,7 +4565,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[10]->arg); } DEFUN (no_ipv6_route_ifname_flags_vrf, @@ -4581,7 +4581,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, NULL, argv[4]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[9]->arg); } DEFUN (no_ipv6_route_ifname_flags_tag_vrf, @@ -4599,7 +4599,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[11]->arg); } DEFUN (no_ipv6_route_pref_vrf, @@ -4614,7 +4614,7 @@ DEFUN (no_ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], argv[3]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, argv[8]->arg); } DEFUN (no_ipv6_route_pref_tag_vrf, @@ -4631,7 +4631,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); } DEFUN (no_ipv6_route_flags_pref_vrf, @@ -4648,8 +4648,8 @@ DEFUN (no_ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3], argv[4]); + /* We do not care about argv[5]->arg */ + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (no_ipv6_route_flags_pref_tag_vrf, @@ -4668,8 +4668,8 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[2] */ - return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]); + /* We do not care about argv[5]->arg */ + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); } DEFUN (no_ipv6_route_ifname_pref_vrf, @@ -4684,7 +4684,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], argv[4]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[9]->arg); } DEFUN (no_ipv6_route_ifname_pref_tag_vrf, @@ -4701,7 +4701,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[11]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_vrf, @@ -4718,7 +4718,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4], argv[5]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[10]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, @@ -4737,7 +4737,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); } DEFUN (show_ipv6_route, @@ -4758,14 +4758,14 @@ DEFUN (show_ipv6_route, json_object *json_prefix = NULL; u_char uj = use_json(argc, argv); - if (argc > 0 && argv[0] && strcmp(argv[0], "json") != 0) + if (argc > 0 && argv[3]->arg && strcmp(argv[3]->arg, "json") != 0) { - if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0]))) + if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[3]->arg))) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE); + vty_out (vty, "vrf %s not defined%s", argv[3]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -4774,7 +4774,7 @@ DEFUN (show_ipv6_route, if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE); + vty_out (vty, "vrf %s inactive%s", argv[3]->arg, VTY_NEWLINE); return CMD_SUCCESS; } else @@ -4860,11 +4860,11 @@ DEFUN (show_ipv6_route_tag, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[4]->arg); tag = atoi(argv[1]); } else - tag = atoi(argv[0]); + tag = atoi(argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -4916,11 +4916,11 @@ DEFUN (show_ipv6_route_prefix_longer, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); ret = str2prefix (argv[1], &p); } else - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[3]->arg, &p); if (! ret) { @@ -4974,11 +4974,11 @@ DEFUN (show_ipv6_route_protocol, if ( argc >1 ) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[4]->arg); type = proto_redistnum (AFI_IP6, argv[1]); } else - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[4]->arg); if (type < 0) { @@ -5030,11 +5030,11 @@ DEFUN (show_ipv6_route_addr, if (argc > 1 ) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[3]->arg, &p); if (ret <= 0) { @@ -5085,11 +5085,11 @@ DEFUN (show_ipv6_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[0]); + VRF_GET_ID (vrf_id, argv[3]->arg); ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[3]->arg, &p); if (ret <= 0) { @@ -5303,8 +5303,8 @@ DEFUN (show_ipv6_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[0]) - tag = atoi(argv[0]); + if (argv[6]->arg) + tag = atoi(argv[6]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -5358,7 +5358,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[5]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -5413,7 +5413,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[0]); + type = proto_redistnum (AFI_IP6, argv[6]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -5466,7 +5466,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[5]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); @@ -5507,7 +5507,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[0], &p); + ret = str2prefix_ipv6 (argv[5]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -5751,7 +5751,7 @@ DEFUN (ip_zebra_import_table_distance, int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[2]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5768,7 +5768,7 @@ DEFUN (ip_zebra_import_table_distance, } if (argc > 1) - VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); + VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255); return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1)); } @@ -5796,7 +5796,7 @@ DEFUN (ip_zebra_import_table_distance_routemap, const char *rmap_name; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[2]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5814,11 +5814,11 @@ DEFUN (ip_zebra_import_table_distance_routemap, if (argc > 2) { - VTY_GET_INTEGER_RANGE("distance", distance, argv[1], 1, 255); - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[2]); + VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[6]->arg); } else - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[4]->arg); return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); } @@ -5843,7 +5843,7 @@ DEFUN (no_ip_zebra_import_table, u_int32_t table_id = 0; if (argc) - VTY_GET_INTEGER("table", table_id, argv[0]); + VTY_GET_INTEGER("table", table_id, argv[3]->arg); if (!is_zebra_valid_kernel_table(table_id)) { From aa1c90a4872b2884e18d3e3ba0c160d327d72f78 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 20:17:48 +0000 Subject: [PATCH 100/280] lib: distribute.c, smux.c, vty.c grammar refactor Signed-off-by: Quentin Young --- lib/distribute.c | 345 +++++------------------------------------------ lib/smux.c | 29 +--- lib/vty.c | 13 +- 3 files changed, 52 insertions(+), 335 deletions(-) diff --git a/lib/distribute.c b/lib/distribute.c index d0d637fbb4..2a2647f23d 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -303,123 +303,39 @@ distribute_list_prefix_unset (const char *ifname, enum distribute_type type, return 1; } -DEFUN (distribute_list_all, - distribute_list_all_cmd, - "distribute-list WORD (in|out)", - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") -{ - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - /* Get interface name corresponding distribute list. */ - distribute_list_set (NULL, type, argv[0]); - - return CMD_SUCCESS; -} - -ALIAS (distribute_list_all, - ipv6_distribute_list_all_cmd, - "distribute-list WORD (in|out)", - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") - -DEFUN (no_distribute_list_all, - no_distribute_list_all_cmd, - "no distribute-list WORD (in|out)", - NO_STR - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") -{ - int ret; - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - ret = distribute_list_unset (NULL, type, argv[0]); - if (! ret) - { - vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - return CMD_SUCCESS; -} - -ALIAS (no_distribute_list_all, - no_ipv6_distribute_list_all_cmd, - "no distribute-list WORD (in|out)", - NO_STR - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") - DEFUN (distribute_list, distribute_list_cmd, - "distribute-list WORD (in|out) WORD", + "distribute-list [prefix] WORD [WORD]", "Filter networks in routing updates\n" "Access-list name\n" "Filter incoming routing updates\n" "Filter outgoing routing updates\n" "Interface name\n") { - enum distribute_type type; + int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); - return CMD_WARNING; - } + enum distribute_type type = argv[2 + prefix]->arg[0] == 'i' ? + DISTRIBUTE_IN : DISTRIBUTE_OUT; + + /* Set appropriate function call */ + int (*distfn)(const char *, enum distribute_type, const char *) = prefix ? + &distribute_list_prefix_set : &distribute_list_set; + + /* if interface is present, get name */ + const char *ifname = NULL; + if (argv[argc - 1]->type == VARIABLE_TKN) + ifname = argv[argc - 1]->arg; /* Get interface name corresponding distribute list. */ - distribute_list_set (argv[2], type, argv[0]); + distfn (ifname, type, argv[1 + prefix]->arg); return CMD_SUCCESS; -} +} -ALIAS (distribute_list, - ipv6_distribute_list_cmd, - "distribute-list WORD (in|out) WORD", - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") - -DEFUN (no_distribute_list, no_distribute_list_cmd, - "no distribute-list WORD (in|out) WORD", +DEFUN (no_distribute_list, + no_distribute_list_cmd, + "no distribute-list [prefix] WORD [WORD]", NO_STR "Filter networks in routing updates\n" "Access-list name\n" @@ -427,201 +343,31 @@ DEFUN (no_distribute_list, no_distribute_list_cmd, "Filter outgoing routing updates\n" "Interface name\n") { - int ret; - enum distribute_type type; + int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE); - return CMD_WARNING; - } + enum distribute_type type = argv[3 + prefix]->arg[0] == 'i' ? + DISTRIBUTE_IN : DISTRIBUTE_OUT; + + /* Set appropriate function call */ + int (*distfn)(const char *, enum distribute_type, const char *) = prefix ? + &distribute_list_prefix_unset : &distribute_list_unset; + + /* if interface is present, get name */ + const char *ifname = NULL; + if (argv[argc - 1]->type == VARIABLE_TKN) + ifname = argv[argc - 1]->arg; + + /* Get interface name corresponding distribute list. */ + int ret = distfn (ifname, type, argv[2 + prefix]->arg); - ret = distribute_list_unset (argv[2], type, argv[0]); if (! ret) { vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; -} - -ALIAS (no_distribute_list, no_ipv6_distribute_list_cmd, - "no distribute-list WORD (in|out) WORD", - NO_STR - "Filter networks in routing updates\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") - -DEFUN (distribute_list_prefix_all, - distribute_list_prefix_all_cmd, - "distribute-list prefix WORD (in|out)", - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") -{ - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (NULL, type, argv[0]); - - return CMD_SUCCESS; -} - -ALIAS (distribute_list_prefix_all, - ipv6_distribute_list_prefix_all_cmd, - "distribute-list prefix WORD (in|out)", - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") - -DEFUN (no_distribute_list_prefix_all, - no_distribute_list_prefix_all_cmd, - "no distribute-list prefix WORD (in|out)", - NO_STR - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") -{ - int ret; - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - ret = distribute_list_prefix_unset (NULL, type, argv[0]); - if (! ret) - { - vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - return CMD_SUCCESS; -} - -ALIAS (no_distribute_list_prefix_all, - no_ipv6_distribute_list_prefix_all_cmd, - "no distribute-list prefix WORD (in|out)", - NO_STR - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n") - -DEFUN (distribute_list_prefix, distribute_list_prefix_cmd, - "distribute-list prefix WORD (in|out) WORD", - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") -{ - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - /* Get interface name corresponding distribute list. */ - distribute_list_prefix_set (argv[2], type, argv[0]); - - return CMD_SUCCESS; -} - -ALIAS (distribute_list_prefix, ipv6_distribute_list_prefix_cmd, - "distribute-list prefix WORD (in|out) WORD", - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") - -DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd, - "no distribute-list prefix WORD (in|out) WORD", - NO_STR - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") -{ - int ret; - enum distribute_type type; - - /* Check of distribute list type. */ - if (strncmp (argv[1], "i", 1) == 0) - type = DISTRIBUTE_IN; - else if (strncmp (argv[1], "o", 1) == 0) - type = DISTRIBUTE_OUT; - else - { - vty_out (vty, "distribute list direction must be [in|out]%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - ret = distribute_list_prefix_unset (argv[2], type, argv[0]); - if (! ret) - { - vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - return CMD_SUCCESS; -} - -ALIAS (no_distribute_list_prefix, no_ipv6_distribute_list_prefix_cmd, - "no distribute-list prefix WORD (in|out) WORD", - NO_STR - "Filter networks in routing updates\n" - "Filter prefixes in routing updates\n" - "Name of an IP prefix-list\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") +} int config_show_distribute (struct vty *vty) @@ -770,25 +516,6 @@ distribute_list_init (int node) disthash = hash_create (distribute_hash_make, (int (*) (const void *, const void *)) distribute_cmp); - if(node==RIP_NODE) { - install_element (node, &distribute_list_all_cmd); - install_element (node, &no_distribute_list_all_cmd); - install_element (node, &distribute_list_cmd); - install_element (node, &no_distribute_list_cmd); - install_element (node, &distribute_list_prefix_all_cmd); - install_element (node, &no_distribute_list_prefix_all_cmd); - install_element (node, &distribute_list_prefix_cmd); - install_element (node, &no_distribute_list_prefix_cmd); - } else if (node == RIPNG_NODE) { - /* WARNING: two identical commands installed do a crash, so be worry with - * aliases */ - install_element (node, &ipv6_distribute_list_all_cmd); - install_element (node, &no_ipv6_distribute_list_all_cmd); - install_element (node, &ipv6_distribute_list_cmd); - install_element (node, &no_ipv6_distribute_list_cmd); - install_element (node, &ipv6_distribute_list_prefix_all_cmd); - install_element (node, &no_ipv6_distribute_list_prefix_all_cmd); - install_element (node, &ipv6_distribute_list_prefix_cmd); - install_element (node, &no_ipv6_distribute_list_prefix_cmd); - } + install_element (node, &distribute_list_cmd); + install_element (node, &no_distribute_list_cmd); } diff --git a/lib/smux.c b/lib/smux.c index 5012e8d95e..5727227248 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1370,7 +1370,7 @@ DEFUN (smux_peer, "SNMP MUX peer settings\n" "Object ID used in SMUX peering\n") { - if (smux_peer_oid (vty, argv[0], NULL) == 0) + if (smux_peer_oid (vty, argv[2]->arg, NULL) == 0) { smux_start(); return CMD_SUCCESS; @@ -1387,7 +1387,7 @@ DEFUN (smux_peer_password, "SMUX peering object ID\n" "SMUX peering password\n") { - if (smux_peer_oid (vty, argv[0], argv[1]) == 0) + if (smux_peer_oid (vty, argv[2]->arg, argv[3]->rg) == 0) { smux_start(); return CMD_SUCCESS; @@ -1398,31 +1398,16 @@ DEFUN (smux_peer_password, DEFUN (no_smux_peer, no_smux_peer_cmd, - "no smux peer", - NO_STR - "SNMP MUX protocol settings\n" - "SNMP MUX peer settings\n") -{ - smux_stop(); - return smux_peer_default (); -} - -ALIAS (no_smux_peer, - no_smux_peer_oid_cmd, - "no smux peer OID", - NO_STR - "SNMP MUX protocol settings\n" - "SNMP MUX peer settings\n" - "SMUX peering object ID\n") - -ALIAS (no_smux_peer, - no_smux_peer_oid_password_cmd, - "no smux peer OID PASSWORD", + "no smux peer [OID [PASSWORD]]", NO_STR "SNMP MUX protocol settings\n" "SNMP MUX peer settings\n" "SMUX peering object ID\n" "SMUX peering password\n") +{ + smux_stop(); + return smux_peer_default (); +} static int config_write_smux (struct vty *vty) diff --git a/lib/vty.c b/lib/vty.c index 900183fe55..a106d5d24d 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -983,6 +983,8 @@ vty_describe_fold (struct vty *vty, int cmd_width, const char *cmd, *p; int pos; + cmd = token->text; + if (desc_width <= 0) { vty_out (vty, " %-*s %s%s", cmd_width, cmd, token->desc, VTY_NEWLINE); @@ -2742,7 +2744,7 @@ exec_timeout (struct vty *vty, const char *min_str, const char *sec_str) DEFUN (exec_timeout_min, exec_timeout_min_cmd, - "exec-timeout <0-35791>", + "exec-timeout (0-35791)", "Set timeout value\n" "Timeout value in minutes\n") { @@ -2751,7 +2753,7 @@ DEFUN (exec_timeout_min, DEFUN (exec_timeout_sec, exec_timeout_sec_cmd, - "exec-timeout <0-35791> <0-2147483>", + "exec-timeout (0-35791) (0-2147483)", "Set the EXEC timeout\n" "Timeout in minutes\n" "Timeout in seconds\n") @@ -2791,7 +2793,8 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, argv[2]->arg))) + const char *accesslist = (argc == 3) ? argv[2]->arg : NULL; + if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2831,8 +2834,10 @@ DEFUN (no_vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { + const char *accesslist = (argc == 4) ? argv[3]->arg : NULL; + if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, argv[3]->arg))) + (argc && strcmp(vty_ipv6_accesslist_name, accesslist))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); From 97e5b7c0b3b7794d98caa1f40927defb751e637c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 20:26:07 +0000 Subject: [PATCH 101/280] lib: argv fixes, XFREE -> free, rm decl in matcher Signed-off-by: Quentin Young --- lib/command.c | 23 +++++++++++------------ lib/command_match.c | 3 --- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/command.c b/lib/command.c index 9cdf0a5ff0..680d32b03e 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2005,13 +2005,13 @@ DEFUN (banner_motd_file, "Banner from a file\n" "Filename\n") { - int cmd = cmd_banner_motd_file (argv[3]->arg); + const char *filename = argv[3]->arg; + int cmd = cmd_banner_motd_file (filename); if (cmd == CMD_ERR_NO_FILE) - vty_out (vty, "%s does not exist", argv[3]->arg); + vty_out (vty, "%s does not exist", filename); else if (cmd == CMD_WARNING) - vty_out (vty, "%s must be in %s", - argv[0], SYSCONFDIR); + vty_out (vty, "%s must be in %s", filename, SYSCONFDIR); return cmd; } @@ -2230,20 +2230,19 @@ del_cmd_token (struct cmd_token *token) if (!token) return; if (token->text) - XFREE (MTYPE_CMD_TOKENS, token->text); + free (token->text); if (token->desc) - XFREE (MTYPE_CMD_TOKENS, token->desc); + free (token->desc); if (token->arg) - XFREE (MTYPE_CMD_TOKENS, token->arg); + free (token->arg); - XFREE (MTYPE_CMD_TOKENS, token); + free (token); } struct cmd_token * copy_cmd_token (struct cmd_token *token) { struct cmd_token *copy = new_cmd_token (token->type, NULL, NULL); - copy->value = token->value; copy->max = token->max; copy->min = token->min; copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; @@ -2257,9 +2256,9 @@ void del_cmd_element(struct cmd_element *cmd) { if (!cmd) return; - XFREE (MTYPE_CMD_TOKENS, cmd->string); - XFREE (MTYPE_CMD_TOKENS, cmd->doc); - XFREE (MTYPE_CMD_TOKENS, cmd); + free ((char *) cmd->string); + free ((char *) cmd->doc); + free (cmd); } struct cmd_element * diff --git a/lib/command_match.c b/lib/command_match.c index 03efa93e04..aa961d3514 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -77,9 +77,6 @@ match_range (struct cmd_token *, const char *); static enum match_type match_word (struct cmd_token *, const char *); -static enum match_type -match_number (struct cmd_token *, const char *); - static enum match_type match_variable (struct cmd_token *, const char *); From 1bf1b05af96ba0e54462e329ea5aa3195605f68a Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 20:32:34 +0000 Subject: [PATCH 102/280] lib: argv update for thread.c Signed-off-by: Quentin Young --- lib/thread.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index a26eb6bfd2..ba9a0ea2a6 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -302,12 +302,12 @@ DEFUN (show_thread_cpu, int i = 0; thread_type filter = (thread_type) -1U; - if (argc > 0) + if (argc > 3) { filter = 0; - while (argv[0][i] != '\0') + while (argv[3]->arg[i] != '\0') { - switch ( argv[0][i] ) + switch ( argv[3]->arg[i] ) { case 'r': case 'R': @@ -342,7 +342,7 @@ DEFUN (show_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0], VTY_NEWLINE); + argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -384,12 +384,12 @@ DEFUN (clear_thread_cpu, int i = 0; thread_type filter = (thread_type) -1U; - if (argc > 0) + if (argc > 3) { filter = 0; - while (argv[0][i] != '\0') + while (argv[3]->arg[i] != '\0') { - switch ( argv[0][i] ) + switch ( argv[3]->arg[i] ) { case 'r': case 'R': @@ -424,7 +424,7 @@ DEFUN (clear_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[0], VTY_NEWLINE); + argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } } From fcbee690565e9bb8a5722d86bf665fde827a5b0d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 21:40:28 +0000 Subject: [PATCH 103/280] lib: argv update for if.c Signed-off-by: Quentin Young --- lib/if.c | 89 +++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 49 deletions(-) diff --git a/lib/if.c b/lib/if.c index bd6079c0fd..646f33354e 100644 --- a/lib/if.c +++ b/lib/if.c @@ -673,19 +673,19 @@ if_dump_all (void) DEFUN (interface_desc, interface_desc_cmd, - "description .LINE", + "description LINE...", "Interface specific description\n" "Characters describing this interface\n") { struct interface *ifp; - if (argc == 0) + if (argc == 1) return CMD_SUCCESS; ifp = vty->index; if (ifp->desc) XFREE (MTYPE_TMP, ifp->desc); - ifp->desc = argv_concat(argv, argc, 0); + ifp->desc = argv_concat(argv, argc, 1); return CMD_SUCCESS; } @@ -750,36 +750,40 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME", + "interface IFNAME ["VRF_CMD_STR"]", "Select an interface to configure\n" - "Interface's name\n") + "Interface's name\n" + VRF_CMD_HELP_STR) { + const char *ifname = argv[1]->arg; + const char *vrfname = (argc > 2) ? argv[3]->arg : NULL; + struct interface *ifp; size_t sl; vrf_id_t vrf_id = VRF_DEFAULT; - if ((sl = strlen(argv[0])) > INTERFACE_NAMSIZ) + if ((sl = strlen(ifname)) > INTERFACE_NAMSIZ) { vty_out (vty, "%% Interface name %s is invalid: length exceeds " "%d characters%s", - argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE); + ifname, INTERFACE_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } /*Pending: need proper vrf name based lookup/(possible creation of VRF) Imagine forward reference of a vrf by name in this interface config */ - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (vrfname) + VRF_GET_ID (vrf_id, vrfname); #ifdef SUNOS_5 - ifp = if_sunwzebra_get (argv[0], sl, vrf_id); + ifp = if_sunwzebra_get (ifname, sl, vrf_id); #else - ifp = if_get_by_name_len_vrf (argv[0], sl, vrf_id, 1); + ifp = if_get_by_name_len_vrf (ifname, sl, vrf_id, 1); #endif /* SUNOS_5 */ if (!ifp) { - vty_out (vty, "%% interface %s not in %s%s", argv[0], argv[1], VTY_NEWLINE); + vty_out (vty, "%% interface %s not in %s%s", ifname, vrfname, VTY_NEWLINE); return CMD_WARNING; } vty->index = ifp; @@ -788,32 +792,29 @@ DEFUN (interface, return CMD_SUCCESS; } -ALIAS (interface, - interface_vrf_cmd, - "interface IFNAME " VRF_CMD_STR, - "Select an interface to configure\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME", + "no interface IFNAME [VRF_CMD_STR]", NO_STR "Delete a pseudo interface's configuration\n" - "Interface's name\n") + "Interface's name\n" + VRF_CMD_HELP_STR) { + const char *ifname = argv[2]->arg; + const char *vrfname = (argc > 3) ? argv[3]->arg : NULL; + // deleting interface struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (argc > 3) + VRF_GET_ID (vrf_id, vrfname); - ifp = if_lookup_by_name_vrf (argv[0], vrf_id); + ifp = if_lookup_by_name_vrf (ifname, vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Interface %s does not exist%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Interface %s does not exist%s", ifname, VTY_NEWLINE); return CMD_WARNING; } @@ -829,32 +830,26 @@ DEFUN_NOSH (no_interface, return CMD_SUCCESS; } -ALIAS (no_interface, - no_interface_vrf_cmd, - "no interface IFNAME " VRF_CMD_STR, - NO_STR - "Delete a pseudo interface's configuration\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - DEFUN (vrf, vrf_cmd, "vrf NAME", "Select a VRF to configure\n" "VRF's name\n") { + const char *vrfname = argv[1]->arg; + struct vrf *vrfp; size_t sl; - if ((sl = strlen(argv[0])) > VRF_NAMSIZ) + if ((sl = strlen(vrfname)) > VRF_NAMSIZ) { vty_out (vty, "%% VRF name %s is invalid: length exceeds " "%d characters%s", - argv[0], VRF_NAMSIZ, VTY_NEWLINE); + vrfname, VRF_NAMSIZ, VTY_NEWLINE); return CMD_WARNING; } - vrfp = vrf_get (VRF_UNKNOWN, argv[0]); + vrfp = vrf_get (VRF_UNKNOWN, vrfname); vty->index = vrfp; vty->node = VRF_NODE; @@ -869,13 +864,15 @@ DEFUN_NOSH (no_vrf, "Delete a pseudo VRF's configuration\n" "VRF's name\n") { + const char *vrfname = argv[2]->arg; + struct vrf *vrfp; - vrfp = vrf_list_lookup_by_name (argv[0]); + vrfp = vrf_list_lookup_by_name (vrfname);; if (vrfp == NULL) { - vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% VRF %s does not exist%s", vrfname, VTY_NEWLINE); return CMD_WARNING; } @@ -895,9 +892,10 @@ DEFUN_NOSH (no_vrf, /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address", + "show address [VRF_CMD_STR]", SHOW_STR - "address\n") + "address\n" + VRF_CMD_HELP_STR) { struct listnode *node; struct listnode *node2; @@ -906,8 +904,8 @@ DEFUN (show_address, struct prefix *p; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (argc > 2) + VRF_GET_ID (vrf_id, argv[2]->arg); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { @@ -923,13 +921,6 @@ DEFUN (show_address, return CMD_SUCCESS; } -ALIAS (show_address, - show_address_vrf_cmd, - "show address " VRF_CMD_STR, - SHOW_STR - "address\n" - VRF_CMD_HELP_STR) - DEFUN (show_address_vrf_all, show_address_vrf_all_cmd, "show address " VRF_ALL_CMD_STR, From 7fcbbdaeb6fca9632811792e74b0ebd11ffab214 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 22 Sep 2016 22:53:09 +0000 Subject: [PATCH 104/280] lib: argv update for routemap.c Signed-off-by: Quentin Young --- lib/routemap.c | 115 +++++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 81 deletions(-) diff --git a/lib/routemap.c b/lib/routemap.c index 10e5ed304c..2d7a8be661 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1399,46 +1399,22 @@ route_map_notify_dependencies (const char *affected_name, route_map_event_t even /* VTY related functions. */ DEFUN (route_map, route_map_cmd, - "route-map WORD (deny|permit) <1-65535>", + "route-map WORD (1-65535)", "Create route-map or enter route-map command mode\n" "Route map tag\n" "Route map denies set operations\n" "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { - int permit; - unsigned long pref; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - - /* Permit check. */ - if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) - permit = RMAP_PERMIT; - else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) - permit = RMAP_DENY; - else - { - vty_out (vty, "the third field must be [permit|deny]%s", VTY_NEWLINE); - return CMD_WARNING; - } - - /* Preference check. */ - pref = strtoul (argv[2], &endptr, 10); - if (pref == ULONG_MAX || *endptr != '\0') - { - vty_out (vty, "the fourth field must be positive integer%s", - VTY_NEWLINE); - return CMD_WARNING; - } - if (pref == 0 || pref > 65535) - { - vty_out (vty, "the fourth field must be <1-65535>%s", VTY_NEWLINE); - return CMD_WARNING; - } + int permit = argv[2]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + unsigned long pref = strtoul (argv[3]->arg, &endptr, 10); + const char *mapname = argv[1]->arg; /* Get route map. */ - map = route_map_get (argv[0]); + map = route_map_get (mapname); index = route_map_index_get (map, permit, pref); vty->index = index; @@ -1453,13 +1429,13 @@ DEFUN (no_route_map_all, "Create route-map or enter route-map command mode\n" "Route map tag\n") { + const char *mapname = argv[2]->arg; struct route_map *map; - map = route_map_lookup_by_name (argv[0]); + map = route_map_lookup_by_name (mapname); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE); return CMD_WARNING; } @@ -1470,7 +1446,7 @@ DEFUN (no_route_map_all, DEFUN (no_route_map, no_route_map_cmd, - "no route-map WORD (deny|permit) <1-65535>", + "no route-map WORD (1-65535)", NO_STR "Create route-map or enter route-map command mode\n" "Route map tag\n" @@ -1478,43 +1454,19 @@ DEFUN (no_route_map, "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { - int permit; - unsigned long pref; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - - /* Permit check. */ - if (strncmp (argv[1], "permit", strlen (argv[1])) == 0) - permit = RMAP_PERMIT; - else if (strncmp (argv[1], "deny", strlen (argv[1])) == 0) - permit = RMAP_DENY; - else - { - vty_out (vty, "the third field must be [permit|deny]%s", VTY_NEWLINE); - return CMD_WARNING; - } - - /* Preference. */ - pref = strtoul (argv[2], &endptr, 10); - if (pref == ULONG_MAX || *endptr != '\0') - { - vty_out (vty, "the fourth field must be positive integer%s", - VTY_NEWLINE); - return CMD_WARNING; - } - if (pref == 0 || pref > 65535) - { - vty_out (vty, "the fourth field must be <1-65535>%s", VTY_NEWLINE); - return CMD_WARNING; - } + int permit = argv[3]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + const char *prefstr = argv[4]->arg; + const char *mapname = argv[2]->arg; + unsigned long pref = strtoul (prefstr, &endptr, 10); /* Existence check. */ - map = route_map_lookup_by_name (argv[0]); + map = route_map_lookup_by_name (mapname); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", - argv[0], VTY_NEWLINE); + vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE); return CMD_WARNING; } @@ -1523,7 +1475,7 @@ DEFUN (no_route_map, if (index == NULL) { vty_out (vty, "%% Could not find route-map entry %s %s%s", - argv[0], argv[2], VTY_NEWLINE); + mapname, prefstr, VTY_NEWLINE); return CMD_WARNING; } @@ -1580,11 +1532,18 @@ DEFUN (no_rmap_onmatch_next, DEFUN (rmap_onmatch_goto, rmap_onmatch_goto_cmd, - "on-match goto <1-65535>", + "on-match goto (1-65535)", "Exit policy on matches\n" "Goto Clause number\n" "Number\n") { + 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[2]->arg; + struct route_map_index *index = vty->index; int d = 0; @@ -1598,8 +1557,8 @@ DEFUN (rmap_onmatch_goto, return CMD_WARNING; } - if (argc == 1 && argv[0]) - VTY_GET_INTEGER_RANGE("route-map index", d, argv[0], 1, 65535); + if (argc == 1 && num) + VTY_GET_INTEGER_RANGE("route-map index", d, num, 1, 65535); else d = index->pref + 1; @@ -1651,13 +1610,13 @@ ALIAS (no_rmap_onmatch_goto, /* GNU Zebra compatible */ ALIAS (rmap_onmatch_goto, rmap_continue_seq_cmd, - "continue <1-65535>", + "continue (1-65535)", "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") ALIAS (no_rmap_onmatch_goto, no_rmap_continue_seq, - "no continue <1-65535>", + "no continue (1-65535)", NO_STR "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") @@ -1670,17 +1629,11 @@ DEFUN (rmap_show_name, "route-map name\n") { const char *name = NULL; - if (argc) - name = argv[0]; + if (argc == 3) + name = argv[2]->arg; return vty_show_route_map (vty, name); } -ALIAS (rmap_onmatch_goto, - rmap_continue_index_cmd, - "continue <1-65535>", - "Exit policy on matches\n" - "Goto Clause number\n") - DEFUN (rmap_call, rmap_call_cmd, "call WORD", @@ -1688,6 +1641,7 @@ DEFUN (rmap_call, "Target route-map name\n") { struct route_map_index *index; + const char *rmap = argv[1]->arg; index = vty->index; if (index) @@ -1699,7 +1653,7 @@ DEFUN (rmap_call, index->map->name); XFREE (MTYPE_ROUTE_MAP_NAME, index->nextrm); } - index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[0]); + index->nextrm = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap); } /* Execute event hook. */ @@ -1733,7 +1687,7 @@ DEFUN (no_rmap_call, DEFUN (rmap_description, rmap_description_cmd, - "description .LINE", + "description LINE...", "Route-map comment\n" "Comment describing this route-map rule\n") { @@ -1744,7 +1698,7 @@ DEFUN (rmap_description, { if (index->description) XFREE (MTYPE_TMP, index->description); - index->description = argv_concat (argv, argc, 0); + index->description = argv_concat (argv, argc, 1); } return CMD_SUCCESS; } @@ -1857,7 +1811,6 @@ route_map_init_vty (void) /* Install the continue stuff (ALIAS of on-match). */ install_element (RMAP_NODE, &rmap_continue_cmd); install_element (RMAP_NODE, &no_rmap_continue_cmd); - install_element (RMAP_NODE, &rmap_continue_index_cmd); /* Install the call stuff. */ install_element (RMAP_NODE, &rmap_call_cmd); From dd4f9f99ed4f5012e11a1c1eed0180345217eaa9 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 22 Sep 2016 23:51:23 +0000 Subject: [PATCH 105/280] ripngd: argv update Signed-off-by: Daniel Walton --- ripd/rip_debug.c | 22 -------------------- ripngd/ripng_debug.c | 31 ++++------------------------ ripngd/ripng_interface.c | 16 +++++++-------- ripngd/ripng_offset.c | 8 ++++---- ripngd/ripng_routemap.c | 44 ++++++++++++---------------------------- ripngd/ripng_zebra.c | 28 ++++++++++++------------- ripngd/ripngd.c | 19 +++++++++-------- tools/argv_translator.py | 8 ++++++-- 8 files changed, 59 insertions(+), 117 deletions(-) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index a267874ade..81d74bf852 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -105,26 +105,6 @@ DEFUN (debug_rip_packet_direct, return CMD_SUCCESS; } -/* N.B. the "detail" modifier is a no-op. we leave this command - for legacy compatibility. */ -DEFUN_DEPRECATED (debug_rip_packet_detail, - debug_rip_packet_detail_cmd, - "debug rip packet (recv|send) detail", - DEBUG_STR - RIP_STR - "RIP packet\n" - "RIP receive packet\n" - "RIP send packet\n" - "Detailed information display\n") -{ - rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) - rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) - rip_debug_packet |= RIP_DEBUG_RECV; - return CMD_SUCCESS; -} - DEFUN (debug_rip_zebra, debug_rip_zebra_cmd, "debug rip zebra", @@ -265,7 +245,6 @@ rip_debug_init (void) install_element (ENABLE_NODE, &debug_rip_events_cmd); install_element (ENABLE_NODE, &debug_rip_packet_cmd); install_element (ENABLE_NODE, &debug_rip_packet_direct_cmd); - install_element (ENABLE_NODE, &debug_rip_packet_detail_cmd); install_element (ENABLE_NODE, &debug_rip_zebra_cmd); install_element (ENABLE_NODE, &no_debug_rip_events_cmd); install_element (ENABLE_NODE, &no_debug_rip_packet_cmd); @@ -275,7 +254,6 @@ rip_debug_init (void) install_element (CONFIG_NODE, &debug_rip_events_cmd); install_element (CONFIG_NODE, &debug_rip_packet_cmd); install_element (CONFIG_NODE, &debug_rip_packet_direct_cmd); - install_element (CONFIG_NODE, &debug_rip_packet_detail_cmd); install_element (CONFIG_NODE, &debug_rip_zebra_cmd); install_element (CONFIG_NODE, &no_debug_rip_events_cmd); install_element (CONFIG_NODE, &no_debug_rip_packet_cmd); diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index c1eb39ba24..73bfcb4d6c 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -99,30 +99,9 @@ DEFUN (debug_ripng_packet_direct, "Debug option set for send packet\n") { ripng_debug_packet |= RIPNG_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) ripng_debug_packet |= RIPNG_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) - ripng_debug_packet |= RIPNG_DEBUG_RECV; - - return CMD_SUCCESS; -} - -/* N.B. the "detail" modifier is a no-op. we leave this command - for legacy compatibility. */ -DEFUN_DEPRECATED (debug_ripng_packet_detail, - debug_ripng_packet_detail_cmd, - "debug ripng packet (recv|send) detail", - DEBUG_STR - "RIPng configuration\n" - "Debug option set for ripng packet\n" - "Debug option set for receive packet\n" - "Debug option set for send packet\n" - "Debug option set detaied information\n") -{ - ripng_debug_packet |= RIPNG_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) - ripng_debug_packet |= RIPNG_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) ripng_debug_packet |= RIPNG_DEBUG_RECV; return CMD_SUCCESS; @@ -173,14 +152,14 @@ DEFUN (no_debug_ripng_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) { if (IS_RIPNG_DEBUG_RECV) ripng_debug_packet &= ~RIPNG_DEBUG_SEND; else ripng_debug_packet = 0; } - else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + else if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) { if (IS_RIPNG_DEBUG_SEND) ripng_debug_packet &= ~RIPNG_DEBUG_RECV; @@ -270,7 +249,6 @@ ripng_debug_init () install_element (ENABLE_NODE, &debug_ripng_events_cmd); install_element (ENABLE_NODE, &debug_ripng_packet_cmd); install_element (ENABLE_NODE, &debug_ripng_packet_direct_cmd); - install_element (ENABLE_NODE, &debug_ripng_packet_detail_cmd); install_element (ENABLE_NODE, &debug_ripng_zebra_cmd); install_element (ENABLE_NODE, &no_debug_ripng_events_cmd); install_element (ENABLE_NODE, &no_debug_ripng_packet_cmd); @@ -280,7 +258,6 @@ ripng_debug_init () install_element (CONFIG_NODE, &debug_ripng_events_cmd); install_element (CONFIG_NODE, &debug_ripng_packet_cmd); install_element (CONFIG_NODE, &debug_ripng_packet_direct_cmd); - install_element (CONFIG_NODE, &debug_ripng_packet_detail_cmd); install_element (CONFIG_NODE, &debug_ripng_zebra_cmd); install_element (CONFIG_NODE, &no_debug_ripng_events_cmd); install_element (CONFIG_NODE, &no_debug_ripng_packet_cmd); diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 0061c0e803..c6167dad6d 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -956,17 +956,17 @@ DEFUN (ripng_network, int ret; struct prefix p; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[1]->arg, &p); /* Given string is IPv6 network or interface name. */ if (ret) ret = ripng_enable_network_add (&p); else - ret = ripng_enable_if_add (argv[0]); + ret = ripng_enable_if_add (argv[1]->arg); if (ret < 0) { - vty_out (vty, "There is same network configuration %s%s", argv[0], + vty_out (vty, "There is same network configuration %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -985,17 +985,17 @@ DEFUN (no_ripng_network, int ret; struct prefix p; - ret = str2prefix (argv[0], &p); + ret = str2prefix (argv[2]->arg, &p); /* Given string is interface name. */ if (ret) ret = ripng_enable_network_delete (&p); else - ret = ripng_enable_if_delete (argv[0]); + ret = ripng_enable_if_delete (argv[2]->arg); if (ret < 0) { - vty_out (vty, "can't find network %s%s", argv[0], + vty_out (vty, "can't find network %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1071,7 +1071,7 @@ DEFUN (ripng_passive_interface, "Suppress routing updates on an interface\n" "Interface name\n") { - return ripng_passive_interface_set (vty, argv[0]); + return ripng_passive_interface_set (vty, argv[1]->arg); } DEFUN (no_ripng_passive_interface, @@ -1081,7 +1081,7 @@ DEFUN (no_ripng_passive_interface, "Suppress routing updates on an interface\n" "Interface name\n") { - return ripng_passive_interface_unset (vty, argv[0]); + return ripng_passive_interface_unset (vty, argv[2]->arg); } static struct ripng_interface * diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 4ed6e9b0c4..2fbfb33e3c 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -297,7 +297,7 @@ DEFUN (ripng_offset_list, "For outgoing updates\n" "Metric value\n") { - return ripng_offset_list_set (vty, argv[0], argv[1], argv[2], NULL); + return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL); } DEFUN (ripng_offset_list_ifname, @@ -310,7 +310,7 @@ DEFUN (ripng_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return ripng_offset_list_set (vty, argv[0], argv[1], argv[2], argv[3]); + return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_ripng_offset_list, @@ -323,7 +323,7 @@ DEFUN (no_ripng_offset_list, "For outgoing updates\n" "Metric value\n") { - return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], NULL); + return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_ripng_offset_list_ifname, @@ -337,7 +337,7 @@ DEFUN (no_ripng_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); + return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } static int diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 9bda2e260d..52495aa3ff 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -507,7 +507,7 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return ripng_route_match_add (vty, vty->index, "metric", argv[0]); + return ripng_route_match_add (vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_match_metric, @@ -517,10 +517,7 @@ DEFUN (no_match_metric, MATCH_STR "Match metric of route\n") { - if (argc == 0) - return ripng_route_match_delete (vty, vty->index, "metric", NULL); - - return ripng_route_match_delete (vty, vty->index, "metric", argv[0]); + return ripng_route_match_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_match_metric, @@ -538,7 +535,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return ripng_route_match_add (vty, vty->index, "interface", argv[0]); + return ripng_route_match_add (vty, vty->index, "interface", argv[2]->arg); } DEFUN (no_match_interface, @@ -548,10 +545,7 @@ DEFUN (no_match_interface, MATCH_STR "Match first hop interface of route\n") { - if (argc == 0) - return ripng_route_match_delete (vty, vty->index, "interface", NULL); - - return ripng_route_match_delete (vty, vty->index, "interface", argv[0]); + return ripng_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } ALIAS (no_match_interface, @@ -569,7 +563,7 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return ripng_route_match_add (vty, vty->index, "tag", argv[0]); + return ripng_route_match_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_match_tag, @@ -579,10 +573,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - if (argc == 0) - return ripng_route_match_delete (vty, vty->index, "tag", NULL); - - return ripng_route_match_delete (vty, vty->index, "tag", argv[0]); + return ripng_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_match_tag, @@ -602,7 +593,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return ripng_route_set_add (vty, vty->index, "metric", argv[0]); + return ripng_route_set_add (vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_set_metric, @@ -612,10 +603,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { - if (argc == 0) - return ripng_route_set_delete (vty, vty->index, "metric", NULL); - - return ripng_route_set_delete (vty, vty->index, "metric", argv[0]); + return ripng_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, @@ -638,7 +626,7 @@ DEFUN (set_ipv6_nexthop_local, union sockunion su; int ret; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[4]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop local address%s", VTY_NEWLINE); @@ -651,7 +639,7 @@ DEFUN (set_ipv6_nexthop_local, return CMD_WARNING; } - return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]); + return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); } DEFUN (no_set_ipv6_nexthop_local, @@ -663,10 +651,7 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 next-hop address\n" "IPv6 local address\n") { - if (argc == 0) - return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); - - return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[0]); + return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); } ALIAS (no_set_ipv6_nexthop_local, @@ -686,7 +671,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return ripng_route_set_add (vty, vty->index, "tag", argv[0]); + return ripng_route_set_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_set_tag, @@ -696,10 +681,7 @@ DEFUN (no_set_tag, SET_STR "Tag value for routing protocol\n") { - if (argc == 0) - return ripng_route_set_delete (vty, vty->index, "tag", NULL); - - return ripng_route_set_delete (vty, vty->index, "tag", argv[0]); + return ripng_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_set_tag, diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index d8667cb68c..06ff558ab6 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -333,11 +333,11 @@ DEFUN (ripng_redistribute_type, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[2]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -354,11 +354,11 @@ DEFUN (no_ripng_redistribute_type, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[3]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -379,12 +379,12 @@ DEFUN (ripng_redistribute_type_metric, int type; int metric; - metric = atoi (argv[1]); - type = proto_redistnum(AFI_IP6, argv[0]); + metric = atoi (argv[3]->arg); + type = proto_redistnum(AFI_IP6, argv[1]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -413,15 +413,15 @@ DEFUN (ripng_redistribute_type_routemap, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[1]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } - ripng_redistribute_routemap_set (type, argv[1]); + ripng_redistribute_routemap_set (type, argv[3]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; @@ -449,17 +449,17 @@ DEFUN (ripng_redistribute_type_metric_routemap, int type; int metric; - type = proto_redistnum(AFI_IP6, argv[0]); - metric = atoi (argv[1]); + type = proto_redistnum(AFI_IP6, argv[1]->arg); + metric = atoi (argv[3]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } ripng_redistribute_metric_set (type, metric); - ripng_redistribute_routemap_set (type, argv[2]); + ripng_redistribute_routemap_set (type, argv[5]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 2858bb6462..dc00d96298 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2265,7 +2265,7 @@ DEFUN (ripng_route, struct prefix_ipv6 p; struct route_node *rp; - ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2298,7 +2298,7 @@ DEFUN (no_ripng_route, struct prefix_ipv6 p; struct route_node *rp; - ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2332,7 +2332,7 @@ DEFUN (ripng_aggregate_address, struct prefix p; struct route_node *node; - ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2365,7 +2365,7 @@ DEFUN (no_ripng_aggregate_address, struct prefix p; struct route_node *rn; - ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *) &p); + ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *) &p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2395,7 +2395,7 @@ DEFUN (ripng_default_metric, { if (ripng) { - ripng->default_metric = atoi (argv[0]); + ripng->default_metric = atoi (argv[1]->arg); } return CMD_SUCCESS; } @@ -2537,9 +2537,9 @@ DEFUN (ripng_timers, unsigned long timeout; unsigned long garbage; - VTY_GET_INTEGER_RANGE("update timer", update, argv[0], 0, 65535); - VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[1], 0, 65535); - VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[2], 0, 65535); + VTY_GET_INTEGER_RANGE("update timer", update, argv[2]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[3]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[4]->arg, 0, 65535); /* Set each timer value. */ ripng->update_time = update; @@ -2580,7 +2580,8 @@ ALIAS (no_ripng_timers, "Routing information timeout timer. Default is 180.\n" "Garbage collection timer. Default is 120.\n") -DEFUN (show_ipv6_protocols, show_ipv6_protocols_cmd, +DEFUN (show_ipv6_protocols, + show_ipv6_protocols_cmd, "show ipv6 protocols", SHOW_STR IPV6_STR diff --git a/tools/argv_translator.py b/tools/argv_translator.py index f21e99d089..71c4566391 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -31,6 +31,8 @@ def token_is_variable(line_number, token): '.LINE', # where is this defined? 'LINE', 'BANDWIDTH', + 'IPV6ADDR', + 'IF_OR_ADDR', 'INTERFACE', 'PERCENTAGE', 'IFNAME', @@ -197,6 +199,7 @@ def update_argvs(filename): line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all') line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)') line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)') + line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -206,8 +209,8 @@ def update_argvs(filename): line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",') line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",') line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '<2-255> <50-60000> <50-60000>",') - line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') - + line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', + ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",') line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",') @@ -219,6 +222,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table)",') line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)",') line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') + line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') From 558e4c284b30ac90b7c8a9e2f8cefd368fe98c9f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 00:01:25 +0000 Subject: [PATCH 106/280] ripd: argv update Signed-off-by: Daniel Walton --- ripd/rip_debug.c | 8 ++--- ripd/rip_interface.c | 42 +++++++++++------------ ripd/rip_offset.c | 8 ++--- ripd/rip_routemap.c | 72 ++++++++++++---------------------------- ripd/rip_zebra.c | 53 +++++++++++++++-------------- ripd/ripd.c | 26 +++++++-------- tools/argv_translator.py | 2 ++ 7 files changed, 91 insertions(+), 120 deletions(-) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index 81d74bf852..0567f4f205 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -98,9 +98,9 @@ DEFUN (debug_rip_packet_direct, "RIP send packet\n") { rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -150,14 +150,14 @@ DEFUN (no_debug_rip_packet_direct, "RIP option set for receive packet\n" "RIP option set for send packet\n") { - if (strncmp ("send", argv[0], strlen (argv[0])) == 0) + if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) { if (IS_RIP_DEBUG_RECV) rip_debug_packet &= ~RIP_DEBUG_SEND; else rip_debug_packet = 0; } - else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) + else if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) { if (IS_RIP_DEBUG_SEND) rip_debug_packet &= ~RIP_DEBUG_RECV; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 09b35d00b9..749939da2e 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1228,16 +1228,16 @@ DEFUN (rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[1]->arg, &p); if (ret) ret = rip_enable_network_add ((struct prefix *) &p); else - ret = rip_enable_if_add (argv[0]); + ret = rip_enable_if_add (argv[1]->arg); if (ret < 0) { - vty_out (vty, "There is a same network configuration %s%s", argv[0], + vty_out (vty, "There is a same network configuration %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1257,16 +1257,16 @@ DEFUN (no_rip_network, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[2]->arg, &p); if (ret) ret = rip_enable_network_delete ((struct prefix *) &p); else - ret = rip_enable_if_delete (argv[0]); + ret = rip_enable_if_delete (argv[2]->arg); if (ret < 0) { - vty_out (vty, "Can't find network configuration %s%s", argv[0], + vty_out (vty, "Can't find network configuration %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1284,7 +1284,7 @@ DEFUN (rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[1]->arg, &p); if (ret <= 0) { @@ -1308,7 +1308,7 @@ DEFUN (no_rip_neighbor, int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[2]->arg, &p); if (ret <= 0) { @@ -1338,12 +1338,12 @@ DEFUN (ip_rip_receive_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]) == 1) + if (atoi (argv[4]->arg) == 1) { ri->ri_receive = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]) == 2) + if (atoi (argv[4]->arg) == 2) { ri->ri_receive = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1440,12 +1440,12 @@ DEFUN (ip_rip_send_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[0]) == 1) + if (atoi (argv[4]->arg) == 1) { ri->ri_send = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[0]) == 2) + if (atoi (argv[4]->arg) == 2) { ri->ri_send = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1548,9 +1548,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("md5", argv[0], strlen (argv[0])) == 0) + if (strncmp ("md5", argv[4]->arg, strlen (argv[4]->arg)) == 0) auth_type = RIP_AUTH_MD5; - else if (strncmp ("text", argv[0], strlen (argv[0])) == 0) + else if (strncmp ("text", argv[4]->arg, strlen (argv[4]->arg)) == 0) auth_type = RIP_AUTH_SIMPLE_PASSWORD; else { @@ -1570,9 +1570,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("r", argv[1], 1) == 0) + if (strncmp ("r", argv[6]->arg, 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_SIZE; - else if (strncmp ("o", argv[1], 1) == 0) + else if (strncmp ("o", argv[6]->arg, 1) == 0) ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; else return CMD_WARNING; @@ -1656,7 +1656,7 @@ DEFUN (ip_rip_authentication_string, ifp = (struct interface *)vty->index; ri = ifp->info; - if (strlen (argv[0]) > 16) + if (strlen (argv[4]->arg) > 16) { vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s", VTY_NEWLINE); @@ -1672,7 +1672,7 @@ DEFUN (ip_rip_authentication_string, if (ri->auth_str) free (ri->auth_str); - ri->auth_str = strdup (argv[0]); + ri->auth_str = strdup (argv[4]->arg); return CMD_SUCCESS; } @@ -1735,7 +1735,7 @@ DEFUN (ip_rip_authentication_key_chain, if (ri->key_chain) free (ri->key_chain); - ri->key_chain = strdup (argv[0]); + ri->key_chain = strdup (argv[4]->arg); return CMD_SUCCESS; } @@ -1867,7 +1867,7 @@ DEFUN (rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]; + const char *ifname = argv[1]->arg; if (!strcmp(ifname,"default")) { passive_default = 1; @@ -1888,7 +1888,7 @@ DEFUN (no_rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[0]; + const char *ifname = argv[2]->arg; if (!strcmp(ifname,"default")) { passive_default = 0; diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 0155f90ef0..be734c66dd 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -289,7 +289,7 @@ DEFUN (rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_set (vty, argv[0], argv[1], argv[2], NULL); + return rip_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL); } DEFUN (rip_offset_list_ifname, @@ -302,7 +302,7 @@ DEFUN (rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_set (vty, argv[0], argv[1], argv[2], argv[3]); + return rip_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); } DEFUN (no_rip_offset_list, @@ -315,7 +315,7 @@ DEFUN (no_rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], NULL); + return rip_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); } DEFUN (no_rip_offset_list_ifname, @@ -329,7 +329,7 @@ DEFUN (no_rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); + return rip_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); } static int diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e7263ad7be..76186cdf66 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -742,7 +742,7 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "metric", argv[0]); + return rip_route_match_add (vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_match_metric, @@ -752,10 +752,7 @@ DEFUN (no_match_metric, MATCH_STR "Match metric of route\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "metric", NULL); - - return rip_route_match_delete (vty, vty->index, "metric", argv[0]); + return rip_route_match_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_match_metric, @@ -773,7 +770,7 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return rip_route_match_add (vty, vty->index, "interface", argv[0]); + return rip_route_match_add (vty, vty->index, "interface", argv[2]->arg); } DEFUN (no_match_interface, @@ -783,10 +780,7 @@ DEFUN (no_match_interface, MATCH_STR "Match first hop interface of route\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "interface", NULL); - - return rip_route_match_delete (vty, vty->index, "interface", argv[0]); + return rip_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } ALIAS (no_match_interface, @@ -807,7 +801,7 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); } DEFUN (no_match_ip_next_hop, @@ -818,10 +812,7 @@ DEFUN (no_match_ip_next_hop, IP_STR "Match next-hop address of route\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "ip next-hop", NULL); - - return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } ALIAS (no_match_ip_next_hop, @@ -844,7 +835,7 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[0]); + return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[4]->arg); } DEFUN (no_match_ip_next_hop_prefix_list, @@ -856,10 +847,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match next-hop address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", NULL); - - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[5]->arg); } ALIAS (no_match_ip_next_hop_prefix_list, @@ -883,7 +871,7 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address", argv[0]); + return rip_route_match_add (vty, vty->index, "ip address", argv[3]->arg); } DEFUN (no_match_ip_address, @@ -894,10 +882,7 @@ DEFUN (no_match_ip_address, IP_STR "Match address of route\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "ip address", NULL); - - return rip_route_match_delete (vty, vty->index, "ip address", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); } ALIAS (no_match_ip_address, @@ -920,7 +905,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[0]); + return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[4]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -932,10 +917,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match address of route\n" "Match entries of prefix-lists\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); + return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[5]->arg); } ALIAS (no_match_ip_address_prefix_list, @@ -955,7 +937,7 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "tag", argv[0]); + return rip_route_match_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_match_tag, @@ -965,10 +947,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - if (argc == 0) - return rip_route_match_delete (vty, vty->index, "tag", NULL); - - return rip_route_match_delete (vty, vty->index, "tag", argv[0]); + return rip_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_match_tag, @@ -988,7 +967,7 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return rip_route_set_add (vty, vty->index, "metric", argv[0]); + return rip_route_set_add (vty, vty->index, "metric", argv[2]->arg); } ALIAS (set_metric, @@ -1005,10 +984,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { - if (argc == 0) - return rip_route_set_delete (vty, vty->index, "metric", NULL); - - return rip_route_set_delete (vty, vty->index, "metric", argv[0]); + return rip_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, @@ -1038,7 +1014,7 @@ DEFUN (set_ip_nexthop, union sockunion su; int ret; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[3]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE); @@ -1052,7 +1028,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return rip_route_set_add (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg); } DEFUN (no_set_ip_nexthop, @@ -1063,10 +1039,7 @@ DEFUN (no_set_ip_nexthop, IP_STR "Next hop address\n") { - if (argc == 0) - return rip_route_set_delete (vty, vty->index, "ip next-hop", NULL); - - return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[0]); + return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } ALIAS (no_set_ip_nexthop, @@ -1085,7 +1058,7 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return rip_route_set_add (vty, vty->index, "tag", argv[0]); + return rip_route_set_add (vty, vty->index, "tag", argv[2]->arg); } DEFUN (no_set_tag, @@ -1095,10 +1068,7 @@ DEFUN (no_set_tag, SET_STR "Tag value for routing protocol\n") { - if (argc == 0) - return rip_route_set_delete (vty, vty->index, "tag", NULL); - - return rip_route_set_delete (vty, vty->index, "tag", argv[0]); + return rip_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } ALIAS (no_set_tag, diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 6ca27d01dd..4ede048f9c 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -367,7 +367,7 @@ DEFUN (rip_redistribute_type, for(i = 0; redist_type[i].str; i++) { - if (strncmp (redist_type[i].str, argv[0], + if (strncmp (redist_type[i].str, argv[2]->arg, redist_type[i].str_min_len) == 0) { zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, @@ -376,7 +376,7 @@ DEFUN (rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -393,7 +393,7 @@ DEFUN (no_rip_redistribute_type, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[3]->arg, redist_type[i].str_min_len) == 0) { rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP); @@ -403,7 +403,7 @@ DEFUN (no_rip_redistribute_type, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -420,17 +420,17 @@ DEFUN (rip_redistribute_type_routemap, int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[1]->arg, redist_type[i].str_min_len) == 0) { - rip_routemap_set (redist_type[i].type, argv[1]); + rip_routemap_set (redist_type[i].type, argv[3]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -449,17 +449,17 @@ DEFUN (no_rip_redistribute_type_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[2]->arg, redist_type[i].str_min_len) == 0) { - if (rip_routemap_unset (redist_type[i].type,argv[1])) + if (rip_routemap_unset (redist_type[i].type,argv[4]->arg)) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -476,10 +476,10 @@ DEFUN (rip_redistribute_type_metric, int i; int metric; - metric = atoi (argv[1]); + metric = atoi (argv[3]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[1]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); @@ -489,7 +489,7 @@ DEFUN (rip_redistribute_type_metric, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -508,17 +508,17 @@ DEFUN (no_rip_redistribute_type_metric, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[2]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[4]->arg))) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -537,21 +537,21 @@ DEFUN (rip_redistribute_type_metric_routemap, int i; int metric; - metric = atoi (argv[1]); + metric = atoi (argv[3]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[1]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); - rip_routemap_set (redist_type[i].type, argv[2]); + rip_routemap_set (redist_type[i].type, argv[5]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -560,8 +560,7 @@ DEFUN (rip_redistribute_type_metric_routemap, DEFUN (no_rip_redistribute_type_metric_routemap, no_rip_redistribute_type_metric_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD - " metric <0-16> route-map WORD", + "no redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16> route-map WORD", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD @@ -574,14 +573,14 @@ DEFUN (no_rip_redistribute_type_metric_routemap, for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[0], + if (strncmp(redist_type[i].str, argv[2]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[1]))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[4]->arg))) return CMD_WARNING; - if (rip_routemap_unset (redist_type[i].type, argv[2])) + if (rip_routemap_unset (redist_type[i].type, argv[6]->arg)) { - rip_redistribute_metric_set(redist_type[i].type, atoi(argv[1])); + rip_redistribute_metric_set(redist_type[i].type, atoi(argv[4]->arg)); return CMD_WARNING; } rip_redistribute_unset (redist_type[i].type); @@ -589,7 +588,7 @@ DEFUN (no_rip_redistribute_type_metric_routemap, } } - vty_out(vty, "Invalid type %s%s", argv[0], + vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; diff --git a/ripd/ripd.c b/ripd/ripd.c index 3a8cd80e7a..3446bb579c 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2949,7 +2949,7 @@ DEFUN (rip_version, { int version; - version = atoi (argv[0]); + version = atoi (argv[1]->arg); if (version != RIPv1 && version != RIPv2) { vty_out (vty, "invalid rip version %d%s", version, @@ -2992,7 +2992,7 @@ DEFUN (rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[1]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3028,7 +3028,7 @@ DEFUN (no_rip_route, struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[0], &p); + ret = str2prefix_ipv4 (argv[2]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3040,7 +3040,7 @@ DEFUN (no_rip_route, node = route_node_lookup (rip->route, (struct prefix *) &p); if (! node) { - vty_out (vty, "Can't find route %s.%s", argv[0], + vty_out (vty, "Can't find route %s.%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -3079,7 +3079,7 @@ DEFUN (rip_default_metric, { if (rip) { - rip->default_metric = atoi (argv[0]); + rip->default_metric = atoi (argv[1]->arg); /* rip_update_default_metric (); */ } return CMD_SUCCESS; @@ -3123,21 +3123,21 @@ DEFUN (rip_timers, unsigned long RIP_TIMER_MAX = 2147483647; unsigned long RIP_TIMER_MIN = 5; - update = strtoul (argv[0], &endptr, 10); + update = strtoul (argv[2]->arg, &endptr, 10); if (update > RIP_TIMER_MAX || update < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "update timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - timeout = strtoul (argv[1], &endptr, 10); + timeout = strtoul (argv[3]->arg, &endptr, 10); if (timeout > RIP_TIMER_MAX || timeout < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "timeout timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - garbage = strtoul (argv[2], &endptr, 10); + garbage = strtoul (argv[4]->arg, &endptr, 10); if (garbage > RIP_TIMER_MAX || garbage < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "garbage timer value error%s", VTY_NEWLINE); @@ -3386,7 +3386,7 @@ DEFUN (rip_distance, "Administrative distance\n" "Distance value\n") { - rip->distance = atoi (argv[0]); + rip->distance = atoi (argv[1]->arg); return CMD_SUCCESS; } @@ -3408,7 +3408,7 @@ DEFUN (rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_set (vty, argv[0], argv[1], NULL); + rip_distance_set (vty, argv[1]->arg, argv[2]->arg, NULL); return CMD_SUCCESS; } @@ -3420,7 +3420,7 @@ DEFUN (no_rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_unset (vty, argv[0], argv[1], NULL); + rip_distance_unset (vty, argv[2]->arg, argv[3]->arg, NULL); return CMD_SUCCESS; } @@ -3432,7 +3432,7 @@ DEFUN (rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_set (vty, argv[0], argv[1], argv[2]); + rip_distance_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg); return CMD_SUCCESS; } @@ -3445,7 +3445,7 @@ DEFUN (no_rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_unset (vty, argv[0], argv[1], argv[2]); + rip_distance_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg); return CMD_SUCCESS; } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 71c4566391..0263b8ba9e 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -200,6 +200,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)') line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)') line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)') + line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '(kernel|connected|static|ospf|isis|bgp|pim|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -223,6 +224,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)",') line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",') + line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' (kernel|connected|static|ospf|isis|bgp|pim|table)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') From 91ac1d43adb63876fdfa123d82d7481a03706277 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 00:14:41 +0000 Subject: [PATCH 107/280] pimd: argv update Signed-off-by: Daniel Walton --- pimd/pim_cmd.c | 130 +++++++++--------- tools/argv_translator.py | 9 ++ .../quagga_parser_to_network_docopt.py | 0 3 files changed, 74 insertions(+), 65 deletions(-) rename quagga_parser_to_network_docopt.py => tools/quagga_parser_to_network_docopt.py (100%) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 6cfed0f2c6..8753106515 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1534,7 +1534,7 @@ DEFUN (pim_interface, "Interface's name\n") { struct interface *ifp; - const char *ifname = argv[0]; + const char *ifname = argv[1]->arg; size_t sl; sl = strlen(ifname); @@ -2374,7 +2374,7 @@ DEFUN (show_ip_rib, char nexthop_addr_str[100]; int result; - addr_str = argv[0]; + addr_str = argv[3]->arg; result = inet_pton(AF_INET, addr_str, &addr); if (result <= 0) { vty_out(vty, "Bad unicast address %s: errno=%d: %s%s", @@ -2468,14 +2468,14 @@ DEFUN (ip_pim_rp, { int result; - result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr); + result = inet_pton(AF_INET, argv[3]->arg, &qpim_rp.rpf_addr.s_addr); if (result <= 0) { - vty_out(vty, "%% Bad RP address specified: %s", argv[0]); + vty_out(vty, "%% Bad RP address specified: %s", argv[3]->arg); return CMD_WARNING; } if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) { - vty_out(vty, "%% No Path to RP address specified: %s", argv[0]); + vty_out(vty, "%% No Path to RP address specified: %s", argv[3]->arg); return CMD_WARNING; } @@ -2533,7 +2533,7 @@ DEFUN (ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[2]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2562,7 +2562,7 @@ DEFUN (no_ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[3]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2658,7 +2658,7 @@ DEFUN (interface_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[3]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2667,7 +2667,7 @@ DEFUN (interface_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[4]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2705,7 +2705,7 @@ DEFUN (interface_no_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2714,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[5]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2887,7 +2887,7 @@ DEFUN (interface_ip_igmp_query_interval, return CMD_WARNING; } - query_interval = atoi(argv[0]); + query_interval = atoi(argv[4]->arg); query_interval_dsec = 10 * query_interval; /* @@ -2981,7 +2981,7 @@ DEFUN (interface_ip_igmp_query_max_response_time, return CMD_WARNING; } - query_max_response_time = atoi(argv[0]); + query_max_response_time = atoi(argv[4]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3075,7 +3075,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec, return CMD_WARNING; } - query_max_response_time_dsec = atoi(argv[0]); + query_max_response_time_dsec = atoi(argv[4]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3166,7 +3166,7 @@ DEFUN (interface_ip_pim_drprio, old_dr_prio = pim_ifp->pim_dr_priority; - pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10); + pim_ifp->pim_dr_priority = strtol(argv[3]->arg, NULL, 10); if (old_dr_prio != pim_ifp->pim_dr_priority) { if (pim_if_dr_election(ifp)) @@ -3355,7 +3355,7 @@ DEFUN (interface_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[2]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3363,7 +3363,7 @@ DEFUN (interface_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[3]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3401,7 +3401,7 @@ DEFUN (interface_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[2]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3409,7 +3409,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[3]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3417,7 +3417,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[4]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3452,7 +3452,7 @@ DEFUN (interface_no_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[3]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3460,7 +3460,7 @@ DEFUN (interface_no_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3499,7 +3499,7 @@ DEFUN (interface_no_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[3]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3507,7 +3507,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3515,7 +3515,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[5]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3550,10 +3550,10 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[3]->arg, NULL, 10); if (argc == 2) - pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10); + pim_ifp->pim_default_holdtime = strtol(argv[4]->arg, NULL, 10); return CMD_SUCCESS; } @@ -3856,12 +3856,12 @@ DEFUN (debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[3]->arg,"h",1) == 0) { PIM_DO_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[3]->arg,"j",1) == 0) { PIM_DO_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE); @@ -3894,12 +3894,12 @@ DEFUN (no_debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[4]->arg,"h",1) == 0) { PIM_DONT_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[4]->arg,"j",1) == 0) { PIM_DONT_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE); @@ -4138,7 +4138,7 @@ DEFUN (test_igmp_receive_report, struct in_addr *src_addr; int argi; - socket = argv[0]; + socket = argv[4]->arg; socket_fd = atoi(socket); igmp = find_igmp_sock_by_fd(socket_fd); if (!igmp) { @@ -4147,7 +4147,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[5]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4155,7 +4155,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - record_type_str = argv[2]; + record_type_str = argv[6]->arg; record_type = atoi(record_type_str); /* @@ -4183,7 +4183,7 @@ DEFUN (test_igmp_receive_report, sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); src_addr = sources; for (argi = 3; argi < argc; ++argi,++src_addr) { - src_str = argv[argi]; + src_str = argv[argi]->arg; result = inet_pton(AF_INET, src_str, src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4243,7 +4243,7 @@ DEFUN (test_pim_receive_dump, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4252,7 +4252,7 @@ DEFUN (test_pim_receive_dump, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4278,7 +4278,7 @@ DEFUN (test_pim_receive_dump, /* Scan LINE dump into buffer */ for (argi = 2; argi < argc; ++argi) { - const char *str = argv[argi]; + const char *str = argv[argi]->arg; int str_len = strlen(str); int str_last = str_len - 1; int i; @@ -4368,7 +4368,7 @@ DEFUN (test_pim_receive_hello, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4377,7 +4377,7 @@ DEFUN (test_pim_receive_hello, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4385,12 +4385,12 @@ DEFUN (test_pim_receive_hello, return CMD_WARNING; } - neigh_holdtime = atoi(argv[2]); - neigh_dr_priority = atoi(argv[3]); - neigh_generation_id = atoi(argv[4]); - neigh_propagation_delay = atoi(argv[5]); - neigh_override_interval = atoi(argv[6]); - neigh_can_disable_join_suppression = atoi(argv[7]); + neigh_holdtime = atoi(argv[6]->arg); + neigh_dr_priority = atoi(argv[7]->arg); + neigh_generation_id = atoi(argv[8]->arg); + neigh_propagation_delay = atoi(argv[9]->arg); + neigh_override_interval = atoi(argv[10]->arg); + neigh_can_disable_join_suppression = atoi(argv[11]->arg); /* Tweak IP header @@ -4409,7 +4409,7 @@ DEFUN (test_pim_receive_hello, /* Scan LINE addresses */ for (argi = 8; argi < argc; ++argi) { - const char *sec_str = argv[argi]; + const char *sec_str = argv[argi]->arg; struct in_addr sec_addr; result = inet_pton(AF_INET, sec_str, &sec_addr); if (result <= 0) { @@ -4494,7 +4494,7 @@ DEFUN (test_pim_receive_assert, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4503,7 +4503,7 @@ DEFUN (test_pim_receive_assert, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4512,7 +4512,7 @@ DEFUN (test_pim_receive_assert, } /* Group address */ - group_str = argv[2]; + group_str = argv[6]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4521,7 +4521,7 @@ DEFUN (test_pim_receive_assert, } /* Source address */ - source_str = argv[3]; + source_str = argv[7]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4529,9 +4529,9 @@ DEFUN (test_pim_receive_assert, return CMD_WARNING; } - assert_metric_preference = atoi(argv[4]); - assert_route_metric = atoi(argv[5]); - assert_rpt_bit_flag = atoi(argv[6]); + assert_metric_preference = atoi(argv[8]->arg); + assert_route_metric = atoi(argv[9]->arg); + assert_rpt_bit_flag = atoi(argv[10]->arg); remain = buf_pastend - buf; if (remain < (int) sizeof(struct ip)) { @@ -4580,7 +4580,7 @@ DEFUN (test_pim_receive_assert, } static int recv_joinprune(struct vty *vty, - const char *argv[], + struct cmd_token **argv, int src_is_join) { uint8_t buf[1000]; @@ -4608,7 +4608,7 @@ static int recv_joinprune(struct vty *vty, uint16_t num_pruned; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4616,10 +4616,10 @@ static int recv_joinprune(struct vty *vty, return CMD_WARNING; } - neigh_holdtime = atoi(argv[1]); + neigh_holdtime = atoi(argv[1]->arg); /* Neighbor destination address */ - neigh_dst_str = argv[2]; + neigh_dst_str = argv[2]->arg; result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr); if (result <= 0) { vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s", @@ -4628,7 +4628,7 @@ static int recv_joinprune(struct vty *vty, } /* Neighbor source address */ - neigh_src_str = argv[3]; + neigh_src_str = argv[3]->arg; result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr); if (result <= 0) { vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s", @@ -4637,7 +4637,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast group address */ - group_str = argv[4]; + group_str = argv[4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4646,7 +4646,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast source address */ - source_str = argv[5]; + source_str = argv[5]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4819,7 +4819,7 @@ DEFUN (test_pim_receive_upcall, const char *source_str; int result; - upcall_type = argv[0]; + upcall_type = argv[4]->arg; if (upcall_type[0] == 'n') msg.im_msgtype = IGMPMSG_NOCACHE; @@ -4833,10 +4833,10 @@ DEFUN (test_pim_receive_upcall, return CMD_WARNING; } - msg.im_vif = atoi(argv[1]); + msg.im_vif = atoi(argv[5]->arg); /* Group address */ - group_str = argv[2]; + group_str = argv[6]->arg; result = inet_pton(AF_INET, group_str, &msg.im_dst); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4845,7 +4845,7 @@ DEFUN (test_pim_receive_upcall, } /* Source address */ - source_str = argv[3]; + source_str = argv[7]->arg; result = inet_pton(AF_INET, source_str, &msg.im_src); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 0263b8ba9e..ba37664250 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -225,6 +225,10 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",') line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' (kernel|connected|static|ospf|isis|bgp|pim|table)",') + line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') @@ -232,12 +236,17 @@ def update_argvs(filename): line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ') line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor (A.B.C.D|X:X::X:X) ') line = line.replace('NEIGHBOR_CMD "', '"neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('PIM_CMD_NO "', '"no ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') # solo line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('NEIGHBOR_CMD2,', '"neighbor (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor (A.B.C.D|X:X::X:X)",') line = line.replace('NEIGHBOR_CMD,', '"neighbor (A.B.C.D|X:X::X:X)",') + line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",') if line.rstrip().endswith('" ,'): line = line.replace('" ,', '",') diff --git a/quagga_parser_to_network_docopt.py b/tools/quagga_parser_to_network_docopt.py similarity index 100% rename from quagga_parser_to_network_docopt.py rename to tools/quagga_parser_to_network_docopt.py From cc9de1ba25b0dddc815909fd9fa2a21f184f4a51 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 00:45:56 +0000 Subject: [PATCH 108/280] ospf6d: argv update Signed-off-by: Daniel Walton --- ospf6d/ospf6_area.c | 78 +++++++++++------------ ospf6d/ospf6_asbr.c | 28 ++++----- ospf6d/ospf6_bfd.c | 2 +- ospf6d/ospf6_interface.c | 38 +++++------ ospf6d/ospf6_intra.c | 4 +- ospf6d/ospf6_lsa.c | 20 +++--- ospf6d/ospf6_message.c | 36 +++++------ ospf6d/ospf6_neighbor.c | 16 ++--- ospf6d/ospf6_route.c | 52 +++++++-------- ospf6d/ospf6_route.h | 4 +- ospf6d/ospf6_spf.c | 6 +- ospf6d/ospf6_top.c | 75 +++++----------------- ospf6d/ospf6_zebra.c | 8 +-- ospf6d/ospf6d.c | 133 ++++++++++++++++----------------------- tools/argv_translator.py | 2 + 15 files changed, 216 insertions(+), 286 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 490d4d2510..cd11cd2a89 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -448,12 +448,12 @@ DEFUN (area_range, struct ospf6_route *range; u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; - OSPF6_CMD_AREA_GET (argv[0], oa); + OSPF6_CMD_AREA_GET (argv[1]->arg, oa); - ret = str2prefix (argv[1], &prefix); + ret = str2prefix (argv[3]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { - vty_out (vty, "Malformed argument: %s%s", argv[1], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[3]->arg, VNL); return CMD_SUCCESS; } @@ -471,24 +471,24 @@ DEFUN (area_range, if (argc > 2) { - if (strcmp (argv[2], "not-advertise") == 0) + if (strcmp (argv[4]->arg, "not-advertise") == 0) { SET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } - else if (strcmp (argv[2], "advertise") == 0) + else if (strcmp (argv[4]->arg, "advertise") == 0) { UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } else { - VTY_GET_INTEGER_RANGE ("cost", cost, argv[2], 0, OSPF_LS_INFINITY); + VTY_GET_INTEGER_RANGE ("cost", cost, argv[5]->arg, 0, OSPF_LS_INFINITY); UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } } range->path.u.cost_config = cost; - zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[1], range->flag); + zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[3]->arg, range->flag); if (range->rnode == NULL) { ospf6_route_add (range, oa->range_table); @@ -546,21 +546,21 @@ DEFUN (no_area_range, struct prefix prefix; struct ospf6_route *range, *route; - OSPF6_CMD_AREA_GET (argv[0], oa); + OSPF6_CMD_AREA_GET (argv[2]->arg, oa); argc--; argv++; - ret = str2prefix (argv[0], &prefix); + ret = str2prefix (argv[2]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { - vty_out (vty, "Malformed argument: %s%s", argv[0], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[2]->arg, VNL); return CMD_SUCCESS; } range = ospf6_route_lookup (&prefix, oa->range_table); if (range == NULL) { - vty_out (vty, "Range %s does not exists.%s", argv[0], VNL); + vty_out (vty, "Range %s does not exists.%s", argv[2]->arg, VNL); return CMD_SUCCESS; } @@ -680,18 +680,18 @@ DEFUN (area_filter_list, struct ospf6_area *area; struct prefix_list *plist; - OSPF6_CMD_AREA_GET (argv[0], area); + OSPF6_CMD_AREA_GET (argv[1]->arg, area); argc--; argv++; - plist = prefix_list_lookup (AFI_IP6, argv[0]); - if (strncmp (argv[1], "in", 2) == 0) + plist = prefix_list_lookup (AFI_IP6, argv[1]->arg); + if (strncmp (argv[4]->arg, "in", 2) == 0) { PREFIX_LIST_IN (area) = plist; if (PREFIX_NAME_IN (area)) free (PREFIX_NAME_IN (area)); - PREFIX_NAME_IN (area) = strdup (argv[0]); + PREFIX_NAME_IN (area) = strdup (argv[1]->arg); ospf6_abr_reimport (area); } else @@ -700,7 +700,7 @@ DEFUN (area_filter_list, if (PREFIX_NAME_OUT (area)) free (PREFIX_NAME_OUT (area)); - PREFIX_NAME_OUT (area) = strdup (argv[0]); + PREFIX_NAME_OUT (area) = strdup (argv[1]->arg); ospf6_abr_enable_area (area); } @@ -721,14 +721,14 @@ DEFUN (no_area_filter_list, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET (argv[0], area); + OSPF6_CMD_AREA_GET (argv[2]->arg, area); argc--; argv++; - if (strncmp (argv[1], "in", 2) == 0) + if (strncmp (argv[5]->arg, "in", 2) == 0) { if (PREFIX_NAME_IN (area)) - if (strcmp (PREFIX_NAME_IN (area), argv[0]) != 0) + if (strcmp (PREFIX_NAME_IN (area), argv[2]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_IN (area) = NULL; @@ -741,7 +741,7 @@ DEFUN (no_area_filter_list, else { if (PREFIX_NAME_OUT (area)) - if (strcmp (PREFIX_NAME_OUT (area), argv[0]) != 0) + if (strcmp (PREFIX_NAME_OUT (area), argv[2]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_OUT (area) = NULL; @@ -766,16 +766,16 @@ DEFUN (area_import_list, struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[1]->arg, area); - list = access_list_lookup (AFI_IP6, argv[1]); + list = access_list_lookup (AFI_IP6, argv[3]->arg); IMPORT_LIST (area) = list; if (IMPORT_NAME (area)) free (IMPORT_NAME (area)); - IMPORT_NAME (area) = strdup (argv[1]); + IMPORT_NAME (area) = strdup (argv[3]->arg); ospf6_abr_reimport (area); return CMD_SUCCESS; @@ -791,7 +791,7 @@ DEFUN (no_area_import_list, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[2]->arg, area); IMPORT_LIST (area) = 0; @@ -815,16 +815,16 @@ DEFUN (area_export_list, struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[1]->arg, area); - list = access_list_lookup (AFI_IP6, argv[1]); + list = access_list_lookup (AFI_IP6, argv[3]->arg); EXPORT_LIST (area) = list; if (EXPORT_NAME (area)) free (EXPORT_NAME (area)); - EXPORT_NAME (area) = strdup (argv[1]); + EXPORT_NAME (area) = strdup (argv[3]->arg); ospf6_abr_enable_area (area); return CMD_SUCCESS; @@ -840,7 +840,7 @@ DEFUN (no_area_export_list, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[2]->arg, area); EXPORT_LIST (area) = 0; @@ -909,15 +909,15 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); - if (inet_pton (AF_INET, argv[0], &area_id) != 1) + if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1) { - vty_out (vty, "Malformed Area-ID: %s%s", argv[0], VNL); + vty_out (vty, "Malformed Area-ID: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } oa = ospf6_area_lookup (area_id, ospf6); if (oa == NULL) { - vty_out (vty, "No such Area: %s%s", argv[0], VNL); + vty_out (vty, "No such Area: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -955,18 +955,18 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, OSPF6_CMD_CHECK_RUNNING (); - inet_pton (AF_INET, argv[0], &router_id); + inet_pton (AF_INET, argv[5]->arg, &router_id); ospf6_linkstate_prefix (router_id, htonl (0), &prefix); - if (inet_pton (AF_INET, argv[1], &area_id) != 1) + if (inet_pton (AF_INET, argv[7]->arg, &area_id) != 1) { - vty_out (vty, "Malformed Area-ID: %s%s", argv[1], VNL); + vty_out (vty, "Malformed Area-ID: %s%s", argv[7]->arg, VNL); return CMD_SUCCESS; } oa = ospf6_area_lookup (area_id, ospf6); if (oa == NULL) { - vty_out (vty, "No such Area: %s%s", argv[1], VNL); + vty_out (vty, "No such Area: %s%s", argv[7]->arg, VNL); return CMD_SUCCESS; } @@ -1004,7 +1004,7 @@ DEFUN (ospf6_area_stub, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[1]->arg, area); if (!ospf6_area_stub_set (ospf6, area)) { @@ -1029,7 +1029,7 @@ DEFUN (ospf6_area_stub_no_summary, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[1]->arg, area); if (!ospf6_area_stub_set (ospf6, area)) { @@ -1054,7 +1054,7 @@ DEFUN (no_ospf6_area_stub, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[2]->arg, area); ospf6_area_stub_unset (ospf6, area); ospf6_area_no_summary_unset (ospf6, area); @@ -1074,7 +1074,7 @@ DEFUN (no_ospf6_area_stub_no_summary, { struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[0], area); + OSPF6_CMD_AREA_GET(argv[2]->arg, area); ospf6_area_stub_unset (ospf6, area); ospf6_area_no_summary_unset (ospf6, area); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 208d3b8c4c..f513e68f70 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -649,7 +649,7 @@ DEFUN (ospf6_redistribute, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[2]->arg); if (type < 0 || type == ZEBRA_ROUTE_OSPF6) return CMD_WARNING; @@ -669,12 +669,12 @@ DEFUN (ospf6_redistribute_routemap, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[1]->arg); if (type < 0 || type == ZEBRA_ROUTE_OSPF6) return CMD_WARNING; ospf6_asbr_redistribute_unset (type); - ospf6_asbr_routemap_set (type, argv[1]); + ospf6_asbr_routemap_set (type, argv[3]->arg); ospf6_asbr_redistribute_set (type); return CMD_SUCCESS; } @@ -689,7 +689,7 @@ DEFUN (no_ospf6_redistribute, { int type; - type = proto_redistnum(AFI_IP6, argv[0]); + type = proto_redistnum(AFI_IP6, argv[3]->arg); if (type < 0 || type == ZEBRA_ROUTE_OSPF6) return CMD_WARNING; @@ -1018,7 +1018,7 @@ DEFUN (ospf6_routemap_match_address_prefixlist, "IPv6 prefix-list name\n") { int ret = route_map_add_match ((struct route_map_index *) vty->index, - "ipv6 address prefix-list", argv[0]); + "ipv6 address prefix-list", argv[4]->arg); return route_map_command_status (vty, ret); } @@ -1034,7 +1034,7 @@ DEFUN (ospf6_routemap_no_match_address_prefixlist, "IPv6 prefix-list name\n") { int ret = route_map_delete_match ((struct route_map_index *) vty->index, - "ipv6 address prefix-list", argv[0]); + "ipv6 address prefix-list", argv[5]->arg); return route_map_command_status (vty, ret); } @@ -1047,7 +1047,7 @@ DEFUN (ospf6_routemap_match_interface, "Interface name\n") { return route_map_add_match ((struct route_map_index *) vty->index, - "interface", argv[0]); + "interface", argv[2]->arg); } /* "no match interface WORD" */ @@ -1059,7 +1059,7 @@ DEFUN (ospf6_routemap_no_match_interface, "Match first hop interface of route\n") { int ret = route_map_delete_match ((struct route_map_index *) vty->index, - "interface", (argc == 0) ? NULL : argv[0]); + "interface", argv[3]->arg); return route_map_command_status (vty, ret); } @@ -1081,7 +1081,7 @@ DEFUN (ospf6_routemap_set_metric_type, "OSPF6 external type 2 metric\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, - "metric-type", argv[0]); + "metric-type", argv[2]->arg); return route_map_command_status (vty, ret); } @@ -1096,7 +1096,7 @@ DEFUN (ospf6_routemap_no_set_metric_type, "OSPF6 external type 2 metric\n") { int ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric-type", argv[0]); + "metric-type", argv[3]->arg); return route_map_command_status (vty, ret); } @@ -1109,7 +1109,7 @@ DEFUN (set_metric, "Metric value\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, - "metric", argv[0]); + "metric", argv[2]->arg); return route_map_command_status (vty, ret); } @@ -1128,7 +1128,7 @@ DEFUN (no_set_metric, "metric", NULL); else ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric", argv[0]); + "metric", argv[3]->arg); return route_map_command_status (vty, ret); } @@ -1149,7 +1149,7 @@ DEFUN (ospf6_routemap_set_forwarding, "IPv6 Address\n") { int ret = route_map_add_set ((struct route_map_index *) vty->index, - "forwarding-address", argv[0]); + "forwarding-address", argv[2]->arg); return route_map_command_status (vty, ret); } @@ -1163,7 +1163,7 @@ DEFUN (ospf6_routemap_no_set_forwarding, "IPv6 Address\n") { int ret = route_map_delete_set ((struct route_map_index *) vty->index, - "forwarding-address", argv[0]); + "forwarding-address", argv[3]->arg); return route_map_command_status (vty, ret); } diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index f9bb6f0031..29368cb9b6 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -369,7 +369,7 @@ DEFUN (ipv6_ospf6_bfd_param, oi = ospf6_interface_create (ifp); assert (oi); - if ((ret = bfd_validate_param (vty, argv[0], argv[1], argv[2], &dm_val, + if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index f4835d0532..e53fb21800 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1001,10 +1001,10 @@ DEFUN (show_ipv6_ospf6_interface, if (argc) { - ifp = if_lookup_by_name (argv[0]); + ifp = if_lookup_by_name (argv[4]->arg); if (ifp == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[0], + vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL); return CMD_WARNING; } @@ -1042,17 +1042,17 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, struct interface *ifp; struct ospf6_interface *oi; - ifp = if_lookup_by_name (argv[0]); + ifp = if_lookup_by_name (argv[4]->arg); if (ifp == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[0], VNL); + vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL); return CMD_WARNING; } oi = ifp->info; if (oi == NULL) { - vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[0], VNL); + vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[4]->arg, VNL); return CMD_WARNING; } @@ -1168,7 +1168,7 @@ DEFUN (ipv6_ospf6_ifmtu, oi = ospf6_interface_create (ifp); assert (oi); - ifmtu = strtol (argv[0], NULL, 10); + ifmtu = strtol (argv[3]->arg, NULL, 10); if (oi->ifmtu == ifmtu) return CMD_SUCCESS; @@ -1274,7 +1274,7 @@ DEFUN (ipv6_ospf6_cost, oi = ospf6_interface_create (ifp); assert (oi); - lcost = strtol (argv[0], NULL, 10); + lcost = strtol (argv[3]->arg, NULL, 10); if (lcost > UINT32_MAX) { @@ -1333,7 +1333,7 @@ DEFUN (auto_cost_reference_bandwidth, struct listnode *i, *j; u_int32_t refbw; - refbw = strtol (argv[0], NULL, 10); + refbw = strtol (argv[2]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); @@ -1403,7 +1403,7 @@ DEFUN (ipv6_ospf6_hellointerval, oi = ospf6_interface_create (ifp); assert (oi); - oi->hello_interval = strtol (argv[0], NULL, 10); + oi->hello_interval = strtol (argv[3]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1428,7 +1428,7 @@ DEFUN (ipv6_ospf6_deadinterval, oi = ospf6_interface_create (ifp); assert (oi); - oi->dead_interval = strtol (argv[0], NULL, 10); + oi->dead_interval = strtol (argv[3]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1453,7 +1453,7 @@ DEFUN (ipv6_ospf6_transmitdelay, oi = ospf6_interface_create (ifp); assert (oi); - oi->transdelay = strtol (argv[0], NULL, 10); + oi->transdelay = strtol (argv[3]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1478,7 +1478,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, oi = ospf6_interface_create (ifp); assert (oi); - oi->rxmt_interval = strtol (argv[0], NULL, 10); + oi->rxmt_interval = strtol (argv[3]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1503,7 +1503,7 @@ DEFUN (ipv6_ospf6_priority, oi = ospf6_interface_create (ifp); assert (oi); - oi->priority = strtol (argv[0], NULL, 10); + oi->priority = strtol (argv[3]->arg, NULL, 10); if (oi->area && (oi->state == OSPF6_INTERFACE_DROTHER || @@ -1534,7 +1534,7 @@ DEFUN (ipv6_ospf6_instance, oi = ospf6_interface_create (ifp); assert (oi); - oi->instance_id = strtol (argv[0], NULL, 10); + oi->instance_id = strtol (argv[3]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1671,7 +1671,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, if (oi->plist_name) XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name); - oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[0]); + oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[4]->arg); ospf6_interface_connected_route_update (oi->interface); @@ -1754,14 +1754,14 @@ DEFUN (ipv6_ospf6_network, } assert (oi); - if (strncmp (argv[0], "b", 1) == 0) + if (strncmp (argv[3]->arg, "b", 1) == 0) { if (oi->type == OSPF_IFTYPE_BROADCAST) return CMD_SUCCESS; oi->type = OSPF_IFTYPE_BROADCAST; } - else if (strncmp (argv[0], "point-to-p", 10) == 0) + else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0) { if (oi->type == OSPF_IFTYPE_POINTOPOINT) { return CMD_SUCCESS; @@ -1992,9 +1992,9 @@ DEFUN (clear_ipv6_ospf6_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[0], VNL); + vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL); return CMD_WARNING; } ospf6_interface_clear (vty, ifp); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 5b92212daa..6ed46f5cd6 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1731,7 +1731,7 @@ DEFUN (debug_ospf6_brouter_router, ) { u_int32_t router_id; - inet_pton (AF_INET, argv[0], &router_id); + inet_pton (AF_INET, argv[4]->arg, &router_id); OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON (router_id); return CMD_SUCCESS; } @@ -1761,7 +1761,7 @@ DEFUN (debug_ospf6_brouter_area, ) { u_int32_t area_id; - inet_pton (AF_INET, argv[0], &area_id); + inet_pton (AF_INET, argv[4]->arg, &area_id); OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON (area_id); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 35e5a91544..fbc72d6fe7 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -835,9 +835,9 @@ DEFUN (debug_ospf6_lsa_type, handler = vector_slot (ospf6_lsa_handler_vector, i); if (handler == NULL) continue; - if (strncmp (argv[0], ospf6_lsa_handler_name(handler), strlen(argv[0])) == 0) + if (strncmp (argv[3]->arg, ospf6_lsa_handler_name(handler), strlen(argv[3]->arg)) == 0) break; - if (! strcasecmp (argv[0], handler->name)) + if (! strcasecmp (argv[3]->arg, handler->name)) break; handler = NULL; } @@ -847,11 +847,11 @@ DEFUN (debug_ospf6_lsa_type, if (argc >= 2) { - if (! strcmp (argv[1], "originate")) + if (! strcmp (argv[4]->arg, "originate")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - if (! strcmp (argv[1], "examine")) + if (! strcmp (argv[4]->arg, "examine")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - if (! strcmp (argv[1], "flooding")) + if (! strcmp (argv[4]->arg, "flooding")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else @@ -889,9 +889,9 @@ DEFUN (no_debug_ospf6_lsa_type, handler = vector_slot (ospf6_lsa_handler_vector, i); if (handler == NULL) continue; - if (strncmp (argv[0], ospf6_lsa_handler_name(handler), strlen(argv[0])) == 0) + if (strncmp (argv[4]->arg, ospf6_lsa_handler_name(handler), strlen(argv[4]->arg)) == 0) break; - if (! strcasecmp (argv[0], handler->name)) + if (! strcasecmp (argv[4]->arg, handler->name)) break; } @@ -900,11 +900,11 @@ DEFUN (no_debug_ospf6_lsa_type, if (argc >= 2) { - if (! strcmp (argv[1], "originate")) + if (! strcmp (argv[5]->arg, "originate")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - if (! strcmp (argv[1], "examine")) + if (! strcmp (argv[5]->arg, "examine")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - if (! strcmp (argv[1], "flooding")) + if (! strcmp (argv[5]->arg, "flooding")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index b0e94288b4..adaef2f9f3 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2360,26 +2360,26 @@ DEFUN (debug_ospf6_message, assert (argc > 0); /* check type */ - if (! strncmp (argv[0], "u", 1)) + if (! strncmp (argv[3]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; - else if (! strncmp (argv[0], "h", 1)) + else if (! strncmp (argv[3]->arg, "h", 1)) type = OSPF6_MESSAGE_TYPE_HELLO; - else if (! strncmp (argv[0], "d", 1)) + else if (! strncmp (argv[3]->arg, "d", 1)) type = OSPF6_MESSAGE_TYPE_DBDESC; - else if (! strncmp (argv[0], "lsr", 3)) + else if (! strncmp (argv[3]->arg, "lsr", 3)) type = OSPF6_MESSAGE_TYPE_LSREQ; - else if (! strncmp (argv[0], "lsu", 3)) + else if (! strncmp (argv[3]->arg, "lsu", 3)) type = OSPF6_MESSAGE_TYPE_LSUPDATE; - else if (! strncmp (argv[0], "lsa", 3)) + else if (! strncmp (argv[3]->arg, "lsa", 3)) type = OSPF6_MESSAGE_TYPE_LSACK; - else if (! strncmp (argv[0], "a", 1)) + else if (! strncmp (argv[3]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; if (argc == 1) level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; - else if (! strncmp (argv[1], "s", 1)) + else if (! strncmp (argv[4]->arg, "s", 1)) level = OSPF6_DEBUG_MESSAGE_SEND; - else if (! strncmp (argv[1], "r", 1)) + else if (! strncmp (argv[4]->arg, "r", 1)) level = OSPF6_DEBUG_MESSAGE_RECV; if (type == OSPF6_MESSAGE_TYPE_ALL) @@ -2434,26 +2434,26 @@ DEFUN (no_debug_ospf6_message, assert (argc > 0); /* check type */ - if (! strncmp (argv[0], "u", 1)) + if (! strncmp (argv[4]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; - else if (! strncmp (argv[0], "h", 1)) + else if (! strncmp (argv[4]->arg, "h", 1)) type = OSPF6_MESSAGE_TYPE_HELLO; - else if (! strncmp (argv[0], "d", 1)) + else if (! strncmp (argv[4]->arg, "d", 1)) type = OSPF6_MESSAGE_TYPE_DBDESC; - else if (! strncmp (argv[0], "lsr", 3)) + else if (! strncmp (argv[4]->arg, "lsr", 3)) type = OSPF6_MESSAGE_TYPE_LSREQ; - else if (! strncmp (argv[0], "lsu", 3)) + else if (! strncmp (argv[4]->arg, "lsu", 3)) type = OSPF6_MESSAGE_TYPE_LSUPDATE; - else if (! strncmp (argv[0], "lsa", 3)) + else if (! strncmp (argv[4]->arg, "lsa", 3)) type = OSPF6_MESSAGE_TYPE_LSACK; - else if (! strncmp (argv[0], "a", 1)) + else if (! strncmp (argv[4]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; if (argc == 1) level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; - else if (! strncmp (argv[1], "s", 1)) + else if (! strncmp (argv[5]->arg, "s", 1)) level = OSPF6_DEBUG_MESSAGE_SEND; - else if (! strncmp (argv[1], "r", 1)) + else if (! strncmp (argv[5]->arg, "r", 1)) level = OSPF6_DEBUG_MESSAGE_RECV; if (type == OSPF6_MESSAGE_TYPE_ALL) diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 9b0285eee9..3e09771629 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -847,9 +847,9 @@ DEFUN (show_ipv6_ospf6_neighbor, if (argc) { - if (! strncmp (argv[0], "de", 2)) + if (! strncmp (argv[4]->arg, "de", 2)) showfunc = ospf6_neighbor_show_detail; - else if (! strncmp (argv[0], "dr", 2)) + else if (! strncmp (argv[4]->arg, "dr", 2)) showfunc = ospf6_neighbor_show_drchoice; } @@ -901,9 +901,9 @@ DEFUN (show_ipv6_ospf6_neighbor_one, OSPF6_CMD_CHECK_RUNNING (); showfunc = ospf6_neighbor_show_detail; - if ((inet_pton (AF_INET, argv[0], &router_id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &router_id)) != 1) { - vty_out (vty, "Router-ID is not parsable: %s%s", argv[0], + vty_out (vty, "Router-ID is not parsable: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -936,9 +936,9 @@ DEFUN (debug_ospf6_neighbor, unsigned char level = 0; if (argc) { - if (! strncmp (argv[0], "s", 1)) + if (! strncmp (argv[3]->arg, "s", 1)) level = OSPF6_DEBUG_NEIGHBOR_STATE; - if (! strncmp (argv[0], "e", 1)) + if (! strncmp (argv[3]->arg, "e", 1)) level = OSPF6_DEBUG_NEIGHBOR_EVENT; } else @@ -970,9 +970,9 @@ DEFUN (no_debug_ospf6_neighbor, unsigned char level = 0; if (argc) { - if (! strncmp (argv[0], "s", 1)) + if (! strncmp (argv[4]->arg, "s", 1)) level = OSPF6_DEBUG_NEIGHBOR_STATE; - if (! strncmp (argv[0], "e", 1)) + if (! strncmp (argv[4]->arg, "e", 1)) level = OSPF6_DEBUG_NEIGHBOR_EVENT; } else diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 5172eee48d..d5267354ae 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1298,7 +1298,7 @@ ospf6_route_show_table (struct vty *vty, int detail, } int -ospf6_route_table_show (struct vty *vty, int argc, const char *argv[], +ospf6_route_table_show (struct vty *vty, int argc, struct cmd_token **argv, struct ospf6_route_table *table) { int summary = 0; @@ -1314,58 +1314,58 @@ ospf6_route_table_show (struct vty *vty, int argc, const char *argv[], for (i = 0; i < argc; i++) { - if (! strcmp (argv[i], "summary")) + if (! strcmp (argv[i]->arg, "summary")) { summary++; continue; } - if (! strcmp (argv[i], "intra-area")) + if (! strcmp (argv[i]->arg, "intra-area")) { type = OSPF6_PATH_TYPE_INTRA; continue; } - if (! strcmp (argv[i], "inter-area")) + if (! strcmp (argv[i]->arg, "inter-area")) { type = OSPF6_PATH_TYPE_INTER; continue; } - if (! strcmp (argv[i], "external-1")) + if (! strcmp (argv[i]->arg, "external-1")) { type = OSPF6_PATH_TYPE_EXTERNAL1; continue; } - if (! strcmp (argv[i], "external-2")) + if (! strcmp (argv[i]->arg, "external-2")) { type = OSPF6_PATH_TYPE_EXTERNAL2; continue; } - if (! strcmp (argv[i], "detail")) + if (! strcmp (argv[i]->arg, "detail")) { detail++; continue; } - if (! strcmp (argv[i], "match")) + if (! strcmp (argv[i]->arg, "match")) { match++; continue; } - ret = str2prefix (argv[i], &prefix); + ret = str2prefix (argv[i]->arg, &prefix); if (ret == 1 && prefix.family == AF_INET6) { isprefix++; - if (strchr (argv[i], '/')) + if (strchr (argv[i]->arg, '/')) slash++; continue; } - vty_out (vty, "Malformed argument: %s%s", argv[i], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[i]->arg, VNL); return CMD_SUCCESS; } @@ -1473,7 +1473,7 @@ ospf6_linkstate_show_table (struct vty *vty, int detail, } int -ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[], +ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv, struct ospf6_route_table *table) { int detail = 0; @@ -1488,7 +1488,7 @@ ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[], for (i = 0; i < argc; i++) { - if (! strcmp (argv[i], "detail")) + if (! strcmp (argv[i]->arg, "detail")) { detail++; continue; @@ -1496,29 +1496,29 @@ ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[], if (! is_router) { - ret = str2prefix (argv[i], &router); + ret = str2prefix (argv[i]->arg, &router); if (ret == 1 && router.family == AF_INET) { is_router++; continue; } - vty_out (vty, "Malformed argument: %s%s", argv[i], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[i]->arg, VNL); return CMD_SUCCESS; } if (! is_id) { - ret = str2prefix (argv[i], &id); + ret = str2prefix (argv[i]->arg, &id); if (ret == 1 && id.family == AF_INET) { is_id++; continue; } - vty_out (vty, "Malformed argument: %s%s", argv[i], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[i]->arg, VNL); return CMD_SUCCESS; } - vty_out (vty, "Malformed argument: %s%s", argv[i], VNL); + vty_out (vty, "Malformed argument: %s%s", argv[i]->arg, VNL); return CMD_SUCCESS; } @@ -1575,13 +1575,13 @@ DEFUN (debug_ospf6_route, { unsigned char level = 0; - if (! strncmp (argv[0], "table", 5)) + if (! strncmp (argv[3]->arg, "table", 5)) level = OSPF6_DEBUG_ROUTE_TABLE; - else if (! strncmp (argv[0], "intra", 5)) + else if (! strncmp (argv[3]->arg, "intra", 5)) level = OSPF6_DEBUG_ROUTE_INTRA; - else if (! strncmp (argv[0], "inter", 5)) + else if (! strncmp (argv[3]->arg, "inter", 5)) level = OSPF6_DEBUG_ROUTE_INTER; - else if (! strncmp (argv[0], "memor", 5)) + else if (! strncmp (argv[3]->arg, "memor", 5)) level = OSPF6_DEBUG_ROUTE_MEMORY; OSPF6_DEBUG_ROUTE_ON (level); return CMD_SUCCESS; @@ -1599,13 +1599,13 @@ DEFUN (no_debug_ospf6_route, { unsigned char level = 0; - if (! strncmp (argv[0], "table", 5)) + if (! strncmp (argv[4]->arg, "table", 5)) level = OSPF6_DEBUG_ROUTE_TABLE; - else if (! strncmp (argv[0], "intra", 5)) + else if (! strncmp (argv[4]->arg, "intra", 5)) level = OSPF6_DEBUG_ROUTE_INTRA; - else if (! strncmp (argv[0], "inter", 5)) + else if (! strncmp (argv[4]->arg, "inter", 5)) level = OSPF6_DEBUG_ROUTE_INTER; - else if (! strncmp (argv[0], "memor", 5)) + else if (! strncmp (argv[4]->arg, "memor", 5)) level = OSPF6_DEBUG_ROUTE_MEMORY; OSPF6_DEBUG_ROUTE_OFF (level); return CMD_SUCCESS; diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 610b0970b0..8c5ca4eb27 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -328,10 +328,10 @@ extern void ospf6_route_dump (struct ospf6_route_table *table); extern void ospf6_route_show (struct vty *vty, struct ospf6_route *route); extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); -extern int ospf6_route_table_show (struct vty *, int, const char *[], +extern int ospf6_route_table_show (struct vty *, int, struct cmd_token **, struct ospf6_route_table *); extern int ospf6_linkstate_table_show (struct vty *vty, int argc, - const char *argv[], + struct cmd_token **argv, struct ospf6_route_table *table); extern void ospf6_brouter_show_header (struct vty *vty); diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 957988b53d..fe5006b24d 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -893,9 +893,9 @@ DEFUN (ospf6_timers_throttle_spf, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000); return ospf6_timers_spf_set (vty, delay, hold, max); } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 7feced007c..e04f22fd09 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -330,10 +330,10 @@ DEFUN (ospf6_router_id, o = (struct ospf6 *) vty->index; - ret = inet_pton (AF_INET, argv[0], &router_id); + ret = inet_pton (AF_INET, argv[1]->arg, &router_id); if (ret == 0) { - vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[0], VNL); + vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[1]->arg, VNL); return CMD_SUCCESS; } @@ -416,7 +416,7 @@ DEFUN (ospf6_timers_lsa, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg); ospf->lsa_minarrival = minarrival; @@ -439,7 +439,7 @@ DEFUN (no_ospf6_timers_lsa, if (argc) { - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[4]->arg); if (ospf->lsa_minarrival != minarrival || minarrival == OSPF_MIN_LS_ARRIVAL) @@ -478,7 +478,7 @@ DEFUN (ospf6_interface_area, o = (struct ospf6 *) vty->index; /* find/create ospf6 interface */ - ifp = if_get_by_name (argv[0]); + ifp = if_get_by_name (argv[1]->arg); oi = (struct ospf6_interface *) ifp->info; if (oi == NULL) oi = ospf6_interface_create (ifp); @@ -490,9 +490,9 @@ DEFUN (ospf6_interface_area, } /* parse Area-ID */ - if (inet_pton (AF_INET, argv[1], &area_id) != 1) + if (inet_pton (AF_INET, argv[3]->arg, &area_id) != 1) { - vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL); + vty_out (vty, "Invalid Area-ID: %s%s", argv[3]->arg, VNL); return CMD_SUCCESS; } @@ -536,10 +536,10 @@ DEFUN (no_ospf6_interface_area, struct interface *ifp; u_int32_t area_id; - ifp = if_lookup_by_name (argv[0]); + ifp = if_lookup_by_name (argv[2]->arg); if (ifp == NULL) { - vty_out (vty, "No such interface %s%s", argv[0], VNL); + vty_out (vty, "No such interface %s%s", argv[2]->arg, VNL); return CMD_SUCCESS; } @@ -551,16 +551,16 @@ DEFUN (no_ospf6_interface_area, } /* parse Area-ID */ - if (inet_pton (AF_INET, argv[1], &area_id) != 1) + if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1) { - vty_out (vty, "Invalid Area-ID: %s%s", argv[1], VNL); + vty_out (vty, "Invalid Area-ID: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } /* Verify Area */ if (oi->area == NULL) { - vty_out (vty, "No such Area-ID: %s%s", argv[1], VNL); + vty_out (vty, "No such Area-ID: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -813,19 +813,9 @@ DEFUN (show_ipv6_ospf6_route_match, "Display routes which match the specified route\n" ) { - const char *sargv[CMD_ARGC_MAX]; - int i, sargc; - OSPF6_CMD_CHECK_RUNNING (); - /* copy argv to sargv and then append "match" */ - for (i = 0; i < argc; i++) - sargv[i] = argv[i]; - sargc = argc; - sargv[sargc++] = "match"; - sargv[sargc] = NULL; - - ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); + ospf6_route_table_show (vty, argc, argv, ospf6->route_table); return CMD_SUCCESS; } @@ -841,20 +831,9 @@ DEFUN (show_ipv6_ospf6_route_match_detail, "Detailed information\n" ) { - const char *sargv[CMD_ARGC_MAX]; - int i, sargc; - - /* copy argv to sargv and then append "match" and "detail" */ - for (i = 0; i < argc; i++) - sargv[i] = argv[i]; - sargc = argc; - sargv[sargc++] = "match"; - sargv[sargc++] = "detail"; - sargv[sargc] = NULL; - OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); + ospf6_route_table_show (vty, argc, argv, ospf6->route_table); return CMD_SUCCESS; } @@ -869,18 +848,6 @@ ALIAS (show_ipv6_ospf6_route_match, "Display routes longer than the specified route\n" ) -DEFUN (show_ipv6_ospf6_route_match_detail, - show_ipv6_ospf6_route_longer_detail_cmd, - "show ipv6 ospf6 route X:X::X:X/M longer detail", - SHOW_STR - IP6_STR - OSPF6_STR - ROUTE_STR - "Specify IPv6 prefix\n" - "Display routes longer than the specified route\n" - "Detailed information\n" - ); - ALIAS (show_ipv6_ospf6_route, show_ipv6_ospf6_route_type_cmd, "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)", @@ -908,19 +875,9 @@ DEFUN (show_ipv6_ospf6_route_type_detail, "Detailed information\n" ) { - const char *sargv[CMD_ARGC_MAX]; - int i, sargc; - - /* copy argv to sargv and then append "detail" */ - for (i = 0; i < argc; i++) - sargv[i] = argv[i]; - sargc = argc; - sargv[sargc++] = "detail"; - sargv[sargc] = NULL; - OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, sargc, sargv, ospf6->route_table); + ospf6_route_table_show (vty, argc, argv, ospf6->route_table); return CMD_SUCCESS; } @@ -1012,7 +969,6 @@ ospf6_top_init (void) install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_detail_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd); @@ -1020,7 +976,6 @@ ospf6_top_init (void) install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 77ea01e53d..1e22a3517e 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -721,9 +721,9 @@ DEFUN (debug_ospf6_zebra_sendrecv, if (argc) { - if (! strncmp (argv[0], "s", 1)) + if (! strncmp (argv[3]->arg, "s", 1)) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[0], "r", 1)) + else if (! strncmp (argv[3]->arg, "r", 1)) level = OSPF6_DEBUG_ZEBRA_RECV; } else @@ -757,9 +757,9 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, if (argc) { - if (! strncmp (argv[0], "s", 1)) + if (! strncmp (argv[4]->arg, "s", 1)) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[0], "r", 1)) + else if (! strncmp (argv[4]->arg, "r", 1)) level = OSPF6_DEBUG_ZEBRA_RECV; } else diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index a60c5b0821..ecd0c04718 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -126,16 +126,16 @@ config_write_ospf6_debug (struct vty *vty) "%s AS Scoped Link State Database%s%s" static int -parse_show_level (int argc, const char *argv[]) +parse_show_level (int argc, struct cmd_token **argv) { int level = 0; if (argc) { - if (! strncmp (argv[0], "de", 2)) + if (! strncmp (argv[0]->arg, "de", 2)) level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; - else if (! strncmp (argv[0], "du", 2)) + else if (! strncmp (argv[0]->arg, "du", 2)) level = OSPF6_LSDB_SHOW_LEVEL_DUMP; - else if (! strncmp (argv[0], "in", 2)) + else if (! strncmp (argv[0]->arg, "in", 2)) level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL; } else @@ -144,23 +144,23 @@ parse_show_level (int argc, const char *argv[]) } static u_int16_t -parse_type_spec (int argc, const char *argv[]) +parse_type_spec (int argc, struct cmd_token **argv) { u_int16_t type = 0; assert (argc); - if (! strcmp (argv[0], "router")) + if (! strcmp (argv[0]->arg, "router")) type = htons (OSPF6_LSTYPE_ROUTER); - else if (! strcmp (argv[0], "network")) + else if (! strcmp (argv[0]->arg, "network")) type = htons (OSPF6_LSTYPE_NETWORK); - else if (! strcmp (argv[0], "as-external")) + else if (! strcmp (argv[0]->arg, "as-external")) type = htons (OSPF6_LSTYPE_AS_EXTERNAL); - else if (! strcmp (argv[0], "intra-prefix")) + else if (! strcmp (argv[0]->arg, "intra-prefix")) type = htons (OSPF6_LSTYPE_INTRA_PREFIX); - else if (! strcmp (argv[0], "inter-router")) + else if (! strcmp (argv[0]->arg, "inter-router")) type = htons (OSPF6_LSTYPE_INTER_ROUTER); - else if (! strcmp (argv[0], "inter-prefix")) + else if (! strcmp (argv[0]->arg, "inter-prefix")) type = htons (OSPF6_LSTYPE_INTER_PREFIX); - else if (! strcmp (argv[0], "link")) + else if (! strcmp (argv[0]->arg, "link")) type = htons (OSPF6_LSTYPE_LINK); return type; } @@ -221,9 +221,7 @@ ALIAS (show_ipv6_ospf6_database, DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix)", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix)", SHOW_STR IPV6_STR OSPF6_STR @@ -333,10 +331,10 @@ DEFUN (show_ipv6_ospf6_database_id, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + argv[5]->arg, VNL); return CMD_SUCCESS; } @@ -429,10 +427,10 @@ DEFUN (show_ipv6_ospf6_database_router, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[6]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[6]->arg, VNL); return CMD_SUCCESS; } @@ -507,9 +505,7 @@ ALIAS (show_ipv6_ospf6_database_router, DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -540,10 +536,10 @@ DEFUN (show_ipv6_ospf6_database_type_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -662,9 +658,7 @@ ALIAS (show_ipv6_ospf6_database_type_id, DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) * A.B.C.D", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) * A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -696,10 +690,10 @@ DEFUN (show_ipv6_ospf6_database_type_router, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -839,20 +833,20 @@ DEFUN (show_ipv6_ospf6_database_id_router, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + argv[5]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[5]->arg, VNL); return CMD_SUCCESS; } @@ -922,20 +916,20 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[5]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + argv[5]->arg, VNL); return CMD_SUCCESS; } @@ -985,9 +979,7 @@ ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id, DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1020,20 +1012,20 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1104,10 +1096,7 @@ ALIAS (show_ipv6_ospf6_database_type_id_router, DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) " - "adv-router A.B.C.D linkstate-id A.B.C.D", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1142,20 +1131,20 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1287,9 +1276,7 @@ ALIAS (show_ipv6_ospf6_database_self_originated, DEFUN (show_ipv6_ospf6_database_type_self_originated, show_ipv6_ospf6_database_type_self_originated_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) self-originated", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated", SHOW_STR IPV6_STR OSPF6_STR @@ -1386,10 +1373,7 @@ ALIAS (show_ipv6_ospf6_database_type_self_originated, DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) self-originated " - "linkstate-id A.B.C.D", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1423,10 +1407,10 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1501,9 +1485,7 @@ ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id, DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated", + "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated", SHOW_STR IPV6_STR OSPF6_STR @@ -1536,10 +1518,10 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, argc--; argv++; - if ((inet_pton (AF_INET, argv[0], &id)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[0], VNL); + argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1629,7 +1611,7 @@ DEFUN (show_ipv6_ospf6_border_routers, OSPF6_CMD_CHECK_RUNNING (); - if (argc && ! strcmp ("detail", argv[0])) + if (argc && ! strcmp ("detail", argv[4]->arg)) { showfunc = ospf6_route_show_detail; argc--; @@ -1640,9 +1622,9 @@ DEFUN (show_ipv6_ospf6_border_routers, if (argc) { - if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) { - vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL); + vty_out (vty, "Router ID is not parsable: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1650,7 +1632,7 @@ DEFUN (show_ipv6_ospf6_border_routers, ro = ospf6_route_lookup (&prefix, ospf6->brouter_table); if (!ro) { - vty_out (vty, "No Route found for Router ID: %s%s", argv[0], VNL); + vty_out (vty, "No Route found for Router ID: %s%s", argv[4]->arg, VNL); return CMD_SUCCESS; } @@ -1736,25 +1718,16 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, "Display linkstate routing table\n" ) { - const char *sargv[CMD_ARGC_MAX]; - int i, sargc; struct listnode *node; struct ospf6_area *oa; OSPF6_CMD_CHECK_RUNNING (); - /* copy argv to sargv and then append "detail" */ - for (i = 0; i < argc; i++) - sargv[i] = argv[i]; - sargc = argc; - sargv[sargc++] = "detail"; - sargv[sargc] = NULL; - for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa)) { vty_out (vty, "%s SPF Result in Area %s%s%s", VNL, oa->name, VNL, VNL); - ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table); + ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table); } vty_out (vty, "%s", VNL); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index ba37664250..57cc28bbbc 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -201,6 +201,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)') line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)') line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '(kernel|connected|static|ospf|isis|bgp|pim|table)') + line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '(kernel|connected|static|ripng|isis|bgp|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -229,6 +230,7 @@ def update_argvs(filename): line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') + line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' (kernel|connected|static|ripng|isis|bgp|table)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') From 6f1ccc12de0bb09560106ac7c1354ec627d97b48 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 00:58:26 +0000 Subject: [PATCH 109/280] lib: argv update for filter.c, if_rmap.c keychain.c and plist.c Signed-off-by: Daniel Walton --- lib/filter.c | 132 ++++++++++++------------ lib/if_rmap.c | 12 +-- lib/keychain.c | 76 +++++++------- lib/plist.c | 210 +++++++++++++++++++-------------------- tools/argv_translator.py | 5 + 5 files changed, 220 insertions(+), 215 deletions(-) diff --git a/lib/filter.c b/lib/filter.c index e9ba715c92..33801ca11c 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -713,7 +713,7 @@ DEFUN (access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, 0, 1); } @@ -727,7 +727,7 @@ DEFUN (access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -742,7 +742,7 @@ DEFUN (access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -756,7 +756,7 @@ DEFUN (access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); } @@ -772,7 +772,7 @@ DEFUN (no_access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], argv[3], + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, 0, 0); } @@ -787,7 +787,7 @@ DEFUN (no_access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -803,7 +803,7 @@ DEFUN (no_access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], "0.0.0.0", + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -818,7 +818,7 @@ DEFUN (no_access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); } @@ -837,8 +837,8 @@ DEFUN (access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], 1 ,1); + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, + argv[5]->arg, argv[6]->arg, argv[7]->arg, 1 ,1); } DEFUN (access_list_extended_mask_any, @@ -854,8 +854,8 @@ DEFUN (access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, + argv[5]->arg, "0.0.0.0", "255.255.255.255", 1, 1); } @@ -872,9 +872,9 @@ DEFUN (access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 1); + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + "255.255.255.255", argv[5]->arg, + argv[6]->arg, 1, 1); } DEFUN (access_list_extended_any_any, @@ -889,7 +889,7 @@ DEFUN (access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -908,8 +908,8 @@ DEFUN (access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, + argv[5]->arg, argv[7]->arg, "0.0.0.0", 1, 1); } @@ -927,9 +927,9 @@ DEFUN (access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 1); + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, + "0.0.0.0", argv[6]->arg, + argv[7]->arg, 1, 1); } DEFUN (access_list_extended_host_host, @@ -946,8 +946,8 @@ DEFUN (access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, + "0.0.0.0", argv[7]->arg, "0.0.0.0", 1, 1); } @@ -964,8 +964,8 @@ DEFUN (access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + "255.255.255.255", argv[6]->arg, "0.0.0.0", 1, 1); } @@ -982,7 +982,7 @@ DEFUN (access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], + return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -1002,8 +1002,8 @@ DEFUN (no_access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], 1, 0); + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, + argv[6]->arg, argv[7]->arg, argv[8]->arg, 1, 0); } DEFUN (no_access_list_extended_mask_any, @@ -1020,8 +1020,8 @@ DEFUN (no_access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], "0.0.0.0", + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, + argv[6]->arg, "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1039,9 +1039,9 @@ DEFUN (no_access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], - argv[3], 1, 0); + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + "255.255.255.255", argv[6]->arg, + argv[7]->arg, 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1057,7 +1057,7 @@ DEFUN (no_access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1077,8 +1077,8 @@ DEFUN (no_access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - argv[3], argv[4], + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, + argv[6]->arg, argv[8]->arg, "0.0.0.0", 1, 0); } @@ -1097,9 +1097,9 @@ DEFUN (no_access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], - argv[4], 1, 0); + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, + "0.0.0.0", argv[7]->arg, + argv[8]->arg, 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1117,8 +1117,8 @@ DEFUN (no_access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], - "0.0.0.0", argv[3], + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, + "0.0.0.0", argv[8]->arg, "0.0.0.0", 1, 0); } @@ -1136,8 +1136,8 @@ DEFUN (no_access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[0], argv[1], "0.0.0.0", - "255.255.255.255", argv[2], + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + "255.255.255.255", argv[7]->arg, "0.0.0.0", 1, 0); } @@ -1155,7 +1155,7 @@ DEFUN (no_access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[0], argv[1], argv[2], + return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1251,7 +1251,7 @@ DEFUN (access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 1); + return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 0, 1); } DEFUN (access_list_exact, @@ -1264,7 +1264,7 @@ DEFUN (access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 1); + return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 1, 1); } DEFUN (access_list_any, @@ -1276,7 +1276,7 @@ DEFUN (access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 1); + return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, "0.0.0.0/0", 0, 1); } DEFUN (no_access_list, @@ -1289,7 +1289,7 @@ DEFUN (no_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 0, 0); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 0, 0); } DEFUN (no_access_list_exact, @@ -1303,7 +1303,7 @@ DEFUN (no_access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, argv[2], 1, 0); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 1, 0); } DEFUN (no_access_list_any, @@ -1316,7 +1316,7 @@ DEFUN (no_access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP, "0.0.0.0/0", 0, 0); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, "0.0.0.0/0", 0, 0); } DEFUN (no_access_list_all, @@ -1334,10 +1334,10 @@ DEFUN (no_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP, argv[0]); + access = access_list_lookup (AFI_IP, argv[2]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], + vty_out (vty, "%% access-list %s doesn't exist%s", argv[2]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1369,7 +1369,7 @@ DEFUN (access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP, argv[0]); + access = access_list_get (AFI_IP, argv[1]->arg); if (access->remark) { @@ -1393,7 +1393,7 @@ DEFUN (no_access_list_remark, "IP zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP, argv[0]); + return vty_access_list_remark_unset (vty, AFI_IP, argv[2]->arg); } ALIAS (no_access_list_remark, @@ -1420,7 +1420,7 @@ DEFUN (ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 1); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1434,7 +1434,7 @@ DEFUN (ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 1); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 1, 1); } DEFUN (ipv6_access_list_any, @@ -1447,7 +1447,7 @@ DEFUN (ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 1); + return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, "::/0", 0, 1); } DEFUN (no_ipv6_access_list, @@ -1461,7 +1461,7 @@ DEFUN (no_ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 0, 0); + return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 0, 0); } DEFUN (no_ipv6_access_list_exact, @@ -1476,7 +1476,7 @@ DEFUN (no_ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, argv[2], 1, 0); + return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 1, 0); } DEFUN (no_ipv6_access_list_any, @@ -1490,7 +1490,7 @@ DEFUN (no_ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[0], argv[1], AFI_IP6, "::/0", 0, 0); + return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, "::/0", 0, 0); } @@ -1506,10 +1506,10 @@ DEFUN (no_ipv6_access_list_all, struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP6, argv[0]); + access = access_list_lookup (AFI_IP6, argv[3]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[0], + vty_out (vty, "%% access-list %s doesn't exist%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1538,7 +1538,7 @@ DEFUN (ipv6_access_list_remark, { struct access_list *access; - access = access_list_get (AFI_IP6, argv[0]); + access = access_list_get (AFI_IP6, argv[2]->arg); if (access->remark) { @@ -1559,7 +1559,7 @@ DEFUN (no_ipv6_access_list_remark, "IPv6 zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP6, argv[0]); + return vty_access_list_remark_unset (vty, AFI_IP6, argv[3]->arg); } ALIAS (no_ipv6_access_list_remark, @@ -1705,7 +1705,7 @@ DEFUN (show_ip_access_list_name, "IP extended access list (expanded range)\n" "IP zebra access-list\n") { - return filter_show (vty, argv[0], AFI_IP); + return filter_show (vty, argv[3]->arg, AFI_IP); } #ifdef HAVE_IPV6 @@ -1727,7 +1727,7 @@ DEFUN (show_ipv6_access_list_name, "List IPv6 access lists\n" "IPv6 zebra access-list\n") { - return filter_show (vty, argv[0], AFI_IP6); + return filter_show (vty, argv[3]->arg, AFI_IP6); } #endif /* HAVE_IPV6 */ diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 736f2e237d..0e1199f21a 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -220,9 +220,9 @@ DEFUN (if_rmap, { enum if_rmap_type type; - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[2]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[2]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -230,7 +230,7 @@ DEFUN (if_rmap, return CMD_WARNING; } - if_rmap_set (argv[2], type, argv[0]); + if_rmap_set (argv[3]->arg, type, argv[1]->arg); return CMD_SUCCESS; } @@ -257,9 +257,9 @@ DEFUN (no_if_rmap, int ret; enum if_rmap_type type; - if (strncmp (argv[1], "i", 1) == 0) + if (strncmp (argv[3]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[1], "o", 1) == 0) + else if (strncmp (argv[3]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -267,7 +267,7 @@ DEFUN (no_if_rmap, return CMD_WARNING; } - ret = if_rmap_unset (argv[2], type, argv[0]); + ret = if_rmap_unset (argv[4]->arg, type, argv[2]->arg); if (! ret) { vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); diff --git a/lib/keychain.c b/lib/keychain.c index ac2083cf4b..1997496d34 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -239,7 +239,7 @@ DEFUN (key_chain, { struct keychain *keychain; - keychain = keychain_get (argv[0]); + keychain = keychain_get (argv[2]->arg); vty->index = keychain; vty->node = KEYCHAIN_NODE; @@ -256,11 +256,11 @@ DEFUN (no_key_chain, { struct keychain *keychain; - keychain = keychain_lookup (argv[0]); + keychain = keychain_lookup (argv[3]->arg); if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Can't find keychain %s%s", argv[3]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -281,7 +281,7 @@ DEFUN (key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]); + VTY_GET_INTEGER ("key identifier", index, argv[1]->arg); key = key_get (keychain, index); vty->index_sub = key; vty->node = KEYCHAIN_KEY_NODE; @@ -302,7 +302,7 @@ DEFUN (no_key, keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[0]); + VTY_GET_INTEGER ("key identifier", index, argv[2]->arg); key = key_lookup (keychain, index); if (! key) { @@ -329,7 +329,7 @@ DEFUN (key_string, if (key->string) XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[0]); + key->string = XSTRDUP(MTYPE_KEY, argv[1]->arg); return CMD_SUCCESS; } @@ -556,8 +556,8 @@ DEFUN (accept_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); } DEFUN (accept_lifetime_day_month_month_day, @@ -577,8 +577,8 @@ DEFUN (accept_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (accept_lifetime_month_day_day_month, @@ -598,8 +598,8 @@ DEFUN (accept_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], - argv[3], argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, + argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); } DEFUN (accept_lifetime_month_day_month_day, @@ -619,8 +619,8 @@ DEFUN (accept_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[0], argv[2], argv[1], - argv[3], argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, + argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (accept_lifetime_infinite_day_month, @@ -637,8 +637,8 @@ DEFUN (accept_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[1], - argv[2], argv[3]); + return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg); } DEFUN (accept_lifetime_infinite_month_day, @@ -655,8 +655,8 @@ DEFUN (accept_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[0], argv[2], - argv[1], argv[3]); + return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, + argv[2]->arg, argv[4]->arg); } DEFUN (accept_lifetime_duration_day_month, @@ -674,8 +674,8 @@ DEFUN (accept_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[1], - argv[2], argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, + argv[3]->arg, argv[4]->arg, argv[6]->arg); } DEFUN (accept_lifetime_duration_month_day, @@ -693,8 +693,8 @@ DEFUN (accept_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[0], argv[2], - argv[1], argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, + argv[2]->arg, argv[4]->arg, argv[6]->arg); } DEFUN (send_lifetime_day_month_day_month, @@ -714,8 +714,8 @@ DEFUN (send_lifetime_day_month_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); } DEFUN (send_lifetime_day_month_month_day, @@ -735,8 +735,8 @@ DEFUN (send_lifetime_day_month_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[1], argv[2], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (send_lifetime_month_day_day_month, @@ -756,8 +756,8 @@ DEFUN (send_lifetime_month_day_day_month, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[5], argv[6], argv[7]); + return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, + argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); } DEFUN (send_lifetime_month_day_month_day, @@ -777,8 +777,8 @@ DEFUN (send_lifetime_month_day_month_day, key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[0], argv[2], argv[1], argv[3], - argv[4], argv[6], argv[5], argv[7]); + return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, + argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (send_lifetime_infinite_day_month, @@ -795,8 +795,8 @@ DEFUN (send_lifetime_infinite_day_month, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg); } DEFUN (send_lifetime_infinite_month_day, @@ -813,8 +813,8 @@ DEFUN (send_lifetime_infinite_month_day, key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3]); + return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, + argv[4]->arg); } DEFUN (send_lifetime_duration_day_month, @@ -832,8 +832,8 @@ DEFUN (send_lifetime_duration_day_month, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[1], argv[2], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, + argv[4]->arg, argv[6]->arg); } DEFUN (send_lifetime_duration_month_day, @@ -851,8 +851,8 @@ DEFUN (send_lifetime_duration_month_day, key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[0], argv[2], argv[1], - argv[3], argv[4]); + return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, + argv[4]->arg, argv[6]->arg); } static struct cmd_node keychain_node = diff --git a/lib/plist.c b/lib/plist.c index eedb830c1a..3de92887bf 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -20,7 +20,6 @@ */ #include -#include "lib/json.h" #include "prefix.h" #include "command.h" @@ -31,6 +30,7 @@ #include "stream.h" #include "log.h" #include "routemap.h" +#include "lib/json.h" #include "plist_int.h" @@ -1415,8 +1415,8 @@ DEFUN (ip_prefix_list, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, - argv[1], argv[2], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, + argv[3]->arg, argv[4]->arg, NULL, NULL); } DEFUN (ip_prefix_list_ge, @@ -1431,8 +1431,8 @@ DEFUN (ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[6]->arg, NULL); } DEFUN (ip_prefix_list_ge_le, @@ -1449,8 +1449,8 @@ DEFUN (ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (ip_prefix_list_le, @@ -1465,8 +1465,8 @@ DEFUN (ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, NULL, argv[6]->arg); } DEFUN (ip_prefix_list_le_ge, @@ -1483,8 +1483,8 @@ DEFUN (ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[8]->arg, argv[6]->arg); } DEFUN (ip_prefix_list_seq, @@ -1500,8 +1500,8 @@ DEFUN (ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, NULL, NULL); } DEFUN (ip_prefix_list_seq_ge, @@ -1518,8 +1518,8 @@ DEFUN (ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[8]->arg, NULL); } DEFUN (ip_prefix_list_seq_ge_le, @@ -1538,8 +1538,8 @@ DEFUN (ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (ip_prefix_list_seq_le, @@ -1556,8 +1556,8 @@ DEFUN (ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ip_prefix_list_seq_le_ge, @@ -1576,8 +1576,8 @@ DEFUN (ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[10]->arg, argv[8]->arg); } DEFUN (no_ip_prefix_list, @@ -1588,7 +1588,7 @@ DEFUN (no_ip_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -1604,8 +1604,8 @@ DEFUN (no_ip_prefix_list_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_ge, @@ -1621,8 +1621,8 @@ DEFUN (no_ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[7]->arg, NULL); } DEFUN (no_ip_prefix_list_ge_le, @@ -1640,8 +1640,8 @@ DEFUN (no_ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (no_ip_prefix_list_le, @@ -1657,8 +1657,8 @@ DEFUN (no_ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, NULL, argv[7]->arg); } DEFUN (no_ip_prefix_list_le_ge, @@ -1676,8 +1676,8 @@ DEFUN (no_ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[9]->arg, argv[7]->arg); } DEFUN (no_ip_prefix_list_seq, @@ -1694,8 +1694,8 @@ DEFUN (no_ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_seq_ge, @@ -1713,8 +1713,8 @@ DEFUN (no_ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[9]->arg, NULL); } DEFUN (no_ip_prefix_list_seq_ge_le, @@ -1734,8 +1734,8 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[9]->arg, argv[11]->arg); } DEFUN (no_ip_prefix_list_seq_le, @@ -1753,8 +1753,8 @@ DEFUN (no_ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ip_prefix_list_seq_le_ge, @@ -1774,8 +1774,8 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[11]->arg, argv[9]->arg); } DEFUN (ip_prefix_list_sequence_number, @@ -1812,7 +1812,7 @@ DEFUN (ip_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP, 0, argv[0]); + plist = prefix_list_get (AFI_IP, 0, argv[2]->arg); if (plist->desc) { @@ -1833,7 +1833,7 @@ DEFUN (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[0]); + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[3]->arg); } ALIAS (no_ip_prefix_list_description, @@ -1864,7 +1864,7 @@ DEFUN (show_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, NULL, normal_display); } DEFUN (show_ip_prefix_list_name_seq, @@ -1877,7 +1877,7 @@ DEFUN (show_ip_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, argv[5]->arg, sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1889,7 +1889,7 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1902,7 +1902,7 @@ DEFUN (show_ip_prefix_list_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1915,7 +1915,7 @@ DEFUN (show_ip_prefix_list_prefix_first_match, "IP prefix /, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, first_match_display); } DEFUN (show_ip_prefix_list_summary, @@ -1938,7 +1938,7 @@ DEFUN (show_ip_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, summary_display); } @@ -1962,7 +1962,7 @@ DEFUN (show_ip_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[0], NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, detail_display); } DEFUN (clear_ip_prefix_list, @@ -1983,7 +1983,7 @@ DEFUN (clear_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0], NULL); + return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, NULL); } DEFUN (clear_ip_prefix_list_name_prefix, @@ -1995,7 +1995,7 @@ DEFUN (clear_ip_prefix_list_name_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[0], argv[1]); + return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, argv[4]->arg); } #ifdef HAVE_IPV6 @@ -2010,8 +2010,8 @@ DEFUN (ipv6_prefix_list, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, - argv[1], argv[2], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, + argv[3]->arg, argv[4]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_ge, @@ -2026,8 +2026,8 @@ DEFUN (ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[6]->arg, NULL); } DEFUN (ipv6_prefix_list_ge_le, @@ -2045,8 +2045,8 @@ DEFUN (ipv6_prefix_list_ge_le, "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (ipv6_prefix_list_le, @@ -2061,8 +2061,8 @@ DEFUN (ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, NULL, argv[6]->arg); } DEFUN (ipv6_prefix_list_le_ge, @@ -2079,8 +2079,8 @@ DEFUN (ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, + argv[4]->arg, argv[8]->arg, argv[6]->arg); } DEFUN (ipv6_prefix_list_seq, @@ -2096,8 +2096,8 @@ DEFUN (ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_seq_ge, @@ -2114,8 +2114,8 @@ DEFUN (ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[8]->arg, NULL); } DEFUN (ipv6_prefix_list_seq_ge_le, @@ -2134,8 +2134,8 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (ipv6_prefix_list_seq_le, @@ -2152,8 +2152,8 @@ DEFUN (ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ipv6_prefix_list_seq_le_ge, @@ -2172,8 +2172,8 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, + argv[6]->arg, argv[10]->arg, argv[8]->arg); } DEFUN (no_ipv6_prefix_list, @@ -2184,7 +2184,7 @@ DEFUN (no_ipv6_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, NULL, + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -2200,8 +2200,8 @@ DEFUN (no_ipv6_prefix_list_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_ge, @@ -2217,8 +2217,8 @@ DEFUN (no_ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[7]->arg, NULL); } DEFUN (no_ipv6_prefix_list_ge_le, @@ -2236,8 +2236,8 @@ DEFUN (no_ipv6_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[3], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (no_ipv6_prefix_list_le, @@ -2253,8 +2253,8 @@ DEFUN (no_ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], NULL, argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, NULL, argv[7]->arg); } DEFUN (no_ipv6_prefix_list_le_ge, @@ -2272,8 +2272,8 @@ DEFUN (no_ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], NULL, argv[1], - argv[2], argv[4], argv[3]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, + argv[5]->arg, argv[9]->arg, argv[7]->arg); } DEFUN (no_ipv6_prefix_list_seq, @@ -2290,8 +2290,8 @@ DEFUN (no_ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge, @@ -2309,8 +2309,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], NULL); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[9]->arg, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge_le, @@ -2330,8 +2330,8 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[4], argv[5]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[9]->arg, argv[11]->arg); } DEFUN (no_ipv6_prefix_list_seq_le, @@ -2349,8 +2349,8 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], NULL, argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ipv6_prefix_list_seq_le_ge, @@ -2370,8 +2370,8 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[0], argv[1], argv[2], - argv[3], argv[5], argv[4]); + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, + argv[7]->arg, argv[11]->arg, argv[9]->arg); } DEFUN (ipv6_prefix_list_sequence_number, @@ -2408,7 +2408,7 @@ DEFUN (ipv6_prefix_list_description, { struct prefix_list *plist; - plist = prefix_list_get (AFI_IP6, 0, argv[0]); + plist = prefix_list_get (AFI_IP6, 0, argv[2]->arg); if (plist->desc) { @@ -2429,7 +2429,7 @@ DEFUN (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[0]); + return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[3]->arg); } ALIAS (no_ipv6_prefix_list_description, @@ -2460,7 +2460,7 @@ DEFUN (show_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, normal_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL, normal_display); } DEFUN (show_ipv6_prefix_list_name_seq, @@ -2473,7 +2473,7 @@ DEFUN (show_ipv6_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], argv[1], sequential_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2485,7 +2485,7 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], normal_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2498,7 +2498,7 @@ DEFUN (show_ipv6_prefix_list_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], longer_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2511,7 +2511,7 @@ DEFUN (show_ipv6_prefix_list_prefix_first_match, "IPv6 prefix /, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[0], argv[1], first_match_display); + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, first_match_display); } DEFUN (show_ipv6_prefix_list_summary, @@ -2534,7 +2534,7 @@ DEFUN (show_ipv6_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, summary_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, summary_display); } DEFUN (show_ipv6_prefix_list_detail, @@ -2557,7 +2557,7 @@ DEFUN (show_ipv6_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[0], NULL, detail_display); + return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, @@ -2578,7 +2578,7 @@ DEFUN (clear_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0], NULL); + return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL); } DEFUN (clear_ipv6_prefix_list_name_prefix, @@ -2590,7 +2590,7 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[0], argv[1]); + return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[4]->arg); } #endif /* HAVE_IPV6 */ diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 57cc28bbbc..051e284c58 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -31,6 +31,8 @@ def token_is_variable(line_number, token): '.LINE', # where is this defined? 'LINE', 'BANDWIDTH', + 'RMAP_NAME', + 'ROUTEMAP_NAME', 'IPV6ADDR', 'IF_OR_ADDR', 'INTERFACE', @@ -46,6 +48,9 @@ def token_is_variable(line_number, token): 'ASN:nn_or_IP-address:nn'): # where is this defined? return True + if token.upper() == token: + return True + re_number_range = re.search('^<\d+-\d+>$', token) if re_number_range: return True From b823bd432cd92234c48bedfd62f4649c8937502c Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 01:07:05 +0000 Subject: [PATCH 110/280] isisd: argv update Signed-off-by: Daniel Walton --- isisd/isis_redist.c | 45 +++++++++--------- isisd/isis_routemap.c | 16 +++---- isisd/isis_te.c | 4 +- isisd/isis_vty.c | 98 ++++++++++++++++++++-------------------- isisd/isisd.c | 29 ++++++------ tools/argv_translator.py | 2 + 6 files changed, 96 insertions(+), 98 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 5311b5c69c..cf598cd5d6 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -539,8 +539,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD - " (level-1|level-2) {metric <0-16777215>|route-map WORD}", + "redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD " (level-1|level-2) {metric <0-16777215>|route-map WORD}", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" @@ -563,7 +562,7 @@ DEFUN (isis_redistribute, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[1]->arg); if (family < 0) return CMD_WARNING; @@ -571,13 +570,13 @@ DEFUN (isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[2]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) + if (!strcmp("level-1", argv[3]->arg)) level = 1; - else if (!strcmp("level-2", argv[2])) + else if (!strcmp("level-2", argv[3]->arg)) level = 2; else return CMD_WARNING; @@ -588,11 +587,11 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[3]) + if (argv[4]->arg) { char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') + metric = strtoul(argv[4]->arg, &endp, 10); + if (argv[4]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -608,8 +607,7 @@ DEFUN (isis_redistribute, DEFUN (no_isis_redistribute, no_isis_redistribute_cmd, - "no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD - " (level-1|level-2)", + "no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD " (level-1|level-2)", NO_STR REDIST_STR "Redistribute IPv4 routes\n" @@ -627,7 +625,7 @@ DEFUN (no_isis_redistribute, if (argc < 3) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[2]->arg); if (family < 0) return CMD_WARNING; @@ -635,13 +633,13 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[3]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) + if (!strcmp("level-1", argv[4]->arg)) level = 1; - else if (!strcmp("level-2", argv[2])) + else if (!strcmp("level-2", argv[4]->arg)) level = 2; else return CMD_WARNING; @@ -652,8 +650,7 @@ DEFUN (no_isis_redistribute, DEFUN (isis_default_originate, isis_default_originate_cmd, - "default-information originate (ipv4|ipv6) (level-1|level-2) " - "{always|metric <0-16777215>|route-map WORD}", + "default-information originate (ipv4|ipv6) (level-1|level-2) {always|metric <0-16777215>|route-map WORD}", "Control distribution of default information\n" "Distribute a default route\n" "Distribute default route for IPv4\n" @@ -676,13 +673,13 @@ DEFUN (isis_default_originate, if (argc < 5) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[2]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) + if (!strcmp("level-1", argv[3]->arg)) level = 1; - else if (!strcmp("level-2", argv[1])) + else if (!strcmp("level-2", argv[3]->arg)) level = 2; else return CMD_WARNING; @@ -693,7 +690,7 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[2] && *argv[2] != '\0') + if (argv[4]->arg && *argv[4]->arg != '\0') originate_type = DEFAULT_ORIGINATE_ALWAYS; else originate_type = DEFAULT_ORIGINATE; @@ -741,13 +738,13 @@ DEFUN (no_isis_default_originate, if (argc < 2) return CMD_WARNING; - family = str2family(argv[0]); + family = str2family(argv[3]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) + if (!strcmp("level-1", argv[4]->arg)) level = 1; - else if (!strcmp("level-2", argv[1])) + else if (!strcmp("level-2", argv[4]->arg)) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index fdc0100e77..86d5efd779 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -354,7 +354,7 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address", argv[0]); + return isis_route_match_add(vty, vty->index, "ip address", argv[3]->arg); } DEFUN (no_match_ip_address, @@ -370,7 +370,7 @@ DEFUN (no_match_ip_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ip address", NULL); - return isis_route_match_delete(vty, vty->index, "ip address", argv[0]); + return isis_route_match_delete(vty, vty->index, "ip address", argv[4]->arg); } ALIAS (no_match_ip_address, @@ -392,7 +392,7 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]); + return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[4]->arg); } DEFUN (no_match_ip_address_prefix_list, @@ -429,7 +429,7 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]); + return isis_route_match_add(vty, vty->index, "ipv6 address", argv[3]->arg); } DEFUN (no_match_ipv6_address, @@ -443,7 +443,7 @@ DEFUN (no_match_ipv6_address, { if (argc == 0) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); - return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]); + return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[4]->arg); } ALIAS (no_match_ipv6_address, @@ -465,7 +465,7 @@ DEFUN (match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]); + return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[4]->arg); } DEFUN (no_match_ipv6_address_prefix_list, @@ -504,7 +504,7 @@ DEFUN (set_metric, "Metric vale for destination routing protocol\n" "Metric value\n") { - return isis_route_set_add(vty, vty->index, "metric", argv[0]); + return isis_route_set_add(vty, vty->index, "metric", argv[2]->arg); } DEFUN (no_set_metric, @@ -517,7 +517,7 @@ DEFUN (no_set_metric, { if (argc == 0) return isis_route_set_delete(vty, vty->index, "metric", NULL); - return isis_route_set_delete(vty, vty->index, "metric", argv[0]); + return isis_route_set_delete(vty, vty->index, "metric", argv[3]->arg); } ALIAS (no_set_metric, diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 022722f760..0a327c754e 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1167,7 +1167,7 @@ DEFUN (isis_mpls_te_router_addr, struct listnode *node; struct isis_area *area; - if (! inet_aton (argv[0], &value)) + if (! inet_aton (argv[2]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1329,7 +1329,7 @@ DEFUN (show_isis_mpls_te_interface, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 53c635ea61..79fbdc4d24 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -64,8 +64,8 @@ DEFUN (ip_router_isis, struct interface *ifp; struct isis_circuit *circuit; struct isis_area *area; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[0]->arg; + const char *area_tag = argv[3]->arg; ifp = (struct interface *) vty->index; assert (ifp); @@ -118,8 +118,8 @@ DEFUN (no_ip_router_isis, struct interface *ifp; struct isis_area *area; struct isis_circuit *circuit; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[1]->arg; + const char *area_tag = argv[4]->arg; ifp = (struct interface *) vty->index; if (!ifp) @@ -132,7 +132,7 @@ DEFUN (no_ip_router_isis, if (!area) { vty_out (vty, "Can't find ISIS instance %s%s", - argv[0], VTY_NEWLINE); + argv[1]->arg, VTY_NEWLINE); return CMD_ERR_NO_MATCH; } @@ -204,7 +204,7 @@ DEFUN (isis_circuit_type, if (!circuit) return CMD_ERR_NO_MATCH; - is_type = string2circuit_t (argv[0]); + is_type = string2circuit_t (argv[2]->arg); if (!is_type) { vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); @@ -310,10 +310,10 @@ DEFUN (isis_passwd, if (!circuit) return CMD_ERR_NO_MATCH; - if (argv[0][0] == 'm') - rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]); + if (argv[2]->arg[0] == 'm') + rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[3]->arg); else - rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]); + rv = isis_circuit_passwd_cleartext_set(circuit, argv[3]->arg); if (rv) { vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); @@ -361,7 +361,7 @@ DEFUN (isis_priority, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[2]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -413,7 +413,7 @@ DEFUN (isis_priority_l1, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[2]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -465,7 +465,7 @@ DEFUN (isis_priority_l2, if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[2]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -517,7 +517,7 @@ DEFUN (isis_metric, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[2]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -581,7 +581,7 @@ DEFUN (isis_metric_l1, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[2]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -645,7 +645,7 @@ DEFUN (isis_metric_l2, if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[2]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -710,7 +710,7 @@ DEFUN (isis_hello_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", @@ -764,7 +764,7 @@ DEFUN (isis_hello_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -818,7 +818,7 @@ DEFUN (isis_hello_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -870,7 +870,7 @@ DEFUN (isis_hello_multiplier, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[2]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -922,7 +922,7 @@ DEFUN (isis_hello_multiplier_l1, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[2]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -974,7 +974,7 @@ DEFUN (isis_hello_multiplier_l2, if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[2]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -1060,7 +1060,7 @@ DEFUN (csnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1112,7 +1112,7 @@ DEFUN (csnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1164,7 +1164,7 @@ DEFUN (csnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1215,7 +1215,7 @@ DEFUN (psnp_interval, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1267,7 +1267,7 @@ DEFUN (psnp_interval_l1, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1319,7 +1319,7 @@ DEFUN (psnp_interval_l2, if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[2]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1409,7 +1409,7 @@ DEFUN (metric_style, assert(area); - if (strncmp (argv[0], "w", 1) == 0) + if (strncmp (argv[1]->arg, "w", 1) == 0) { isis_area_metricstyle_set(area, false, true); return CMD_SUCCESS; @@ -1419,9 +1419,9 @@ DEFUN (metric_style, if (ret != CMD_SUCCESS) return ret; - if (strncmp (argv[0], "t", 1) == 0) + if (strncmp (argv[1]->arg, "t", 1) == 0) isis_area_metricstyle_set(area, true, true); - else if (strncmp (argv[0], "n", 1) == 0) + else if (strncmp (argv[1]->arg, "n", 1) == 0) isis_area_metricstyle_set(area, true, false); return CMD_SUCCESS; @@ -1561,7 +1561,7 @@ DEFUN (area_lsp_mtu, { unsigned int lsp_mtu; - VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); + VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[1]->arg, 128, 4352); return area_lsp_mtu_set(vty, lsp_mtu); } @@ -1601,7 +1601,7 @@ DEFUN (is_type, return CMD_ERR_NO_MATCH; } - type = string2circuit_t (argv[0]); + type = string2circuit_t (argv[1]->arg); if (!type) { vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); @@ -1684,7 +1684,7 @@ DEFUN (lsp_gen_interval, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[1]->arg); level = IS_LEVEL_1 | IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1724,7 +1724,7 @@ DEFUN (lsp_gen_interval_l1, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); level = IS_LEVEL_1; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1766,7 +1766,7 @@ DEFUN (lsp_gen_interval_l2, int level; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1806,7 +1806,7 @@ DEFUN (spf_interval, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[1]->arg); area->min_spf_interval[0] = interval; area->min_spf_interval[1] = interval; @@ -1847,7 +1847,7 @@ DEFUN (spf_interval_l1, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); area->min_spf_interval[0] = interval; return CMD_SUCCESS; @@ -1888,7 +1888,7 @@ DEFUN (spf_interval_l2, u_int16_t interval; area = vty->index; - interval = atoi (argv[0]); + interval = atoi (argv[2]->arg); area->min_spf_interval[1] = interval; return CMD_SUCCESS; @@ -1976,7 +1976,7 @@ DEFUN (max_lsp_lifetime, "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); } DEFUN (no_max_lsp_lifetime, @@ -2002,7 +2002,7 @@ DEFUN (max_lsp_lifetime_l1, "Maximum LSP lifetime for Level 1 only\n" "LSP lifetime for Level 1 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); } DEFUN (no_max_lsp_lifetime_l1, @@ -2027,7 +2027,7 @@ DEFUN (max_lsp_lifetime_l2, "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime for Level 2 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); } DEFUN (no_max_lsp_lifetime_l2, @@ -2096,7 +2096,7 @@ DEFUN (lsp_refresh_interval, "LSP refresh interval\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); } DEFUN (no_lsp_refresh_interval, @@ -2122,7 +2122,7 @@ DEFUN (lsp_refresh_interval_l1, "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); } DEFUN (no_lsp_refresh_interval_l1, @@ -2148,7 +2148,7 @@ DEFUN (lsp_refresh_interval_l2, "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0])); + return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); } DEFUN (no_lsp_refresh_interval_l2, @@ -2201,7 +2201,7 @@ DEFUN (area_passwd_md5, "Level-wide password\n") { u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { @@ -2211,7 +2211,7 @@ DEFUN (area_passwd_md5, } return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, - argv[1], snp_auth); + argv[2]->arg, snp_auth); } ALIAS (area_passwd_md5, @@ -2235,7 +2235,7 @@ DEFUN (area_passwd_clear, "Area password\n") { u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { @@ -2245,7 +2245,7 @@ DEFUN (area_passwd_clear, } return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, - argv[1], snp_auth); + argv[2]->arg, snp_auth); } ALIAS (area_passwd_clear, @@ -2267,7 +2267,7 @@ DEFUN (no_area_passwd, "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") { - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[1]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; struct isis_area *area = vty->index; if (!area) diff --git a/isisd/isisd.c b/isisd/isisd.c index 4d7f475616..c1401ac135 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -533,7 +533,7 @@ DEFUN (show_isis_interface_arg, "ISIS interface\n" "ISIS interface name\n") { - return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_interface_common (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -707,7 +707,7 @@ DEFUN (show_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_neighbor_common (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (clear_isis_neighbor, @@ -728,7 +728,7 @@ DEFUN (clear_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return clear_isis_neighbor_common (vty, argv[0]); + return clear_isis_neighbor_common (vty, argv[3]->arg); } /* @@ -1530,7 +1530,7 @@ DEFUN (show_database_lsp_brief, "IS-IS link state database\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF); + return show_isis_database (vty, argv[3]->arg, ISIS_UI_LEVEL_BRIEF); } DEFUN (show_database_lsp_detail, @@ -1542,7 +1542,7 @@ DEFUN (show_database_lsp_detail, "LSP ID\n" "Detailed information\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (show_database_detail, @@ -1564,7 +1564,7 @@ DEFUN (show_database_detail_lsp, "Detailed information\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + return show_isis_database (vty, argv[4]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -1577,7 +1577,7 @@ DEFUN (router_isis, "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_get (vty, argv[0]); + return isis_area_get (vty, argv[2]->arg); } /* @@ -1588,7 +1588,7 @@ DEFUN (no_router_isis, "no router isis WORD", "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_destroy (vty, argv[0]); + return isis_area_destroy (vty, argv[3]->arg); } /* @@ -1600,7 +1600,7 @@ DEFUN (net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_net_title (vty, argv[0]); + return area_net_title (vty, argv[1]->arg); } /* @@ -1613,7 +1613,7 @@ DEFUN (no_net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_clear_net_title (vty, argv[0]); + return area_clear_net_title (vty, argv[2]->arg); } void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) @@ -1896,8 +1896,7 @@ DEFUN (no_log_adj_changes, DEFUN (topology_generate_grid, topology_generate_grid_cmd, - "topology generate grid <1-100> <1-100> <1-65000> [param] [param] " - "[param]", + "topology generate grid <1-100> <1-100> <1-65000> [param] [param] [param]", "Topology generation for IS-IS\n" "Topology generation\n" "Grid topology\n" @@ -1973,8 +1972,8 @@ DEFUN (topology_baseis, area = vty->index; assert (area); - if (sysid2buff (buff, argv[0])) - sysid2buff (area->topology_baseis, argv[0]); + if (sysid2buff (buff, argv[2]->arg)) + sysid2buff (area->topology_baseis, argv[2]->arg); return CMD_SUCCESS; } @@ -2016,7 +2015,7 @@ DEFUN (topology_basedynh, assert (area); /* I hope that it's enough. */ - area->topology_basedynh = strndup (argv[0], 16); + area->topology_basedynh = strndup (argv[2]->arg, 16); return CMD_SUCCESS; } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 051e284c58..3464a81d71 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -207,6 +207,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)') line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '(kernel|connected|static|ospf|isis|bgp|pim|table)') line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '(kernel|connected|static|ripng|isis|bgp|table)') + line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '(kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -236,6 +237,7 @@ def update_argvs(filename): line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' (kernel|connected|static|ripng|isis|bgp|table)",') + line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' (kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') From c0c053fa13d77fa8261b81eaab13c21d4ed0f05a Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 01:20:49 +0000 Subject: [PATCH 111/280] lib: argv update for distribute.c and ns.c Signed-off-by: Daniel Walton --- lib/distribute.c | 10 +++------- lib/ns.c | 8 ++++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/distribute.c b/lib/distribute.c index 2a2647f23d..8a00833915 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -148,7 +148,7 @@ distribute_cmp (const struct distribute *dist1, const struct distribute *dist2) } /* Set access-list name to the distribute list. */ -static struct distribute * +static void distribute_list_set (const char *ifname, enum distribute_type type, const char *alist_name) { @@ -171,8 +171,6 @@ distribute_list_set (const char *ifname, enum distribute_type type, /* Apply this distribute-list to the interface. */ (*distribute_add_hook) (dist); - - return dist; } /* Unset distribute-list. If matched distribute-list exist then @@ -226,7 +224,7 @@ distribute_list_unset (const char *ifname, enum distribute_type type, } /* Set access-list name to the distribute list. */ -static struct distribute * +static void distribute_list_prefix_set (const char *ifname, enum distribute_type type, const char *plist_name) { @@ -249,8 +247,6 @@ distribute_list_prefix_set (const char *ifname, enum distribute_type type, /* Apply this distribute-list to the interface. */ (*distribute_add_hook) (dist); - - return dist; } /* Unset distribute-list. If matched distribute-list exist then @@ -319,7 +315,7 @@ DEFUN (distribute_list, DISTRIBUTE_IN : DISTRIBUTE_OUT; /* Set appropriate function call */ - int (*distfn)(const char *, enum distribute_type, const char *) = prefix ? + void (*distfn)(const char *, enum distribute_type, const char *) = prefix ? &distribute_list_prefix_set : &distribute_list_set; /* if interface is present, get name */ diff --git a/lib/ns.c b/lib/ns.c index 556350ed17..58b640651d 100644 --- a/lib/ns.c +++ b/lib/ns.c @@ -559,12 +559,12 @@ DEFUN (ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]); + char *pathname = ns_netns_pathname (vty, argv[3]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); + VTY_GET_INTEGER ("NS ID", ns_id, argv[1]->arg); ns = ns_get (ns_id); if (ns->name && strcmp (ns->name, pathname) != 0) @@ -598,12 +598,12 @@ DEFUN (no_ns_netns, { ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[1]); + char *pathname = ns_netns_pathname (vty, argv[4]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[0]); + VTY_GET_INTEGER ("NS ID", ns_id, argv[2]->arg); ns = ns_lookup (ns_id); if (!ns) From c66bbd697dd04c158807e7de81ac7691616c79a3 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 03:27:05 +0000 Subject: [PATCH 112/280] tools: added alias_destroyer.py Signed-off-by: Daniel Walton --- tools/alias_destroyer.py | 269 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100755 tools/alias_destroyer.py diff --git a/tools/alias_destroyer.py b/tools/alias_destroyer.py new file mode 100755 index 0000000000..b5aba48fb1 --- /dev/null +++ b/tools/alias_destroyer.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python + +import re +import sys +import os +from pprint import pformat, pprint + + +class DEFUN(object): + + def __init__(self, lines): + # name, name_cmd, command_string, help_strings, guts): + self.name = None + self.name_cmd = None + self.command_string = None + self.help_strings = [] + self.guts = [] + self.aliases = [] + + ''' +DEFUN (no_bgp_maxmed_onstartup, + no_bgp_maxmed_onstartup_cmd, + "no bgp max-med on-startup", + NO_STR + BGP_STR + "Advertise routes with max-med\n" + "Effective on a startup\n") + + ''' + state = 'HEADER' + for (line_number, line) in enumerate(lines): + + if state == 'HEADER': + if line_number == 0: + re_name = re.search('DEFUN \((.*),', line.strip()) + self.name = re_name.group(1) + + elif line_number == 1: + self.name_cmd = line.strip()[0:-1] # chop the trailing comma + + elif line_number == 2: + self.command_string = line + state = 'HELP' + + elif state == 'HELP': + if line.strip() == '{': + self.guts.append(line) + state = 'BODY' + else: + self.help_strings.append(line) + + elif state == 'BODY': + if line.rstrip() == '}': + self.guts.append(line) + state = None + else: + self.guts.append(line) + + else: + raise Exception("invalid state %s" % state) + + # print "%d %7s: %s" % (line_number, state, line.rstrip()) + + assert self.command_string, "No command string for\n%s" % pformat(lines) + + def __str__(self): + return self.name + + def dump(self): + lines = [] + + if self.aliases: + lines.append("/*\n") + lines.append(" * CHECK ME - The following ALIASes need to be implemented in this DEFUN\n") + + for alias in self.aliases: + lines.append(" * %s\n" % alias.command_string.strip()) + for line in alias.help_strings: + lines.append(" * %s\n" % line) + lines.append(" *\n") + + lines.append(" */\n") + + lines.append("DEFUN (%s,\n" % self.name) + lines.append(" %s,\n" % self.name_cmd) + lines.append(self.command_string) + lines.extend(self.help_strings) + lines.extend(self.guts) + return ''.join(lines) + + +class ALIAS(object): + + def __init__(self, lines): + self.name = None + self.name_cmd = None + self.command_string = None + self.help_strings = [] + + ''' +ALIAS (no_bgp_maxmed_onstartup, + no_bgp_maxmed_onstartup_period_cmd, + "no bgp max-med on-startup <5-86400>", + NO_STR + BGP_STR + "Advertise routes with max-med\n" + "Effective on a startup\n" + "Time (seconds) period for max-med\n") + ''' + state = 'HEADER' + for (line_number, line) in enumerate(lines): + + if state == 'HEADER': + if line_number == 0: + re_name = re.search('ALIAS \((.*),', line) + + try: + self.name = re_name.group(1) + except AttributeError: + pprint(lines) + raise + + elif line_number == 1: + self.name_cmd = line.strip()[0:-1] # chop the trailing comma + + elif line_number == 2: + self.command_string = line + state = 'HELP' + + elif state == 'HELP': + if line.strip() == '{': + raise Exception("should not see { in an ALIAS") + else: + line = line.strip() + if line.endswith(')'): + line = line[0:-1] # strip the trailing ) + self.help_strings.append(line) + + else: + raise Exception("invalid state %s" % state) + + assert self.command_string, "No command string for\n%s" % pformat(lines) + + def __str__(self): + return self.name_cmd + + +def alias_destroy(filename): + lines = [] + defuns = {} + aliases = {} + + with open(filename, 'r') as fh: + state = None + defun_lines = [] + alias_lines = [] + + for (line_number, line) in enumerate(fh.readlines()): + + if state is None: + if line.startswith('DEFUN ('): + assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) + defun_lines.append(line) + state = 'DEFUN_HEADER' + + elif line.startswith('ALIAS ('): + assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) + alias_lines.append(line) + state = 'ALIAS_HEADER' + + elif state == 'DEFUN_HEADER': + defun_lines.append(line) + + if line.startswith('DEFUN'): + raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number) + + elif line.startswith('ALIAS'): + raise Exception("ERROR on line %d, found ALIAS inside DEFUN" % line_number) + + elif line.strip() == '{': + state = 'DEFUN_BODY' + + elif state == 'ALIAS_HEADER': + alias_lines.append(line) + + if line.startswith('ALIAS'): + raise Exception("ERROR on line %d, found ALIAS inside ALIAS" % line_number) + + elif line.startswith('DEFUN'): + raise Exception("ERROR on line %d, found DEFUN inside ALIAS" % line_number) + + if line.rstrip().endswith(')'): + new_alias = ALIAS(alias_lines) + aliases[new_alias.name_cmd] = new_alias + state = None + alias_lines = [] + + elif state == 'DEFUN_BODY': + defun_lines.append(line) + + if line.rstrip() == '}': + new_defun = DEFUN(defun_lines) + defuns[new_defun.name] = new_defun + state = None + defun_lines = [] + + # uncomment to debug state machine + print "%5d %12s: %s" % (line_number, state, line.rstrip()) + + lines.append(line) + + + # At this point we know all of the aliases and all of the tokens + # Assign each ALIAS to its parent DEFUN + for alias in aliases.itervalues(): + defun = defuns.get(alias.name) + assert defun, "Could not find DEFUN for %s" % alias + defun.aliases.append(alias) + + # Now write the file but: + # - do not write any ALIASes + # - do not write the install_element for any ALIASes + # - when you write the DEFUN include a comment that contains the ALIAS command strings it needs to cover + with open(filename, 'w') as fh: + state = None + + for line in lines: + + if state is None: + if line.startswith('DEFUN ('): + state = 'DEFUN_HEADER' + re_name = re.search('DEFUN \((.*),', line.strip()) + name = re_name.group(1) + defun = defuns.get(name) + fh.write(defun.dump()) + + elif line.startswith('ALIAS ('): + state = 'ALIAS_HEADER' + + else: + if 'install_element' in line: + # install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); + re_install_element = re.search('install_element\s*\(\w+,\s*&(.*)\s*\)', line.strip()) + cmd = re_install_element.group(1) + if cmd not in aliases: + fh.write(line) + else: + fh.write(line) + + elif state == 'DEFUN_HEADER': + if line.strip() == '{': + state = 'DEFUN_BODY' + + elif state == 'ALIAS_HEADER': + if line.rstrip().endswith(')'): + state = None + + elif state == 'DEFUN_BODY': + if line.rstrip() == '}': + state = None + + +if __name__ == '__main__': + + filename = sys.argv[1] + if os.path.exists(filename): + alias_destroy(filename) + else: + print "ERROR: could not find file %s" % filename From f412b39a337b55e07c5d361f7d7c4ae845fb34e8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 03:55:26 +0000 Subject: [PATCH 113/280] ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra Signed-off-by: Daniel Walton --- bgpd/bgp_bfd.c | 23 +- bgpd/bgp_debug.c | 15 +- bgpd/bgp_route.c | 3716 ++++++++++++------------ bgpd/bgp_routemap.c | 785 ++--- bgpd/bgp_vty.c | 5919 ++++++++++++++++++-------------------- isisd/isis_routemap.c | 101 +- isisd/isis_vty.c | 604 ++-- isisd/isisd.c | 15 +- lib/command.c | 59 +- lib/filter.c | 48 +- lib/if_rmap.c | 40 +- lib/plist.c | 42 +- lib/routemap.c | 44 +- lib/vty.c | 15 +- ospf6d/ospf6_area.c | 114 +- ospf6d/ospf6_asbr.c | 62 +- ospf6d/ospf6_interface.c | 147 +- ospf6d/ospf6_lsa.c | 42 +- ospf6d/ospf6_message.c | 76 +- ospf6d/ospf6_neighbor.c | 70 +- ospf6d/ospf6_spf.c | 23 +- ospf6d/ospf6_top.c | 96 +- ospf6d/ospf6_zebra.c | 38 +- ospf6d/ospf6d.c | 1052 +++---- ospfd/ospf_bfd.c | 23 +- ospfd/ospf_dump.c | 660 +++-- ospfd/ospf_opaque.c | 28 +- ospfd/ospf_ri.c | 13 +- ospfd/ospf_routemap.c | 175 +- ospfd/ospf_te.c | 15 +- ospfd/ospf_vty.c | 2141 +++++++------- pimd/pim_cmd.c | 233 +- ripd/rip_interface.c | 164 +- ripd/rip_routemap.c | 229 +- ripd/ripd.c | 51 +- ripngd/ripng_interface.c | 19 +- ripngd/ripng_routemap.c | 108 +- ripngd/ripng_zebra.c | 51 +- ripngd/ripngd.c | 36 +- zebra/interface.c | 92 +- zebra/router-id.c | 44 +- zebra/rtadv.c | 727 +++-- zebra/zebra_routemap.c | 249 +- zebra/zebra_vty.c | 612 ++-- 44 files changed, 9067 insertions(+), 9749 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index ad221d922d..170b207a85 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -638,6 +638,18 @@ DEFUN_HIDDEN (neighbor_bfd_type, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Disables BFD support\n" + * "Detect Multiplier\n" + * "Required min receive interval\n" + * "Desired min transmit interval\n" + * + */ DEFUN (no_neighbor_bfd, no_neighbor_bfd_cmd, NO_NEIGHBOR_CMD2 "bfd", @@ -660,16 +672,6 @@ DEFUN (no_neighbor_bfd, return CMD_SUCCESS; } -ALIAS (no_neighbor_bfd, - no_neighbor_bfd_val_cmd, - NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Disables BFD support\n" - "Detect Multiplier\n" - "Required min receive interval\n" - "Desired min transmit interval\n") DEFUN_HIDDEN (no_neighbor_bfd_type, no_neighbor_bfd_type_cmd, @@ -711,6 +713,5 @@ bgp_bfd_init(void) install_element (BGP_NODE, &neighbor_bfd_param_cmd); install_element (BGP_NODE, &neighbor_bfd_type_cmd); install_element (BGP_NODE, &no_neighbor_bfd_cmd); - install_element (BGP_NODE, &no_neighbor_bfd_val_cmd); install_element (BGP_NODE, &no_neighbor_bfd_type_cmd); } diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index bf865afdcb..e64730624a 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1538,6 +1538,14 @@ DEFUN (debug_bgp_allow_martians, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug bgp allow-martians", + * UNDEBUG_STR + * BGP_STR + * "BGP allow martian next hops\n" + * + */ DEFUN (no_debug_bgp_allow_martians, no_debug_bgp_allow_martians_cmd, "no debug bgp allow-martians", @@ -1556,12 +1564,6 @@ DEFUN (no_debug_bgp_allow_martians, return CMD_SUCCESS; } -ALIAS (no_debug_bgp_allow_martians, - undebug_bgp_allow_martians_cmd, - "undebug bgp allow-martians", - UNDEBUG_STR - BGP_STR - "BGP allow martian next hops\n") /* debug bgp update-groups */ DEFUN (debug_bgp_update_groups, @@ -1862,7 +1864,6 @@ bgp_debug_init (void) install_element (ENABLE_NODE, &no_debug_bgp_zebra_cmd); install_element (CONFIG_NODE, &no_debug_bgp_zebra_cmd); install_element (ENABLE_NODE, &no_debug_bgp_allow_martians_cmd); - install_element (ENABLE_NODE, &undebug_bgp_allow_martians_cmd); install_element (CONFIG_NODE, &no_debug_bgp_allow_martians_cmd); install_element (ENABLE_NODE, &no_debug_bgp_update_groups_cmd); install_element (CONFIG_NODE, &no_debug_bgp_update_groups_cmd); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2472511fe7..37009e1ab9 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4442,6 +4442,22 @@ DEFUN (bgp_network_mask_natural_backdoor, NULL, 1); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no network A.B.C.D/M route-map WORD", + * NO_STR + * "Specify a network to announce via BGP\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "Route-map to modify the attributes\n" + * "Name of the route map\n" + * + * "no network A.B.C.D/M backdoor", + * NO_STR + * "Specify a network to announce via BGP\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "Specify a BGP backdoor route\n" + * + */ DEFUN (no_bgp_network, no_bgp_network_cmd, "no network A.B.C.D/M", @@ -4453,23 +4469,28 @@ DEFUN (no_bgp_network, bgp_node_safi (vty)); } -ALIAS (no_bgp_network, - no_bgp_network_route_map_cmd, - "no network A.B.C.D/M route-map WORD", - NO_STR - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Route-map to modify the attributes\n" - "Name of the route map\n") -ALIAS (no_bgp_network, - no_bgp_network_backdoor_cmd, - "no network A.B.C.D/M backdoor", - NO_STR - "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Specify a BGP backdoor route\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no network A.B.C.D mask A.B.C.D backdoor", + * NO_STR + * "Specify a network to announce via BGP\n" + * "Network number\n" + * "Network mask\n" + * "Network mask\n" + * "Specify a BGP backdoor route\n" + * + * "no network A.B.C.D mask A.B.C.D route-map WORD", + * NO_STR + * "Specify a network to announce via BGP\n" + * "Network number\n" + * "Network mask\n" + * "Network mask\n" + * "Route-map to modify the attributes\n" + * "Name of the route map\n" + * + */ DEFUN (no_bgp_network_mask, no_bgp_network_mask_cmd, "no network A.B.C.D mask A.B.C.D", @@ -4493,27 +4514,24 @@ DEFUN (no_bgp_network_mask, bgp_node_safi (vty)); } -ALIAS (no_bgp_network_mask, - no_bgp_network_mask_route_map_cmd, - "no network A.B.C.D mask A.B.C.D route-map WORD", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "Route-map to modify the attributes\n" - "Name of the route map\n") -ALIAS (no_bgp_network_mask, - no_bgp_network_mask_backdoor_cmd, - "no network A.B.C.D mask A.B.C.D backdoor", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Network mask\n" - "Network mask\n" - "Specify a BGP backdoor route\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no network A.B.C.D backdoor", + * NO_STR + * "Specify a network to announce via BGP\n" + * "Network number\n" + * "Specify a BGP backdoor route\n" + * + * "no network A.B.C.D route-map WORD", + * NO_STR + * "Specify a network to announce via BGP\n" + * "Network number\n" + * "Route-map to modify the attributes\n" + * "Name of the route map\n" + * + */ DEFUN (no_bgp_network_mask_natural, no_bgp_network_mask_natural_cmd, "no network A.B.C.D", @@ -4535,24 +4553,18 @@ DEFUN (no_bgp_network_mask_natural, bgp_node_safi (vty)); } -ALIAS (no_bgp_network_mask_natural, - no_bgp_network_mask_natural_route_map_cmd, - "no network A.B.C.D route-map WORD", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Route-map to modify the attributes\n" - "Name of the route map\n") -ALIAS (no_bgp_network_mask_natural, - no_bgp_network_mask_natural_backdoor_cmd, - "no network A.B.C.D backdoor", - NO_STR - "Specify a network to announce via BGP\n" - "Network number\n" - "Specify a BGP backdoor route\n") #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ipv6 bgp network X:X::X:X/M", + * IPV6_STR + * BGP_STR + * "Specify a network to announce via BGP\n" + * "IPv6 prefix /, e.g., 3ffe::/16\n" + * + */ DEFUN (ipv6_bgp_network, ipv6_bgp_network_cmd, "network X:X::X:X/M", @@ -4575,6 +4587,23 @@ DEFUN (ipv6_bgp_network_route_map, bgp_node_safi (vty), argv[3]->arg, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no network X:X::X:X/M route-map WORD", + * NO_STR + * "Specify a network to announce via BGP\n" + * "IPv6 prefix /\n" + * "Route-map to modify the attributes\n" + * "Name of the route map\n" + * + * "no ipv6 bgp network X:X::X:X/M", + * NO_STR + * IPV6_STR + * BGP_STR + * "Specify a network to announce via BGP\n" + * "IPv6 prefix /, e.g., 3ffe::/16\n" + * + */ DEFUN (no_ipv6_bgp_network, no_ipv6_bgp_network_cmd, "no network X:X::X:X/M", @@ -4585,31 +4614,8 @@ DEFUN (no_ipv6_bgp_network, return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP6, bgp_node_safi(vty)); } -ALIAS (no_ipv6_bgp_network, - no_ipv6_bgp_network_route_map_cmd, - "no network X:X::X:X/M route-map WORD", - NO_STR - "Specify a network to announce via BGP\n" - "IPv6 prefix /\n" - "Route-map to modify the attributes\n" - "Name of the route map\n") -ALIAS (ipv6_bgp_network, - old_ipv6_bgp_network_cmd, - "ipv6 bgp network X:X::X:X/M", - IPV6_STR - BGP_STR - "Specify a network to announce via BGP\n" - "IPv6 prefix /, e.g., 3ffe::/16\n") -ALIAS (no_ipv6_bgp_network, - old_no_ipv6_bgp_network_cmd, - "no ipv6 bgp network X:X::X:X/M", - NO_STR - IPV6_STR - BGP_STR - "Specify a network to announce via BGP\n" - "IPv6 prefix /, e.g., 3ffe::/16\n") #endif /* HAVE_IPV6 */ /* Aggreagete address: @@ -5313,6 +5319,15 @@ DEFUN (aggregate_address_mask_as_set, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "aggregate-address A.B.C.D/M summary-only as-set", + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Filter more specific routes from updates\n" + * "Generate AS set path information\n" + * + */ DEFUN (aggregate_address_as_set_summary, aggregate_address_as_set_summary_cmd, "aggregate-address A.B.C.D/M as-set summary-only", @@ -5325,14 +5340,17 @@ DEFUN (aggregate_address_as_set_summary, AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } -ALIAS (aggregate_address_as_set_summary, - aggregate_address_summary_as_set_cmd, - "aggregate-address A.B.C.D/M summary-only as-set", - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n" - "Generate AS set path information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "aggregate-address A.B.C.D A.B.C.D summary-only as-set", + * "Configure BGP aggregate entries\n" + * "Aggregate address\n" + * "Aggregate mask\n" + * "Filter more specific routes from updates\n" + * "Generate AS set path information\n" + * + */ DEFUN (aggregate_address_mask_as_set_summary, aggregate_address_mask_as_set_summary_cmd, "aggregate-address A.B.C.D A.B.C.D as-set summary-only", @@ -5357,15 +5375,36 @@ DEFUN (aggregate_address_mask_as_set_summary, AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } -ALIAS (aggregate_address_mask_as_set_summary, - aggregate_address_mask_summary_as_set_cmd, - "aggregate-address A.B.C.D A.B.C.D summary-only as-set", - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Filter more specific routes from updates\n" - "Generate AS set path information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no aggregate-address A.B.C.D/M summary-only", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Filter more specific routes from updates\n" + * + * "no aggregate-address A.B.C.D/M as-set summary-only", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Generate AS set path information\n" + * "Filter more specific routes from updates\n" + * + * "no aggregate-address A.B.C.D/M summary-only as-set", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Filter more specific routes from updates\n" + * "Generate AS set path information\n" + * + * "no aggregate-address A.B.C.D/M as-set", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Generate AS set path information\n" + * + */ DEFUN (no_aggregate_address, no_aggregate_address_cmd, "no aggregate-address A.B.C.D/M", @@ -5376,40 +5415,43 @@ DEFUN (no_aggregate_address, return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); } -ALIAS (no_aggregate_address, - no_aggregate_address_summary_only_cmd, - "no aggregate-address A.B.C.D/M summary-only", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n") -ALIAS (no_aggregate_address, - no_aggregate_address_as_set_cmd, - "no aggregate-address A.B.C.D/M as-set", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Generate AS set path information\n") -ALIAS (no_aggregate_address, - no_aggregate_address_as_set_summary_cmd, - "no aggregate-address A.B.C.D/M as-set summary-only", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Generate AS set path information\n" - "Filter more specific routes from updates\n") -ALIAS (no_aggregate_address, - no_aggregate_address_summary_as_set_cmd, - "no aggregate-address A.B.C.D/M summary-only as-set", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n" - "Generate AS set path information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no aggregate-address A.B.C.D A.B.C.D summary-only as-set", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate address\n" + * "Aggregate mask\n" + * "Filter more specific routes from updates\n" + * "Generate AS set path information\n" + * + * "no aggregate-address A.B.C.D A.B.C.D as-set summary-only", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate address\n" + * "Aggregate mask\n" + * "Generate AS set path information\n" + * "Filter more specific routes from updates\n" + * + * "no aggregate-address A.B.C.D A.B.C.D summary-only", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate address\n" + * "Aggregate mask\n" + * "Filter more specific routes from updates\n" + * + * "no aggregate-address A.B.C.D A.B.C.D as-set", + * NO_STR + * "Configure BGP aggregate entries\n" + * "Aggregate address\n" + * "Aggregate mask\n" + * "Generate AS set path information\n" + * + */ DEFUN (no_aggregate_address_mask, no_aggregate_address_mask_cmd, "no aggregate-address A.B.C.D A.B.C.D", @@ -5432,45 +5474,20 @@ DEFUN (no_aggregate_address_mask, return bgp_aggregate_unset (vty, prefix_str, AFI_IP, bgp_node_safi (vty)); } -ALIAS (no_aggregate_address_mask, - no_aggregate_address_mask_summary_only_cmd, - "no aggregate-address A.B.C.D A.B.C.D summary-only", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Filter more specific routes from updates\n") -ALIAS (no_aggregate_address_mask, - no_aggregate_address_mask_as_set_cmd, - "no aggregate-address A.B.C.D A.B.C.D as-set", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Generate AS set path information\n") -ALIAS (no_aggregate_address_mask, - no_aggregate_address_mask_as_set_summary_cmd, - "no aggregate-address A.B.C.D A.B.C.D as-set summary-only", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Generate AS set path information\n" - "Filter more specific routes from updates\n") -ALIAS (no_aggregate_address_mask, - no_aggregate_address_mask_summary_as_set_cmd, - "no aggregate-address A.B.C.D A.B.C.D summary-only as-set", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Filter more specific routes from updates\n" - "Generate AS set path information\n") #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ipv6 bgp aggregate-address X:X::X:X/M", + * IPV6_STR + * BGP_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * + */ DEFUN (ipv6_aggregate_address, ipv6_aggregate_address_cmd, "aggregate-address X:X::X:X/M", @@ -5480,6 +5497,16 @@ DEFUN (ipv6_aggregate_address, return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ipv6 bgp aggregate-address X:X::X:X/M summary-only", + * IPV6_STR + * BGP_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Filter more specific routes from updates\n" + * + */ DEFUN (ipv6_aggregate_address_summary_only, ipv6_aggregate_address_summary_only_cmd, "aggregate-address X:X::X:X/M summary-only", @@ -5491,6 +5518,16 @@ DEFUN (ipv6_aggregate_address_summary_only, AGGREGATE_SUMMARY_ONLY, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 bgp aggregate-address X:X::X:X/M", + * NO_STR + * IPV6_STR + * BGP_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * + */ DEFUN (no_ipv6_aggregate_address, no_ipv6_aggregate_address_cmd, "no aggregate-address X:X::X:X/M", @@ -5501,6 +5538,17 @@ DEFUN (no_ipv6_aggregate_address, return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 bgp aggregate-address X:X::X:X/M summary-only", + * NO_STR + * IPV6_STR + * BGP_STR + * "Configure BGP aggregate entries\n" + * "Aggregate prefix\n" + * "Filter more specific routes from updates\n" + * + */ DEFUN (no_ipv6_aggregate_address_summary_only, no_ipv6_aggregate_address_summary_only_cmd, "no aggregate-address X:X::X:X/M summary-only", @@ -5512,41 +5560,9 @@ DEFUN (no_ipv6_aggregate_address_summary_only, return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); } -ALIAS (ipv6_aggregate_address, - old_ipv6_aggregate_address_cmd, - "ipv6 bgp aggregate-address X:X::X:X/M", - IPV6_STR - BGP_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n") -ALIAS (ipv6_aggregate_address_summary_only, - old_ipv6_aggregate_address_summary_only_cmd, - "ipv6 bgp aggregate-address X:X::X:X/M summary-only", - IPV6_STR - BGP_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n") -ALIAS (no_ipv6_aggregate_address, - old_no_ipv6_aggregate_address_cmd, - "no ipv6 bgp aggregate-address X:X::X:X/M", - NO_STR - IPV6_STR - BGP_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n") -ALIAS (no_ipv6_aggregate_address_summary_only, - old_no_ipv6_aggregate_address_summary_only_cmd, - "no ipv6 bgp aggregate-address X:X::X:X/M summary-only", - NO_STR - IPV6_STR - BGP_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n") #endif /* HAVE_IPV6 */ /* Redistribute route treatment. */ @@ -7934,6 +7950,17 @@ DEFUN (show_ip_bgp, return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv4 (unicast|multicast) {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, "show ip bgp ipv4 (unicast|multicast) {json}", @@ -7954,15 +7981,6 @@ DEFUN (show_ip_bgp_ipv4, return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, uj); } -ALIAS (show_ip_bgp_ipv4, - show_bgp_ipv4_safi_cmd, - "show bgp ipv4 (unicast|multicast) {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "JavaScript Object Notation\n") DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, @@ -8058,6 +8076,18 @@ DEFUN (show_bgp_ipv6_prefix, return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv4 (unicast|multicast) A.B.C.D {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Network in the BGP routing table to display\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4_route, show_ip_bgp_ipv4_route_cmd, "show ip bgp ipv4 (unicast|multicast) A.B.C.D {json}", @@ -8078,16 +8108,6 @@ DEFUN (show_ip_bgp_ipv4_route, return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } -ALIAS (show_ip_bgp_ipv4_route, - show_bgp_ipv4_safi_route_cmd, - "show bgp ipv4 (unicast|multicast) A.B.C.D {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") DEFUN (show_ip_bgp_vpnv4_all_route, show_ip_bgp_vpnv4_all_route_cmd, @@ -8232,6 +8252,18 @@ DEFUN (show_ip_bgp_prefix_pathtype, return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv4 (unicast|multicast) A.B.C.D/M {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4_prefix, show_ip_bgp_ipv4_prefix_cmd, "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M {json}", @@ -8252,17 +8284,21 @@ DEFUN (show_ip_bgp_ipv4_prefix, return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } -ALIAS (show_ip_bgp_ipv4_prefix, - show_bgp_ipv4_safi_prefix_cmd, - "show bgp ipv4 (unicast|multicast) A.B.C.D/M {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "Display only the bestpath\n" + * "Display only multipaths\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, show_ip_bgp_ipv4_prefix_pathtype_cmd, "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) {json}", @@ -8291,18 +8327,6 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } -ALIAS (show_ip_bgp_ipv4_prefix_pathtype, - show_bgp_ipv4_safi_prefix_pathtype_cmd, - "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") DEFUN (show_ip_bgp_vpnv4_all_prefix, show_ip_bgp_vpnv4_all_prefix_cmd, @@ -8445,6 +8469,15 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp, show_bgp_cmd, "show bgp {json}", @@ -8456,13 +8489,6 @@ DEFUN (show_bgp, NULL, use_json(argc, argv)); } -ALIAS (show_bgp, - show_bgp_ipv6_cmd, - "show bgp ipv6 {json}", - SHOW_STR - BGP_STR - "Address family\n" - "JavaScript Object Notation\n") DEFUN (show_bgp_ipv6_safi, show_bgp_ipv6_safi_cmd, @@ -8533,6 +8559,18 @@ DEFUN (show_bgp_ipv6_safi_route, return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 X:X::X:X (bestpath|multipath) {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Network in the BGP routing table to display\n" + * "Display only the bestpath\n" + * "Display only multipaths\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_route_pathtype, show_bgp_route_pathtype_cmd, "show bgp X:X::X:X (bestpath|multipath) {json}", @@ -8550,16 +8588,6 @@ DEFUN (show_bgp_route_pathtype, return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } -ALIAS (show_bgp_route_pathtype, - show_bgp_ipv6_route_pathtype_cmd, - "show bgp ipv6 X:X::X:X (bestpath|multipath) {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") DEFUN (show_bgp_ipv6_safi_route_pathtype, show_bgp_ipv6_safi_route_pathtype_cmd, @@ -8630,6 +8658,18 @@ DEFUN (show_bgp_ipv6_safi_prefix, return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 X:X::X:X/M (bestpath|multipath) {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "IPv6 prefix /\n" + * "Display only the bestpath\n" + * "Display only multipaths\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_prefix_pathtype, show_bgp_prefix_pathtype_cmd, "show bgp X:X::X:X/M (bestpath|multipath) {json}", @@ -8647,16 +8687,6 @@ DEFUN (show_bgp_prefix_pathtype, return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } -ALIAS (show_bgp_prefix_pathtype, - show_bgp_ipv6_prefix_pathtype_cmd, - "show bgp ipv6 X:X::X:X/M (bestpath|multipath) {json}", - SHOW_STR - BGP_STR - "Address family\n" - "IPv6 prefix /\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") DEFUN (show_bgp_ipv6_safi_prefix_pathtype, show_bgp_ipv6_safi_prefix_pathtype_cmd, @@ -8698,6 +8728,16 @@ DEFUN (show_ipv6_bgp_prefix, return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_view, show_bgp_instance_cmd, "show bgp " BGP_INSTANCE_CMD " {json}", @@ -8733,15 +8773,18 @@ DEFUN (show_bgp_instance_all, return CMD_SUCCESS; } -ALIAS (show_bgp_view, - show_bgp_instance_ipv6_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Network in the BGP routing table to display\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_route, show_bgp_instance_route_cmd, "show bgp " BGP_INSTANCE_CMD " X:X::X:X {json}", @@ -8754,16 +8797,20 @@ DEFUN (show_bgp_instance_route, return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } -ALIAS (show_bgp_instance_route, - show_bgp_instance_ipv6_route_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X (bestpath|multipath) {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Network in the BGP routing table to display\n" + * "Display only the bestpath\n" + * "Display only multipaths\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_route_pathtype, show_bgp_instance_route_pathtype_cmd, "show bgp " BGP_INSTANCE_CMD " X:X::X:X (bestpath|multipath) {json}", @@ -8782,18 +8829,18 @@ DEFUN (show_bgp_instance_route_pathtype, return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } -ALIAS (show_bgp_instance_route_pathtype, - show_bgp_instance_ipv6_route_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X (bestpath|multipath) {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "IPv6 prefix /\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_prefix, show_bgp_instance_prefix_cmd, "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M {json}", @@ -8806,16 +8853,20 @@ DEFUN (show_bgp_instance_prefix, return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } -ALIAS (show_bgp_instance_prefix, - show_bgp_instance_ipv6_prefix_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "IPv6 prefix /\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M (bestpath|multipath) {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "IPv6 prefix /\n" + * "Display only the bestpath\n" + * "Display only multipaths\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_prefix_pathtype, show_bgp_instance_prefix_pathtype_cmd, "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M (bestpath|multipath) {json}", @@ -8834,18 +8885,18 @@ DEFUN (show_bgp_instance_prefix_pathtype, return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } -ALIAS (show_bgp_instance_prefix_pathtype, - show_bgp_instance_ipv6_prefix_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M (bestpath|multipath) {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "IPv6 prefix /\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 prefix-list WORD", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Display routes conforming to the prefix-list\n" + * "IPv6 prefix-list name\n" + * + */ DEFUN (show_bgp_instance_prefix_list, show_bgp_instance_prefix_list_cmd, "show bgp " BGP_INSTANCE_CMD " prefix-list WORD", @@ -8859,16 +8910,18 @@ DEFUN (show_bgp_instance_prefix_list, bgp_show_type_prefix_list); } -ALIAS (show_bgp_instance_prefix_list, - show_bgp_instance_ipv6_prefix_list_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 prefix-list WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Display routes conforming to the prefix-list\n" - "IPv6 prefix-list name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 filter-list WORD", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Display routes conforming to the filter-list\n" + * "Regular expression access list name\n" + * + */ DEFUN (show_bgp_instance_filter_list, show_bgp_instance_filter_list_cmd, "show bgp " BGP_INSTANCE_CMD " filter-list WORD", @@ -8882,16 +8935,18 @@ DEFUN (show_bgp_instance_filter_list, bgp_show_type_filter_list); } -ALIAS (show_bgp_instance_filter_list, - show_bgp_instance_ipv6_filter_list_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 filter-list WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 route-map WORD", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Display routes matching the route-map\n" + * "A route-map to match on\n" + * + */ DEFUN (show_bgp_instance_route_map, show_bgp_instance_route_map_cmd, "show bgp " BGP_INSTANCE_CMD " route-map WORD", @@ -8905,16 +8960,19 @@ DEFUN (show_bgp_instance_route_map, bgp_show_type_route_map); } -ALIAS (show_bgp_instance_route_map, - show_bgp_instance_ipv6_route_map_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 route-map WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Display routes matching the route-map\n" - "A route-map to match on\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 community-list (<1-500>|WORD)", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Display routes matching the community-list\n" + * "community-list number\n" + * "community-list name\n" + * + */ DEFUN (show_bgp_instance_community_list, show_bgp_instance_community_list_cmd, "show bgp " BGP_INSTANCE_CMD " community-list (<1-500>|WORD)", @@ -8928,17 +8986,18 @@ DEFUN (show_bgp_instance_community_list, return bgp_show_community_list (vty, argv[3]->arg, argv[5]->arg, 0, AFI_IP6, SAFI_UNICAST); } -ALIAS (show_bgp_instance_community_list, - show_bgp_instance_ipv6_community_list_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 community-list (<1-500>|WORD)", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M longer-prefixes", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "IPv6 prefix /\n" + * "Display route and more specific routes\n" + * + */ DEFUN (show_bgp_instance_prefix_longer, show_bgp_instance_prefix_longer_cmd, "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M longer-prefixes", @@ -8952,15 +9011,6 @@ DEFUN (show_bgp_instance_prefix_longer, bgp_show_type_prefix_longer); } -ALIAS (show_bgp_instance_prefix_longer, - show_bgp_instance_ipv6_prefix_longer_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M longer-prefixes", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "IPv6 prefix /\n" - "Display route and more specific routes\n") /* old command */ DEFUN (show_ipv6_mbgp, @@ -9051,7 +9101,7 @@ bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, return rc; } -DEFUN (show_ip_bgp_regexp, +DEFUN (show_ip_bgp_regexp, show_ip_bgp_regexp_cmd, "show ip bgp regexp .LINE", SHOW_STR @@ -9064,7 +9114,19 @@ DEFUN (show_ip_bgp_regexp, bgp_show_type_regexp); } -DEFUN (show_ip_bgp_flap_regexp, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics regexp .LINE", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Display routes matching the AS path regular expression\n" + * "A regular-expression to match the BGP AS paths\n" + * + */ +DEFUN (show_ip_bgp_flap_regexp, show_ip_bgp_flap_regexp_cmd, "show ip bgp flap-statistics regexp .LINE", SHOW_STR @@ -9078,18 +9140,8 @@ DEFUN (show_ip_bgp_flap_regexp, bgp_show_type_flap_regexp); } -ALIAS (show_ip_bgp_flap_regexp, - show_ip_bgp_damp_flap_regexp_cmd, - "show ip bgp dampening flap-statistics regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -DEFUN (show_ip_bgp_ipv4_regexp, +DEFUN (show_ip_bgp_ipv4_regexp, show_ip_bgp_ipv4_regexp_cmd, "show ip bgp ipv4 (unicast|multicast) regexp .LINE", SHOW_STR @@ -9110,7 +9162,17 @@ DEFUN (show_ip_bgp_ipv4_regexp, } #ifdef HAVE_IPV6 -DEFUN (show_bgp_regexp, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 regexp .LINE", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the AS path regular expression\n" + * "A regular-expression to match the BGP AS paths\n" + * + */ +DEFUN (show_bgp_regexp, show_bgp_regexp_cmd, "show bgp regexp .LINE", SHOW_STR @@ -9122,17 +9184,9 @@ DEFUN (show_bgp_regexp, bgp_show_type_regexp); } -ALIAS (show_bgp_regexp, - show_bgp_ipv6_regexp_cmd, - "show bgp ipv6 regexp .LINE", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") /* old command */ -DEFUN (show_ipv6_bgp_regexp, +DEFUN (show_ipv6_bgp_regexp, show_ipv6_bgp_regexp_cmd, "show ipv6 bgp regexp .LINE", SHOW_STR @@ -9147,7 +9201,7 @@ DEFUN (show_ipv6_bgp_regexp, } /* old command */ -DEFUN (show_ipv6_mbgp_regexp, +DEFUN (show_ipv6_mbgp_regexp, show_ipv6_mbgp_regexp_cmd, "show ipv6 mbgp regexp .LINE", SHOW_STR @@ -9187,7 +9241,7 @@ bgp_show_prefix_list (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, plist, 0); } -DEFUN (show_ip_bgp_prefix_list, +DEFUN (show_ip_bgp_prefix_list, show_ip_bgp_prefix_list_cmd, "show ip bgp prefix-list WORD", SHOW_STR @@ -9214,7 +9268,19 @@ DEFUN (show_ip_bgp_instance_prefix_list, bgp_show_type_prefix_list); } -DEFUN (show_ip_bgp_flap_prefix_list, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics prefix-list WORD", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Display routes conforming to the prefix-list\n" + * "IP prefix-list name\n" + * + */ +DEFUN (show_ip_bgp_flap_prefix_list, show_ip_bgp_flap_prefix_list_cmd, "show ip bgp flap-statistics prefix-list WORD", SHOW_STR @@ -9228,18 +9294,8 @@ DEFUN (show_ip_bgp_flap_prefix_list, bgp_show_type_flap_prefix_list); } -ALIAS (show_ip_bgp_flap_prefix_list, - show_ip_bgp_damp_flap_prefix_list_cmd, - "show ip bgp dampening flap-statistics prefix-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Display routes conforming to the prefix-list\n" - "IP prefix-list name\n") -DEFUN (show_ip_bgp_ipv4_prefix_list, +DEFUN (show_ip_bgp_ipv4_prefix_list, show_ip_bgp_ipv4_prefix_list_cmd, "show ip bgp ipv4 (unicast|multicast) prefix-list WORD", SHOW_STR @@ -9260,7 +9316,17 @@ DEFUN (show_ip_bgp_ipv4_prefix_list, } #ifdef HAVE_IPV6 -DEFUN (show_bgp_prefix_list, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 prefix-list WORD", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes conforming to the prefix-list\n" + * "IPv6 prefix-list name\n" + * + */ +DEFUN (show_bgp_prefix_list, show_bgp_prefix_list_cmd, "show bgp prefix-list WORD", SHOW_STR @@ -9272,17 +9338,9 @@ DEFUN (show_bgp_prefix_list, bgp_show_type_prefix_list); } -ALIAS (show_bgp_prefix_list, - show_bgp_ipv6_prefix_list_cmd, - "show bgp ipv6 prefix-list WORD", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes conforming to the prefix-list\n" - "IPv6 prefix-list name\n") /* old command */ -DEFUN (show_ipv6_bgp_prefix_list, +DEFUN (show_ipv6_bgp_prefix_list, show_ipv6_bgp_prefix_list_cmd, "show ipv6 bgp prefix-list WORD", SHOW_STR @@ -9297,7 +9355,7 @@ DEFUN (show_ipv6_bgp_prefix_list, } /* old command */ -DEFUN (show_ipv6_mbgp_prefix_list, +DEFUN (show_ipv6_mbgp_prefix_list, show_ipv6_mbgp_prefix_list_cmd, "show ipv6 mbgp prefix-list WORD", SHOW_STR @@ -9336,7 +9394,7 @@ bgp_show_filter_list (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, as_list, 0); } -DEFUN (show_ip_bgp_filter_list, +DEFUN (show_ip_bgp_filter_list, show_ip_bgp_filter_list_cmd, "show ip bgp filter-list WORD", SHOW_STR @@ -9363,7 +9421,19 @@ DEFUN (show_ip_bgp_instance_filter_list, bgp_show_type_filter_list); } -DEFUN (show_ip_bgp_flap_filter_list, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics filter-list WORD", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Display routes conforming to the filter-list\n" + * "Regular expression access list name\n" + * + */ +DEFUN (show_ip_bgp_flap_filter_list, show_ip_bgp_flap_filter_list_cmd, "show ip bgp flap-statistics filter-list WORD", SHOW_STR @@ -9377,18 +9447,8 @@ DEFUN (show_ip_bgp_flap_filter_list, bgp_show_type_flap_filter_list); } -ALIAS (show_ip_bgp_flap_filter_list, - show_ip_bgp_damp_flap_filter_list_cmd, - "show ip bgp dampening flap-statistics filter-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -DEFUN (show_ip_bgp_ipv4_filter_list, +DEFUN (show_ip_bgp_ipv4_filter_list, show_ip_bgp_ipv4_filter_list_cmd, "show ip bgp ipv4 (unicast|multicast) filter-list WORD", SHOW_STR @@ -9409,7 +9469,17 @@ DEFUN (show_ip_bgp_ipv4_filter_list, } #ifdef HAVE_IPV6 -DEFUN (show_bgp_filter_list, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 filter-list WORD", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes conforming to the filter-list\n" + * "Regular expression access list name\n" + * + */ +DEFUN (show_bgp_filter_list, show_bgp_filter_list_cmd, "show bgp filter-list WORD", SHOW_STR @@ -9421,17 +9491,9 @@ DEFUN (show_bgp_filter_list, bgp_show_type_filter_list); } -ALIAS (show_bgp_filter_list, - show_bgp_ipv6_filter_list_cmd, - "show bgp ipv6 filter-list WORD", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") /* old command */ -DEFUN (show_ipv6_bgp_filter_list, +DEFUN (show_ipv6_bgp_filter_list, show_ipv6_bgp_filter_list_cmd, "show ipv6 bgp filter-list WORD", SHOW_STR @@ -9446,7 +9508,7 @@ DEFUN (show_ipv6_bgp_filter_list, } /* old command */ -DEFUN (show_ipv6_mbgp_filter_list, +DEFUN (show_ipv6_mbgp_filter_list, show_ipv6_mbgp_filter_list_cmd, "show ipv6 mbgp filter-list WORD", SHOW_STR @@ -9558,7 +9620,7 @@ bgp_show_route_map (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, rmap, 0); } -DEFUN (show_ip_bgp_route_map, +DEFUN (show_ip_bgp_route_map, show_ip_bgp_route_map_cmd, "show ip bgp route-map WORD", SHOW_STR @@ -9585,7 +9647,19 @@ DEFUN (show_ip_bgp_instance_route_map, bgp_show_type_route_map); } -DEFUN (show_ip_bgp_flap_route_map, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics route-map WORD", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Display routes matching the route-map\n" + * "A route-map to match on\n" + * + */ +DEFUN (show_ip_bgp_flap_route_map, show_ip_bgp_flap_route_map_cmd, "show ip bgp flap-statistics route-map WORD", SHOW_STR @@ -9599,18 +9673,8 @@ DEFUN (show_ip_bgp_flap_route_map, bgp_show_type_flap_route_map); } -ALIAS (show_ip_bgp_flap_route_map, - show_ip_bgp_damp_flap_route_map_cmd, - "show ip bgp dampening flap-statistics route-map WORD", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Display routes matching the route-map\n" - "A route-map to match on\n") -DEFUN (show_ip_bgp_ipv4_route_map, +DEFUN (show_ip_bgp_ipv4_route_map, show_ip_bgp_ipv4_route_map_cmd, "show ip bgp ipv4 (unicast|multicast) route-map WORD", SHOW_STR @@ -9630,7 +9694,17 @@ DEFUN (show_ip_bgp_ipv4_route_map, bgp_show_type_route_map); } -DEFUN (show_bgp_route_map, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 route-map WORD", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the route-map\n" + * "A route-map to match on\n" + * + */ +DEFUN (show_bgp_route_map, show_bgp_route_map_cmd, "show bgp route-map WORD", SHOW_STR @@ -9642,14 +9716,6 @@ DEFUN (show_bgp_route_map, bgp_show_type_route_map); } -ALIAS (show_bgp_route_map, - show_bgp_ipv6_route_map_cmd, - "show bgp ipv6 route-map WORD", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the route-map\n" - "A route-map to match on\n") DEFUN (show_ip_bgp_cidr_only, show_ip_bgp_cidr_only_cmd, @@ -9663,6 +9729,17 @@ DEFUN (show_ip_bgp_cidr_only, bgp_show_type_cidr_only, NULL, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics cidr-only", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Display only routes with non-natural netmasks\n" + * + */ DEFUN (show_ip_bgp_flap_cidr_only, show_ip_bgp_flap_cidr_only_cmd, "show ip bgp flap-statistics cidr-only", @@ -9676,15 +9753,6 @@ DEFUN (show_ip_bgp_flap_cidr_only, bgp_show_type_flap_cidr_only, NULL, 0); } -ALIAS (show_ip_bgp_flap_cidr_only, - show_ip_bgp_damp_flap_cidr_only_cmd, - "show ip bgp dampening flap-statistics cidr-only", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Display only routes with non-natural netmasks\n") DEFUN (show_ip_bgp_ipv4_cidr_only, show_ip_bgp_ipv4_cidr_only_cmd, @@ -9737,6 +9805,15 @@ DEFUN (show_ip_bgp_ipv4_community_all, } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 community", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * + */ DEFUN (show_bgp_community_all, show_bgp_community_all_cmd, "show bgp community", @@ -9748,13 +9825,6 @@ DEFUN (show_bgp_community_all, bgp_show_type_community_all, NULL, 0); } -ALIAS (show_bgp_community_all, - show_bgp_ipv6_community_all_cmd, - "show bgp ipv6 community", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n") /* old command */ DEFUN (show_ipv6_bgp_community_all, @@ -9848,6 +9918,63 @@ bgp_show_community (struct vty *vty, const char *view_name, int argc, bgp_show_type_community), com, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_ip_bgp_community, show_ip_bgp_community_cmd, "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)", @@ -9863,66 +9990,75 @@ DEFUN (show_ip_bgp_community, return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); } -ALIAS (show_ip_bgp_community, - show_ip_bgp_community2_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_ip_bgp_community, - show_ip_bgp_community3_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_ip_bgp_community, - show_ip_bgp_community4_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community_cmd, "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", @@ -9944,74 +10080,8 @@ DEFUN (show_ip_bgp_ipv4_community, return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); } -ALIAS (show_ip_bgp_ipv4_community, - show_ip_bgp_ipv4_community2_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_ip_bgp_ipv4_community, - show_ip_bgp_ipv4_community3_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_ip_bgp_ipv4_community, - show_ip_bgp_ipv4_community4_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") DEFUN (show_bgp_instance_afi_safi_community_all, show_bgp_instance_afi_safi_community_all_cmd, @@ -10042,6 +10112,75 @@ DEFUN (show_bgp_instance_afi_safi_community_all, return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Address family\n" + * "Address family modifier\n" + * "Address family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Address family\n" + * "Address family modifier\n" + * "Address family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Address family\n" + * "Address family modifier\n" + * "Address family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community_cmd, "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", @@ -10066,78 +10205,69 @@ DEFUN (show_bgp_instance_afi_safi_community, return bgp_show_community (vty, argv[3]->arg, argc, argv, 0, afi, safi); } -ALIAS (show_bgp_instance_afi_safi_community, - show_bgp_instance_afi_safi_community2_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family modifier\n" - "Address family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_instance_afi_safi_community, - show_bgp_instance_afi_safi_community3_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family modifier\n" - "Address family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_instance_afi_safi_community, - show_bgp_instance_afi_safi_community4_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family modifier\n" - "Address family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + */ DEFUN (show_ip_bgp_community_exact, show_ip_bgp_community_exact_cmd, "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", @@ -10154,69 +10284,78 @@ DEFUN (show_ip_bgp_community_exact, return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); } -ALIAS (show_ip_bgp_community_exact, - show_ip_bgp_community2_exact_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_ip_bgp_community_exact, - show_ip_bgp_community3_exact_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_ip_bgp_community_exact, - show_ip_bgp_community4_exact_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + */ DEFUN (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community_exact_cmd, "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match", @@ -10239,79 +10378,128 @@ DEFUN (show_ip_bgp_ipv4_community_exact, return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); } -ALIAS (show_ip_bgp_ipv4_community_exact, - show_ip_bgp_ipv4_community2_exact_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_ip_bgp_ipv4_community_exact, - show_ip_bgp_ipv4_community3_exact_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_ip_bgp_ipv4_community_exact, - show_ip_bgp_ipv4_community4_exact_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_bgp_community, show_bgp_community_cmd, "show bgp community (AA:NN|local-AS|no-advertise|no-export)", @@ -10326,136 +10514,71 @@ DEFUN (show_bgp_community, return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_UNICAST); } -ALIAS (show_bgp_community, - show_bgp_ipv6_community_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_community2_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_ipv6_community2_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_community3_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_ipv6_community3_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_community4_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -ALIAS (show_bgp_community, - show_bgp_ipv6_community4_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_ipv6_bgp_community, show_ipv6_bgp_community_cmd, "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)", @@ -10473,68 +10596,136 @@ DEFUN (show_ipv6_bgp_community, } /* old command */ -ALIAS (show_ipv6_bgp_community, - show_ipv6_bgp_community2_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ -ALIAS (show_ipv6_bgp_community, - show_ipv6_bgp_community3_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ -ALIAS (show_ipv6_bgp_community, - show_ipv6_bgp_community4_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + */ DEFUN (show_bgp_community_exact, show_bgp_community_exact_cmd, "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", @@ -10550,143 +10741,74 @@ DEFUN (show_bgp_community_exact, return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_UNICAST); } -ALIAS (show_bgp_community_exact, - show_bgp_ipv6_community_exact_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_community2_exact_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_ipv6_community2_exact_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_community3_exact_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_ipv6_community3_exact_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_community4_exact_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -ALIAS (show_bgp_community_exact, - show_bgp_ipv6_community4_exact_cmd, - "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + */ DEFUN (show_ipv6_bgp_community_exact, show_ipv6_bgp_community_exact_cmd, "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", @@ -10705,72 +10827,69 @@ DEFUN (show_ipv6_bgp_community_exact, } /* old command */ -ALIAS (show_ipv6_bgp_community_exact, - show_ipv6_bgp_community2_exact_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ -ALIAS (show_ipv6_bgp_community_exact, - show_ipv6_bgp_community3_exact_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ -ALIAS (show_ipv6_bgp_community_exact, - show_ipv6_bgp_community4_exact_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * + */ DEFUN (show_ipv6_mbgp_community, show_ipv6_mbgp_community_cmd, "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)", @@ -10788,69 +10907,72 @@ DEFUN (show_ipv6_mbgp_community, } /* old command */ -ALIAS (show_ipv6_mbgp_community, - show_ipv6_mbgp_community2_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ -ALIAS (show_ipv6_mbgp_community, - show_ipv6_mbgp_community3_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ -ALIAS (show_ipv6_mbgp_community, - show_ipv6_mbgp_community4_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") /* old command */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", + * SHOW_STR + * IPV6_STR + * MBGP_STR + * "Display routes matching the communities\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * COMMUNITY_AANN_STR + * "Do not send outside local AS (well-known community)\n" + * "Do not advertise to any peer (well-known community)\n" + * "Do not export to next AS (well-known community)\n" + * "Exact match of the communities" + * + */ DEFUN (show_ipv6_mbgp_community_exact, show_ipv6_mbgp_community_exact_cmd, "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", @@ -10869,70 +10991,10 @@ DEFUN (show_ipv6_mbgp_community_exact, } /* old command */ -ALIAS (show_ipv6_mbgp_community_exact, - show_ipv6_mbgp_community2_exact_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ -ALIAS (show_ipv6_mbgp_community_exact, - show_ipv6_mbgp_community3_exact_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") /* old command */ -ALIAS (show_ipv6_mbgp_community_exact, - show_ipv6_mbgp_community4_exact_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") #endif /* HAVE_IPV6 */ static int @@ -11043,6 +11105,17 @@ DEFUN (show_ip_bgp_ipv4_community_list_exact, } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 community-list (<1-500>|WORD)", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the community-list\n" + * "community-list number\n" + * "community-list name\n" + * + */ DEFUN (show_bgp_community_list, show_bgp_community_list_cmd, "show bgp community-list (<1-500>|WORD)", @@ -11055,15 +11128,6 @@ DEFUN (show_bgp_community_list, return bgp_show_community_list (vty, NULL, argv[3]->arg, 0, AFI_IP6, SAFI_UNICAST); } -ALIAS (show_bgp_community_list, - show_bgp_ipv6_community_list_cmd, - "show bgp ipv6 community-list (<1-500>|WORD)", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") /* old command */ DEFUN (show_ipv6_bgp_community_list, @@ -11093,6 +11157,18 @@ DEFUN (show_ipv6_mbgp_community_list, return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_MULTICAST); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 community-list (<1-500>|WORD) exact-match", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Display routes matching the community-list\n" + * "community-list number\n" + * "community-list name\n" + * "Exact match of the communities\n" + * + */ DEFUN (show_bgp_community_list_exact, show_bgp_community_list_exact_cmd, "show bgp community-list (<1-500>|WORD) exact-match", @@ -11106,16 +11182,6 @@ DEFUN (show_bgp_community_list_exact, return bgp_show_community_list (vty, NULL, argv[3]->arg, 1, AFI_IP6, SAFI_UNICAST); } -ALIAS (show_bgp_community_list_exact, - show_bgp_ipv6_community_list_exact_cmd, - "show bgp ipv6 community-list (<1-500>|WORD) exact-match", - SHOW_STR - BGP_STR - "Address family\n" - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n" - "Exact match of the communities\n") /* old command */ DEFUN (show_ipv6_bgp_community_list_exact, @@ -11204,6 +11270,18 @@ DEFUN (show_ip_bgp_instance_prefix_longer, bgp_show_type_prefix_longer); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics A.B.C.D/M longer-prefixes", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "Display route and more specific routes\n" + * + */ DEFUN (show_ip_bgp_flap_prefix_longer, show_ip_bgp_flap_prefix_longer_cmd, "show ip bgp flap-statistics A.B.C.D/M longer-prefixes", @@ -11218,16 +11296,6 @@ DEFUN (show_ip_bgp_flap_prefix_longer, bgp_show_type_flap_prefix_longer); } -ALIAS (show_ip_bgp_flap_prefix_longer, - show_ip_bgp_damp_flap_prefix_longer_cmd, - "show ip bgp dampening flap-statistics A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display route and more specific routes\n") DEFUN (show_ip_bgp_ipv4_prefix_longer, show_ip_bgp_ipv4_prefix_longer_cmd, @@ -11249,6 +11317,17 @@ DEFUN (show_ip_bgp_ipv4_prefix_longer, bgp_show_type_prefix_longer); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics A.B.C.D", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "Network in the BGP routing table to display\n" + * + */ DEFUN (show_ip_bgp_flap_address, show_ip_bgp_flap_address_cmd, "show ip bgp flap-statistics A.B.C.D", @@ -11262,16 +11341,18 @@ DEFUN (show_ip_bgp_flap_address, bgp_show_type_flap_address); } -ALIAS (show_ip_bgp_flap_address, - show_ip_bgp_damp_flap_address_cmd, - "show ip bgp dampening flap-statistics A.B.C.D", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "Network in the BGP routing table to display\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics A.B.C.D/M", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * + */ DEFUN (show_ip_bgp_flap_prefix, show_ip_bgp_flap_prefix_cmd, "show ip bgp flap-statistics A.B.C.D/M", @@ -11285,17 +11366,18 @@ DEFUN (show_ip_bgp_flap_prefix, bgp_show_type_flap_prefix); } -ALIAS (show_ip_bgp_flap_prefix, - show_ip_bgp_damp_flap_prefix_cmd, - "show ip bgp dampening flap-statistics A.B.C.D/M", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n" - "IP prefix /, e.g., 35.0.0.0/8\n") #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 X:X::X:X/M longer-prefixes", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "IPv6 prefix /\n" + * "Display route and more specific routes\n" + * + */ DEFUN (show_bgp_prefix_longer, show_bgp_prefix_longer_cmd, "show bgp X:X::X:X/M longer-prefixes", @@ -11308,14 +11390,6 @@ DEFUN (show_bgp_prefix_longer, bgp_show_type_prefix_longer); } -ALIAS (show_bgp_prefix_longer, - show_bgp_ipv6_prefix_longer_cmd, - "show bgp ipv6 X:X::X:X/M longer-prefixes", - SHOW_STR - BGP_STR - "Address family\n" - "IPv6 prefix /\n" - "Display route and more specific routes\n") /* old command */ DEFUN (show_ipv6_bgp_prefix_longer, @@ -12358,6 +12432,21 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", @@ -12385,6 +12474,20 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_neighbor_advertised_route, show_ip_bgp_neighbor_advertised_route_cmd, "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", @@ -12415,32 +12518,25 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); } -ALIAS (show_ip_bgp_neighbor_advertised_route, - show_ip_bgp_neighbor_advertised_route_rmap_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_instance_neighbor_advertised_route, - show_ip_bgp_instance_neighbor_advertised_route_rmap_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "Route-map to control what is displayed\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, show_ip_bgp_ipv4_neighbor_advertised_route_cmd, "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", @@ -12474,24 +12570,23 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); } -ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route, - show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "Route-map to control what is displayed\n" - "JavaScript Object Notation\n") #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_neighbor_advertised_route, show_bgp_instance_neighbor_advertised_route_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", @@ -12519,20 +12614,32 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, uj); } -ALIAS (show_bgp_instance_neighbor_advertised_route, - show_bgp_instance_ipv6_neighbor_advertised_route_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "JavaScript Object Notation\n" + * + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the routes advertised to a BGP neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_neighbor_advertised_route, show_bgp_neighbor_advertised_route_cmd, "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", @@ -12561,32 +12668,8 @@ DEFUN (show_bgp_neighbor_advertised_route, return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, rmap_name, uj); } -ALIAS (show_bgp_neighbor_advertised_route, - show_bgp_ipv6_neighbor_advertised_route_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") /* old command */ -ALIAS (show_bgp_neighbor_advertised_route, - ipv6_bgp_neighbor_advertised_route_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", - SHOW_STR - IPV6_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") /* old command */ DEFUN (ipv6_mbgp_neighbor_advertised_route, @@ -12615,6 +12698,21 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, } #endif /* HAVE_IPV6 */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_neighbor_received_routes, show_bgp_instance_neighbor_received_routes_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", @@ -12638,6 +12736,21 @@ DEFUN (show_bgp_instance_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, NULL, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_instance_neighbor_received_routes, show_ip_bgp_instance_neighbor_received_routes_cmd, "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", @@ -12662,20 +12775,21 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL, uj); } -ALIAS (show_bgp_instance_neighbor_received_routes, - show_bgp_instance_ipv6_neighbor_received_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_neighbor_received_routes, show_ip_bgp_neighbor_received_routes_cmd, "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", @@ -12705,33 +12819,25 @@ DEFUN (show_ip_bgp_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); } -ALIAS (show_ip_bgp_neighbor_received_routes, - show_ip_bgp_neighbor_received_routes_rmap_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_instance_neighbor_received_routes, - show_ip_bgp_instance_neighbor_received_routes_rmap_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, show_ip_bgp_ipv4_neighbor_received_routes_cmd, "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", @@ -12765,21 +12871,6 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); } -ALIAS (show_ip_bgp_ipv4_neighbor_received_routes, - show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, @@ -13021,6 +13112,31 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, return CMD_SUCCESS; } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the received routes from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_neighbor_received_routes, show_bgp_neighbor_received_routes_cmd, "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", @@ -13048,19 +13164,22 @@ DEFUN (show_bgp_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, rmap_name, uj); } -ALIAS (show_bgp_neighbor_received_routes, - show_bgp_ipv6_neighbor_received_routes_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display information received from a BGP neighbor\n" + * "Display the prefixlist filter\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_neighbor_received_prefix_filter, show_bgp_neighbor_received_prefix_filter_cmd, "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", @@ -13147,33 +13266,8 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, return CMD_SUCCESS; } -ALIAS (show_bgp_neighbor_received_prefix_filter, - show_bgp_ipv6_neighbor_received_prefix_filter_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display information received from a BGP neighbor\n" - "Display the prefixlist filter\n" - "JavaScript Object Notation\n") /* old command */ -ALIAS (show_bgp_neighbor_received_routes, - ipv6_bgp_neighbor_received_routes_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", - SHOW_STR - IPV6_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") /* old command */ DEFUN (ipv6_mbgp_neighbor_received_routes, @@ -13200,6 +13294,22 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display information received from a BGP neighbor\n" + * "Display the prefixlist filter\n" + * "JavaScript Object NOtation\n" + * + */ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, show_bgp_instance_neighbor_received_prefix_filter_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", @@ -13292,20 +13402,6 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, return CMD_SUCCESS; } -ALIAS (show_bgp_instance_neighbor_received_prefix_filter, - show_bgp_instance_ipv6_neighbor_received_prefix_filter_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display information received from a BGP neighbor\n" - "Display the prefixlist filter\n" - "JavaScript Object NOtation\n") #endif /* HAVE_IPV6 */ static int @@ -13459,6 +13555,21 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_neighbor_routes, show_bgp_instance_neighbor_routes_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", @@ -13483,20 +13594,43 @@ DEFUN (show_bgp_instance_neighbor_routes, bgp_show_type_neighbor, uj); } -ALIAS (show_bgp_instance_neighbor_routes, - show_bgp_instance_ipv6_neighbor_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * SHOW_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the dampened routes received from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the dampened routes received from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display the dampened routes received from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_neighbor_damp, show_bgp_instance_neighbor_damp_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", @@ -13526,20 +13660,43 @@ DEFUN (show_bgp_instance_neighbor_damp, bgp_show_type_damp_neighbor, uj); } -ALIAS (show_bgp_instance_neighbor_damp, - show_bgp_instance_ipv6_neighbor_damp_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * SHOW_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display flap statistics of the routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display flap statistics of the routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display flap statistics of the routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_instance_neighbor_flap, show_bgp_instance_neighbor_flap_cmd, "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", @@ -13569,20 +13726,32 @@ DEFUN (show_bgp_instance_neighbor_flap, bgp_show_type_flap_neighbor, uj); } -ALIAS (show_bgp_instance_neighbor_flap, - show_bgp_instance_ipv6_neighbor_flap_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display flap statistics of the routes learned from neighbor\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * SHOW_STR + * IPV6_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "Display routes learned from neighbor\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_bgp_neighbor_routes, show_bgp_neighbor_routes_cmd, "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", @@ -13607,32 +13776,8 @@ DEFUN (show_bgp_neighbor_routes, } -ALIAS (show_bgp_neighbor_routes, - show_bgp_ipv6_neighbor_routes_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") /* old command */ -ALIAS (show_bgp_neighbor_routes, - ipv6_bgp_neighbor_routes_cmd, - "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", - SHOW_STR - IPV6_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") /* old command */ DEFUN (ipv6_mbgp_neighbor_routes, @@ -13660,55 +13805,9 @@ DEFUN (ipv6_mbgp_neighbor_routes, bgp_show_type_neighbor, uj); } -ALIAS (show_bgp_instance_neighbor_flap, - show_bgp_neighbor_flap_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display flap statistics of the routes learned from neighbor\n" - "JavaScript Object Notation\n") -ALIAS (show_bgp_instance_neighbor_flap, - show_bgp_ipv6_neighbor_flap_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display flap statistics of the routes learned from neighbor\n" - "JavaScript Object Notation\n") -ALIAS (show_bgp_instance_neighbor_damp, - show_bgp_neighbor_damp_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") -ALIAS (show_bgp_instance_neighbor_damp, - show_bgp_ipv6_neighbor_damp_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") #endif /* HAVE_IPV6 */ @@ -13919,6 +14018,14 @@ DEFUN (bgp_distance, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no distance bgp", + * NO_STR + * "Define an administrative distance\n" + * "BGP distance\n" + * + */ DEFUN (no_bgp_distance, no_bgp_distance_cmd, "no distance bgp <1-255> <1-255> <1-255>", @@ -13939,12 +14046,6 @@ DEFUN (no_bgp_distance, return CMD_SUCCESS; } -ALIAS (no_bgp_distance, - no_bgp_distance2_cmd, - "no distance bgp", - NO_STR - "Define an administrative distance\n" - "BGP distance\n") DEFUN (bgp_distance_source, bgp_distance_source_cmd, @@ -13994,6 +14095,18 @@ DEFUN (no_bgp_distance_source_access_list, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "bgp dampening", + * "BGP Specific commands\n" + * "Enable route-flap dampening\n" + * + * "bgp dampening <1-45>", + * "BGP Specific commands\n" + * "Enable route-flap dampening\n" + * "Half-life time for the penalty\n" + * + */ DEFUN (bgp_damp_set, bgp_damp_set_cmd, "bgp dampening <1-45> <1-20000> <1-20000> <1-255>", @@ -14036,19 +14149,26 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } -ALIAS (bgp_damp_set, - bgp_damp_set2_cmd, - "bgp dampening <1-45>", - "BGP Specific commands\n" - "Enable route-flap dampening\n" - "Half-life time for the penalty\n") -ALIAS (bgp_damp_set, - bgp_damp_set3_cmd, - "bgp dampening", - "BGP Specific commands\n" - "Enable route-flap dampening\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp dampening <1-45>", + * NO_STR + * "BGP Specific commands\n" + * "Enable route-flap dampening\n" + * "Half-life time for the penalty\n" + * + * "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>", + * NO_STR + * "BGP Specific commands\n" + * "Enable route-flap dampening\n" + * "Half-life time for the penalty\n" + * "Value to start reusing a route\n" + * "Value to start suppressing a route\n" + * "Maximum duration to suppress a stable route\n" + * + */ DEFUN (bgp_damp_unset, bgp_damp_unset_cmd, "no bgp dampening", @@ -14062,25 +14182,18 @@ DEFUN (bgp_damp_unset, return bgp_damp_disable (bgp, bgp_node_afi (vty), bgp_node_safi (vty)); } -ALIAS (bgp_damp_unset, - bgp_damp_unset2_cmd, - "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>", - NO_STR - "BGP Specific commands\n" - "Enable route-flap dampening\n" - "Half-life time for the penalty\n" - "Value to start reusing a route\n" - "Value to start suppressing a route\n" - "Maximum duration to suppress a stable route\n") -ALIAS (bgp_damp_unset, - bgp_damp_unset3_cmd, - "no bgp dampening <1-45>", - NO_STR - "BGP Specific commands\n" - "Enable route-flap dampening\n" - "Half-life time for the penalty\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening dampened-paths", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display paths suppressed due to dampening\n" + * + */ DEFUN (show_ip_bgp_dampened_paths, show_ip_bgp_dampened_paths_cmd, "show ip bgp dampened-paths", @@ -14093,15 +14206,17 @@ DEFUN (show_ip_bgp_dampened_paths, NULL, 0); } -ALIAS (show_ip_bgp_dampened_paths, - show_ip_bgp_damp_dampened_paths_cmd, - "show ip bgp dampening dampened-paths", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display paths suppressed due to dampening\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp dampening flap-statistics", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display detailed information about dampening\n" + * "Display flap statistics of routes\n" + * + */ DEFUN (show_ip_bgp_flap_statistics, show_ip_bgp_flap_statistics_cmd, "show ip bgp flap-statistics", @@ -14114,14 +14229,6 @@ DEFUN (show_ip_bgp_flap_statistics, bgp_show_type_flap_statistics, NULL, 0); } -ALIAS (show_ip_bgp_flap_statistics, - show_ip_bgp_damp_flap_statistics_cmd, - "show ip bgp dampening flap-statistics", - SHOW_STR - IP_STR - BGP_STR - "Display detailed information about dampening\n" - "Display flap statistics of routes\n") /* Display specified route of BGP table. */ static int @@ -14478,12 +14585,6 @@ bgp_route_init (void) install_element (BGP_NODE, &no_bgp_network_cmd); install_element (BGP_NODE, &no_bgp_network_mask_cmd); install_element (BGP_NODE, &no_bgp_network_mask_natural_cmd); - install_element (BGP_NODE, &no_bgp_network_route_map_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_route_map_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_natural_route_map_cmd); - install_element (BGP_NODE, &no_bgp_network_backdoor_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_backdoor_cmd); - install_element (BGP_NODE, &no_bgp_network_mask_natural_backdoor_cmd); install_element (BGP_NODE, &aggregate_address_cmd); install_element (BGP_NODE, &aggregate_address_mask_cmd); @@ -14493,18 +14594,8 @@ bgp_route_init (void) install_element (BGP_NODE, &aggregate_address_mask_as_set_cmd); install_element (BGP_NODE, &aggregate_address_as_set_summary_cmd); install_element (BGP_NODE, &aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_NODE, &aggregate_address_summary_as_set_cmd); - install_element (BGP_NODE, &aggregate_address_mask_summary_as_set_cmd); install_element (BGP_NODE, &no_aggregate_address_cmd); - install_element (BGP_NODE, &no_aggregate_address_summary_only_cmd); - install_element (BGP_NODE, &no_aggregate_address_as_set_cmd); - install_element (BGP_NODE, &no_aggregate_address_as_set_summary_cmd); - install_element (BGP_NODE, &no_aggregate_address_summary_as_set_cmd); install_element (BGP_NODE, &no_aggregate_address_mask_cmd); - install_element (BGP_NODE, &no_aggregate_address_mask_summary_only_cmd); - install_element (BGP_NODE, &no_aggregate_address_mask_as_set_cmd); - install_element (BGP_NODE, &no_aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_NODE, &no_aggregate_address_mask_summary_as_set_cmd); /* IPv4 unicast configuration. */ install_element (BGP_IPV4_NODE, &bgp_table_map_cmd); @@ -14518,9 +14609,6 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &no_bgp_network_cmd); install_element (BGP_IPV4_NODE, &no_bgp_network_mask_cmd); install_element (BGP_IPV4_NODE, &no_bgp_network_mask_natural_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_route_map_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_route_map_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_network_mask_natural_route_map_cmd); install_element (BGP_IPV4_NODE, &aggregate_address_cmd); install_element (BGP_IPV4_NODE, &aggregate_address_mask_cmd); @@ -14530,18 +14618,8 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &aggregate_address_mask_as_set_cmd); install_element (BGP_IPV4_NODE, &aggregate_address_as_set_summary_cmd); install_element (BGP_IPV4_NODE, &aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_summary_as_set_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_mask_summary_as_set_cmd); install_element (BGP_IPV4_NODE, &no_aggregate_address_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_summary_only_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_as_set_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_as_set_summary_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_summary_as_set_cmd); install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_summary_only_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_as_set_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_summary_as_set_cmd); /* IPv4 multicast configuration. */ install_element (BGP_IPV4M_NODE, &bgp_table_map_cmd); @@ -14555,9 +14633,6 @@ bgp_route_init (void) install_element (BGP_IPV4M_NODE, &no_bgp_network_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_cmd); install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_route_map_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_route_map_cmd); - install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_route_map_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_mask_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_summary_only_cmd); @@ -14566,39 +14641,25 @@ bgp_route_init (void) install_element (BGP_IPV4M_NODE, &aggregate_address_mask_as_set_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_as_set_summary_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_summary_as_set_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_mask_summary_as_set_cmd); install_element (BGP_IPV4M_NODE, &no_aggregate_address_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_summary_only_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_as_set_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_as_set_summary_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_summary_as_set_cmd); install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_summary_only_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_as_set_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_as_set_summary_cmd); - install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_summary_as_set_cmd); install_element (VIEW_NODE, &show_ip_bgp_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_route_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); @@ -14620,26 +14681,11 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_community_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_community_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community2_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community3_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community4_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community2_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community3_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community4_cmd); install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community_all_cmd); install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community2_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community3_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community4_cmd); install_element (VIEW_NODE, &show_ip_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community2_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community3_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community4_exact_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community2_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community3_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community4_exact_cmd); install_element (VIEW_NODE, &show_ip_bgp_community_list_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_community_list_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_list_cmd); @@ -14650,16 +14696,10 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd); install_element (VIEW_NODE, &show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); @@ -14671,23 +14711,15 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_dampd_paths_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_flap_stats_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_dampened_paths_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_statistics_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_address_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_cidr_only_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_cidr_only_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_regexp_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_filter_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_filter_list_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_prefix_list_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_prefix_longer_cmd); install_element (VIEW_NODE, &show_ip_bgp_flap_route_map_cmd); - install_element (VIEW_NODE, &show_ip_bgp_damp_flap_route_map_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_damp_cmd); @@ -14698,14 +14730,11 @@ bgp_route_init (void) install_element (RESTRICTED_NODE, &show_ip_bgp_instance_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_route_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); @@ -14713,47 +14742,28 @@ bgp_route_init (void) install_element (RESTRICTED_NODE, &show_ip_bgp_instance_route_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_community_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community2_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community3_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community4_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community2_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community3_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community4_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community_all_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community2_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community3_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community4_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community2_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community3_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community4_exact_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community2_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community3_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community4_exact_cmd); install_element (ENABLE_NODE, &show_ip_bgp_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_cmd); install_element (ENABLE_NODE, &show_ip_bgp_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_route_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_route_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); @@ -14775,26 +14785,11 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_community_all_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_all_cmd); install_element (ENABLE_NODE, &show_ip_bgp_community_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community2_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community3_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community4_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community2_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community3_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community4_cmd); install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community_all_cmd); install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community2_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community3_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community4_cmd); install_element (ENABLE_NODE, &show_ip_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community2_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community3_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community4_exact_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community2_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community3_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community4_exact_cmd); install_element (ENABLE_NODE, &show_ip_bgp_community_list_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_community_list_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_list_cmd); @@ -14805,16 +14800,10 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd); install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); @@ -14826,25 +14815,15 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_dampd_paths_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_flap_stats_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_dampened_paths_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_statistics_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_address_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_cidr_only_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_cidr_only_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_regexp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_regexp_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_filter_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_filter_list_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_prefix_list_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_prefix_longer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_flap_route_map_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_damp_flap_route_map_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd); @@ -14881,7 +14860,6 @@ bgp_route_init (void) install_element (BGP_IPV6_NODE, &ipv6_bgp_network_route_map_cmd); install_element (BGP_IPV6_NODE, &no_bgp_table_map_cmd); install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_cmd); - install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_route_map_cmd); install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_cmd); install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_summary_only_cmd); @@ -14892,106 +14870,51 @@ bgp_route_init (void) install_element (BGP_IPV6M_NODE, &no_ipv6_bgp_network_cmd); /* Old config IPv6 BGP commands. */ - install_element (BGP_NODE, &old_ipv6_bgp_network_cmd); - install_element (BGP_NODE, &old_no_ipv6_bgp_network_cmd); - install_element (BGP_NODE, &old_ipv6_aggregate_address_cmd); - install_element (BGP_NODE, &old_ipv6_aggregate_address_summary_only_cmd); - install_element (BGP_NODE, &old_no_ipv6_aggregate_address_cmd); - install_element (BGP_NODE, &old_no_ipv6_aggregate_address_summary_only_cmd); install_element (VIEW_NODE, &show_bgp_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_cmd); install_element (VIEW_NODE, &show_bgp_route_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_route_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_cmd); install_element (VIEW_NODE, &show_bgp_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_route_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_prefix_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_prefix_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_cmd); install_element (VIEW_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_regexp_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_regexp_cmd); install_element (VIEW_NODE, &show_bgp_prefix_list_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_prefix_list_cmd); install_element (VIEW_NODE, &show_bgp_filter_list_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_filter_list_cmd); install_element (VIEW_NODE, &show_bgp_route_map_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_route_map_cmd); install_element (VIEW_NODE, &show_bgp_community_all_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community_all_cmd); install_element (VIEW_NODE, &show_bgp_community_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community_cmd); - install_element (VIEW_NODE, &show_bgp_community2_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community2_cmd); - install_element (VIEW_NODE, &show_bgp_community3_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community3_cmd); - install_element (VIEW_NODE, &show_bgp_community4_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community4_cmd); install_element (VIEW_NODE, &show_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community_exact_cmd); - install_element (VIEW_NODE, &show_bgp_community2_exact_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community2_exact_cmd); - install_element (VIEW_NODE, &show_bgp_community3_exact_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community3_exact_cmd); - install_element (VIEW_NODE, &show_bgp_community4_exact_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community4_exact_cmd); install_element (VIEW_NODE, &show_bgp_community_list_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community_list_cmd); install_element (VIEW_NODE, &show_bgp_community_list_exact_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_community_list_exact_cmd); install_element (VIEW_NODE, &show_bgp_prefix_longer_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_bgp_neighbor_flap_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_flap_cmd); - install_element (VIEW_NODE, &show_bgp_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_damp_cmd); install_element (VIEW_NODE, &show_bgp_instance_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_cmd); install_element (VIEW_NODE, &show_bgp_instance_route_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_route_cmd); install_element (VIEW_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_route_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_instance_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_prefix_cmd); install_element (VIEW_NODE, &show_bgp_instance_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_prefix_pathtype_cmd); install_element (VIEW_NODE, &show_bgp_instance_prefix_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_prefix_list_cmd); install_element (VIEW_NODE, &show_bgp_instance_filter_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_filter_list_cmd); install_element (VIEW_NODE, &show_bgp_instance_route_map_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_route_map_cmd); install_element (VIEW_NODE, &show_bgp_instance_community_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_community_list_cmd); install_element (VIEW_NODE, &show_bgp_instance_prefix_longer_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_prefix_longer_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_flap_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_flap_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbor_damp_cmd); /* Restricted: * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) @@ -15000,131 +14923,62 @@ bgp_route_init (void) install_element (RESTRICTED_NODE, &show_bgp_ipv6_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_community_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community2_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community2_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community3_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community3_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community4_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community4_cmd); install_element (RESTRICTED_NODE, &show_bgp_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community2_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community2_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community3_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community3_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community4_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_community4_exact_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_route_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_route_pathtype_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_cmd); install_element (ENABLE_NODE, &show_bgp_route_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_route_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_route_cmd); install_element (ENABLE_NODE, &show_bgp_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_route_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_regexp_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_regexp_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_list_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_list_cmd); install_element (ENABLE_NODE, &show_bgp_filter_list_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_filter_list_cmd); install_element (ENABLE_NODE, &show_bgp_route_map_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_route_map_cmd); install_element (ENABLE_NODE, &show_bgp_community_all_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community_all_cmd); install_element (ENABLE_NODE, &show_bgp_community_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community_cmd); - install_element (ENABLE_NODE, &show_bgp_community2_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community2_cmd); - install_element (ENABLE_NODE, &show_bgp_community3_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community3_cmd); - install_element (ENABLE_NODE, &show_bgp_community4_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community4_cmd); install_element (ENABLE_NODE, &show_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_community2_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community2_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_community3_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community3_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_community4_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community4_exact_cmd); install_element (ENABLE_NODE, &show_bgp_community_list_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community_list_cmd); install_element (ENABLE_NODE, &show_bgp_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_community_list_exact_cmd); install_element (ENABLE_NODE, &show_bgp_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_routes_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbor_flap_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_flap_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbor_damp_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_damp_cmd); install_element (ENABLE_NODE, &show_bgp_instance_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_cmd); install_element (ENABLE_NODE, &show_bgp_instance_route_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_route_cmd); install_element (ENABLE_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_route_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_instance_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_prefix_cmd); install_element (ENABLE_NODE, &show_bgp_instance_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_prefix_pathtype_cmd); install_element (ENABLE_NODE, &show_bgp_instance_prefix_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_prefix_list_cmd); install_element (ENABLE_NODE, &show_bgp_instance_filter_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_filter_list_cmd); install_element (ENABLE_NODE, &show_bgp_instance_route_map_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_route_map_cmd); install_element (ENABLE_NODE, &show_bgp_instance_community_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_community_list_cmd); install_element (ENABLE_NODE, &show_bgp_instance_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_prefix_longer_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_routes_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_flap_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_damp_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_damp_cmd); /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); @@ -15141,13 +14995,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ipv6_bgp_filter_list_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_community_all_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_community_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community2_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community3_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community4_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community2_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community3_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community4_exact_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_community_list_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_community_list_exact_cmd); install_element (VIEW_NODE, &show_ipv6_bgp_prefix_longer_cmd); @@ -15159,13 +15007,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ipv6_mbgp_filter_list_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_community_all_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_community_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community2_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community3_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community4_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community2_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community3_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community4_exact_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_community_list_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_community_list_exact_cmd); install_element (VIEW_NODE, &show_ipv6_mbgp_prefix_longer_cmd); @@ -15179,13 +15021,7 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ipv6_bgp_filter_list_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_community_all_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_community_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community2_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community3_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community4_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community2_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community3_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community4_exact_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_community_list_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_community_list_exact_cmd); install_element (ENABLE_NODE, &show_ipv6_bgp_prefix_longer_cmd); @@ -15197,63 +15033,39 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ipv6_mbgp_filter_list_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_all_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community2_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community3_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community4_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community2_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community3_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community4_exact_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_exact_cmd); install_element (ENABLE_NODE, &show_ipv6_mbgp_prefix_longer_cmd); /* old command */ - install_element (VIEW_NODE, &ipv6_bgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &ipv6_bgp_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); /* old command */ - install_element (VIEW_NODE, &ipv6_bgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &ipv6_bgp_neighbor_received_routes_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); /* old command */ - install_element (VIEW_NODE, &ipv6_bgp_neighbor_routes_cmd); - install_element (ENABLE_NODE, &ipv6_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &ipv6_mbgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_routes_cmd); #endif /* HAVE_IPV6 */ install_element (BGP_NODE, &bgp_distance_cmd); install_element (BGP_NODE, &no_bgp_distance_cmd); - install_element (BGP_NODE, &no_bgp_distance2_cmd); install_element (BGP_NODE, &bgp_distance_source_cmd); install_element (BGP_NODE, &no_bgp_distance_source_cmd); install_element (BGP_NODE, &bgp_distance_source_access_list_cmd); install_element (BGP_NODE, &no_bgp_distance_source_access_list_cmd); install_element (BGP_NODE, &bgp_damp_set_cmd); - install_element (BGP_NODE, &bgp_damp_set2_cmd); - install_element (BGP_NODE, &bgp_damp_set3_cmd); install_element (BGP_NODE, &bgp_damp_unset_cmd); - install_element (BGP_NODE, &bgp_damp_unset2_cmd); - install_element (BGP_NODE, &bgp_damp_unset3_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_set_cmd); - install_element (BGP_IPV4_NODE, &bgp_damp_set2_cmd); - install_element (BGP_IPV4_NODE, &bgp_damp_set3_cmd); install_element (BGP_IPV4_NODE, &bgp_damp_unset_cmd); - install_element (BGP_IPV4_NODE, &bgp_damp_unset2_cmd); - install_element (BGP_IPV4_NODE, &bgp_damp_unset3_cmd); /* IPv4 Multicast Mode */ install_element (BGP_IPV4M_NODE, &bgp_damp_set_cmd); - install_element (BGP_IPV4M_NODE, &bgp_damp_set2_cmd); - install_element (BGP_IPV4M_NODE, &bgp_damp_set3_cmd); install_element (BGP_IPV4M_NODE, &bgp_damp_unset_cmd); - install_element (BGP_IPV4M_NODE, &bgp_damp_unset2_cmd); } void diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 286975f4af..5b170f88f4 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3005,7 +3005,7 @@ DEFUN (match_peer, } DEFUN (match_peer_local, - match_peer_local_cmd, + match_peer_local_cmd, "match peer local", MATCH_STR "Match peer address\n" @@ -3015,6 +3015,22 @@ DEFUN (match_peer_local, RMAP_EVENT_MATCH_DELETED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match peer local", + * NO_STR + * MATCH_STR + * "Match peer address\n" + * "Static or Redistributed routes\n" + * + * "no match peer (A.B.C.D|X:X::X:X)", + * NO_STR + * MATCH_STR + * "Match peer address\n" + * "IP address of peer\n" + * "IPv6 address of peer\n" + * + */ DEFUN (no_match_peer, no_match_peer_cmd, "no match peer", @@ -3026,24 +3042,9 @@ DEFUN (no_match_peer, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_peer, - no_match_peer_val_cmd, - "no match peer (A.B.C.D|X:X::X:X)", - NO_STR - MATCH_STR - "Match peer address\n" - "IP address of peer\n" - "IPv6 address of peer\n") -ALIAS (no_match_peer, - no_match_peer_local_cmd, - "no match peer local", - NO_STR - MATCH_STR - "Match peer address\n" - "Static or Redistributed routes\n") -DEFUN (match_ip_address, +DEFUN (match_ip_address, match_ip_address_cmd, "match ip address (<1-199>|<1300-2699>|WORD)", MATCH_STR @@ -3057,7 +3058,19 @@ DEFUN (match_ip_address, RMAP_EVENT_FILTER_ADDED); } -DEFUN (no_match_ip_address, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ +DEFUN (no_match_ip_address, no_match_ip_address_cmd, "no match ip address", NO_STR @@ -3069,18 +3082,8 @@ DEFUN (no_match_ip_address, RMAP_EVENT_FILTER_DELETED); } -ALIAS (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -DEFUN (match_ip_next_hop, +DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, "match ip next-hop (<1-199>|<1300-2699>|WORD)", MATCH_STR @@ -3094,6 +3097,18 @@ DEFUN (match_ip_next_hop, RMAP_EVENT_FILTER_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, "no match ip next-hop", @@ -3106,16 +3121,6 @@ DEFUN (no_match_ip_next_hop, RMAP_EVENT_FILTER_DELETED); } -ALIAS (no_match_ip_next_hop, - no_match_ip_next_hop_val_cmd, - "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") /* match probability { */ @@ -3130,6 +3135,15 @@ DEFUN (match_probability, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match probability <1-99>", + * NO_STR + * MATCH_STR + * "Match portion of routes defined by percentage value\n" + * "Percentage of routes\n" + * + */ DEFUN (no_match_probability, no_match_probability_cmd, "no match probability", @@ -3141,17 +3155,10 @@ DEFUN (no_match_probability, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_probability, - no_match_probability_val_cmd, - "no match probability <1-99>", - NO_STR - MATCH_STR - "Match portion of routes defined by percentage value\n" - "Percentage of routes\n") /* } */ -DEFUN (match_ip_route_source, +DEFUN (match_ip_route_source, match_ip_route_source_cmd, "match ip route-source (<1-199>|<1300-2699>|WORD)", MATCH_STR @@ -3165,6 +3172,18 @@ DEFUN (match_ip_route_source, RMAP_EVENT_FILTER_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip route-source (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match advertising source address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP standard access-list name\n" + * + */ DEFUN (no_match_ip_route_source, no_match_ip_route_source_cmd, "no match ip route-source", @@ -3177,18 +3196,8 @@ DEFUN (no_match_ip_route_source, argv[4]->arg, RMAP_EVENT_FILTER_DELETED); } -ALIAS (no_match_ip_route_source, - no_match_ip_route_source_val_cmd, - "no match ip route-source (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match advertising source address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP standard access-list name\n") -DEFUN (match_ip_address_prefix_list, +DEFUN (match_ip_address_prefix_list, match_ip_address_prefix_list_cmd, "match ip address prefix-list WORD", MATCH_STR @@ -3201,6 +3210,17 @@ DEFUN (match_ip_address_prefix_list, argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, "no match ip address prefix-list", @@ -3214,17 +3234,8 @@ DEFUN (no_match_ip_address_prefix_list, argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -DEFUN (match_ip_next_hop_prefix_list, +DEFUN (match_ip_next_hop_prefix_list, match_ip_next_hop_prefix_list_cmd, "match ip next-hop prefix-list WORD", MATCH_STR @@ -3237,6 +3248,17 @@ DEFUN (match_ip_next_hop_prefix_list, argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, "no match ip next-hop prefix-list", @@ -3250,17 +3272,8 @@ DEFUN (no_match_ip_next_hop_prefix_list, argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } -ALIAS (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_val_cmd, - "no match ip next-hop prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -DEFUN (match_ip_route_source_prefix_list, +DEFUN (match_ip_route_source_prefix_list, match_ip_route_source_prefix_list_cmd, "match ip route-source prefix-list WORD", MATCH_STR @@ -3273,6 +3286,17 @@ DEFUN (match_ip_route_source_prefix_list, argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip route-source prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match advertising source address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_route_source_prefix_list, no_match_ip_route_source_prefix_list_cmd, "no match ip route-source prefix-list", @@ -3286,17 +3310,8 @@ DEFUN (no_match_ip_route_source_prefix_list, argv[5]->arg, RMAP_EVENT_PLIST_DELETED); } -ALIAS (no_match_ip_route_source_prefix_list, - no_match_ip_route_source_prefix_list_val_cmd, - "no match ip route-source prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match advertising source address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -DEFUN (match_metric, +DEFUN (match_metric, match_metric_cmd, "match metric <0-4294967295>", MATCH_STR @@ -3307,6 +3322,15 @@ DEFUN (match_metric, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match metric <0-4294967295>", + * NO_STR + * MATCH_STR + * "Match metric of route\n" + * "Metric value\n" + * + */ DEFUN (no_match_metric, no_match_metric_cmd, "no match metric", @@ -3319,13 +3343,6 @@ DEFUN (no_match_metric, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_metric, - no_match_metric_val_cmd, - "no match metric <0-4294967295>", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") DEFUN (match_local_pref, match_local_pref_cmd, @@ -3338,6 +3355,15 @@ DEFUN (match_local_pref, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match local-preference <0-4294967295>", + * NO_STR + * MATCH_STR + * "Match local preference of route\n" + * "Local preference value\n" + * + */ DEFUN (no_match_local_pref, no_match_local_pref_cmd, "no match local-preference", @@ -3350,15 +3376,8 @@ DEFUN (no_match_local_pref, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_local_pref, - no_match_local_pref_val_cmd, - "no match local-preference <0-4294967295>", - NO_STR - MATCH_STR - "Match local preference of route\n" - "Local preference value\n") -DEFUN (match_community, +DEFUN (match_community, match_community_cmd, "match community (<1-99>|<100-500>|WORD)", MATCH_STR @@ -3371,7 +3390,7 @@ DEFUN (match_community, RMAP_EVENT_CLIST_ADDED); } -DEFUN (match_community_exact, +DEFUN (match_community_exact, match_community_exact_cmd, "match community (<1-99>|<100-500>|WORD) exact-match", MATCH_STR @@ -3397,6 +3416,26 @@ DEFUN (match_community_exact, return ret; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match community (<1-99>|<100-500>|WORD)", + * NO_STR + * MATCH_STR + * "Match BGP community list\n" + * "Community-list number (standard)\n" + * "Community-list number (expanded)\n" + * "Community-list name\n" + * + * "no match community (<1-99>|<100-500>|WORD) exact-match", + * NO_STR + * MATCH_STR + * "Match BGP community list\n" + * "Community-list number (standard)\n" + * "Community-list number (expanded)\n" + * "Community-list name\n" + * "Do exact matching of communities\n" + * + */ DEFUN (no_match_community, no_match_community_cmd, "no match community", @@ -3408,28 +3447,9 @@ DEFUN (no_match_community, RMAP_EVENT_CLIST_DELETED); } -ALIAS (no_match_community, - no_match_community_val_cmd, - "no match community (<1-99>|<100-500>|WORD)", - NO_STR - MATCH_STR - "Match BGP community list\n" - "Community-list number (standard)\n" - "Community-list number (expanded)\n" - "Community-list name\n") -ALIAS (no_match_community, - no_match_community_exact_cmd, - "no match community (<1-99>|<100-500>|WORD) exact-match", - NO_STR - MATCH_STR - "Match BGP community list\n" - "Community-list number (standard)\n" - "Community-list number (expanded)\n" - "Community-list name\n" - "Do exact matching of communities\n") -DEFUN (match_ecommunity, +DEFUN (match_ecommunity, match_ecommunity_cmd, "match extcommunity (<1-99>|<100-500>|WORD)", MATCH_STR @@ -3442,6 +3462,17 @@ DEFUN (match_ecommunity, RMAP_EVENT_ECLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match extcommunity (<1-99>|<100-500>|WORD)", + * NO_STR + * MATCH_STR + * "Match BGP/VPN extended community list\n" + * "Extended community-list number (standard)\n" + * "Extended community-list number (expanded)\n" + * "Extended community-list name\n" + * + */ DEFUN (no_match_ecommunity, no_match_ecommunity_cmd, "no match extcommunity", @@ -3453,15 +3484,6 @@ DEFUN (no_match_ecommunity, RMAP_EVENT_ECLIST_DELETED); } -ALIAS (no_match_ecommunity, - no_match_ecommunity_val_cmd, - "no match extcommunity (<1-99>|<100-500>|WORD)", - NO_STR - MATCH_STR - "Match BGP/VPN extended community list\n" - "Extended community-list number (standard)\n" - "Extended community-list number (expanded)\n" - "Extended community-list name\n") DEFUN (match_aspath, match_aspath_cmd, @@ -3474,6 +3496,15 @@ DEFUN (match_aspath, RMAP_EVENT_ASLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match as-path WORD", + * NO_STR + * MATCH_STR + * "Match BGP AS path list\n" + * "AS path access-list name\n" + * + */ DEFUN (no_match_aspath, no_match_aspath_cmd, "no match as-path", @@ -3485,13 +3516,6 @@ DEFUN (no_match_aspath, RMAP_EVENT_ASLIST_DELETED); } -ALIAS (no_match_aspath, - no_match_aspath_val_cmd, - "no match as-path WORD", - NO_STR - MATCH_STR - "Match BGP AS path list\n" - "AS path access-list name\n") DEFUN (match_origin, match_origin_cmd, @@ -3515,6 +3539,17 @@ DEFUN (match_origin, return CMD_WARNING; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match origin (egp|igp|incomplete)", + * NO_STR + * MATCH_STR + * "BGP origin code\n" + * "remote EGP\n" + * "local IGP\n" + * "unknown heritage\n" + * + */ DEFUN (no_match_origin, no_match_origin_cmd, "no match origin", @@ -3526,15 +3561,6 @@ DEFUN (no_match_origin, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_origin, - no_match_origin_val_cmd, - "no match origin (egp|igp|incomplete)", - NO_STR - MATCH_STR - "BGP origin code\n" - "remote EGP\n" - "local IGP\n" - "unknown heritage\n") DEFUN (match_interface, match_interface_cmd, @@ -3547,6 +3573,15 @@ DEFUN (match_interface, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * NO_STR + * MATCH_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (no_match_interface, no_match_interface_cmd, "no match interface", @@ -3558,13 +3593,6 @@ DEFUN (no_match_interface, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_interface, - no_match_interface_val_cmd, - "no match interface WORD", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") DEFUN (match_tag, match_tag_cmd, @@ -3577,6 +3605,15 @@ DEFUN (match_tag, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match tag <1-65535>", + * NO_STR + * MATCH_STR + * "Match tag of route\n" + * "Tag value\n" + * + */ DEFUN (no_match_tag, no_match_tag_cmd, "no match tag", @@ -3588,13 +3625,6 @@ DEFUN (no_match_tag, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_tag, - no_match_tag_val_cmd, - "no match tag <1-65535>", - NO_STR - MATCH_STR - "Match tag of route\n" - "Tag value\n") DEFUN (set_ip_nexthop, @@ -3647,6 +3677,23 @@ DEFUN (set_ip_nexthop_unchanged, return bgp_route_set_add (vty, vty->index, "ip next-hop", "unchanged"); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set ip next-hop peer-address", + * NO_STR + * SET_STR + * IP_STR + * "Next hop address\n" + * "Use peer address (for BGP only)\n" + * + * "no set ip next-hop A.B.C.D", + * NO_STR + * SET_STR + * IP_STR + * "Next hop address\n" + * "IP address of next hop\n" + * + */ DEFUN (no_set_ip_nexthop, no_set_ip_nexthop_cmd, "no set ip next-hop", @@ -3657,24 +3704,23 @@ DEFUN (no_set_ip_nexthop, return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } -ALIAS (no_set_ip_nexthop, - no_set_ip_nexthop_val_cmd, - "no set ip next-hop A.B.C.D", - NO_STR - SET_STR - IP_STR - "Next hop address\n" - "IP address of next hop\n") -ALIAS (no_set_ip_nexthop, - no_set_ip_nexthop_peer_cmd, - "no set ip next-hop peer-address", - NO_STR - SET_STR - IP_STR - "Next hop address\n" - "Use peer address (for BGP only)\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "set metric (rtt|+rtt|-rtt)", + * SET_STR + * "Metric value for destination routing protocol\n" + * "Assign round trip time\n" + * "Add round trip time\n" + * "Subtract round trip time\n" + * + * "set metric <+/-metric>", + * SET_STR + * "Metric value for destination routing protocol\n" + * "Add or subtract metric\n" + * + */ DEFUN (set_metric, set_metric_cmd, "set metric <0-4294967295>", @@ -3685,22 +3731,17 @@ DEFUN (set_metric, return bgp_route_set_add (vty, vty->index, "metric", argv[2]->arg); } -ALIAS (set_metric, - set_metric_addsub_cmd, - "set metric <+/-metric>", - SET_STR - "Metric value for destination routing protocol\n" - "Add or subtract metric\n") -ALIAS (set_metric, - set_metric_rtt_cmd, - "set metric (rtt|+rtt|-rtt)", - SET_STR - "Metric value for destination routing protocol\n" - "Assign round trip time\n" - "Add round trip time\n" - "Subtract round trip time\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric <0-4294967295>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Metric value\n" + * + */ DEFUN (no_set_metric, no_set_metric_cmd, "no set metric", @@ -3711,13 +3752,6 @@ DEFUN (no_set_metric, return bgp_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") DEFUN (set_local_pref, set_local_pref_cmd, @@ -3729,6 +3763,15 @@ DEFUN (set_local_pref, return bgp_route_set_add (vty, vty->index, "local-preference", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set local-preference <0-4294967295>", + * NO_STR + * SET_STR + * "BGP local preference path attribute\n" + * "Preference value\n" + * + */ DEFUN (no_set_local_pref, no_set_local_pref_cmd, "no set local-preference", @@ -3739,13 +3782,6 @@ DEFUN (no_set_local_pref, return bgp_route_set_delete (vty, vty->index, "local-preference", argv[3]->arg); } -ALIAS (no_set_local_pref, - no_set_local_pref_val_cmd, - "no set local-preference <0-4294967295>", - NO_STR - SET_STR - "BGP local preference path attribute\n" - "Preference value\n") DEFUN (set_weight, set_weight_cmd, @@ -3757,6 +3793,15 @@ DEFUN (set_weight, return bgp_route_set_add (vty, vty->index, "weight", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set weight <0-4294967295>", + * NO_STR + * SET_STR + * "BGP weight for routing table\n" + * "Weight value\n" + * + */ DEFUN (no_set_weight, no_set_weight_cmd, "no set weight", @@ -3767,14 +3812,17 @@ DEFUN (no_set_weight, return bgp_route_set_delete (vty, vty->index, "weight", argv[3]->arg); } -ALIAS (no_set_weight, - no_set_weight_val_cmd, - "no set weight <0-4294967295>", - NO_STR - SET_STR - "BGP weight for routing table\n" - "Weight value\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "set as-path prepend (last-as) <1-10>", + * SET_STR + * "Transform BGP AS_PATH attribute\n" + * "Prepend to the as-path\n" + * "Use the peer's AS-number\n" + * "Number of times to insert" + * + */ DEFUN (set_aspath_prepend, set_aspath_prepend_cmd, "set as-path prepend ." CMD_AS_RANGE, @@ -3793,15 +3841,17 @@ DEFUN (set_aspath_prepend, return ret; } -ALIAS (set_aspath_prepend, - set_aspath_prepend_lastas_cmd, - "set as-path prepend (last-as) <1-10>", - SET_STR - "Transform BGP AS_PATH attribute\n" - "Prepend to the as-path\n" - "Use the peer's AS-number\n" - "Number of times to insert") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set as-path prepend ." CMD_AS_RANGE, + * NO_STR + * SET_STR + * "Transform BGP AS_PATH attribute\n" + * "Prepend to the as-path\n" + * "AS number\n" + * + */ DEFUN (no_set_aspath_prepend, no_set_aspath_prepend_cmd, "no set as-path prepend", @@ -3819,14 +3869,6 @@ DEFUN (no_set_aspath_prepend, return ret; } -ALIAS (no_set_aspath_prepend, - no_set_aspath_prepend_val_cmd, - "no set as-path prepend ." CMD_AS_RANGE, - NO_STR - SET_STR - "Transform BGP AS_PATH attribute\n" - "Prepend to the as-path\n" - "AS number\n") DEFUN (set_aspath_exclude, set_aspath_exclude_cmd, @@ -3845,6 +3887,16 @@ DEFUN (set_aspath_exclude, return ret; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set as-path exclude ." CMD_AS_RANGE, + * NO_STR + * SET_STR + * "Transform BGP AS_PATH attribute\n" + * "Exclude from the as-path\n" + * "AS number\n" + * + */ DEFUN (no_set_aspath_exclude, no_set_aspath_exclude_cmd, "no set as-path exclude", @@ -3862,14 +3914,6 @@ DEFUN (no_set_aspath_exclude, return ret; } -ALIAS (no_set_aspath_exclude, - no_set_aspath_exclude_val_cmd, - "no set as-path exclude ." CMD_AS_RANGE, - NO_STR - SET_STR - "Transform BGP AS_PATH attribute\n" - "Exclude from the as-path\n" - "AS number\n") DEFUN (set_community, set_community_cmd, @@ -3974,6 +4018,21 @@ DEFUN (set_community_none, return bgp_route_set_add (vty, vty->index, "community", "none"); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set community none", + * NO_STR + * SET_STR + * "BGP community attribute\n" + * "No community attribute\n" + * + * "no set community .AA:NN", + * NO_STR + * SET_STR + * "BGP community attribute\n" + * COMMUNITY_VAL_STR + * + */ DEFUN (no_set_community, no_set_community_cmd, "no set community", @@ -3984,21 +4043,7 @@ DEFUN (no_set_community, return bgp_route_set_delete (vty, vty->index, "community", NULL); } -ALIAS (no_set_community, - no_set_community_val_cmd, - "no set community .AA:NN", - NO_STR - SET_STR - "BGP community attribute\n" - COMMUNITY_VAL_STR) -ALIAS (no_set_community, - no_set_community_none_cmd, - "no set community none", - NO_STR - SET_STR - "BGP community attribute\n" - "No community attribute\n") DEFUN (set_community_delete, set_community_delete_cmd, @@ -4022,6 +4067,18 @@ DEFUN (set_community_delete, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set comm-list (<1-99>|<100-500>|WORD) delete", + * NO_STR + * SET_STR + * "set BGP community list (for deletion)\n" + * "Community-list number (standard)\n" + * "Community-list number (expanded)\n" + * "Community-list name\n" + * "Delete matching communities\n" + * + */ DEFUN (no_set_community_delete, no_set_community_delete_cmd, "no set comm-list", @@ -4032,16 +4089,6 @@ DEFUN (no_set_community_delete, return bgp_route_set_delete (vty, vty->index, "comm-list", NULL); } -ALIAS (no_set_community_delete, - no_set_community_delete_val_cmd, - "no set comm-list (<1-99>|<100-500>|WORD) delete", - NO_STR - SET_STR - "set BGP community list (for deletion)\n" - "Community-list number (standard)\n" - "Community-list number (expanded)\n" - "Community-list name\n" - "Delete matching communities\n") DEFUN (set_ecommunity_rt, set_ecommunity_rt_cmd, @@ -4061,6 +4108,16 @@ DEFUN (set_ecommunity_rt, return ret; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set extcommunity rt .ASN:nn_or_IP-address:nn", + * NO_STR + * SET_STR + * "BGP extended community attribute\n" + * "Route Target extended community\n" + * "VPN extended community\n" + * + */ DEFUN (no_set_ecommunity_rt, no_set_ecommunity_rt_cmd, "no set extcommunity rt", @@ -4072,14 +4129,6 @@ DEFUN (no_set_ecommunity_rt, return bgp_route_set_delete (vty, vty->index, "extcommunity rt", NULL); } -ALIAS (no_set_ecommunity_rt, - no_set_ecommunity_rt_val_cmd, - "no set extcommunity rt .ASN:nn_or_IP-address:nn", - NO_STR - SET_STR - "BGP extended community attribute\n" - "Route Target extended community\n" - "VPN extended community\n") DEFUN (set_ecommunity_soo, set_ecommunity_soo_cmd, @@ -4098,6 +4147,16 @@ DEFUN (set_ecommunity_soo, return ret; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set extcommunity soo .ASN:nn_or_IP-address:nn", + * NO_STR + * SET_STR + * "BGP extended community attribute\n" + * "Site-of-Origin extended community\n" + * "VPN extended community\n" + * + */ DEFUN (no_set_ecommunity_soo, no_set_ecommunity_soo_cmd, "no set extcommunity soo", @@ -4109,14 +4168,6 @@ DEFUN (no_set_ecommunity_soo, return bgp_route_set_delete (vty, vty->index, "extcommunity soo", NULL); } -ALIAS (no_set_ecommunity_soo, - no_set_ecommunity_soo_val_cmd, - "no set extcommunity soo .ASN:nn_or_IP-address:nn", - NO_STR - SET_STR - "BGP extended community attribute\n" - "Site-of-Origin extended community\n" - "VPN extended community\n") DEFUN (set_origin, set_origin_cmd, @@ -4137,6 +4188,17 @@ DEFUN (set_origin, return CMD_WARNING; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set origin (egp|igp|incomplete)", + * NO_STR + * SET_STR + * "BGP origin code\n" + * "remote EGP\n" + * "local IGP\n" + * "unknown heritage\n" + * + */ DEFUN (no_set_origin, no_set_origin_cmd, "no set origin", @@ -4147,15 +4209,6 @@ DEFUN (no_set_origin, return bgp_route_set_delete (vty, vty->index, "origin", NULL); } -ALIAS (no_set_origin, - no_set_origin_val_cmd, - "no set origin (egp|igp|incomplete)", - NO_STR - SET_STR - "BGP origin code\n" - "remote EGP\n" - "local IGP\n" - "unknown heritage\n") DEFUN (set_atomic_aggregate, set_atomic_aggregate_cmd, @@ -4208,6 +4261,17 @@ DEFUN (set_aggregator_as, return ret; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set aggregator as " CMD_AS_RANGE " A.B.C.D", + * NO_STR + * SET_STR + * "BGP aggregator attribute\n" + * "AS number of aggregator\n" + * "AS number\n" + * "IP address of aggregator\n" + * + */ DEFUN (no_set_aggregator_as, no_set_aggregator_as_cmd, "no set aggregator as", @@ -4242,15 +4306,6 @@ DEFUN (no_set_aggregator_as, return ret; } -ALIAS (no_set_aggregator_as, - no_set_aggregator_as_val_cmd, - "no set aggregator as " CMD_AS_RANGE " A.B.C.D", - NO_STR - SET_STR - "BGP aggregator attribute\n" - "AS number of aggregator\n" - "AS number\n" - "IP address of aggregator\n") DEFUN (set_tag, set_tag_cmd, @@ -4262,6 +4317,15 @@ DEFUN (set_tag, return bgp_route_set_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set tag <1-65535>", + * NO_STR + * SET_STR + * "Tag value for routing protocol\n" + * "Tag value\n" + * + */ DEFUN (no_set_tag, no_set_tag_cmd, "no set tag", @@ -4272,17 +4336,10 @@ DEFUN (no_set_tag, return bgp_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_set_tag, - no_set_tag_val_cmd, - "no set tag <1-65535>", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") #ifdef HAVE_IPV6 -DEFUN (match_ipv6_address, +DEFUN (match_ipv6_address, match_ipv6_address_cmd, "match ipv6 address WORD", MATCH_STR @@ -4294,7 +4351,7 @@ DEFUN (match_ipv6_address, RMAP_EVENT_FILTER_ADDED); } -DEFUN (no_match_ipv6_address, +DEFUN (no_match_ipv6_address, no_match_ipv6_address_cmd, "no match ipv6 address WORD", NO_STR @@ -4307,7 +4364,7 @@ DEFUN (no_match_ipv6_address, RMAP_EVENT_FILTER_DELETED); } -DEFUN (match_ipv6_next_hop, +DEFUN (match_ipv6_next_hop, match_ipv6_next_hop_cmd, "match ipv6 next-hop X:X::X:X", MATCH_STR @@ -4332,7 +4389,7 @@ DEFUN (no_match_ipv6_next_hop, RMAP_EVENT_MATCH_DELETED); } -DEFUN (match_ipv6_address_prefix_list, +DEFUN (match_ipv6_address_prefix_list, match_ipv6_address_prefix_list_cmd, "match ipv6 address prefix-list WORD", MATCH_STR @@ -4435,6 +4492,17 @@ DEFUN (set_ipv6_nexthop_global, return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set ipv6 next-hop global X:X::X:X", + * NO_STR + * SET_STR + * IPV6_STR + * "IPv6 next-hop address\n" + * "IPv6 global address\n" + * "IPv6 address of next hop\n" + * + */ DEFUN (no_set_ipv6_nexthop_global, no_set_ipv6_nexthop_global_cmd, "no set ipv6 next-hop global", @@ -4447,15 +4515,6 @@ DEFUN (no_set_ipv6_nexthop_global, return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[5]->arg); } -ALIAS (no_set_ipv6_nexthop_global, - no_set_ipv6_nexthop_global_val_cmd, - "no set ipv6 next-hop global X:X::X:X", - NO_STR - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 global address\n" - "IPv6 address of next hop\n") DEFUN (set_ipv6_nexthop_local, set_ipv6_nexthop_local_cmd, @@ -4484,6 +4543,17 @@ DEFUN (set_ipv6_nexthop_local, return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set ipv6 next-hop local X:X::X:X", + * NO_STR + * SET_STR + * IPV6_STR + * "IPv6 next-hop address\n" + * "IPv6 local address\n" + * "IPv6 address of next hop\n" + * + */ DEFUN (no_set_ipv6_nexthop_local, no_set_ipv6_nexthop_local_cmd, "no set ipv6 next-hop local", @@ -4496,15 +4566,6 @@ DEFUN (no_set_ipv6_nexthop_local, return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); } -ALIAS (no_set_ipv6_nexthop_local, - no_set_ipv6_nexthop_local_val_cmd, - "no set ipv6 next-hop local X:X::X:X", - NO_STR - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") #endif /* HAVE_IPV6 */ DEFUN (set_vpnv4_nexthop, @@ -4518,6 +4579,16 @@ DEFUN (set_vpnv4_nexthop, return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set vpnv4 next-hop A.B.C.D", + * NO_STR + * SET_STR + * "VPNv4 information\n" + * "VPNv4 next-hop address\n" + * "IP address of next hop\n" + * + */ DEFUN (no_set_vpnv4_nexthop, no_set_vpnv4_nexthop_cmd, "no set vpnv4 next-hop", @@ -4529,14 +4600,6 @@ DEFUN (no_set_vpnv4_nexthop, return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[4]->arg); } -ALIAS (no_set_vpnv4_nexthop, - no_set_vpnv4_nexthop_val_cmd, - "no set vpnv4 next-hop A.B.C.D", - NO_STR - SET_STR - "VPNv4 information\n" - "VPNv4 next-hop address\n" - "IP address of next hop\n") DEFUN (set_originator_id, set_originator_id_cmd, @@ -4548,6 +4611,15 @@ DEFUN (set_originator_id, return bgp_route_set_add (vty, vty->index, "originator-id", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set originator-id A.B.C.D", + * NO_STR + * SET_STR + * "BGP originator ID attribute\n" + * "IP address of originator\n" + * + */ DEFUN (no_set_originator_id, no_set_originator_id_cmd, "no set originator-id", @@ -4558,13 +4630,6 @@ DEFUN (no_set_originator_id, return bgp_route_set_delete (vty, vty->index, "originator-id", argv[3]->arg); } -ALIAS (no_set_originator_id, - no_set_originator_id_val_cmd, - "no set originator-id A.B.C.D", - NO_STR - SET_STR - "BGP originator ID attribute\n" - "IP address of originator\n") /* Initialization of route map. */ void @@ -4614,112 +4679,74 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &match_peer_cmd); install_element (RMAP_NODE, &match_peer_local_cmd); install_element (RMAP_NODE, &no_match_peer_cmd); - install_element (RMAP_NODE, &no_match_peer_val_cmd); - install_element (RMAP_NODE, &no_match_peer_local_cmd); install_element (RMAP_NODE, &match_ip_address_cmd); install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd); install_element (RMAP_NODE, &match_ip_route_source_cmd); install_element (RMAP_NODE, &no_match_ip_route_source_cmd); - install_element (RMAP_NODE, &no_match_ip_route_source_val_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_route_source_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_route_source_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_route_source_prefix_list_val_cmd); install_element (RMAP_NODE, &match_aspath_cmd); install_element (RMAP_NODE, &no_match_aspath_cmd); - install_element (RMAP_NODE, &no_match_aspath_val_cmd); install_element (RMAP_NODE, &match_metric_cmd); install_element (RMAP_NODE, &no_match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_val_cmd); install_element (RMAP_NODE, &match_local_pref_cmd); install_element (RMAP_NODE, &no_match_local_pref_cmd); - install_element (RMAP_NODE, &no_match_local_pref_val_cmd); install_element (RMAP_NODE, &match_community_cmd); install_element (RMAP_NODE, &match_community_exact_cmd); install_element (RMAP_NODE, &no_match_community_cmd); - install_element (RMAP_NODE, &no_match_community_val_cmd); - install_element (RMAP_NODE, &no_match_community_exact_cmd); install_element (RMAP_NODE, &match_ecommunity_cmd); install_element (RMAP_NODE, &no_match_ecommunity_cmd); - install_element (RMAP_NODE, &no_match_ecommunity_val_cmd); install_element (RMAP_NODE, &match_origin_cmd); install_element (RMAP_NODE, &no_match_origin_cmd); - install_element (RMAP_NODE, &no_match_origin_val_cmd); install_element (RMAP_NODE, &match_probability_cmd); install_element (RMAP_NODE, &no_match_probability_cmd); - install_element (RMAP_NODE, &no_match_probability_val_cmd); install_element (RMAP_NODE, &match_interface_cmd); install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_val_cmd); install_element (RMAP_NODE, &match_tag_cmd); install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_val_cmd); install_element (RMAP_NODE, &set_ip_nexthop_cmd); install_element (RMAP_NODE, &set_ip_nexthop_peer_cmd); install_element (RMAP_NODE, &set_ip_nexthop_unchanged_cmd); install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); - install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd); - install_element (RMAP_NODE, &no_set_ip_nexthop_peer_cmd); install_element (RMAP_NODE, &set_local_pref_cmd); install_element (RMAP_NODE, &no_set_local_pref_cmd); - install_element (RMAP_NODE, &no_set_local_pref_val_cmd); install_element (RMAP_NODE, &set_weight_cmd); install_element (RMAP_NODE, &no_set_weight_cmd); - install_element (RMAP_NODE, &no_set_weight_val_cmd); install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &set_metric_addsub_cmd); - install_element (RMAP_NODE, &set_metric_rtt_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_val_cmd); install_element (RMAP_NODE, &set_aspath_prepend_cmd); - install_element (RMAP_NODE, &set_aspath_prepend_lastas_cmd); install_element (RMAP_NODE, &set_aspath_exclude_cmd); install_element (RMAP_NODE, &no_set_aspath_prepend_cmd); - install_element (RMAP_NODE, &no_set_aspath_prepend_val_cmd); install_element (RMAP_NODE, &no_set_aspath_exclude_cmd); - install_element (RMAP_NODE, &no_set_aspath_exclude_val_cmd); install_element (RMAP_NODE, &set_origin_cmd); install_element (RMAP_NODE, &no_set_origin_cmd); - install_element (RMAP_NODE, &no_set_origin_val_cmd); install_element (RMAP_NODE, &set_atomic_aggregate_cmd); install_element (RMAP_NODE, &no_set_atomic_aggregate_cmd); install_element (RMAP_NODE, &set_aggregator_as_cmd); install_element (RMAP_NODE, &no_set_aggregator_as_cmd); - install_element (RMAP_NODE, &no_set_aggregator_as_val_cmd); install_element (RMAP_NODE, &set_community_cmd); install_element (RMAP_NODE, &set_community_none_cmd); install_element (RMAP_NODE, &no_set_community_cmd); - install_element (RMAP_NODE, &no_set_community_val_cmd); - install_element (RMAP_NODE, &no_set_community_none_cmd); install_element (RMAP_NODE, &set_community_delete_cmd); install_element (RMAP_NODE, &no_set_community_delete_cmd); - install_element (RMAP_NODE, &no_set_community_delete_val_cmd); install_element (RMAP_NODE, &set_ecommunity_rt_cmd); install_element (RMAP_NODE, &no_set_ecommunity_rt_cmd); - install_element (RMAP_NODE, &no_set_ecommunity_rt_val_cmd); install_element (RMAP_NODE, &set_ecommunity_soo_cmd); install_element (RMAP_NODE, &no_set_ecommunity_soo_cmd); - install_element (RMAP_NODE, &no_set_ecommunity_soo_val_cmd); install_element (RMAP_NODE, &set_vpnv4_nexthop_cmd); install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd); - install_element (RMAP_NODE, &no_set_vpnv4_nexthop_val_cmd); install_element (RMAP_NODE, &set_originator_id_cmd); install_element (RMAP_NODE, &no_set_originator_id_cmd); - install_element (RMAP_NODE, &no_set_originator_id_val_cmd); install_element (RMAP_NODE, &set_tag_cmd); install_element (RMAP_NODE, &no_set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_val_cmd); #ifdef HAVE_IPV6 route_map_install_match (&route_match_ipv6_address_cmd); @@ -4738,12 +4765,10 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_global_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_global_cmd); - install_element (RMAP_NODE, &no_set_ipv6_nexthop_global_val_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_prefer_global_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd); - install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_val_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd); #endif /* HAVE_IPV6 */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 32506c4e24..60e8d36c98 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -622,6 +622,16 @@ DEFUN (bgp_config_type, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp config-type (cisco|zebra)", + * NO_STR + * BGP_STR + * "Configuration type\n" + * "cisco\n" + * "zebra\n" + * + */ DEFUN (no_bgp_config_type, no_bgp_config_type_cmd, "no bgp config-type", @@ -633,14 +643,6 @@ DEFUN (no_bgp_config_type, return CMD_SUCCESS; } -ALIAS (no_bgp_config_type, - no_bgp_config_type_val_cmd, - "no bgp config-type (cisco|zebra)", - NO_STR - BGP_STR - "Configuration type\n" - "cisco\n" - "zebra\n") DEFUN (no_synchronization, no_synchronization_cmd, @@ -661,8 +663,22 @@ DEFUN (no_auto_summary, } /* "router bgp" commands. */ -DEFUN (router_bgp, - router_bgp_cmd, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "router bgp", + * ROUTER_STR + * BGP_STR + * + * "router bgp " CMD_AS_RANGE " (view|vrf) WORD", + * ROUTER_STR + * BGP_STR + * AS_STR + * "BGP view\nBGP VRF\n" + * "View/VRF name\n" + * + */ +DEFUN (router_bgp, + router_bgp_cmd, "router bgp " CMD_AS_RANGE, ROUTER_STR BGP_STR @@ -734,22 +750,25 @@ DEFUN (router_bgp, return CMD_SUCCESS; } -ALIAS (router_bgp, - router_bgp_instance_cmd, - "router bgp " CMD_AS_RANGE " (view|vrf) WORD", - ROUTER_STR - BGP_STR - AS_STR - "BGP view\nBGP VRF\n" - "View/VRF name\n") -ALIAS (router_bgp, - router_bgp_noasn_cmd, - "router bgp", - ROUTER_STR - BGP_STR) /* "no router bgp" commands. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no router bgp", + * NO_STR + * ROUTER_STR + * BGP_STR + * + * "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", + * NO_STR + * ROUTER_STR + * BGP_STR + * AS_STR + * "BGP view\nBGP VRF\n" + * "View/VRF name\n" + * + */ DEFUN (no_router_bgp, no_router_bgp_cmd, "no router bgp " CMD_AS_RANGE, @@ -802,22 +821,7 @@ DEFUN (no_router_bgp, return CMD_SUCCESS; } -ALIAS (no_router_bgp, - no_router_bgp_instance_cmd, - "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", - NO_STR - ROUTER_STR - BGP_STR - AS_STR - "BGP view\nBGP VRF\n" - "View/VRF name\n") -ALIAS (no_router_bgp, - no_router_bgp_noasn_cmd, - "no router bgp", - NO_STR - ROUTER_STR - BGP_STR) /* BGP router-id. */ @@ -846,6 +850,15 @@ DEFUN (bgp_router_id, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp router-id A.B.C.D", + * NO_STR + * BGP_STR + * "Override configured router identifier\n" + * "Manually configured router identifier\n" + * + */ DEFUN (no_bgp_router_id, no_bgp_router_id_cmd, "no bgp router-id", @@ -881,16 +894,17 @@ DEFUN (no_bgp_router_id, return CMD_SUCCESS; } -ALIAS (no_bgp_router_id, - no_bgp_router_id_val_cmd, - "no bgp router-id A.B.C.D", - NO_STR - BGP_STR - "Override configured router identifier\n" - "Manually configured router identifier\n") /* BGP Cluster ID. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "bgp cluster-id <1-4294967295>", + * BGP_STR + * "Configure Route-Reflector Cluster-id\n" + * "Route-Reflector Cluster-id as 32 bit quantity\n" + * + */ DEFUN (bgp_cluster_id, bgp_cluster_id_cmd, "bgp cluster-id A.B.C.D", @@ -917,13 +931,22 @@ DEFUN (bgp_cluster_id, return CMD_SUCCESS; } -ALIAS (bgp_cluster_id, - bgp_cluster_id32_cmd, - "bgp cluster-id <1-4294967295>", - BGP_STR - "Configure Route-Reflector Cluster-id\n" - "Route-Reflector Cluster-id as 32 bit quantity\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp cluster-id A.B.C.D", + * NO_STR + * BGP_STR + * "Configure Route-Reflector Cluster-id\n" + * "Route-Reflector Cluster-id in IP address format\n" + * + * "no bgp cluster-id <1-4294967295>", + * NO_STR + * BGP_STR + * "Configure Route-Reflector Cluster-id\n" + * "Route-Reflector Cluster-id as 32 bit quantity\n" + * + */ DEFUN (no_bgp_cluster_id, no_bgp_cluster_id_cmd, "no bgp cluster-id", @@ -953,21 +976,7 @@ DEFUN (no_bgp_cluster_id, return CMD_SUCCESS; } -ALIAS (no_bgp_cluster_id, - no_bgp_cluster_id_ip_cmd, - "no bgp cluster-id A.B.C.D", - NO_STR - BGP_STR - "Configure Route-Reflector Cluster-id\n" - "Route-Reflector Cluster-id in IP address format\n") -ALIAS (no_bgp_cluster_id, - no_bgp_cluster_id_decimal_cmd, - "no bgp cluster-id <1-4294967295>", - NO_STR - BGP_STR - "Configure Route-Reflector Cluster-id\n" - "Route-Reflector Cluster-id as 32 bit quantity\n") DEFUN (bgp_confederation_identifier, bgp_confederation_identifier_cmd, @@ -989,6 +998,16 @@ DEFUN (bgp_confederation_identifier, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp confederation identifier " CMD_AS_RANGE, + * NO_STR + * "BGP specific commands\n" + * "AS confederation parameters\n" + * "AS number\n" + * "Set routing domain confederation AS\n" + * + */ DEFUN (no_bgp_confederation_identifier, no_bgp_confederation_identifier_cmd, "no bgp confederation identifier", @@ -1006,14 +1025,6 @@ DEFUN (no_bgp_confederation_identifier, return CMD_SUCCESS; } -ALIAS (no_bgp_confederation_identifier, - no_bgp_confederation_identifier_arg_cmd, - "no bgp confederation identifier " CMD_AS_RANGE, - NO_STR - "BGP specific commands\n" - "AS confederation parameters\n" - "AS number\n" - "Set routing domain confederation AS\n") DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, @@ -1152,6 +1163,16 @@ DEFUN (bgp_maxmed_admin_medv, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp max-med administrative <0-4294967294>", + * NO_STR + * BGP_STR + * "Advertise routes with max-med\n" + * "Administratively applied, for an indefinite period\n" + * "Max MED value to be used\n" + * + */ DEFUN (no_bgp_maxmed_admin, no_bgp_maxmed_admin_cmd, "no bgp max-med administrative", @@ -1172,14 +1193,6 @@ DEFUN (no_bgp_maxmed_admin, return CMD_SUCCESS; } -ALIAS (no_bgp_maxmed_admin, - no_bgp_maxmed_admin_medv_cmd, - "no bgp max-med administrative <0-4294967294>", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Administratively applied, for an indefinite period\n" - "Max MED value to be used\n") DEFUN (bgp_maxmed_onstartup, @@ -1235,6 +1248,24 @@ DEFUN (bgp_maxmed_onstartup_medv, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp max-med on-startup <5-86400> <0-4294967294>", + * NO_STR + * BGP_STR + * "Advertise routes with max-med\n" + * "Effective on a startup\n" + * "Time (seconds) period for max-med\n" + * "Max MED value to be used\n" + * + * "no bgp max-med on-startup <5-86400>", + * NO_STR + * BGP_STR + * "Advertise routes with max-med\n" + * "Effective on a startup\n" + * "Time (seconds) period for max-med\n" + * + */ DEFUN (no_bgp_maxmed_onstartup, no_bgp_maxmed_onstartup_cmd, "no bgp max-med on-startup", @@ -1262,24 +1293,7 @@ DEFUN (no_bgp_maxmed_onstartup, return CMD_SUCCESS; } -ALIAS (no_bgp_maxmed_onstartup, - no_bgp_maxmed_onstartup_period_cmd, - "no bgp max-med on-startup <5-86400>", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n" - "Time (seconds) period for max-med\n") -ALIAS (no_bgp_maxmed_onstartup, - no_bgp_maxmed_onstartup_period_medv_cmd, - "no bgp max-med on-startup <5-86400> <0-4294967294>", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n" - "Time (seconds) period for max-med\n" - "Max MED value to be used\n") static int bgp_update_delay_config_vty (struct vty *vty, const char *delay, @@ -1367,6 +1381,15 @@ DEFUN (bgp_update_delay_establish_wait, } /* Update-delay deconfiguration */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no update-delay <0-3600> <1-3600>", + * "Force initial delay for best-path and updates\n" + * "Seconds\n" + * "Wait for peers to be established\n" + * "Seconds\n" + * + */ DEFUN (no_bgp_update_delay, no_bgp_update_delay_cmd, "no update-delay <0-3600>", @@ -1376,13 +1399,6 @@ DEFUN (no_bgp_update_delay, return bgp_update_delay_deconfig_vty(vty); } -ALIAS (no_bgp_update_delay, - no_bgp_update_delay_establish_wait_cmd, - "no update-delay <0-3600> <1-3600>", - "Force initial delay for best-path and updates\n" - "Seconds\n" - "Wait for peers to be established\n" - "Seconds\n") static int bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) @@ -1508,6 +1524,14 @@ DEFUN (bgp_maxpaths_ibgp_cluster, BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), + * NO_STR + * "Forward packets over multiple paths\n" + * "Number of paths\n" + * + */ DEFUN (no_bgp_maxpaths, no_bgp_maxpaths_cmd, "no maximum-paths", @@ -1518,13 +1542,23 @@ DEFUN (no_bgp_maxpaths, return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); } -ALIAS (no_bgp_maxpaths, - no_bgp_maxpaths_arg_cmd, - "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), - NO_STR - "Forward packets over multiple paths\n" - "Number of paths\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", + * NO_STR + * "Forward packets over multiple paths\n" + * "iBGP-multipath\n" + * "Number of paths\n" + * "Match the cluster length\n" + * + * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), + * NO_STR + * "Forward packets over multiple paths\n" + * "iBGP-multipath\n" + * "Number of paths\n" + * + */ DEFUN (no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_cmd, "no maximum-paths ibgp", @@ -1536,22 +1570,7 @@ DEFUN (no_bgp_maxpaths_ibgp, return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); } -ALIAS (no_bgp_maxpaths_ibgp, - no_bgp_maxpaths_ibgp_arg_cmd, - "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), - NO_STR - "Forward packets over multiple paths\n" - "iBGP-multipath\n" - "Number of paths\n") -ALIAS (no_bgp_maxpaths_ibgp, - no_bgp_maxpaths_ibgp_cluster_cmd, - "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", - NO_STR - "Forward packets over multiple paths\n" - "iBGP-multipath\n" - "Number of paths\n" - "Match the cluster length\n") int bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, @@ -1610,6 +1629,16 @@ DEFUN (bgp_timers, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers bgp <0-65535> <0-65535>", + * NO_STR + * "Adjust routing timers\n" + * "BGP timers\n" + * "Keepalive interval\n" + * "Holdtime\n" + * + */ DEFUN (no_bgp_timers, no_bgp_timers_cmd, "no timers bgp", @@ -1625,14 +1654,6 @@ DEFUN (no_bgp_timers, return CMD_SUCCESS; } -ALIAS (no_bgp_timers, - no_bgp_timers_arg_cmd, - "no timers bgp <0-65535> <0-65535>", - NO_STR - "Adjust routing timers\n" - "BGP timers\n" - "Keepalive interval\n" - "Holdtime\n") DEFUN (bgp_client_to_client_reflection, bgp_client_to_client_reflection_cmd, @@ -1837,6 +1858,16 @@ DEFUN (bgp_graceful_restart_restart_time, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp graceful-restart stalepath-time <1-3600>", + * NO_STR + * "BGP specific commands\n" + * "Graceful restart capability parameters\n" + * "Set the max time to hold onto restarting peer's stale paths\n" + * "Delay value (seconds)\n" + * + */ DEFUN (no_bgp_graceful_restart_stalepath_time, no_bgp_graceful_restart_stalepath_time_cmd, "no bgp graceful-restart stalepath-time", @@ -1855,6 +1886,16 @@ DEFUN (no_bgp_graceful_restart_stalepath_time, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp graceful-restart restart-time <1-3600>", + * NO_STR + * "BGP specific commands\n" + * "Graceful restart capability parameters\n" + * "Set the time to wait to delete stale routes before a BGP open message is received\n" + * "Delay value (seconds)\n" + * + */ DEFUN (no_bgp_graceful_restart_restart_time, no_bgp_graceful_restart_restart_time_cmd, "no bgp graceful-restart restart-time", @@ -1873,23 +1914,7 @@ DEFUN (no_bgp_graceful_restart_restart_time, return CMD_SUCCESS; } -ALIAS (no_bgp_graceful_restart_stalepath_time, - no_bgp_graceful_restart_stalepath_time_val_cmd, - "no bgp graceful-restart stalepath-time <1-3600>", - NO_STR - "BGP specific commands\n" - "Graceful restart capability parameters\n" - "Set the max time to hold onto restarting peer's stale paths\n" - "Delay value (seconds)\n") -ALIAS (no_bgp_graceful_restart_restart_time, - no_bgp_graceful_restart_restart_time_val_cmd, - "no bgp graceful-restart restart-time <1-3600>", - NO_STR - "BGP specific commands\n" - "Graceful restart capability parameters\n" - "Set the time to wait to delete stale routes before a BGP open message is received\n" - "Delay value (seconds)\n") /* "bgp fast-external-failover" configuration. */ DEFUN (bgp_fast_external_failover, @@ -2158,6 +2183,16 @@ DEFUN (bgp_bestpath_med, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "bgp bestpath med missing-as-worst confed", + * "BGP specific commands\n" + * "Change the default bestpath selection\n" + * "MED attribute\n" + * "Treat missing MED as the least preferred one\n" + * "Compare MED among confederation paths\n" + * + */ DEFUN (bgp_bestpath_med2, bgp_bestpath_med2_cmd, "bgp bestpath med confed missing-as-worst", @@ -2177,14 +2212,6 @@ DEFUN (bgp_bestpath_med2, return CMD_SUCCESS; } -ALIAS (bgp_bestpath_med2, - bgp_bestpath_med3_cmd, - "bgp bestpath med missing-as-worst confed", - "BGP specific commands\n" - "Change the default bestpath selection\n" - "MED attribute\n" - "Treat missing MED as the least preferred one\n" - "Compare MED among confederation paths\n") DEFUN (no_bgp_bestpath_med, no_bgp_bestpath_med_cmd, @@ -2210,6 +2237,17 @@ DEFUN (no_bgp_bestpath_med, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp bestpath med missing-as-worst confed", + * NO_STR + * "BGP specific commands\n" + * "Change the default bestpath selection\n" + * "MED attribute\n" + * "Treat missing MED as the least preferred one\n" + * "Compare MED among confederation paths\n" + * + */ DEFUN (no_bgp_bestpath_med2, no_bgp_bestpath_med2_cmd, "no bgp bestpath med confed missing-as-worst", @@ -2230,15 +2268,6 @@ DEFUN (no_bgp_bestpath_med2, return CMD_SUCCESS; } -ALIAS (no_bgp_bestpath_med2, - no_bgp_bestpath_med3_cmd, - "no bgp bestpath med missing-as-worst confed", - NO_STR - "BGP specific commands\n" - "Change the default bestpath selection\n" - "MED attribute\n" - "Treat missing MED as the least preferred one\n" - "Compare MED among confederation paths\n") /* "no bgp default ipv4-unicast". */ DEFUN (no_bgp_default_ipv4_unicast, @@ -2369,6 +2398,16 @@ DEFUN (bgp_default_local_preference, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp default local-preference <0-4294967295>", + * NO_STR + * "BGP specific commands\n" + * "Configure BGP defaults\n" + * "local preference (higher=more preferred)\n" + * "Configure default local preference value\n" + * + */ DEFUN (no_bgp_default_local_preference, no_bgp_default_local_preference_cmd, "no bgp default local-preference", @@ -2386,14 +2425,6 @@ DEFUN (no_bgp_default_local_preference, return CMD_SUCCESS; } -ALIAS (no_bgp_default_local_preference, - no_bgp_default_local_preference_val_cmd, - "no bgp default local-preference <0-4294967295>", - NO_STR - "BGP specific commands\n" - "Configure BGP defaults\n" - "local preference (higher=more preferred)\n" - "Configure default local preference value\n") DEFUN (bgp_default_subgroup_pkt_queue_max, bgp_default_subgroup_pkt_queue_max_cmd, @@ -2415,6 +2446,16 @@ DEFUN (bgp_default_subgroup_pkt_queue_max, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp default subgroup-pkt-queue-max <20-100>", + * NO_STR + * "BGP specific commands\n" + * "Configure BGP defaults\n" + * "subgroup-pkt-queue-max\n" + * "Configure subgroup packet queue max\n" + * + */ DEFUN (no_bgp_default_subgroup_pkt_queue_max, no_bgp_default_subgroup_pkt_queue_max_cmd, "no bgp default subgroup-pkt-queue-max", @@ -2430,14 +2471,6 @@ DEFUN (no_bgp_default_subgroup_pkt_queue_max, return CMD_SUCCESS; } -ALIAS (no_bgp_default_subgroup_pkt_queue_max, - no_bgp_default_subgroup_pkt_queue_max_val_cmd, - "no bgp default subgroup-pkt-queue-max <20-100>", - NO_STR - "BGP specific commands\n" - "Configure BGP defaults\n" - "subgroup-pkt-queue-max\n" - "Configure subgroup packet queue max\n") DEFUN (bgp_rr_allow_outbound_policy, bgp_rr_allow_outbound_policy_cmd, @@ -2504,6 +2537,16 @@ DEFUN (bgp_listen_limit, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, + * NO_STR + * "BGP specific commands\n" + * "Configure BGP defaults\n" + * "maximum number of BGP Dynamic Neighbors that can be created\n" + * "Configure Dynamic Neighbors listen limit value\n" + * + */ DEFUN (no_bgp_listen_limit, no_bgp_listen_limit_cmd, "no bgp listen limit", @@ -2519,14 +2562,6 @@ DEFUN (no_bgp_listen_limit, return CMD_SUCCESS; } -ALIAS (no_bgp_listen_limit, - no_bgp_listen_limit_val_cmd, - "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, - NO_STR - "BGP specific commands\n" - "Configure BGP defaults\n" - "maximum number of BGP Dynamic Neighbors that can be created\n" - "Configure Dynamic Neighbors listen limit value\n") /* * Check if this listen range is already configured. Check for exact @@ -2928,6 +2963,16 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, return bgp_vty_return (vty, ret); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "neighbor WORD interface peer-group WORD", + * NEIGHBOR_STR + * "Interface name or neighbor tag\n" + * "Enable BGP on interface\n" + * "Member of the peer-group\n" + * "peer-group name\n" + * + */ DEFUN (neighbor_interface_config, neighbor_interface_config_cmd, "neighbor WORD interface", @@ -2943,15 +2988,18 @@ DEFUN (neighbor_interface_config, NULL, NULL); } -ALIAS (neighbor_interface_config, - neighbor_interface_config_peergroup_cmd, - "neighbor WORD interface peer-group WORD", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP on interface\n" - "Member of the peer-group\n" - "peer-group name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "neighbor WORD interface v6only peer-group WORD", + * NEIGHBOR_STR + * "Interface name or neighbor tag\n" + * "Enable BGP on interface\n" + * "Enable BGP with v6 link-local only\n" + * "Member of the peer-group\n" + * "peer-group name\n" + * + */ DEFUN (neighbor_interface_config_v6only, neighbor_interface_config_v6only_cmd, "neighbor WORD interface v6only", @@ -2964,15 +3012,6 @@ DEFUN (neighbor_interface_config_v6only, argv[5]->arg, NULL); } -ALIAS (neighbor_interface_config_v6only, - neighbor_interface_config_v6only_peergroup_cmd, - "neighbor WORD interface v6only peer-group WORD", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP on interface\n" - "Enable BGP with v6 link-local only\n" - "Member of the peer-group\n" - "peer-group name\n") DEFUN (neighbor_interface_config_remote_as, neighbor_interface_config_remote_as_cmd, @@ -3024,6 +3063,16 @@ DEFUN (neighbor_peer_group, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR + * "Specify a BGP neighbor\n" + * AS_STR + * + */ DEFUN (no_neighbor, no_neighbor_cmd, NO_NEIGHBOR_CMD2, @@ -3082,15 +3131,49 @@ DEFUN (no_neighbor, return CMD_SUCCESS; } -ALIAS (no_neighbor, - no_neighbor_remote_as_cmd, - NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Specify a BGP neighbor\n" - AS_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", + * NO_STR + * NEIGHBOR_STR + * "Interface name\n" + * "Configure BGP on interface\n" + * AS_STR + * + * "no neighbor WORD interface v6only peer-group WORD", + * NO_STR + * NEIGHBOR_STR + * "Interface name\n" + * "Configure BGP on interface\n" + * "Enable BGP with v6 link-local only\n" + * "Member of the peer-group\n" + * "peer-group name\n" + * + * "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", + * NO_STR + * NEIGHBOR_STR + * "Interface name\n" + * "Configure BGP on interface\n" + * "Enable BGP with v6 link-local only\n" + * AS_STR + * + * "no neighbor WORD interface v6only", + * NO_STR + * NEIGHBOR_STR + * "Interface name\n" + * "Configure BGP on interface\n" + * "Enable BGP with v6 link-local only\n" + * + * "no neighbor WORD interface peer-group WORD", + * NO_STR + * NEIGHBOR_STR + * "Interface name\n" + * "Configure BGP on interface\n" + * "Member of the peer-group\n" + * "peer-group name\n" + * + */ DEFUN (no_neighbor_interface_config, no_neighbor_interface_config_cmd, "no neighbor WORD interface", @@ -3118,54 +3201,10 @@ DEFUN (no_neighbor_interface_config, return CMD_SUCCESS; } -ALIAS (no_neighbor_interface_config, - no_neighbor_interface_config_peergroup_cmd, - "no neighbor WORD interface peer-group WORD", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - "Member of the peer-group\n" - "peer-group name\n") -ALIAS (no_neighbor_interface_config, - no_neighbor_interface_config_v6only_cmd, - "no neighbor WORD interface v6only", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - "Enable BGP with v6 link-local only\n") -ALIAS (no_neighbor_interface_config, - no_neighbor_interface_config_v6only_peergroup_cmd, - "no neighbor WORD interface v6only peer-group WORD", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - "Enable BGP with v6 link-local only\n" - "Member of the peer-group\n" - "peer-group name\n") -ALIAS (no_neighbor_interface_config, - no_neighbor_interface_config_remote_as_cmd, - "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - AS_STR) -ALIAS (no_neighbor_interface_config, - no_neighbor_interface_config_v6only_remote_as_cmd, - "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - "Enable BGP with v6 link-local only\n" - AS_STR) DEFUN (no_neighbor_peer_group, no_neighbor_peer_group_cmd, @@ -3280,6 +3319,33 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Specify a local-as number\n" + * "AS number used as local AS\n" + * + * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Specify a local-as number\n" + * "AS number used as local AS\n" + * "Do not prepend local-as to updates from ebgp peers\n" + * + * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Specify a local-as number\n" + * "AS number used as local AS\n" + * "Do not prepend local-as to updates from ebgp peers\n" + * "Do not prepend local-as to updates from ibgp peers\n" + * + */ DEFUN (no_neighbor_local_as, no_neighbor_local_as_cmd, NO_NEIGHBOR_CMD2 "local-as", @@ -3299,35 +3365,8 @@ DEFUN (no_neighbor_local_as, return bgp_vty_return (vty, ret); } -ALIAS (no_neighbor_local_as, - no_neighbor_local_as_val_cmd, - NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n") -ALIAS (no_neighbor_local_as, - no_neighbor_local_as_val2_cmd, - NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n" - "Do not prepend local-as to updates from ebgp peers\n") -ALIAS (no_neighbor_local_as, - no_neighbor_local_as_val3_cmd, - NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n" - "Do not prepend local-as to updates from ebgp peers\n" - "Do not prepend local-as to updates from ibgp peers\n") DEFUN (neighbor_solo, neighbor_solo_cmd, @@ -3385,6 +3424,16 @@ DEFUN (neighbor_password, return bgp_vty_return (vty, ret); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "password LINE", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Set a password\n" + * "The password\n" + * + */ DEFUN (no_neighbor_password, no_neighbor_password_cmd, NO_NEIGHBOR_CMD2 "password", @@ -3404,14 +3453,6 @@ DEFUN (no_neighbor_password, return bgp_vty_return (vty, ret); } -ALIAS (no_neighbor_password, - no_neighbor_password_val_cmd, - NO_NEIGHBOR_CMD2 "password LINE", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set a password\n" - "The password\n") DEFUN (neighbor_activate, neighbor_activate_cmd, @@ -4183,6 +4224,57 @@ DEFUN (no_neighbor_nexthop_local_unchanged, PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Med attribute\n" + * "Nexthop attribute\n" + * "As-path attribute\n" + * + * NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Med attribute\n" + * "As-path attribute\n" + * "Nexthop attribute\n" + * + * NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "As-path attribute\n" + * "Nexthop attribute\n" + * "Med attribute\n" + * + * NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Nexthop attribute\n" + * "As-path attribute\n" + * "Med attribute\n" + * + * NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "As-path attribute\n" + * "Med attribute\n" + * "Nexthop attribute\n" + * + * NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Nexthop attribute\n" + * "Med attribute\n" + * "As-path attribute\n" + * + */ DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, NEIGHBOR_CMD2 "attribute-unchanged", @@ -4284,66 +4376,69 @@ DEFUN (neighbor_attr_unchanged4, bgp_node_safi (vty), flags); } -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged5_cmd, - NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged6_cmd, - NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Med attribute\n" - "Nexthop attribute\n") -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged7_cmd, - NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "Med attribute\n" - "As-path attribute\n") -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged8_cmd, - NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n") -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged9_cmd, - NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Med attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") -ALIAS (neighbor_attr_unchanged, - neighbor_attr_unchanged10_cmd, - NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Nexthop attribute\n" + * "Med attribute\n" + * "As-path attribute\n" + * + * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "As-path attribute\n" + * "Med attribute\n" + * "Nexthop attribute\n" + * + * NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Med attribute\n" + * "As-path attribute\n" + * "Nexthop attribute\n" + * + * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Nexthop attribute\n" + * "As-path attribute\n" + * "Med attribute\n" + * + * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "As-path attribute\n" + * "Nexthop attribute\n" + * "Med attribute\n" + * + * NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP attribute is propagated unchanged to this neighbor\n" + * "Med attribute\n" + * "Nexthop attribute\n" + * "As-path attribute\n" + * + */ DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, NO_NEIGHBOR_CMD2 "attribute-unchanged", @@ -4449,71 +4544,11 @@ DEFUN (no_neighbor_attr_unchanged4, bgp_node_safi (vty), flags); } -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged5_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged6_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Med attribute\n" - "Nexthop attribute\n") -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged7_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "Med attribute\n" - "As-path attribute\n") -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged8_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n") -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged9_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Med attribute\n" - "Nexthop attribute\n" - "As-path attribute\n") -ALIAS (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged10_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n") /* EBGP multihop configuration. */ static int @@ -4572,6 +4607,16 @@ DEFUN (neighbor_ebgp_multihop_ttl, return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Allow EBGP neighbors not on directly connected networks\n" + * "maximum hop count\n" + * + */ DEFUN (no_neighbor_ebgp_multihop, no_neighbor_ebgp_multihop_cmd, NO_NEIGHBOR_CMD2 "ebgp-multihop", @@ -4583,16 +4628,16 @@ DEFUN (no_neighbor_ebgp_multihop, return peer_ebgp_multihop_unset_vty (vty, argv[2]->arg); } -ALIAS (no_neighbor_ebgp_multihop, - no_neighbor_ebgp_multihop_ttl_cmd, - NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Allow EBGP neighbors not on directly connected networks\n" - "maximum hop count\n") /* disable-connected-check */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NEIGHBOR_CMD2 "enforce-multihop", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Enforce EBGP neighbors perform multihop\n" + * + */ DEFUN (neighbor_disable_connected_check, neighbor_disable_connected_check_cmd, NEIGHBOR_CMD2 "disable-connected-check", @@ -4603,6 +4648,15 @@ DEFUN (neighbor_disable_connected_check, return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "enforce-multihop", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Enforce EBGP neighbors perform multihop\n" + * + */ DEFUN (no_neighbor_disable_connected_check, no_neighbor_disable_connected_check_cmd, NO_NEIGHBOR_CMD2 "disable-connected-check", @@ -4615,21 +4669,8 @@ DEFUN (no_neighbor_disable_connected_check, } /* Enforce multihop. */ -ALIAS (neighbor_disable_connected_check, - neighbor_enforce_multihop_cmd, - NEIGHBOR_CMD2 "enforce-multihop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enforce EBGP neighbors perform multihop\n") /* Enforce multihop. */ -ALIAS (no_neighbor_disable_connected_check, - no_neighbor_enforce_multihop_cmd, - NO_NEIGHBOR_CMD2 "enforce-multihop", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enforce EBGP neighbors perform multihop\n") DEFUN (neighbor_description, neighbor_description_cmd, @@ -4658,6 +4699,16 @@ DEFUN (neighbor_description, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "description .LINE", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Neighbor specific description\n" + * "Up to 80 characters describing this neighbor\n" + * + */ DEFUN (no_neighbor_description, no_neighbor_description_cmd, NO_NEIGHBOR_CMD2 "description", @@ -4677,14 +4728,6 @@ DEFUN (no_neighbor_description, return CMD_SUCCESS; } -ALIAS (no_neighbor_description, - no_neighbor_description_val_cmd, - NO_NEIGHBOR_CMD2 "description .LINE", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Neighbor specific description\n" - "Up to 80 characters describing this neighbor\n") /* Neighbor update-source. */ static int @@ -4792,6 +4835,17 @@ DEFUN (neighbor_default_originate_rmap, bgp_node_safi (vty), argv[4]->arg, 1); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "default-originate route-map WORD", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Originate default route to this neighbor\n" + * "Route-map to specify criteria to originate default\n" + * "route-map name\n" + * + */ DEFUN (no_neighbor_default_originate, no_neighbor_default_originate_cmd, NO_NEIGHBOR_CMD2 "default-originate", @@ -4804,15 +4858,6 @@ DEFUN (no_neighbor_default_originate, bgp_node_safi (vty), NULL, 0); } -ALIAS (no_neighbor_default_originate, - no_neighbor_default_originate_rmap_cmd, - NO_NEIGHBOR_CMD2 "default-originate route-map WORD", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Originate default route to this neighbor\n" - "Route-map to specify criteria to originate default\n" - "route-map name\n") /* Set neighbor's BGP port. */ static int @@ -4854,6 +4899,16 @@ DEFUN (neighbor_port, return peer_port_vty (vty, argv[1]->arg, AFI_IP, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD "port <0-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR + * "Neighbor's BGP port\n" + * "TCP port number\n" + * + */ DEFUN (no_neighbor_port, no_neighbor_port_cmd, NO_NEIGHBOR_CMD "port", @@ -4865,14 +4920,6 @@ DEFUN (no_neighbor_port, return peer_port_vty (vty, argv[2]->arg, AFI_IP, NULL); } -ALIAS (no_neighbor_port, - no_neighbor_port_val_cmd, - NO_NEIGHBOR_CMD "port <0-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Neighbor's BGP port\n" - "TCP port number\n") /* neighbor weight. */ static int @@ -4918,6 +4965,16 @@ DEFUN (neighbor_weight, return peer_weight_set_vty (vty, argv[1]->arg, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "weight <0-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Set default weight for routes from this neighbor\n" + * "default weight\n" + * + */ DEFUN (no_neighbor_weight, no_neighbor_weight_cmd, NO_NEIGHBOR_CMD2 "weight", @@ -4929,14 +4986,6 @@ DEFUN (no_neighbor_weight, return peer_weight_unset_vty (vty, argv[2]->arg); } -ALIAS (no_neighbor_weight, - no_neighbor_weight_val_cmd, - NO_NEIGHBOR_CMD2 "weight <0-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set default weight for routes from this neighbor\n" - "default weight\n") /* Override capability negotiation. */ DEFUN (neighbor_override_capability, @@ -5029,6 +5078,17 @@ DEFUN (neighbor_timers, return peer_timers_set_vty (vty, argv[1]->arg, argv[3]->arg, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP per neighbor timers\n" + * "Keepalive interval\n" + * "Holdtime\n" + * + */ DEFUN (no_neighbor_timers, no_neighbor_timers_cmd, NO_NEIGHBOR_CMD2 "timers", @@ -5040,15 +5100,6 @@ DEFUN (no_neighbor_timers, return peer_timers_unset_vty (vty, argv[2]->arg); } -ALIAS (no_neighbor_timers, - no_neighbor_timers_val_cmd, - NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "Keepalive interval\n" - "Holdtime\n") static int peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, @@ -5096,6 +5147,17 @@ DEFUN (neighbor_timers_connect, return peer_timers_connect_set_vty (vty, argv[1]->arg, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "timers connect <1-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "BGP per neighbor timers\n" + * "BGP connect timer\n" + * "Connect timer\n" + * + */ DEFUN (no_neighbor_timers_connect, no_neighbor_timers_connect_cmd, NO_NEIGHBOR_CMD2 "timers connect", @@ -5108,15 +5170,6 @@ DEFUN (no_neighbor_timers_connect, return peer_timers_connect_unset_vty (vty, argv[2]->arg); } -ALIAS (no_neighbor_timers_connect, - no_neighbor_timers_connect_val_cmd, - NO_NEIGHBOR_CMD2 "timers connect <1-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "BGP connect timer\n" - "Connect timer\n") static int peer_advertise_interval_vty (struct vty *vty, const char *ip_str, @@ -5152,6 +5205,16 @@ DEFUN (neighbor_advertise_interval, return peer_advertise_interval_vty (vty, argv[1]->arg, argv[3]->arg, 1); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Minimum interval between sending BGP routing updates\n" + * "time in seconds\n" + * + */ DEFUN (no_neighbor_advertise_interval, no_neighbor_advertise_interval_cmd, NO_NEIGHBOR_CMD2 "advertisement-interval", @@ -5163,14 +5226,6 @@ DEFUN (no_neighbor_advertise_interval, return peer_advertise_interval_vty (vty, argv[2]->arg, NULL, 0); } -ALIAS (no_neighbor_advertise_interval, - no_neighbor_advertise_interval_val_cmd, - NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Minimum interval between sending BGP routing updates\n" - "time in seconds\n") /* Time to wait before processing route-map updates */ DEFUN (bgp_set_route_map_delay_timer, @@ -5202,6 +5257,15 @@ DEFUN (bgp_set_route_map_delay_timer, return CMD_WARNING; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bgp route-map delay-timer <0-600>", + * NO_STR + * "Default BGP route-map delay timer\n" + * "Reset to default time to wait for processing route-map changes\n" + * "0 disables the timer, no route updates happen when route-maps change\n" + * + */ DEFUN (no_bgp_set_route_map_delay_timer, no_bgp_set_route_map_delay_timer_cmd, "no bgp route-map delay-timer", @@ -5215,13 +5279,6 @@ DEFUN (no_bgp_set_route_map_delay_timer, return CMD_SUCCESS; } -ALIAS (no_bgp_set_route_map_delay_timer, - no_bgp_set_route_map_delay_timer_val_cmd, - "no bgp route-map delay-timer <0-600>", - NO_STR - "Default BGP route-map delay timer\n" - "Reset to default time to wait for processing route-map changes\n" - "0 disables the timer, no route updates happen when route-maps change\n") /* neighbor interface */ static int @@ -5773,6 +5830,60 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, argv[6]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * "Threshold value (%) at which to generate a warning msg\n" + * "Restart bgp connection after limit is exceeded\n" + * "Restart interval in minutes" + * + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * "Only give warning message when limit is exceeded\n" + * + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * "Restart bgp connection after limit is exceeded\n" + * "Restart interval in minutes" + * + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * "Threshold value (%) at which to generate a warning msg\n" + * "Only give warning message when limit is exceeded\n" + * + * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Maximum number of prefix accept from this peer\n" + * "maximum no. of prefix limit\n" + * "Threshold value (%) at which to generate a warning msg\n" + * + */ DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, NO_NEIGHBOR_CMD2 "maximum-prefix", @@ -5785,70 +5896,22 @@ DEFUN (no_neighbor_maximum_prefix, bgp_node_safi (vty)); } -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_val_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n") -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_threshold_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n") -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_warning_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Only give warning message when limit is exceeded\n") -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_threshold_warning_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Only give warning message when limit is exceeded\n") -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_restart_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes") -ALIAS (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_threshold_restart_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes") /* "neighbor allowas-in" */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NEIGHBOR_CMD2 "allowas-in <1-10>", + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "Accept as-path with my AS present in it\n" + * "Number of occurances of AS number\n" + * + */ DEFUN (neighbor_allowas_in, neighbor_allowas_in_cmd, NEIGHBOR_CMD2 "allowas-in", @@ -5875,14 +5938,17 @@ DEFUN (neighbor_allowas_in, return bgp_vty_return (vty, ret); } -ALIAS (neighbor_allowas_in, - neighbor_allowas_in_arg_cmd, - NEIGHBOR_CMD2 "allowas-in <1-10>", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Accept as-path with my AS present in it\n" - "Number of occurances of AS number\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * NO_NEIGHBOR_CMD2 "allowas-in <1-10>", + * NO_STR + * NEIGHBOR_STR + * NEIGHBOR_ADDR_STR2 + * "allow local ASN appears in aspath attribute\n" + * "Number of occurances of AS number\n" + * + */ DEFUN (no_neighbor_allowas_in, no_neighbor_allowas_in_cmd, NO_NEIGHBOR_CMD2 "allowas-in", @@ -5903,14 +5969,6 @@ DEFUN (no_neighbor_allowas_in, return bgp_vty_return (vty, ret); } -ALIAS (no_neighbor_allowas_in, - no_neighbor_allowas_in_val_cmd, - NO_NEIGHBOR_CMD2 "allowas-in <1-10>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "allow local ASN appears in aspath attribute\n" - "Number of occurances of AS number\n") DEFUN (neighbor_ttl_security, neighbor_ttl_security_cmd, @@ -6074,6 +6132,14 @@ DEFUN (address_family_ipv6_safi, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "address-family vpnv4 unicast", + * "Enter Address Family command mode\n" + * "Address family\n" + * "Address Family Modifier\n" + * + */ DEFUN (address_family_vpnv4, address_family_vpnv4_cmd, "address-family vpnv4", @@ -6084,13 +6150,15 @@ DEFUN (address_family_vpnv4, return CMD_SUCCESS; } -ALIAS (address_family_vpnv4, - address_family_vpnv4_unicast_cmd, - "address-family vpnv4 unicast", - "Enter Address Family command mode\n" - "Address family\n" - "Address Family Modifier\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "address-family vpnv6 unicast", + * "Enter Address Family command mode\n" + * "Address family\n" + * "Address Family Modifier\n" + * + */ DEFUN (address_family_vpnv6, address_family_vpnv6_cmd, "address-family vpnv6", @@ -6101,13 +6169,14 @@ DEFUN (address_family_vpnv6, return CMD_SUCCESS; } -ALIAS (address_family_vpnv6, - address_family_vpnv6_unicast_cmd, - "address-family vpnv6 unicast", - "Enter Address Family command mode\n" - "Address family\n" - "Address Family Modifier\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "address-family encapv4", + * "Enter Address Family command mode\n" + * "Address family\n" + * + */ DEFUN (address_family_encap, address_family_encap_cmd, "address-family encap", @@ -6118,11 +6187,6 @@ DEFUN (address_family_encap, return CMD_SUCCESS; } -ALIAS (address_family_encap, - address_family_encapv4_cmd, - "address-family encapv4", - "Enter Address Family command mode\n" - "Address family\n") DEFUN (address_family_encapv6, address_family_encapv6_cmd, @@ -6232,6 +6296,40 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp *", + * CLEAR_STR + * BGP_STR + * "Clear all peers\n" + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 *", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * + * "clear ip bgp " BGP_INSTANCE_CMD " *", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * + * "clear bgp ipv6 *", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * + * "clear bgp " BGP_INSTANCE_CMD " *", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * + */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, "clear ip bgp *", @@ -6243,49 +6341,57 @@ DEFUN (clear_ip_bgp_all, return bgp_clear_vty (vty, argv[4]->arg, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); } -ALIAS (clear_ip_bgp_all, - clear_ip_bgp_instance_all_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " *", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n") -ALIAS (clear_ip_bgp_all, - clear_bgp_all_cmd, - "clear bgp *", - CLEAR_STR - BGP_STR - "Clear all peers\n") -ALIAS (clear_ip_bgp_all, - clear_bgp_instance_all_cmd, - "clear bgp " BGP_INSTANCE_CMD " *", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n") -ALIAS (clear_ip_bgp_all, - clear_bgp_ipv6_all_cmd, - "clear bgp ipv6 *", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n") -ALIAS (clear_ip_bgp_all, - clear_bgp_instance_ipv6_all_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 *", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor IP address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor IP address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * + * "clear bgp (A.B.C.D|X:X::X:X|WORD)", + * CLEAR_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor IP address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * + */ DEFUN (clear_ip_bgp_peer, - clear_ip_bgp_peer_cmd, + clear_ip_bgp_peer_cmd, "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", CLEAR_STR IP_STR @@ -6300,59 +6406,52 @@ DEFUN (clear_ip_bgp_peer, return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer, - clear_ip_bgp_instance_peer_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") -ALIAS (clear_ip_bgp_peer, - clear_bgp_peer_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD)", - CLEAR_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") -ALIAS (clear_ip_bgp_peer, - clear_bgp_instance_peer_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") -ALIAS (clear_ip_bgp_peer, - clear_bgp_ipv6_peer_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") -ALIAS (clear_ip_bgp_peer, - clear_bgp_instance_ipv6_peer_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp peer-group WORD", + * CLEAR_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * + * "clear bgp ipv6 peer-group WORD", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * + */ DEFUN (clear_ip_bgp_peer_group, - clear_ip_bgp_peer_group_cmd, + clear_ip_bgp_peer_group_cmd, "clear ip bgp peer-group WORD", CLEAR_STR IP_STR @@ -6366,52 +6465,45 @@ DEFUN (clear_ip_bgp_peer_group, return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[4]->arg); } -ALIAS (clear_ip_bgp_peer_group, - clear_ip_bgp_instance_peer_group_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n") -ALIAS (clear_ip_bgp_peer_group, - clear_bgp_peer_group_cmd, - "clear bgp peer-group WORD", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n") -ALIAS (clear_ip_bgp_peer_group, - clear_bgp_instance_peer_group_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n") -ALIAS (clear_ip_bgp_peer_group, - clear_bgp_ipv6_peer_group_cmd, - "clear bgp ipv6 peer-group WORD", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n") -ALIAS (clear_ip_bgp_peer_group, - clear_bgp_instance_ipv6_peer_group_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * + * "clear bgp " BGP_INSTANCE_CMD " external", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * + * "clear bgp external", + * CLEAR_STR + * BGP_STR + * "Clear all external peers\n" + * + * "clear bgp ipv6 external", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * + * "clear ip bgp " BGP_INSTANCE_CMD " external", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * + */ DEFUN (clear_ip_bgp_external, clear_ip_bgp_external_cmd, "clear ip bgp external", @@ -6426,47 +6518,35 @@ DEFUN (clear_ip_bgp_external, return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); } -ALIAS (clear_ip_bgp_external, - clear_ip_bgp_instance_external_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n") -ALIAS (clear_ip_bgp_external, - clear_bgp_external_cmd, - "clear bgp external", - CLEAR_STR - BGP_STR - "Clear all external peers\n") -ALIAS (clear_ip_bgp_external, - clear_bgp_instance_external_cmd, - "clear bgp " BGP_INSTANCE_CMD " external", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n") -ALIAS (clear_ip_bgp_external, - clear_bgp_ipv6_external_cmd, - "clear bgp ipv6 external", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n") -ALIAS (clear_ip_bgp_external, - clear_bgp_instance_ipv6_external_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear bestpath and re-advertise\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * + * "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear bestpath and re-advertise\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * + * "clear bgp prefix A.B.C.D/M", + * CLEAR_STR + * BGP_STR + * "Clear bestpath and re-advertise\n" + * "IP prefix /, e.g., 35.0.0.0/8\n" + * + */ DEFUN (clear_ip_bgp_prefix, clear_ip_bgp_prefix_cmd, "clear ip bgp prefix A.B.C.D/M", @@ -6482,33 +6562,43 @@ DEFUN (clear_ip_bgp_prefix, return bgp_clear_prefix (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL); } -ALIAS (clear_ip_bgp_prefix, - clear_ip_bgp_instance_prefix_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear bestpath and re-advertise\n" - "IP prefix /, e.g., 35.0.0.0/8\n") -ALIAS (clear_ip_bgp_prefix, - clear_bgp_prefix_cmd, - "clear bgp prefix A.B.C.D/M", - CLEAR_STR - BGP_STR - "Clear bestpath and re-advertise\n" - "IP prefix /, e.g., 35.0.0.0/8\n") -ALIAS (clear_ip_bgp_prefix, - clear_bgp_instance_prefix_cmd, - "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear bestpath and re-advertise\n" - "IP prefix /, e.g., 35.0.0.0/8\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * + * "clear bgp ipv6 " CMD_AS_RANGE, + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * + * "clear bgp " CMD_AS_RANGE, + * CLEAR_STR + * BGP_STR + * "Clear peers with the AS number\n" + * + */ DEFUN (clear_ip_bgp_as, clear_ip_bgp_as_cmd, "clear ip bgp " CMD_AS_RANGE, @@ -6523,48 +6613,39 @@ DEFUN (clear_ip_bgp_as, return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[3]->arg); } -ALIAS (clear_ip_bgp_as, - clear_ip_bgp_instance_as_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n") -ALIAS (clear_ip_bgp_as, - clear_bgp_as_cmd, - "clear bgp " CMD_AS_RANGE, - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n") -ALIAS (clear_ip_bgp_as, - clear_bgp_instance_as_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n") -ALIAS (clear_ip_bgp_as, - clear_bgp_ipv6_as_cmd, - "clear bgp ipv6 " CMD_AS_RANGE, - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n") -ALIAS (clear_ip_bgp_as, - clear_bgp_instance_ipv6_as_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n") /* Outbound soft-reconfiguration */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " * out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " * soft out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear ip bgp * out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_all_soft_out, clear_ip_bgp_all_soft_out_cmd, "clear ip bgp * soft out", @@ -6583,36 +6664,22 @@ DEFUN (clear_ip_bgp_all_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_all_soft_out, - clear_ip_bgp_instance_all_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * soft out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_all_soft_out, - clear_ip_bgp_all_out_cmd, - "clear ip bgp * out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_all_soft_out, - clear_ip_bgp_instance_all_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_all_ipv4_soft_out, clear_ip_bgp_all_ipv4_soft_out_cmd, "clear ip bgp * ipv4 (unicast|multicast) soft out", @@ -6634,6 +6701,20 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, clear_ip_bgp_instance_all_ipv4_soft_out_cmd, "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", @@ -6655,31 +6736,20 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_all_ipv4_soft_out, - clear_ip_bgp_all_ipv4_out_cmd, - "clear ip bgp * ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out, - clear_ip_bgp_instance_all_ipv4_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * vpnv4 unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family Modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_all_vpnv4_soft_out, clear_ip_bgp_all_vpnv4_soft_out_cmd, "clear ip bgp * vpnv4 unicast soft out", @@ -6696,17 +6766,19 @@ DEFUN (clear_ip_bgp_all_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_all_vpnv4_soft_out, - clear_ip_bgp_all_vpnv4_out_cmd, - "clear ip bgp * vpnv4 unicast out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * encap unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family Modifier\n" + * "Soft reconfig outbound update\n" + * + */ DEFUN (clear_ip_bgp_all_encap_soft_out, clear_ip_bgp_all_encap_soft_out_cmd, "clear ip bgp * encap unicast soft out", @@ -6723,17 +6795,63 @@ DEFUN (clear_ip_bgp_all_encap_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_all_encap_soft_out, - clear_ip_bgp_all_encap_out_cmd, - "clear ip bgp * encap unicast out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig outbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 * soft out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " * soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 * out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp * out", + * CLEAR_STR + * BGP_STR + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " * out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_bgp_all_soft_out, clear_bgp_all_soft_out_cmd, "clear bgp * soft out", @@ -6751,72 +6869,12 @@ DEFUN (clear_bgp_all_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_bgp_all_soft_out, - clear_bgp_instance_all_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " * soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_all_out_cmd, - "clear bgp * out", - CLEAR_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_instance_all_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " * out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_ipv6_all_soft_out_cmd, - "clear bgp ipv6 * soft out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_instance_ipv6_all_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_ipv6_all_out_cmd, - "clear bgp ipv6 * out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_all_soft_out, - clear_bgp_instance_ipv6_all_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_OUT_STR) DEFUN (clear_bgp_ipv6_safi_prefix, clear_bgp_ipv6_safi_prefix_cmd, @@ -6851,6 +6909,36 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_UNICAST, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear ip bgp (A.B.C.D|WORD) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_peer_soft_out, clear_ip_bgp_peer_soft_out_cmd, "clear ip bgp (A.B.C.D|WORD) soft out", @@ -6870,39 +6958,23 @@ DEFUN (clear_ip_bgp_peer_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_soft_out, - clear_ip_bgp_instance_peer_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_peer_soft_out, - clear_ip_bgp_peer_out_cmd, - "clear ip bgp (A.B.C.D|WORD) out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_peer_soft_out, - clear_ip_bgp_instance_peer_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, clear_ip_bgp_peer_ipv4_soft_out_cmd, "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", @@ -6925,6 +6997,21 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", @@ -6948,34 +7035,22 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[5]->arg); } -ALIAS (clear_ip_bgp_peer_ipv4_soft_out, - clear_ip_bgp_peer_ipv4_out_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out, - clear_ip_bgp_instance_peer_ipv4_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) /* NOTE: WORD peers have not been tested for vpnv4 */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family Modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, clear_ip_bgp_peer_vpnv4_soft_out_cmd, "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", @@ -6993,18 +7068,19 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, - clear_ip_bgp_peer_vpnv4_out_cmd, - "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp A.B.C.D encap unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "Address family\n" + * "Address Family Modifier\n" + * "Soft reconfig outbound update\n" + * + */ DEFUN (clear_ip_bgp_peer_encap_soft_out, clear_ip_bgp_peer_encap_soft_out_cmd, "clear ip bgp A.B.C.D encap unicast soft out", @@ -7021,17 +7097,77 @@ DEFUN (clear_ip_bgp_peer_encap_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_encap_soft_out, - clear_ip_bgp_peer_encap_out_cmd, - "clear ip bgp A.B.C.D encap unicast out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig outbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp (A.B.C.D|X:X::X:X|WORD) out", + * CLEAR_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_bgp_peer_soft_out, clear_bgp_peer_soft_out_cmd, "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", @@ -7051,89 +7187,45 @@ DEFUN (clear_bgp_peer_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]->arg); } -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_instance_peer_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_ipv6_peer_soft_out_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_instance_ipv6_peer_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_peer_out_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) out", - CLEAR_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_instance_peer_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_ipv6_peer_out_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_soft_out, - clear_bgp_instance_ipv6_peer_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp peer-group WORD out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_peer_group_soft_out, - clear_ip_bgp_peer_group_soft_out_cmd, + clear_ip_bgp_peer_group_soft_out_cmd, "clear ip bgp peer-group WORD soft out", CLEAR_STR IP_STR @@ -7151,39 +7243,23 @@ DEFUN (clear_ip_bgp_peer_group_soft_out, BGP_CLEAR_SOFT_OUT, argv[4]->arg); } -ALIAS (clear_ip_bgp_peer_group_soft_out, - clear_ip_bgp_instance_peer_group_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_peer_group_soft_out, - clear_ip_bgp_peer_group_out_cmd, - "clear ip bgp peer-group WORD out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_peer_group_soft_out, - clear_ip_bgp_instance_peer_group_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, clear_ip_bgp_peer_group_ipv4_soft_out_cmd, "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", @@ -7206,6 +7282,21 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", @@ -7229,33 +7320,71 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[6]->arg); } -ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, - clear_ip_bgp_peer_group_ipv4_out_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out, - clear_ip_bgp_instance_peer_group_ipv4_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 peer-group WORD soft out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp peer-group WORD out", + * CLEAR_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 peer-group WORD out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_bgp_peer_group_soft_out, clear_bgp_peer_group_soft_out_cmd, "clear bgp peer-group WORD soft out", @@ -7274,82 +7403,42 @@ DEFUN (clear_bgp_peer_group_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_instance_peer_group_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_ipv6_peer_group_soft_out_cmd, - "clear bgp ipv6 peer-group WORD soft out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_instance_ipv6_peer_group_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_peer_group_out_cmd, - "clear bgp peer-group WORD out", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_instance_peer_group_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_ipv6_peer_group_out_cmd, - "clear bgp ipv6 peer-group WORD out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_peer_group_soft_out, - clear_bgp_instance_ipv6_peer_group_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " external soft out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " external out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + * "clear ip bgp external out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_external_soft_out, - clear_ip_bgp_external_soft_out_cmd, + clear_ip_bgp_external_soft_out_cmd, "clear ip bgp external soft out", CLEAR_STR IP_STR @@ -7366,36 +7455,22 @@ DEFUN (clear_ip_bgp_external_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_external_soft_out, - clear_ip_bgp_instance_external_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external soft out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_external_soft_out, - clear_ip_bgp_external_out_cmd, - "clear ip bgp external out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_external_soft_out, - clear_ip_bgp_instance_external_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp external ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all external peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_external_ipv4_soft_out, clear_ip_bgp_external_ipv4_soft_out_cmd, "clear ip bgp external ipv4 (unicast|multicast) soft out", @@ -7417,6 +7492,20 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, clear_ip_bgp_instance_external_ipv4_soft_out_cmd, "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", @@ -7439,31 +7528,64 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_ip_bgp_external_ipv4_soft_out, - clear_ip_bgp_external_ipv4_out_cmd, - "clear ip bgp external ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out, - clear_ip_bgp_instance_external_ipv4_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 external WORD out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " external soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " external out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 external soft out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp external out", + * CLEAR_STR + * BGP_STR + * "Clear all external peers\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_bgp_external_soft_out, clear_bgp_external_soft_out_cmd, "clear bgp external soft out", @@ -7481,73 +7603,40 @@ DEFUN (clear_bgp_external_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -ALIAS (clear_bgp_external_soft_out, - clear_bgp_instance_external_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " external soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_ipv6_external_soft_out_cmd, - "clear bgp ipv6 external soft out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_instance_ipv6_external_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_external_out_cmd, - "clear bgp external out", - CLEAR_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_instance_external_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " external out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_ipv6_external_out_cmd, - "clear bgp ipv6 external WORD out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_external_soft_out, - clear_bgp_instance_ipv6_external_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " CMD_AS_RANGE " out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_soft_out_cmd, "clear ip bgp " CMD_AS_RANGE " soft out", @@ -7566,36 +7655,22 @@ DEFUN (clear_ip_bgp_as_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_soft_out, - clear_ip_bgp_instance_as_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_as_soft_out, - clear_ip_bgp_as_out_cmd, - "clear ip bgp " CMD_AS_RANGE " out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_as_soft_out, - clear_ip_bgp_instance_as_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", @@ -7617,6 +7692,20 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, clear_ip_bgp_instance_as_ipv4_soft_out_cmd, "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", @@ -7639,31 +7728,20 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[5]->arg); } -ALIAS (clear_ip_bgp_as_ipv4_soft_out, - clear_ip_bgp_as_ipv4_out_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out, - clear_ip_bgp_instance_as_ipv4_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_soft_out_cmd, "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", @@ -7680,17 +7758,19 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_vpnv4_soft_out, - clear_ip_bgp_as_vpnv4_out_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " encap unicast out", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Soft reconfig outbound update\n" + * + */ DEFUN (clear_ip_bgp_as_encap_soft_out, clear_ip_bgp_as_encap_soft_out_cmd, "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", @@ -7707,17 +7787,63 @@ DEFUN (clear_ip_bgp_as_encap_soft_out, BGP_CLEAR_SOFT_OUT, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_encap_soft_out, - clear_ip_bgp_as_encap_out_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Soft reconfig outbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 " CMD_AS_RANGE " soft out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " CMD_AS_RANGE " out", + * CLEAR_STR + * BGP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp ipv6 " CMD_AS_RANGE " out", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_OUT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_OUT_STR + * + */ DEFUN (clear_bgp_as_soft_out, clear_bgp_as_soft_out_cmd, "clear bgp " CMD_AS_RANGE " soft out", @@ -7735,74 +7861,41 @@ DEFUN (clear_bgp_as_soft_out, BGP_CLEAR_SOFT_OUT, argv[2]->arg); } -ALIAS (clear_bgp_as_soft_out, - clear_bgp_instance_as_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_ipv6_as_soft_out_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " soft out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_instance_ipv6_as_soft_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_as_out_cmd, - "clear bgp " CMD_AS_RANGE " out", - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_instance_as_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_ipv6_as_out_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " out", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) -ALIAS (clear_bgp_as_soft_out, - clear_bgp_instance_ipv6_as_out_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_OUT_STR) /* Inbound soft-reconfiguration */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " * in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " * soft in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear ip bgp * in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_all_soft_in, clear_ip_bgp_all_soft_in_cmd, "clear ip bgp * soft in", @@ -7821,35 +7914,8 @@ DEFUN (clear_ip_bgp_all_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_all_soft_in, - clear_ip_bgp_instance_all_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * soft in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_all_soft_in, - clear_ip_bgp_all_in_cmd, - "clear ip bgp * in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_all_soft_in, - clear_ip_bgp_instance_all_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_all_in_prefix_filter, clear_ip_bgp_all_in_prefix_filter_cmd, @@ -7869,6 +7935,19 @@ DEFUN (clear_ip_bgp_all_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_all_ipv4_soft_in, clear_ip_bgp_all_ipv4_soft_in_cmd, "clear ip bgp * ipv4 (unicast|multicast) soft in", @@ -7890,6 +7969,20 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, clear_ip_bgp_instance_all_ipv4_soft_in_cmd, "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", @@ -7912,30 +8005,7 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_all_ipv4_soft_in, - clear_ip_bgp_all_ipv4_in_cmd, - "clear ip bgp * ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in, - clear_ip_bgp_instance_all_ipv4_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, @@ -7958,6 +8028,18 @@ DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * vpnv4 unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family Modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_all_vpnv4_soft_in, clear_ip_bgp_all_vpnv4_soft_in_cmd, "clear ip bgp * vpnv4 unicast soft in", @@ -7974,17 +8056,19 @@ DEFUN (clear_ip_bgp_all_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_all_vpnv4_soft_in, - clear_ip_bgp_all_vpnv4_in_cmd, - "clear ip bgp * vpnv4 unicast in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp * encap unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all peers\n" + * "Address family\n" + * "Address Family Modifier\n" + * "Soft reconfig inbound update\n" + * + */ DEFUN (clear_ip_bgp_all_encap_soft_in, clear_ip_bgp_all_encap_soft_in_cmd, "clear ip bgp * encap unicast soft in", @@ -8001,17 +8085,63 @@ DEFUN (clear_ip_bgp_all_encap_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_all_encap_soft_in, - clear_ip_bgp_all_encap_in_cmd, - "clear ip bgp * encap unicast in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig inbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 * soft in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp * in", + * CLEAR_STR + * BGP_STR + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " * in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 * in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " * soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_bgp_all_soft_in, clear_bgp_all_soft_in_cmd, "clear bgp * soft in", @@ -8029,73 +8159,24 @@ DEFUN (clear_bgp_all_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_bgp_all_soft_in, - clear_bgp_instance_all_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " * soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_ipv6_all_soft_in_cmd, - "clear bgp ipv6 * soft in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_instance_ipv6_all_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_all_in_cmd, - "clear bgp * in", - CLEAR_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_instance_all_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " * in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_ipv6_all_in_cmd, - "clear bgp ipv6 * in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_all_soft_in, - clear_bgp_instance_ipv6_all_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 * in prefix-filter", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_IN_STR + * "Push out prefix-list ORF and do inbound soft reconfig\n" + * + */ DEFUN (clear_bgp_all_in_prefix_filter, clear_bgp_all_in_prefix_filter_cmd, "clear bgp * in prefix-filter", @@ -8109,16 +8190,37 @@ DEFUN (clear_bgp_all_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } -ALIAS (clear_bgp_all_in_prefix_filter, - clear_bgp_ipv6_all_in_prefix_filter_cmd, - "clear bgp ipv6 * in prefix-filter", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear ip bgp (A.B.C.D|WORD) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_peer_soft_in, clear_ip_bgp_peer_soft_in_cmd, "clear ip bgp (A.B.C.D|WORD) soft in", @@ -8138,38 +8240,8 @@ DEFUN (clear_ip_bgp_peer_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_soft_in, - clear_ip_bgp_instance_peer_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_peer_soft_in, - clear_ip_bgp_peer_in_cmd, - "clear ip bgp (A.B.C.D|WORD) in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_peer_soft_in, - clear_ip_bgp_instance_peer_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_peer_in_prefix_filter, clear_ip_bgp_peer_in_prefix_filter_cmd, @@ -8186,6 +8258,20 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, clear_ip_bgp_peer_ipv4_soft_in_cmd, "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", @@ -8208,6 +8294,21 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", @@ -8231,32 +8332,7 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[5]->arg); } -ALIAS (clear_ip_bgp_peer_ipv4_soft_in, - clear_ip_bgp_peer_ipv4_in_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in, - clear_ip_bgp_instance_peer_ipv4_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, @@ -8280,6 +8356,19 @@ DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * "Address family\n" + * "Address Family Modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, clear_ip_bgp_peer_vpnv4_soft_in_cmd, "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", @@ -8297,18 +8386,19 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, - clear_ip_bgp_peer_vpnv4_in_cmd, - "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp A.B.C.D encap unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "Address family\n" + * "Address Family Modifier\n" + * "Soft reconfig inbound update\n" + * + */ DEFUN (clear_ip_bgp_peer_encap_soft_in, clear_ip_bgp_peer_encap_soft_in_cmd, "clear ip bgp A.B.C.D encap unicast soft in", @@ -8325,17 +8415,77 @@ DEFUN (clear_ip_bgp_peer_encap_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_encap_soft_in, - clear_ip_bgp_peer_encap_in_cmd, - "clear ip bgp A.B.C.D encap unicast in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig inbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp (A.B.C.D|X:X::X:X|WORD) in", + * CLEAR_STR + * BGP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_bgp_peer_soft_in, clear_bgp_peer_soft_in_cmd, "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", @@ -8355,87 +8505,26 @@ DEFUN (clear_bgp_peer_soft_in, BGP_CLEAR_SOFT_IN, argv[2]->arg); } -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_instance_peer_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_ipv6_peer_soft_in_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_instance_ipv6_peer_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_peer_in_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) in", - CLEAR_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_instance_peer_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_ipv6_peer_in_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_soft_in, - clear_bgp_instance_ipv6_peer_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_IN_STR + * "Push out the existing ORF prefix-list\n" + * + */ DEFUN (clear_bgp_peer_in_prefix_filter, clear_bgp_peer_in_prefix_filter_cmd, "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", @@ -8451,18 +8540,37 @@ DEFUN (clear_bgp_peer_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); } -ALIAS (clear_bgp_peer_in_prefix_filter, - clear_bgp_ipv6_peer_in_prefix_filter_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR - "Push out the existing ORF prefix-list\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear ip bgp peer-group WORD in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_peer_group_soft_in, clear_ip_bgp_peer_group_soft_in_cmd, "clear ip bgp peer-group WORD soft in", @@ -8482,38 +8590,8 @@ DEFUN (clear_ip_bgp_peer_group_soft_in, BGP_CLEAR_SOFT_IN, argv[4]->arg); } -ALIAS (clear_ip_bgp_peer_group_soft_in, - clear_ip_bgp_instance_peer_group_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_peer_group_soft_in, - clear_ip_bgp_peer_group_in_cmd, - "clear ip bgp peer-group WORD in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_peer_group_soft_in, - clear_ip_bgp_instance_peer_group_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, clear_ip_bgp_peer_group_in_prefix_filter_cmd, @@ -8530,6 +8608,20 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, clear_ip_bgp_peer_group_ipv4_soft_in_cmd, "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", @@ -8552,6 +8644,21 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", @@ -8575,32 +8682,7 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[6]->arg); } -ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, - clear_ip_bgp_peer_group_ipv4_in_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in, - clear_ip_bgp_instance_peer_group_ipv4_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, @@ -8624,6 +8706,69 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 peer-group WORD in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp peer-group WORD in", + * CLEAR_STR + * BGP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 peer-group WORD soft in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_bgp_peer_group_soft_in, clear_bgp_peer_group_soft_in_cmd, "clear bgp peer-group WORD soft in", @@ -8642,80 +8787,25 @@ DEFUN (clear_bgp_peer_group_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_instance_peer_group_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_ipv6_peer_group_soft_in_cmd, - "clear bgp ipv6 peer-group WORD soft in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_instance_ipv6_peer_group_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_peer_group_in_cmd, - "clear bgp peer-group WORD in", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_instance_peer_group_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_ipv6_peer_group_in_cmd, - "clear bgp ipv6 peer-group WORD in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_peer_group_soft_in, - clear_bgp_instance_ipv6_peer_group_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 peer-group WORD in prefix-filter", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_IN_STR + * "Push out prefix-list ORF and do inbound soft reconfig\n" + * + */ DEFUN (clear_bgp_peer_group_in_prefix_filter, clear_bgp_peer_group_in_prefix_filter_cmd, "clear bgp peer-group WORD in prefix-filter", @@ -8730,17 +8820,34 @@ DEFUN (clear_bgp_peer_group_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } -ALIAS (clear_bgp_peer_group_in_prefix_filter, - clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, - "clear bgp ipv6 peer-group WORD in prefix-filter", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp external in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " external in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " external soft in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_external_soft_in, clear_ip_bgp_external_soft_in_cmd, "clear ip bgp external soft in", @@ -8759,35 +8866,8 @@ DEFUN (clear_ip_bgp_external_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_external_soft_in, - clear_ip_bgp_instance_external_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external soft in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_external_soft_in, - clear_ip_bgp_external_in_cmd, - "clear ip bgp external in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_external_soft_in, - clear_ip_bgp_instance_external_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_external_in_prefix_filter, clear_ip_bgp_external_in_prefix_filter_cmd, @@ -8803,6 +8883,19 @@ DEFUN (clear_ip_bgp_external_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp external ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear all external peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_external_ipv4_soft_in, clear_ip_bgp_external_ipv4_soft_in_cmd, "clear ip bgp external ipv4 (unicast|multicast) soft in", @@ -8824,6 +8917,20 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, clear_ip_bgp_instance_external_ipv4_soft_in_cmd, "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", @@ -8846,30 +8953,7 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_ip_bgp_external_ipv4_soft_in, - clear_ip_bgp_external_ipv4_in_cmd, - "clear ip bgp external ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in, - clear_ip_bgp_instance_external_ipv4_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, @@ -8892,6 +8976,62 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " external in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " external soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 external soft in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 external WORD in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + * "clear bgp external in", + * CLEAR_STR + * BGP_STR + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_bgp_external_soft_in, clear_bgp_external_soft_in_cmd, "clear bgp external soft in", @@ -8909,73 +9049,24 @@ DEFUN (clear_bgp_external_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -ALIAS (clear_bgp_external_soft_in, - clear_bgp_instance_external_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " external soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_ipv6_external_soft_in_cmd, - "clear bgp ipv6 external soft in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_instance_ipv6_external_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_external_in_cmd, - "clear bgp external in", - CLEAR_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_instance_external_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " external in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_ipv6_external_in_cmd, - "clear bgp ipv6 external WORD in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_external_soft_in, - clear_bgp_instance_ipv6_external_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 external in prefix-filter", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_IN_STR + * "Push out prefix-list ORF and do inbound soft reconfig\n" + * + */ DEFUN (clear_bgp_external_in_prefix_filter, clear_bgp_external_in_prefix_filter_cmd, "clear bgp external in prefix-filter", @@ -8989,16 +9080,34 @@ DEFUN (clear_bgp_external_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } -ALIAS (clear_bgp_external_in_prefix_filter, - clear_bgp_ipv6_external_in_prefix_filter_cmd, - "clear bgp ipv6 external in prefix-filter", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_soft_in_cmd, "clear ip bgp " CMD_AS_RANGE " soft in", @@ -9017,35 +9126,8 @@ DEFUN (clear_ip_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_soft_in, - clear_ip_bgp_instance_as_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_as_soft_in, - clear_ip_bgp_as_in_cmd, - "clear ip bgp " CMD_AS_RANGE " in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_as_soft_in, - clear_ip_bgp_instance_as_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_as_in_prefix_filter, clear_ip_bgp_as_in_prefix_filter_cmd, @@ -9061,6 +9143,19 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", @@ -9082,6 +9177,20 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, clear_ip_bgp_instance_as_ipv4_soft_in_cmd, "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", @@ -9104,30 +9213,7 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[5]->arg); } -ALIAS (clear_ip_bgp_as_ipv4_soft_in, - clear_ip_bgp_as_ipv4_in_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) -ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in, - clear_ip_bgp_instance_as_ipv4_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, @@ -9150,6 +9236,18 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_soft_in_cmd, "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", @@ -9166,17 +9264,19 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_vpnv4_soft_in, - clear_ip_bgp_as_vpnv4_in_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " CMD_AS_RANGE " encap unicast in", + * CLEAR_STR + * IP_STR + * BGP_STR + * "Clear peers with the AS number\n" + * "Address family\n" + * "Address Family modifier\n" + * "Soft reconfig inbound update\n" + * + */ DEFUN (clear_ip_bgp_as_encap_soft_in, clear_ip_bgp_as_encap_soft_in_cmd, "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", @@ -9193,17 +9293,63 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, BGP_CLEAR_SOFT_IN, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_encap_soft_in, - clear_ip_bgp_as_encap_in_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Soft reconfig inbound update\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 " CMD_AS_RANGE " in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear bgp ipv6 " CMD_AS_RANGE " soft in", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + * "clear bgp " CMD_AS_RANGE " in", + * CLEAR_STR + * BGP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * BGP_SOFT_IN_STR + * + */ DEFUN (clear_bgp_as_soft_in, clear_bgp_as_soft_in_cmd, "clear bgp " CMD_AS_RANGE " soft in", @@ -9221,73 +9367,24 @@ DEFUN (clear_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[2]->arg); } -ALIAS (clear_bgp_as_soft_in, - clear_bgp_instance_as_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_ipv6_as_soft_in_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " soft in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_instance_ipv6_as_soft_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_as_in_cmd, - "clear bgp " CMD_AS_RANGE " in", - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_instance_as_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_ipv6_as_in_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " in", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) -ALIAS (clear_bgp_as_soft_in, - clear_bgp_instance_ipv6_as_in_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_IN_STR + * "Push out prefix-list ORF and do inbound soft reconfig\n" + * + */ DEFUN (clear_bgp_as_in_prefix_filter, clear_bgp_as_in_prefix_filter_cmd, "clear bgp " CMD_AS_RANGE " in prefix-filter", @@ -9301,17 +9398,19 @@ DEFUN (clear_bgp_as_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); } -ALIAS (clear_bgp_as_in_prefix_filter, - clear_bgp_ipv6_as_in_prefix_filter_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") /* Both soft-reconfiguration */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " * soft", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_ip_bgp_all_soft, clear_ip_bgp_all_soft_cmd, "clear ip bgp * soft", @@ -9329,15 +9428,6 @@ DEFUN (clear_ip_bgp_all_soft, BGP_CLEAR_SOFT_BOTH, NULL); } -ALIAS (clear_ip_bgp_all_soft, - clear_ip_bgp_instance_all_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR) DEFUN (clear_ip_bgp_all_ipv4_soft, @@ -9411,6 +9501,31 @@ DEFUN (clear_ip_bgp_all_encap_soft, BGP_CLEAR_SOFT_BOTH, argv[0]); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 * soft", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " * soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all peers\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all peers\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_bgp_all_soft, clear_bgp_all_soft_cmd, "clear bgp * soft", @@ -9427,34 +9542,21 @@ DEFUN (clear_bgp_all_soft, BGP_CLEAR_SOFT_BOTH, NULL); } -ALIAS (clear_bgp_all_soft, - clear_bgp_instance_all_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " * soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_all_soft, - clear_bgp_ipv6_all_soft_cmd, - "clear bgp ipv6 * soft", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_all_soft, - clear_bgp_instance_ipv6_all_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all peers\n" - BGP_SOFT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_ip_bgp_peer_soft, clear_ip_bgp_peer_soft_cmd, "clear ip bgp (A.B.C.D|WORD) soft", @@ -9473,16 +9575,6 @@ DEFUN (clear_ip_bgp_peer_soft, BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } -ALIAS (clear_ip_bgp_peer_soft, - clear_ip_bgp_instance_peer_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) DEFUN (clear_ip_bgp_peer_ipv4_soft, clear_ip_bgp_peer_ipv4_soft_cmd, @@ -9558,6 +9650,37 @@ DEFUN (clear_ip_bgp_peer_encap_soft, BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "BGP neighbor address to clear\n" + * "BGP IPv6 neighbor to clear\n" + * "BGP neighbor on interface to clear\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_bgp_peer_soft, clear_bgp_peer_soft_cmd, "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", @@ -9576,40 +9699,21 @@ DEFUN (clear_bgp_peer_soft, BGP_CLEAR_SOFT_BOTH, argv[2]->arg); } -ALIAS (clear_bgp_peer_soft, - clear_bgp_instance_peer_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_peer_soft, - clear_bgp_ipv6_peer_soft_cmd, - "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", - CLEAR_STR - BGP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_peer_soft, - clear_bgp_instance_ipv6_peer_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_ip_bgp_peer_group_soft, clear_ip_bgp_peer_group_soft_cmd, "clear ip bgp peer-group WORD soft", @@ -9628,16 +9732,6 @@ DEFUN (clear_ip_bgp_peer_group_soft, BGP_CLEAR_SOFT_BOTH, argv[4]->arg); } -ALIAS (clear_ip_bgp_peer_group_soft, - clear_ip_bgp_instance_peer_group_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) DEFUN (clear_ip_bgp_peer_group_ipv4_soft, clear_ip_bgp_peer_group_ipv4_soft_cmd, @@ -9682,6 +9776,34 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, BGP_CLEAR_SOFT_BOTH, argv[6]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * + * "clear bgp ipv6 peer-group WORD soft", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all members of peer-group\n" + * "BGP peer-group name\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_bgp_peer_group_soft, clear_bgp_peer_group_soft_cmd, "clear bgp peer-group WORD soft", @@ -9699,37 +9821,20 @@ DEFUN (clear_bgp_peer_group_soft, BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } -ALIAS (clear_bgp_peer_group_soft, - clear_bgp_instance_peer_group_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_peer_group_soft, - clear_bgp_ipv6_peer_group_soft_cmd, - "clear bgp ipv6 peer-group WORD soft", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_peer_group_soft, - clear_bgp_instance_ipv6_peer_group_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " external soft", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_ip_bgp_external_soft, clear_ip_bgp_external_soft_cmd, "clear ip bgp external soft", @@ -9747,15 +9852,6 @@ DEFUN (clear_ip_bgp_external_soft, BGP_CLEAR_SOFT_BOTH, NULL); } -ALIAS (clear_ip_bgp_external_soft, - clear_ip_bgp_instance_external_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR) DEFUN (clear_ip_bgp_external_ipv4_soft, clear_ip_bgp_external_ipv4_soft_cmd, @@ -9798,6 +9894,31 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft, BGP_CLEAR_SOFT_BOTH, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp " BGP_INSTANCE_CMD " external soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear all external peers\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * + * "clear bgp ipv6 external soft", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear all external peers\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_bgp_external_soft, clear_bgp_external_soft_cmd, "clear bgp external soft", @@ -9814,34 +9935,20 @@ DEFUN (clear_bgp_external_soft, BGP_CLEAR_SOFT_BOTH, NULL); } -ALIAS (clear_bgp_external_soft, - clear_bgp_instance_external_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " external soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_external_soft, - clear_bgp_ipv6_external_soft_cmd, - "clear bgp ipv6 external soft", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_external_soft, - clear_bgp_instance_ipv6_external_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear all external peers\n" - BGP_SOFT_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", + * CLEAR_STR + * IP_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_ip_bgp_as_soft, clear_ip_bgp_as_soft_cmd, "clear ip bgp " CMD_AS_RANGE " soft", @@ -9859,15 +9966,6 @@ DEFUN (clear_ip_bgp_as_soft, BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } -ALIAS (clear_ip_bgp_as_soft, - clear_ip_bgp_instance_as_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR) DEFUN (clear_ip_bgp_as_ipv4_soft, clear_ip_bgp_as_ipv4_soft_cmd, @@ -9940,6 +10038,31 @@ DEFUN (clear_ip_bgp_as_encap_soft, BGP_CLEAR_SOFT_BOTH, argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "clear bgp ipv6 " CMD_AS_RANGE " soft", + * CLEAR_STR + * BGP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * + * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", + * CLEAR_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Clear peers with the AS number\n" + * BGP_SOFT_STR + * + */ DEFUN (clear_bgp_as_soft, clear_bgp_as_soft_cmd, "clear bgp " CMD_AS_RANGE " soft", @@ -9956,33 +10079,8 @@ DEFUN (clear_bgp_as_soft, BGP_CLEAR_SOFT_BOTH, argv[2]->arg); } -ALIAS (clear_bgp_as_soft, - clear_bgp_instance_as_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_as_soft, - clear_bgp_ipv6_as_soft_cmd, - "clear bgp ipv6 " CMD_AS_RANGE " soft", - CLEAR_STR - BGP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR) -ALIAS (clear_bgp_as_soft, - clear_bgp_instance_ipv6_as_soft_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Clear peers with the AS number\n" - BGP_SOFT_STR) DEFUN (show_bgp_views, show_bgp_views_cmd, @@ -10123,7 +10221,7 @@ DEFUN (show_bgp_vrfs, return CMD_SUCCESS; } -DEFUN (show_bgp_memory, +DEFUN (show_bgp_memory, show_bgp_memory_cmd, "show bgp memory", SHOW_STR @@ -10704,7 +10802,18 @@ DEFUN (show_ip_bgp_instance_all_summary, return CMD_SUCCESS; } -DEFUN (show_ip_bgp_ipv4_summary, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv4 (unicast|multicast) summary {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Summary of BGP neighbor status\n" + * + */ +DEFUN (show_ip_bgp_ipv4_summary, show_ip_bgp_ipv4_summary_cmd, "show ip bgp ipv4 (unicast|multicast) summary {json}", SHOW_STR @@ -10723,15 +10832,6 @@ DEFUN (show_ip_bgp_ipv4_summary, return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); } -ALIAS (show_ip_bgp_ipv4_summary, - show_bgp_ipv4_safi_summary_cmd, - "show bgp ipv4 (unicast|multicast) summary {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n") DEFUN (show_bgp_ipv4_vpn_summary, show_bgp_ipv4_vpn_summary_cmd, @@ -10760,6 +10860,19 @@ DEFUN (show_bgp_ipv6_vpn_summary, return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN, use_json (argc, argv)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp view WORD ipv4 (unicast|multicast) summary {json}", + * SHOW_STR + * BGP_STR + * "BGP view\n" + * "View name\n" + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Summary of BGP neighbor status\n" + * + */ DEFUN (show_ip_bgp_instance_ipv4_summary, show_ip_bgp_instance_ipv4_summary_cmd, "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", @@ -10781,17 +10894,6 @@ DEFUN (show_ip_bgp_instance_ipv4_summary, return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); } -ALIAS (show_ip_bgp_instance_ipv4_summary, - show_bgp_instance_ipv4_safi_summary_cmd, - "show bgp view WORD ipv4 (unicast|multicast) summary {json}", - SHOW_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n") DEFUN (show_ip_bgp_vpnv4_all_summary, show_ip_bgp_vpnv4_all_summary_cmd, @@ -10835,6 +10937,15 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary, } #ifdef HAVE_IPV6 +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp ipv6 summary {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Summary of BGP neighbor status\n" + * + */ DEFUN (show_bgp_summary, show_bgp_summary_cmd, "show bgp summary {json}", @@ -10846,6 +10957,16 @@ DEFUN (show_bgp_summary, return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Summary of BGP neighbor status\n" + * + */ DEFUN (show_bgp_instance_summary, show_bgp_instance_summary_cmd, "show bgp " BGP_INSTANCE_CMD " summary {json}", @@ -10873,22 +10994,7 @@ DEFUN (show_bgp_instance_all_summary, return CMD_SUCCESS; } -ALIAS (show_bgp_summary, - show_bgp_ipv6_summary_cmd, - "show bgp ipv6 summary {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Summary of BGP neighbor status\n") -ALIAS (show_bgp_instance_summary, - show_bgp_instance_ipv6_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Summary of BGP neighbor status\n") DEFUN (show_bgp_ipv6_safi_summary, show_bgp_ipv6_safi_summary_cmd, @@ -10928,7 +11034,7 @@ DEFUN (show_bgp_instance_ipv6_safi_summary, } /* old command */ -DEFUN (show_ipv6_bgp_summary, +DEFUN (show_ipv6_bgp_summary, show_ipv6_bgp_summary_cmd, "show ipv6 bgp summary {json}", SHOW_STR @@ -10942,7 +11048,7 @@ DEFUN (show_ipv6_bgp_summary, } /* old command */ -DEFUN (show_ipv6_mbgp_summary, +DEFUN (show_ipv6_mbgp_summary, show_ipv6_mbgp_summary_cmd, "show ipv6 mbgp summary {json}", SHOW_STR @@ -12786,6 +12892,51 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) } /* "show ip bgp neighbors" commands. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display VPNv4 NLRI specific information\n" + * "Display information for a route distinguisher\n" + * "VPN Route Distinguisher\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + * "show bgp neighbors {json}", + * SHOW_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + * "show ip bgp vpnv4 all neighbors {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display VPNv4 NLRI specific information\n" + * "Display information about all VPNv4 NLRIs\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + * "show ip bgp ipv4 (unicast|multicast) neighbors {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + * "show bgp ipv6 neighbors {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_neighbors, show_ip_bgp_neighbors_cmd, "show ip bgp neighbors {json}", @@ -12800,58 +12951,66 @@ DEFUN (show_ip_bgp_neighbors, return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); } -ALIAS (show_ip_bgp_neighbors, - show_ip_bgp_ipv4_neighbors_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors {json}", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors, - show_ip_bgp_vpnv4_all_neighbors_cmd, - "show ip bgp vpnv4 all neighbors {json}", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors, - show_ip_bgp_vpnv4_rd_neighbors_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors, - show_bgp_neighbors_cmd, - "show bgp neighbors {json}", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors, - show_bgp_ipv6_neighbors_cmd, - "show bgp ipv6 neighbors {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Address family\n" + * "Address Family modifier\n" + * "Address Family modifier\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "JavaScript Object Notation\n" + * + * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display VPNv4 NLRI specific information\n" + * "Display information about all VPNv4 NLRIs\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "JavaScript Object Notation\n" + * + * "show ip bgp vpnv4 all neighbors A.B.C.D {json}", + * SHOW_STR + * IP_STR + * BGP_STR + * "Display VPNv4 NLRI specific information\n" + * "Display information about all VPNv4 NLRIs\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "JavaScript Object Notation\n" + * + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * SHOW_STR + * BGP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "JavaScript Object Notation\n" + * + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * SHOW_STR + * BGP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_neighbors_peer, show_ip_bgp_neighbors_peer_cmd, "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", @@ -12869,68 +13028,29 @@ DEFUN (show_ip_bgp_neighbors_peer, return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); } -ALIAS (show_ip_bgp_neighbors_peer, - show_ip_bgp_ipv4_neighbors_peer_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors_peer, - show_ip_bgp_vpnv4_all_neighbors_peer_cmd, - "show ip bgp vpnv4 all neighbors A.B.C.D {json}", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors_peer, - show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors_peer, - show_bgp_neighbors_peer_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_neighbors_peer, - show_bgp_ipv6_neighbors_peer_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", - SHOW_STR - BGP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " neighbors {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_instance_neighbors, show_ip_bgp_instance_neighbors_cmd, "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", @@ -12962,25 +13082,32 @@ DEFUN (show_ip_bgp_instance_all_neighbors, return CMD_SUCCESS; } -ALIAS (show_ip_bgp_instance_neighbors, - show_bgp_instance_neighbors_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_instance_neighbors, - show_bgp_instance_ipv6_neighbors_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Address family\n" + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "JavaScript Object Notation\n" + * + * "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * SHOW_STR + * BGP_STR + * BGP_INSTANCE_HELP_STR + * "Detailed information on TCP and BGP neighbor connections\n" + * "Neighbor to display information about\n" + * "Neighbor to display information about\n" + * "Neighbor on bgp configured interface\n" + * "JavaScript Object Notation\n" + * + */ DEFUN (show_ip_bgp_instance_neighbors_peer, show_ip_bgp_instance_neighbors_peer_cmd, "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", @@ -12999,35 +13126,12 @@ DEFUN (show_ip_bgp_instance_neighbors_peer, return bgp_show_neighbor_vty (vty, argv[4]->arg, show_peer, argv[6]->arg, uj, NULL); } -ALIAS (show_ip_bgp_instance_neighbors_peer, - show_bgp_instance_neighbors_peer_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") -ALIAS (show_ip_bgp_instance_neighbors_peer, - show_bgp_instance_ipv6_neighbors_peer_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") /* Show BGP's AS paths internal data. There are both `show ip bgp paths' and `show ip mbgp paths'. Those functions results are the same.*/ -DEFUN (show_ip_bgp_paths, +DEFUN (show_ip_bgp_paths, show_ip_bgp_paths_cmd, "show ip bgp paths", SHOW_STR @@ -13040,7 +13144,7 @@ DEFUN (show_ip_bgp_paths, return CMD_SUCCESS; } -DEFUN (show_ip_bgp_ipv4_paths, +DEFUN (show_ip_bgp_ipv4_paths, show_ip_bgp_ipv4_paths_cmd, "show ip bgp ipv4 (unicast|multicast) paths", SHOW_STR @@ -13070,7 +13174,7 @@ community_show_all_iterator (struct hash_backet *backet, struct vty *vty) } /* Show BGP's community internal data. */ -DEFUN (show_ip_bgp_community_info, +DEFUN (show_ip_bgp_community_info, show_ip_bgp_community_info_cmd, "show ip bgp community-info", SHOW_STR @@ -13088,7 +13192,7 @@ DEFUN (show_ip_bgp_community_info, return CMD_SUCCESS; } -DEFUN (show_ip_bgp_attr_info, +DEFUN (show_ip_bgp_attr_info, show_ip_bgp_attr_info_cmd, "show ip bgp attribute-info", SHOW_STR @@ -14026,6 +14130,49 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no redistribute (ospf|table) <1-65535> route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * "Open Shortest Path First (OSPFv2)\n" + * "Non-main Kernel Routing Table\n" + * "Instance ID/Table ID\n" + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * "Open Shortest Path First (OSPFv2)\n" + * "Non-main Kernel Routing Table\n" + * "Instance ID/Table ID\n" + * "Metric for redistributed routes\n" + * "Default metric\n" + * + * "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * "Open Shortest Path First (OSPFv2)\n" + * "Non-main Kernel Routing Table\n" + * "Instance ID/Table ID\n" + * "Route map reference\n" + * "Pointer to route-map entries\n" + * "Metric for redistributed routes\n" + * "Default metric\n" + * + * "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * "Open Shortest Path First (OSPFv2)\n" + * "Non-main Kernel Routing Table\n" + * "Instance ID/Table ID\n" + * "Metric for redistributed routes\n" + * "Default metric\n" + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + */ DEFUN (no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_cmd, "no redistribute (ospf|table) <1-65535>", @@ -14047,54 +14194,45 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); } -ALIAS (no_bgp_redistribute_ipv4_ospf, - no_bgp_redistribute_ipv4_ospf_rmap_cmd, - "no redistribute (ospf|table) <1-65535> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Open Shortest Path First (OSPFv2)\n" - "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n" - "Route map reference\n" - "Pointer to route-map entries\n") -ALIAS (no_bgp_redistribute_ipv4_ospf, - no_bgp_redistribute_ipv4_ospf_metric_cmd, - "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Open Shortest Path First (OSPFv2)\n" - "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n" - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv4_ospf, - no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, - "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - "Open Shortest Path First (OSPFv2)\n" - "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n" - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv4_ospf, - no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, - "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - "Open Shortest Path First (OSPFv2)\n" - "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n" - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" - "Pointer to route-map entries\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP_REDIST_HELP_STR_BGPD + * "Metric for redistributed routes\n" + * "Default metric\n" + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP_REDIST_HELP_STR_BGPD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP_REDIST_HELP_STR_BGPD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * "Metric for redistributed routes\n" + * "Default metric\n" + * + * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP_REDIST_HELP_STR_BGPD + * "Metric for redistributed routes\n" + * "Default metric\n" + * + */ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, @@ -14113,45 +14251,9 @@ DEFUN (no_bgp_redistribute_ipv4, return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); } -ALIAS (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_rmap_cmd, - "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD - "Route map reference\n" - "Pointer to route-map entries\n") -ALIAS (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_metric_cmd, - "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_rmap_metric_cmd, - "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv4, - no_bgp_redistribute_ipv4_metric_rmap_cmd, - "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" - "Pointer to route-map entries\n") #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, @@ -14277,6 +14379,41 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP6_REDIST_HELP_STR_BGPD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP6_REDIST_HELP_STR_BGPD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * "Metric for redistributed routes\n" + * "Default metric\n" + * + * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP6_REDIST_HELP_STR_BGPD + * "Metric for redistributed routes\n" + * "Default metric\n" + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", + * NO_STR + * "Redistribute information from another routing protocol\n" + * QUAGGA_IP6_REDIST_HELP_STR_BGPD + * "Metric for redistributed routes\n" + * "Default metric\n" + * + */ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, @@ -14296,45 +14433,9 @@ DEFUN (no_bgp_redistribute_ipv6, return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); } -ALIAS (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_rmap_cmd, - "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD - "Route map reference\n" - "Pointer to route-map entries\n") -ALIAS (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_metric_cmd, - "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_rmap_metric_cmd, - "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD - "Route map reference\n" - "Pointer to route-map entries\n" - "Metric for redistributed routes\n" - "Default metric\n") -ALIAS (no_bgp_redistribute_ipv6, - no_bgp_redistribute_ipv6_metric_rmap_cmd, - "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", - NO_STR - "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD - "Metric for redistributed routes\n" - "Default metric\n" - "Route map reference\n" - "Pointer to route-map entries\n") #endif /* HAVE_IPV6 */ int @@ -14477,12 +14578,10 @@ bgp_vty_init (void) /* "bgp config-type" commands. */ install_element (CONFIG_NODE, &bgp_config_type_cmd); - install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); /* bgp route-map delay-timer commands. */ install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); - install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); /* Dummy commands (Currently not supported) */ install_element (BGP_NODE, &no_synchronization_cmd); @@ -14490,30 +14589,21 @@ bgp_vty_init (void) /* "router bgp" commands. */ install_element (CONFIG_NODE, &router_bgp_cmd); - install_element (CONFIG_NODE, &router_bgp_instance_cmd); - install_element (CONFIG_NODE, &router_bgp_noasn_cmd); /* "no router bgp" commands. */ install_element (CONFIG_NODE, &no_router_bgp_cmd); - install_element (CONFIG_NODE, &no_router_bgp_instance_cmd); - install_element (CONFIG_NODE, &no_router_bgp_noasn_cmd); /* "bgp router-id" commands. */ install_element (BGP_NODE, &bgp_router_id_cmd); install_element (BGP_NODE, &no_bgp_router_id_cmd); - install_element (BGP_NODE, &no_bgp_router_id_val_cmd); /* "bgp cluster-id" commands. */ install_element (BGP_NODE, &bgp_cluster_id_cmd); - install_element (BGP_NODE, &bgp_cluster_id32_cmd); install_element (BGP_NODE, &no_bgp_cluster_id_cmd); - install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); - install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); /* "bgp confederation" commands. */ install_element (BGP_NODE, &bgp_confederation_identifier_cmd); install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); - install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); /* "bgp confederation peers" commands. */ install_element (BGP_NODE, &bgp_confederation_peers_cmd); @@ -14523,12 +14613,9 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_maxmed_admin_cmd); install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); - install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); - install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); - install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); /* bgp disable-ebgp-connected-nh-check */ install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); @@ -14538,7 +14625,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_update_delay_cmd); install_element (BGP_NODE, &no_bgp_update_delay_cmd); install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); - install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); @@ -14549,38 +14635,27 @@ bgp_vty_init (void) /* "maximum-paths" commands. */ install_element (BGP_NODE, &bgp_maxpaths_cmd); install_element (BGP_NODE, &no_bgp_maxpaths_cmd); - install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); - install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); - install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); /* "timers bgp" commands. */ install_element (BGP_NODE, &bgp_timers_cmd); install_element (BGP_NODE, &no_bgp_timers_cmd); - install_element (BGP_NODE, &no_bgp_timers_arg_cmd); /* route-map delay-timer commands - per instance for backwards compat. */ install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); - install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); /* "bgp client-to-client reflection" commands */ install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); @@ -14599,10 +14674,8 @@ bgp_vty_init (void) install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); - install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd); install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd); - install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd); /* "bgp fast-external-failover" commands */ install_element (BGP_NODE, &bgp_fast_external_failover_cmd); @@ -14635,10 +14708,8 @@ bgp_vty_init (void) /* "bgp bestpath med" commands */ install_element (BGP_NODE, &bgp_bestpath_med_cmd); install_element (BGP_NODE, &bgp_bestpath_med2_cmd); - install_element (BGP_NODE, &bgp_bestpath_med3_cmd); install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); - install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); /* "no bgp default ipv4-unicast" commands. */ install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); @@ -14652,7 +14723,6 @@ bgp_vty_init (void) /* "bgp default local-preference" commands. */ install_element (BGP_NODE, &bgp_default_local_preference_cmd); install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); - install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); /* bgp default show-hostname */ install_element (BGP_NODE, &bgp_default_show_hostname_cmd); @@ -14661,7 +14731,6 @@ bgp_vty_init (void) /* "bgp default subgroup-pkt-queue-max" commands. */ install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); - install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); /* bgp ibgp-allow-policy-mods command */ install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); @@ -14670,7 +14739,6 @@ bgp_vty_init (void) /* "bgp listen limit" commands. */ install_element (BGP_NODE, &bgp_listen_limit_cmd); install_element (BGP_NODE, &no_bgp_listen_limit_cmd); - install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); /* "bgp listen range" commands. */ install_element (BGP_NODE, &bgp_listen_range_cmd); @@ -14680,18 +14748,10 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_remote_as_cmd); install_element (BGP_NODE, &neighbor_interface_config_cmd); install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); - install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd); - install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd); install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd); install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd); install_element (BGP_NODE, &no_neighbor_cmd); - install_element (BGP_NODE, &no_neighbor_remote_as_cmd); install_element (BGP_NODE, &no_neighbor_interface_config_cmd); - install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd); - install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd); - install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd); - install_element (BGP_NODE, &no_neighbor_interface_config_remote_as_cmd); - install_element (BGP_NODE, &no_neighbor_interface_config_v6only_remote_as_cmd); /* "neighbor peer-group" commands. */ install_element (BGP_NODE, &neighbor_peer_group_cmd); @@ -14703,9 +14763,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); install_element (BGP_NODE, &no_neighbor_local_as_cmd); - install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); - install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); - install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); /* "neighbor solo" commands. */ install_element (BGP_NODE, &neighbor_solo_cmd); @@ -14714,7 +14771,6 @@ bgp_vty_init (void) /* "neighbor password" commands. */ install_element (BGP_NODE, &neighbor_password_cmd); install_element (BGP_NODE, &no_neighbor_password_cmd); - install_element (BGP_NODE, &no_neighbor_password_val_cmd); /* "neighbor activate" commands. */ install_element (BGP_NODE, &neighbor_activate_cmd); @@ -14791,201 +14847,93 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd); /* "nexthop-local unchanged" commands */ install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); @@ -15252,18 +15200,14 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); - install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); /* "neighbor disable-connected-check" commands. */ install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); - install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); - install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); /* "neighbor description" commands. */ install_element (BGP_NODE, &neighbor_description_cmd); install_element (BGP_NODE, &no_neighbor_description_cmd); - install_element (BGP_NODE, &no_neighbor_description_val_cmd); /* "neighbor update-source" commands. "*/ install_element (BGP_NODE, &neighbor_update_source_cmd); @@ -15273,33 +15217,26 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_default_originate_cmd); install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); install_element (BGP_NODE, &no_neighbor_default_originate_cmd); - install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); /* "neighbor port" commands. */ install_element (BGP_NODE, &neighbor_port_cmd); install_element (BGP_NODE, &no_neighbor_port_cmd); - install_element (BGP_NODE, &no_neighbor_port_val_cmd); /* "neighbor weight" commands. */ install_element (BGP_NODE, &neighbor_weight_cmd); install_element (BGP_NODE, &no_neighbor_weight_cmd); - install_element (BGP_NODE, &no_neighbor_weight_val_cmd); /* "neighbor override-capability" commands. */ install_element (BGP_NODE, &neighbor_override_capability_cmd); @@ -15312,17 +15249,14 @@ bgp_vty_init (void) /* "neighbor timers" commands. */ install_element (BGP_NODE, &neighbor_timers_cmd); install_element (BGP_NODE, &no_neighbor_timers_cmd); - install_element (BGP_NODE, &no_neighbor_timers_val_cmd); /* "neighbor timers connect" commands. */ install_element (BGP_NODE, &neighbor_timers_connect_cmd); install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); - install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); /* "neighbor advertisement-interval" commands. */ install_element (BGP_NODE, &neighbor_advertise_interval_cmd); install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); - install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); /* "neighbor interface" commands. */ install_element (BGP_NODE, &neighbor_interface_cmd); @@ -15436,12 +15370,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15449,12 +15377,6 @@ bgp_vty_init (void) install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15462,12 +15384,6 @@ bgp_vty_init (void) install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15475,12 +15391,6 @@ bgp_vty_init (void) install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15488,12 +15398,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15501,12 +15405,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); @@ -15514,12 +15412,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); @@ -15528,12 +15420,6 @@ bgp_vty_init (void) install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); @@ -15542,47 +15428,25 @@ bgp_vty_init (void) install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); /* "neighbor allowas-in" */ install_element (BGP_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd); install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); /* address-family commands. */ @@ -15593,13 +15457,10 @@ bgp_vty_init (void) install_element (BGP_NODE, &address_family_ipv6_safi_cmd); #endif /* HAVE_IPV6 */ install_element (BGP_NODE, &address_family_vpnv4_cmd); - install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); install_element (BGP_NODE, &address_family_encap_cmd); - install_element (BGP_NODE, &address_family_encapv4_cmd); #ifdef HAVE_IPV6 install_element (BGP_NODE, &address_family_encapv6_cmd); #endif @@ -15616,262 +15477,94 @@ bgp_vty_init (void) /* "clear ip bgp commands" */ install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd); /* "clear ip bgp neighbor soft in" */ install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd); install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd); install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd); install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd); install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); /* clear ip bgp prefix */ install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd); install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); /* "clear ip bgp neighbor soft out" */ install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd); install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd); install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd); install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd); /* "clear ip bgp neighbor soft" */ install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); @@ -15889,25 +15582,10 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd); install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd); install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd); install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd); /* "show ip bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); @@ -15936,18 +15614,14 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); #ifdef HAVE_IPV6 install_element (VIEW_NODE, &show_bgp_summary_cmd); install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); #endif /* HAVE_IPV6 */ install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); @@ -15976,18 +15650,14 @@ bgp_vty_init (void) install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); #ifdef HAVE_IPV6 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); #endif /* HAVE_IPV6 */ install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); @@ -16016,18 +15686,14 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); #ifdef HAVE_IPV6 install_element (ENABLE_NODE, &show_bgp_summary_cmd); install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); #endif /* HAVE_IPV6 */ @@ -16039,54 +15705,19 @@ bgp_vty_init (void) /* "show ip bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); #ifdef HAVE_IPV6 - install_element (VIEW_NODE, &show_bgp_neighbors_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); - install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); /* Old commands. */ install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); @@ -16123,54 +15754,34 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); - install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); - install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); #ifdef HAVE_IPV6 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); - install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); #endif /* HAVE_IPV6 */ /* ttl_security commands */ @@ -16339,6 +15950,16 @@ community_list_unset_vty (struct vty *vty, int argc, const char **argv, /* "community-list" keyword help string. */ #define COMMUNITY_LIST_STR "Add a community list entry\n" +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip community-list <1-99> (deny|permit)", + * IP_STR + * COMMUNITY_LIST_STR + * "Community list number (standard)\n" + * "Specify community to reject\n" + * "Specify community to accept\n" + * + */ DEFUN (ip_community_list_standard, ip_community_list_standard_cmd, "ip community-list <1-99> (deny|permit) .AA:NN", @@ -16352,14 +15973,6 @@ DEFUN (ip_community_list_standard, return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); } -ALIAS (ip_community_list_standard, - ip_community_list_standard2_cmd, - "ip community-list <1-99> (deny|permit)", - IP_STR - COMMUNITY_LIST_STR - "Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n") DEFUN (ip_community_list_expanded, ip_community_list_expanded_cmd, @@ -16374,6 +15987,17 @@ DEFUN (ip_community_list_expanded, return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip community-list standard WORD (deny|permit)", + * IP_STR + * COMMUNITY_LIST_STR + * "Add a standard community-list entry\n" + * "Community list name\n" + * "Specify community to reject\n" + * "Specify community to accept\n" + * + */ DEFUN (ip_community_list_name_standard, ip_community_list_name_standard_cmd, "ip community-list standard WORD (deny|permit) .AA:NN", @@ -16388,15 +16012,6 @@ DEFUN (ip_community_list_name_standard, return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); } -ALIAS (ip_community_list_name_standard, - ip_community_list_name_standard2_cmd, - "ip community-list standard WORD (deny|permit)", - IP_STR - COMMUNITY_LIST_STR - "Add a standard community-list entry\n" - "Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n") DEFUN (ip_community_list_name_expanded, ip_community_list_name_expanded_cmd, @@ -16717,6 +16332,16 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip extcommunity-list <1-99> (deny|permit)", + * IP_STR + * EXTCOMMUNITY_LIST_STR + * "Extended Community list number (standard)\n" + * "Specify community to reject\n" + * "Specify community to accept\n" + * + */ DEFUN (ip_extcommunity_list_standard, ip_extcommunity_list_standard_cmd, "ip extcommunity-list <1-99> (deny|permit) .AA:NN", @@ -16730,14 +16355,6 @@ DEFUN (ip_extcommunity_list_standard, return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); } -ALIAS (ip_extcommunity_list_standard, - ip_extcommunity_list_standard2_cmd, - "ip extcommunity-list <1-99> (deny|permit)", - IP_STR - EXTCOMMUNITY_LIST_STR - "Extended Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n") DEFUN (ip_extcommunity_list_expanded, ip_extcommunity_list_expanded_cmd, @@ -16752,6 +16369,17 @@ DEFUN (ip_extcommunity_list_expanded, return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip extcommunity-list standard WORD (deny|permit)", + * IP_STR + * EXTCOMMUNITY_LIST_STR + * "Specify standard extcommunity-list\n" + * "Extended Community list name\n" + * "Specify community to reject\n" + * "Specify community to accept\n" + * + */ DEFUN (ip_extcommunity_list_name_standard, ip_extcommunity_list_name_standard_cmd, "ip extcommunity-list standard WORD (deny|permit) .AA:NN", @@ -16766,15 +16394,6 @@ DEFUN (ip_extcommunity_list_name_standard, return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); } -ALIAS (ip_extcommunity_list_name_standard, - ip_extcommunity_list_name_standard2_cmd, - "ip extcommunity-list standard WORD (deny|permit)", - IP_STR - EXTCOMMUNITY_LIST_STR - "Specify standard extcommunity-list\n" - "Extended Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n") DEFUN (ip_extcommunity_list_name_expanded, ip_extcommunity_list_name_expanded_cmd, @@ -17088,10 +16707,8 @@ community_list_vty (void) /* Community-list. */ install_element (CONFIG_NODE, &ip_community_list_standard_cmd); - install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); - install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); @@ -17110,10 +16727,8 @@ community_list_vty (void) /* Extcommunity-list. */ install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); - install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); - install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 86d5efd779..35781ef2ca 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -357,6 +357,15 @@ DEFUN (match_ip_address, return isis_route_match_add(vty, vty->index, "ip address", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * + */ DEFUN (no_match_ip_address, no_match_ip_address_val_cmd, "no match ip address (<1-199>|<1300-2699>|WORD)", @@ -373,13 +382,6 @@ DEFUN (no_match_ip_address, return isis_route_match_delete(vty, vty->index, "ip address", argv[4]->arg); } -ALIAS (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n") /* ------------------------------------------------------------*/ @@ -395,6 +397,17 @@ DEFUN (match_ip_address_prefix_list, return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, "no match ip address prefix-list", @@ -409,15 +422,6 @@ DEFUN (no_match_ip_address_prefix_list, return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); } -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") /* ------------------------------------------------------------*/ @@ -432,6 +436,15 @@ DEFUN (match_ipv6_address, return isis_route_match_add(vty, vty->index, "ipv6 address", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ipv6 address", + * NO_STR + * MATCH_STR + * IPV6_STR + * "Match IPv6 address of route\n" + * + */ DEFUN (no_match_ipv6_address, no_match_ipv6_address_val_cmd, "no match ipv6 address WORD", @@ -446,13 +459,6 @@ DEFUN (no_match_ipv6_address, return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[4]->arg); } -ALIAS (no_match_ipv6_address, - no_match_ipv6_address_cmd, - "no match ipv6 address", - NO_STR - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n") /* ------------------------------------------------------------*/ @@ -468,6 +474,17 @@ DEFUN (match_ipv6_address_prefix_list, return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ipv6 address prefix-list WORD", + * NO_STR + * MATCH_STR + * IPV6_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ipv6_address_prefix_list, no_match_ipv6_address_prefix_list_cmd, "no match ipv6 address prefix-list", @@ -482,15 +499,6 @@ DEFUN (no_match_ipv6_address_prefix_list, return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]); } -ALIAS (no_match_ipv6_address_prefix_list, - no_match_ipv6_address_prefix_list_val_cmd, - "no match ipv6 address prefix-list WORD", - NO_STR - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") /* ------------------------------------------------------------*/ @@ -498,7 +506,7 @@ ALIAS (no_match_ipv6_address_prefix_list, * commands at the same node, therefore add set metric with the same 32-bit range as ospf and * verify that the input is a valid isis metric */ DEFUN (set_metric, - set_metric_cmd, + set_metric_cmd, "set metric <0-4294967295>", SET_STR "Metric vale for destination routing protocol\n" @@ -507,8 +515,19 @@ DEFUN (set_metric, return isis_route_set_add(vty, vty->index, "metric", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric", + * NO_STR + * SET_STR + * "Metric vale for destination routing protocol\n"); + * + * void + * isis_route_map_init(void + * + */ DEFUN (no_set_metric, - no_set_metric_val_cmd, + no_set_metric_val_cmd, "no set metric <0-4294967295>", NO_STR SET_STR @@ -520,15 +539,6 @@ DEFUN (no_set_metric, return isis_route_set_delete(vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_set_metric, - no_set_metric_cmd, - "no set metric", - NO_STR - SET_STR - "Metric vale for destination routing protocol\n"); - -void -isis_route_map_init(void) { route_map_init(); route_map_init_vty(); @@ -536,25 +546,20 @@ isis_route_map_init(void) route_map_install_match(&route_match_ip_address_cmd); install_element(RMAP_NODE, &match_ip_address_cmd); install_element(RMAP_NODE, &no_match_ip_address_val_cmd); - install_element(RMAP_NODE, &no_match_ip_address_cmd); route_map_install_match(&route_match_ip_address_prefix_list_cmd); install_element(RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); install_element(RMAP_NODE, &no_match_ip_address_prefix_list_cmd); route_map_install_match(&route_match_ipv6_address_cmd); install_element(RMAP_NODE, &match_ipv6_address_cmd); install_element(RMAP_NODE, &no_match_ipv6_address_val_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_cmd); route_map_install_match(&route_match_ipv6_address_prefix_list_cmd); install_element(RMAP_NODE, &match_ipv6_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_val_cmd); install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); route_map_install_set(&route_set_metric_cmd); install_element(RMAP_NODE, &set_metric_cmd); install_element(RMAP_NODE, &no_set_metric_val_cmd); - install_element(RMAP_NODE, &no_set_metric_cmd); } diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 79fbdc4d24..b0976177ff 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -323,6 +323,17 @@ DEFUN (isis_passwd, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis password (md5|clear) WORD", + * NO_STR + * "IS-IS commands\n" + * "Configure the authentication password for a circuit\n" + * "HMAC-MD5 authentication\n" + * "Cleartext password\n" + * "Circuit password\n" + * + */ DEFUN (no_isis_passwd, no_isis_passwd_cmd, "no isis password", @@ -339,15 +350,6 @@ DEFUN (no_isis_passwd, return CMD_SUCCESS; } -ALIAS (no_isis_passwd, - no_isis_passwd_arg_cmd, - "no isis password (md5|clear) WORD", - NO_STR - "IS-IS commands\n" - "Configure the authentication password for a circuit\n" - "HMAC-MD5 authentication\n" - "Cleartext password\n" - "Circuit password\n") DEFUN (isis_priority, isis_priority_cmd, @@ -375,6 +377,15 @@ DEFUN (isis_priority, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis priority <0-127>", + * NO_STR + * "IS-IS commands\n" + * "Set priority for Designated Router election\n" + * "Priority value\n" + * + */ DEFUN (no_isis_priority, no_isis_priority_cmd, "no isis priority", @@ -392,13 +403,6 @@ DEFUN (no_isis_priority, return CMD_SUCCESS; } -ALIAS (no_isis_priority, - no_isis_priority_arg_cmd, - "no isis priority <0-127>", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n") DEFUN (isis_priority_l1, isis_priority_l1_cmd, @@ -426,6 +430,16 @@ DEFUN (isis_priority_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis priority <0-127> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set priority for Designated Router election\n" + * "Priority value\n" + * "Specify priority for level-1 routing\n" + * + */ DEFUN (no_isis_priority_l1, no_isis_priority_l1_cmd, "no isis priority level-1", @@ -443,14 +457,6 @@ DEFUN (no_isis_priority_l1, return CMD_SUCCESS; } -ALIAS (no_isis_priority_l1, - no_isis_priority_l1_arg_cmd, - "no isis priority <0-127> level-1", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n" - "Specify priority for level-1 routing\n") DEFUN (isis_priority_l2, isis_priority_l2_cmd, @@ -478,6 +484,16 @@ DEFUN (isis_priority_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis priority <0-127> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set priority for Designated Router election\n" + * "Priority value\n" + * "Specify priority for level-2 routing\n" + * + */ DEFUN (no_isis_priority_l2, no_isis_priority_l2_cmd, "no isis priority level-2", @@ -495,14 +511,6 @@ DEFUN (no_isis_priority_l2, return CMD_SUCCESS; } -ALIAS (no_isis_priority_l2, - no_isis_priority_l2_arg_cmd, - "no isis priority <0-127> level-2", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n" - "Specify priority for level-2 routing\n") /* Metric command */ DEFUN (isis_metric, @@ -544,6 +552,15 @@ DEFUN (isis_metric, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis metric <0-16777215>", + * NO_STR + * "IS-IS commands\n" + * "Set default metric for circuit\n" + * "Default metric value\n" + * + */ DEFUN (no_isis_metric, no_isis_metric_cmd, "no isis metric", @@ -560,13 +577,6 @@ DEFUN (no_isis_metric, return CMD_SUCCESS; } -ALIAS (no_isis_metric, - no_isis_metric_arg_cmd, - "no isis metric <0-16777215>", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n") DEFUN (isis_metric_l1, isis_metric_l1_cmd, @@ -607,6 +617,16 @@ DEFUN (isis_metric_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis metric <0-16777215> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set default metric for circuit\n" + * "Default metric value\n" + * "Specify metric for level-1 routing\n" + * + */ DEFUN (no_isis_metric_l1, no_isis_metric_l1_cmd, "no isis metric level-1", @@ -623,14 +643,6 @@ DEFUN (no_isis_metric_l1, return CMD_SUCCESS; } -ALIAS (no_isis_metric_l1, - no_isis_metric_l1_arg_cmd, - "no isis metric <0-16777215> level-1", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n" - "Specify metric for level-1 routing\n") DEFUN (isis_metric_l2, isis_metric_l2_cmd, @@ -671,6 +683,16 @@ DEFUN (isis_metric_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis metric <0-16777215> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set default metric for circuit\n" + * "Default metric value\n" + * "Specify metric for level-2 routing\n" + * + */ DEFUN (no_isis_metric_l2, no_isis_metric_l2_cmd, "no isis metric level-2", @@ -687,14 +709,6 @@ DEFUN (no_isis_metric_l2, return CMD_SUCCESS; } -ALIAS (no_isis_metric_l2, - no_isis_metric_l2_arg_cmd, - "no isis metric <0-16777215> level-2", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n" - "Specify metric for level-2 routing\n") /* end of metrics */ DEFUN (isis_hello_interval, @@ -724,6 +738,16 @@ DEFUN (isis_hello_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-interval <1-600>", + * NO_STR + * "IS-IS commands\n" + * "Set Hello interval\n" + * "Hello interval value\n" + * "Holdtime 1 second, interval depends on multiplier\n" + * + */ DEFUN (no_isis_hello_interval, no_isis_hello_interval_cmd, "no isis hello-interval", @@ -741,14 +765,6 @@ DEFUN (no_isis_hello_interval, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval, - no_isis_hello_interval_arg_cmd, - "no isis hello-interval <1-600>", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n") DEFUN (isis_hello_interval_l1, isis_hello_interval_l1_cmd, @@ -777,6 +793,17 @@ DEFUN (isis_hello_interval_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-interval <1-600> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set Hello interval\n" + * "Hello interval value\n" + * "Holdtime 1 second, interval depends on multiplier\n" + * "Specify hello-interval for level-1 IIHs\n" + * + */ DEFUN (no_isis_hello_interval_l1, no_isis_hello_interval_l1_cmd, "no isis hello-interval level-1", @@ -794,15 +821,6 @@ DEFUN (no_isis_hello_interval_l1, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval_l1, - no_isis_hello_interval_l1_arg_cmd, - "no isis hello-interval <1-600> level-1", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n" - "Specify hello-interval for level-1 IIHs\n") DEFUN (isis_hello_interval_l2, isis_hello_interval_l2_cmd, @@ -831,6 +849,17 @@ DEFUN (isis_hello_interval_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-interval <1-600> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set Hello interval\n" + * "Hello interval value\n" + * "Holdtime 1 second, interval depends on multiplier\n" + * "Specify hello-interval for level-2 IIHs\n" + * + */ DEFUN (no_isis_hello_interval_l2, no_isis_hello_interval_l2_cmd, "no isis hello-interval level-2", @@ -848,15 +877,6 @@ DEFUN (no_isis_hello_interval_l2, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval_l2, - no_isis_hello_interval_l2_arg_cmd, - "no isis hello-interval <1-600> level-2", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n" - "Specify hello-interval for level-2 IIHs\n") DEFUN (isis_hello_multiplier, isis_hello_multiplier_cmd, @@ -884,6 +904,15 @@ DEFUN (isis_hello_multiplier, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-multiplier <2-100>", + * NO_STR + * "IS-IS commands\n" + * "Set multiplier for Hello holding time\n" + * "Hello multiplier value\n" + * + */ DEFUN (no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, "no isis hello-multiplier", @@ -901,13 +930,6 @@ DEFUN (no_isis_hello_multiplier, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier, - no_isis_hello_multiplier_arg_cmd, - "no isis hello-multiplier <2-100>", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n") DEFUN (isis_hello_multiplier_l1, isis_hello_multiplier_l1_cmd, @@ -935,6 +957,16 @@ DEFUN (isis_hello_multiplier_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-multiplier <2-100> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set multiplier for Hello holding time\n" + * "Hello multiplier value\n" + * "Specify hello multiplier for level-1 IIHs\n" + * + */ DEFUN (no_isis_hello_multiplier_l1, no_isis_hello_multiplier_l1_cmd, "no isis hello-multiplier level-1", @@ -952,14 +984,6 @@ DEFUN (no_isis_hello_multiplier_l1, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier_l1, - no_isis_hello_multiplier_l1_arg_cmd, - "no isis hello-multiplier <2-100> level-1", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n" - "Specify hello multiplier for level-1 IIHs\n") DEFUN (isis_hello_multiplier_l2, isis_hello_multiplier_l2_cmd, @@ -987,6 +1011,16 @@ DEFUN (isis_hello_multiplier_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis hello-multiplier <2-100> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set multiplier for Hello holding time\n" + * "Hello multiplier value\n" + * "Specify hello multiplier for level-2 IIHs\n" + * + */ DEFUN (no_isis_hello_multiplier_l2, no_isis_hello_multiplier_l2_cmd, "no isis hello-multiplier level-2", @@ -1004,14 +1038,6 @@ DEFUN (no_isis_hello_multiplier_l2, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier_l2, - no_isis_hello_multiplier_l2_arg_cmd, - "no isis hello-multiplier <2-100> level-2", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n" - "Specify hello multiplier for level-2 IIHs\n") DEFUN (isis_hello_padding, isis_hello_padding_cmd, @@ -1074,6 +1100,15 @@ DEFUN (csnp_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis csnp-interval <1-600>", + * NO_STR + * "IS-IS commands\n" + * "Set CSNP interval in seconds\n" + * "CSNP interval value\n" + * + */ DEFUN (no_csnp_interval, no_csnp_interval_cmd, "no isis csnp-interval", @@ -1091,13 +1126,6 @@ DEFUN (no_csnp_interval, return CMD_SUCCESS; } -ALIAS (no_csnp_interval, - no_csnp_interval_arg_cmd, - "no isis csnp-interval <1-600>", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n") DEFUN (csnp_interval_l1, csnp_interval_l1_cmd, @@ -1125,6 +1153,16 @@ DEFUN (csnp_interval_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis csnp-interval <1-600> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set CSNP interval in seconds\n" + * "CSNP interval value\n" + * "Specify interval for level-1 CSNPs\n" + * + */ DEFUN (no_csnp_interval_l1, no_csnp_interval_l1_cmd, "no isis csnp-interval level-1", @@ -1142,14 +1180,6 @@ DEFUN (no_csnp_interval_l1, return CMD_SUCCESS; } -ALIAS (no_csnp_interval_l1, - no_csnp_interval_l1_arg_cmd, - "no isis csnp-interval <1-600> level-1", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n" - "Specify interval for level-1 CSNPs\n") DEFUN (csnp_interval_l2, csnp_interval_l2_cmd, @@ -1177,6 +1207,16 @@ DEFUN (csnp_interval_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis csnp-interval <1-600> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set CSNP interval in seconds\n" + * "CSNP interval value\n" + * "Specify interval for level-2 CSNPs\n" + * + */ DEFUN (no_csnp_interval_l2, no_csnp_interval_l2_cmd, "no isis csnp-interval level-2", @@ -1194,14 +1234,6 @@ DEFUN (no_csnp_interval_l2, return CMD_SUCCESS; } -ALIAS (no_csnp_interval_l2, - no_csnp_interval_l2_arg_cmd, - "no isis csnp-interval <1-600> level-2", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n" - "Specify interval for level-2 CSNPs\n") DEFUN (psnp_interval, psnp_interval_cmd, @@ -1229,6 +1261,15 @@ DEFUN (psnp_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis psnp-interval <1-120>", + * NO_STR + * "IS-IS commands\n" + * "Set PSNP interval in seconds\n" + * "PSNP interval value\n" + * + */ DEFUN (no_psnp_interval, no_psnp_interval_cmd, "no isis psnp-interval", @@ -1246,13 +1287,6 @@ DEFUN (no_psnp_interval, return CMD_SUCCESS; } -ALIAS (no_psnp_interval, - no_psnp_interval_arg_cmd, - "no isis psnp-interval <1-120>", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n") DEFUN (psnp_interval_l1, psnp_interval_l1_cmd, @@ -1280,6 +1314,16 @@ DEFUN (psnp_interval_l1, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis psnp-interval <1-120> level-1", + * NO_STR + * "IS-IS commands\n" + * "Set PSNP interval in seconds\n" + * "PSNP interval value\n" + * "Specify interval for level-1 PSNPs\n" + * + */ DEFUN (no_psnp_interval_l1, no_psnp_interval_l1_cmd, "no isis psnp-interval level-1", @@ -1297,14 +1341,6 @@ DEFUN (no_psnp_interval_l1, return CMD_SUCCESS; } -ALIAS (no_psnp_interval_l1, - no_psnp_interval_l1_arg_cmd, - "no isis psnp-interval <1-120> level-1", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n" - "Specify interval for level-1 PSNPs\n") DEFUN (psnp_interval_l2, psnp_interval_l2_cmd, @@ -1332,6 +1368,16 @@ DEFUN (psnp_interval_l2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no isis psnp-interval <1-120> level-2", + * NO_STR + * "IS-IS commands\n" + * "Set PSNP interval in seconds\n" + * "PSNP interval value\n" + * "Specify interval for level-2 PSNPs\n" + * + */ DEFUN (no_psnp_interval_l2, no_psnp_interval_l2_cmd, "no isis psnp-interval level-2", @@ -1349,14 +1395,6 @@ DEFUN (no_psnp_interval_l2, return CMD_SUCCESS; } -ALIAS (no_psnp_interval_l2, - no_psnp_interval_l2_arg_cmd, - "no isis psnp-interval <1-120> level-2", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n" - "Specify interval for level-2 PSNPs\n") static int validate_metric_style_narrow (struct vty *vty, struct isis_area *area) @@ -1566,6 +1604,14 @@ DEFUN (area_lsp_mtu, return area_lsp_mtu_set(vty, lsp_mtu); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-mtu <128-4352>", + * NO_STR + * "Configure the maximum size of generated LSPs\n" + * "Maximum size of generated LSPs\n" + * + */ DEFUN (no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu", @@ -1575,12 +1621,6 @@ DEFUN (no_area_lsp_mtu, return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU); } -ALIAS (no_area_lsp_mtu, - no_area_lsp_mtu_arg_cmd, - "no lsp-mtu <128-4352>", - NO_STR - "Configure the maximum size of generated LSPs\n" - "Maximum size of generated LSPs\n"); DEFUN (is_type, is_type_cmd, @@ -1689,6 +1729,14 @@ DEFUN (lsp_gen_interval, return set_lsp_gen_interval (vty, area, interval, level); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-gen-interval <1-120>", + * NO_STR + * "Minimum interval between regenerating same LSP\n" + * "Minimum interval in seconds\n" + * + */ DEFUN (no_lsp_gen_interval, no_lsp_gen_interval_cmd, "no lsp-gen-interval", @@ -1705,12 +1753,6 @@ DEFUN (no_lsp_gen_interval, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval, - no_lsp_gen_interval_arg_cmd, - "no lsp-gen-interval <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Minimum interval in seconds\n") DEFUN (lsp_gen_interval_l1, lsp_gen_interval_l1_cmd, @@ -1729,6 +1771,15 @@ DEFUN (lsp_gen_interval_l1, return set_lsp_gen_interval (vty, area, interval, level); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-gen-interval level-1 <1-120>", + * NO_STR + * "Minimum interval between regenerating same LSP\n" + * "Set interval for level 1 only\n" + * "Minimum interval in seconds\n" + * + */ DEFUN (no_lsp_gen_interval_l1, no_lsp_gen_interval_l1_cmd, "no lsp-gen-interval level-1", @@ -1746,13 +1797,6 @@ DEFUN (no_lsp_gen_interval_l1, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval_l1, - no_lsp_gen_interval_l1_arg_cmd, - "no lsp-gen-interval level-1 <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 1 only\n" - "Minimum interval in seconds\n") DEFUN (lsp_gen_interval_l2, lsp_gen_interval_l2_cmd, @@ -1771,6 +1815,15 @@ DEFUN (lsp_gen_interval_l2, return set_lsp_gen_interval (vty, area, interval, level); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-gen-interval level-2 <1-120>", + * NO_STR + * "Minimum interval between regenerating same LSP\n" + * "Set interval for level 2 only\n" + * "Minimum interval in seconds\n" + * + */ DEFUN (no_lsp_gen_interval_l2, no_lsp_gen_interval_l2_cmd, "no lsp-gen-interval level-2", @@ -1788,13 +1841,6 @@ DEFUN (no_lsp_gen_interval_l2, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval_l2, - no_lsp_gen_interval_l2_arg_cmd, - "no lsp-gen-interval level-2 <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 2 only\n" - "Minimum interval in seconds\n") DEFUN (spf_interval, spf_interval_cmd, @@ -1813,6 +1859,26 @@ DEFUN (spf_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no spf-interval level-2 <1-120>", + * NO_STR + * "Minimum interval between SPF calculations\n" + * "Set interval for level 2 only\n" + * "Minimum interval between consecutive SPFs in seconds\n" + * + * "no spf-interval <1-120>", + * NO_STR + * "Minimum interval between SPF calculations\n" + * "Minimum interval between consecutive SPFs in seconds\n" + * + * "no spf-interval level-1 <1-120>", + * NO_STR + * "Minimum interval between SPF calculations\n" + * "Set interval for level 1 only\n" + * "Minimum interval between consecutive SPFs in seconds\n" + * + */ DEFUN (no_spf_interval, no_spf_interval_cmd, "no spf-interval", @@ -1829,12 +1895,6 @@ DEFUN (no_spf_interval, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_arg_cmd, - "no spf-interval <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Minimum interval between consecutive SPFs in seconds\n") DEFUN (spf_interval_l1, spf_interval_l1_cmd, @@ -1869,13 +1929,6 @@ DEFUN (no_spf_interval_l1, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_l1_arg_cmd, - "no spf-interval level-1 <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Set interval for level 1 only\n" - "Minimum interval between consecutive SPFs in seconds\n") DEFUN (spf_interval_l2, spf_interval_l2_cmd, @@ -1910,13 +1963,6 @@ DEFUN (no_spf_interval_l2, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_l2_arg_cmd, - "no spf-interval level-2 <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Set interval for level 2 only\n" - "Minimum interval between consecutive SPFs in seconds\n") static int area_max_lsp_lifetime_set(struct vty *vty, int level, @@ -1979,6 +2025,14 @@ DEFUN (max_lsp_lifetime, return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no max-lsp-lifetime <350-65535>", + * NO_STR + * "Maximum LSP lifetime\n" + * "LSP lifetime in seconds\n" + * + */ DEFUN (no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, "no max-lsp-lifetime", @@ -1989,12 +2043,6 @@ DEFUN (no_max_lsp_lifetime, DEFAULT_LSP_LIFETIME); } -ALIAS (no_max_lsp_lifetime, - no_max_lsp_lifetime_arg_cmd, - "no max-lsp-lifetime <350-65535>", - NO_STR - "Maximum LSP lifetime\n" - "LSP lifetime in seconds\n") DEFUN (max_lsp_lifetime_l1, max_lsp_lifetime_l1_cmd, @@ -2005,6 +2053,14 @@ DEFUN (max_lsp_lifetime_l1, return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no max-lsp-lifetime level-1 <350-65535>", + * NO_STR + * "Maximum LSP lifetime for Level 1 only\n" + * "LSP lifetime for Level 1 only in seconds\n" + * + */ DEFUN (no_max_lsp_lifetime_l1, no_max_lsp_lifetime_l1_cmd, "no max-lsp-lifetime level-1", @@ -2014,12 +2070,6 @@ DEFUN (no_max_lsp_lifetime_l1, return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, DEFAULT_LSP_LIFETIME); } -ALIAS (no_max_lsp_lifetime_l1, - no_max_lsp_lifetime_l1_arg_cmd, - "no max-lsp-lifetime level-1 <350-65535>", - NO_STR - "Maximum LSP lifetime for Level 1 only\n" - "LSP lifetime for Level 1 only in seconds\n") DEFUN (max_lsp_lifetime_l2, max_lsp_lifetime_l2_cmd, @@ -2030,6 +2080,14 @@ DEFUN (max_lsp_lifetime_l2, return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no max-lsp-lifetime level-2 <350-65535>", + * NO_STR + * "Maximum LSP lifetime for Level 2 only\n" + * "LSP lifetime for Level 2 only in seconds\n" + * + */ DEFUN (no_max_lsp_lifetime_l2, no_max_lsp_lifetime_l2_cmd, "no max-lsp-lifetime level-2", @@ -2039,12 +2097,6 @@ DEFUN (no_max_lsp_lifetime_l2, return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, DEFAULT_LSP_LIFETIME); } -ALIAS (no_max_lsp_lifetime_l2, - no_max_lsp_lifetime_l2_arg_cmd, - "no max-lsp-lifetime level-2 <350-65535>", - NO_STR - "Maximum LSP lifetime for Level 2 only\n" - "LSP lifetime for Level 2 only in seconds\n") static int area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) @@ -2099,6 +2151,14 @@ DEFUN (lsp_refresh_interval, return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-refresh-interval <1-65235>", + * NO_STR + * "LSP refresh interval\n" + * "LSP refresh interval in seconds\n" + * + */ DEFUN (no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, "no lsp-refresh-interval", @@ -2109,12 +2169,6 @@ DEFUN (no_lsp_refresh_interval, DEFAULT_MAX_LSP_GEN_INTERVAL); } -ALIAS (no_lsp_refresh_interval, - no_lsp_refresh_interval_arg_cmd, - "no lsp-refresh-interval <1-65235>", - NO_STR - "LSP refresh interval\n" - "LSP refresh interval in seconds\n") DEFUN (lsp_refresh_interval_l1, lsp_refresh_interval_l1_cmd, @@ -2125,6 +2179,14 @@ DEFUN (lsp_refresh_interval_l1, return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-refresh-interval level-1 <1-65235>", + * NO_STR + * "LSP refresh interval for Level 1 only\n" + * "LSP refresh interval for Level 1 only in seconds\n" + * + */ DEFUN (no_lsp_refresh_interval_l1, no_lsp_refresh_interval_l1_cmd, "no lsp-refresh-interval level-1", @@ -2135,12 +2197,6 @@ DEFUN (no_lsp_refresh_interval_l1, DEFAULT_MAX_LSP_GEN_INTERVAL); } -ALIAS (no_lsp_refresh_interval_l1, - no_lsp_refresh_interval_l1_arg_cmd, - "no lsp-refresh-interval level-1 <1-65235>", - NO_STR - "LSP refresh interval for Level 1 only\n" - "LSP refresh interval for Level 1 only in seconds\n") DEFUN (lsp_refresh_interval_l2, lsp_refresh_interval_l2_cmd, @@ -2151,6 +2207,14 @@ DEFUN (lsp_refresh_interval_l2, return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no lsp-refresh-interval level-2 <1-65235>", + * NO_STR + * "LSP refresh interval for Level 2 only\n" + * "LSP refresh interval for Level 2 only in seconds\n" + * + */ DEFUN (no_lsp_refresh_interval_l2, no_lsp_refresh_interval_l2_cmd, "no lsp-refresh-interval level-2", @@ -2161,12 +2225,6 @@ DEFUN (no_lsp_refresh_interval_l2, DEFAULT_MAX_LSP_GEN_INTERVAL); } -ALIAS (no_lsp_refresh_interval_l2, - no_lsp_refresh_interval_l2_arg_cmd, - "no lsp-refresh-interval level-2 <1-65235>", - NO_STR - "LSP refresh interval for Level 2 only\n" - "LSP refresh interval for Level 2 only in seconds\n") static int area_passwd_set(struct vty *vty, int level, @@ -2192,6 +2250,19 @@ area_passwd_set(struct vty *vty, int level, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "(area-password|domain-password) md5 WORD authenticate snp (send-only|validate)", + * "Configure the authentication password for an area\n" + * "Set the authentication password for a routing domain\n" + * "Authentication type\n" + * "Level-wide password\n" + * "Authentication\n" + * "SNP PDUs\n" + * "Send but do not check PDUs on receiving\n" + * "Send and check PDUs on receiving\n" + * + */ DEFUN (area_passwd_md5, area_passwd_md5_cmd, "(area-password|domain-password) md5 WORD", @@ -2214,18 +2285,20 @@ DEFUN (area_passwd_md5, argv[2]->arg, snp_auth); } -ALIAS (area_passwd_md5, - area_passwd_md5_snpauth_cmd, - "(area-password|domain-password) md5 WORD authenticate snp (send-only|validate)", - "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" - "Authentication type\n" - "Level-wide password\n" - "Authentication\n" - "SNP PDUs\n" - "Send but do not check PDUs on receiving\n" - "Send and check PDUs on receiving\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "(area-password|domain-password) clear WORD authenticate snp (send-only|validate)", + * "Configure the authentication password for an area\n" + * "Set the authentication password for a routing domain\n" + * "Authentication type\n" + * "Area password\n" + * "Authentication\n" + * "SNP PDUs\n" + * "Send but do not check PDUs on receiving\n" + * "Send and check PDUs on receiving\n" + * + */ DEFUN (area_passwd_clear, area_passwd_clear_cmd, "(area-password|domain-password) clear WORD", @@ -2248,17 +2321,6 @@ DEFUN (area_passwd_clear, argv[2]->arg, snp_auth); } -ALIAS (area_passwd_clear, - area_passwd_clear_snpauth_cmd, - "(area-password|domain-password) clear WORD authenticate snp (send-only|validate)", - "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" - "Authentication type\n" - "Area password\n" - "Authentication\n" - "SNP PDUs\n" - "Send but do not check PDUs on receiving\n" - "Send and check PDUs on receiving\n") DEFUN (no_area_passwd, no_area_passwd_cmd, @@ -2296,70 +2358,51 @@ isis_vty_init (void) install_element (INTERFACE_NODE, &isis_passwd_cmd); install_element (INTERFACE_NODE, &no_isis_passwd_cmd); - install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_cmd); install_element (INTERFACE_NODE, &no_isis_priority_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_l1_cmd); install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_l2_cmd); install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_cmd); install_element (INTERFACE_NODE, &no_isis_metric_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_l1_cmd); install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_l2_cmd); install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_padding_cmd); install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd); install_element (INTERFACE_NODE, &csnp_interval_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_l1_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_l2_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd); install_element (ISIS_NODE, &metric_style_cmd); install_element (ISIS_NODE, &no_metric_style_cmd); @@ -2375,54 +2418,39 @@ isis_vty_init (void) install_element (ISIS_NODE, &area_lsp_mtu_cmd); install_element (ISIS_NODE, &no_area_lsp_mtu_cmd); - install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd); install_element (ISIS_NODE, &is_type_cmd); install_element (ISIS_NODE, &no_is_type_cmd); install_element (ISIS_NODE, &lsp_gen_interval_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); install_element (ISIS_NODE, &spf_interval_cmd); install_element (ISIS_NODE, &no_spf_interval_cmd); - install_element (ISIS_NODE, &no_spf_interval_arg_cmd); install_element (ISIS_NODE, &spf_interval_l1_cmd); install_element (ISIS_NODE, &no_spf_interval_l1_cmd); - install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); install_element (ISIS_NODE, &spf_interval_l2_cmd); install_element (ISIS_NODE, &no_spf_interval_l2_cmd); - install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); install_element (ISIS_NODE, &max_lsp_lifetime_cmd); install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd); install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd); install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd); install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd); install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd); install_element (ISIS_NODE, &lsp_refresh_interval_cmd); install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd); install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd); install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd); install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd); install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd); install_element (ISIS_NODE, &area_passwd_md5_cmd); - install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd); install_element (ISIS_NODE, &area_passwd_clear_cmd); - install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd); install_element (ISIS_NODE, &no_area_passwd_cmd); } diff --git a/isisd/isisd.c b/isisd/isisd.c index c1401ac135..bfee7a810b 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1978,6 +1978,14 @@ DEFUN (topology_baseis, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no topology base-is", + * NO_STR + * "Topology generation for IS-IS\n" + * "A Network IS Base for this topology\n" + * + */ DEFUN (no_topology_baseis, no_topology_baseis_cmd, "no topology base-is WORD", @@ -1995,12 +2003,6 @@ DEFUN (no_topology_baseis, return CMD_SUCCESS; } -ALIAS (no_topology_baseis, - no_topology_baseis_noid_cmd, - "no topology base-is", - NO_STR - "Topology generation for IS-IS\n" - "A Network IS Base for this topology\n") DEFUN (topology_basedynh, topology_basedynh_cmd, @@ -2418,7 +2420,6 @@ isis_init () install_element (ISIS_NODE, &topology_baseis_cmd); install_element (ISIS_NODE, &topology_basedynh_cmd); install_element (ISIS_NODE, &no_topology_baseis_cmd); - install_element (ISIS_NODE, &no_topology_baseis_noid_cmd); install_element (VIEW_NODE, &show_isis_generated_topology_cmd); install_element (ENABLE_NODE, &show_isis_generated_topology_cmd); #endif /* TOPOLOGY_GENERATE */ diff --git a/lib/command.c b/lib/command.c index 680d32b03e..b676b0c9d3 100644 --- a/lib/command.c +++ b/lib/command.c @@ -952,6 +952,12 @@ 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", @@ -1011,10 +1017,6 @@ DEFUN (config_exit, } /* quit is alias of exit. */ -ALIAS (config_exit, - config_quit_cmd, - "quit", - "Exit current mode and down to previous mode\n") /* End of configuration. */ DEFUN (config_end, @@ -1124,6 +1126,18 @@ DEFUN (config_list, } /* Write current configuration into file. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "copy running-config startup-config", + * "Copy configuration\n" + * "Copy running config to... \n" + * "Copy running config to startup config (same as write file)\n" + * + * "show running-config", + * SHOW_STR + * "running configuration\n" + * + */ DEFUN (config_write, config_write_cmd, "write []", @@ -1268,19 +1282,8 @@ finished: return ret; } -ALIAS (config_write, - copy_runningconfig_startupconfig_cmd, - "copy running-config startup-config", - "Copy configuration\n" - "Copy running config to... \n" - "Copy running config to startup config (same as write file)\n") /* Write current configuration into the terminal. */ -ALIAS (config_write, - show_running_config_cmd, - "show running-config", - SHOW_STR - "running configuration\n") /* Write startup configuration into the terminal. */ DEFUN (show_startup_config, @@ -1352,7 +1355,8 @@ DEFUN (config_no_hostname, } /* VTY interface password set. */ -DEFUN (config_password, password_cmd, +DEFUN (config_password, + password_cmd, "password [8] WORD", "Assign the terminal connection password\n" "Specifies a HIDDEN password will follow\n" @@ -1393,7 +1397,8 @@ DEFUN (config_password, password_cmd, } /* VTY enable password set. */ -DEFUN (config_enable_password, enable_password_cmd, +DEFUN (config_enable_password, + enable_password_cmd, "enable password [8] WORD", "Modify enable password parameters\n" "Assign the privileged level password\n" @@ -1448,7 +1453,8 @@ DEFUN (config_enable_password, enable_password_cmd, } /* VTY enable password delete. */ -DEFUN (no_config_enable_password, no_enable_password_cmd, +DEFUN (no_config_enable_password, + no_enable_password_cmd, "no enable password", NO_STR "Modify enable password parameters\n" @@ -1515,7 +1521,8 @@ DEFUN (no_service_password_encrypt, return CMD_SUCCESS; } -DEFUN (config_terminal_length, config_terminal_length_cmd, +DEFUN (config_terminal_length, + config_terminal_length_cmd, "terminal length (0-512)", "Set terminal line parameters\n" "Set number of lines on a screen\n" @@ -1535,7 +1542,8 @@ DEFUN (config_terminal_length, config_terminal_length_cmd, return CMD_SUCCESS; } -DEFUN (config_terminal_no_length, config_terminal_no_length_cmd, +DEFUN (config_terminal_no_length, + config_terminal_no_length_cmd, "terminal no length", "Set terminal line parameters\n" NO_STR @@ -1545,7 +1553,8 @@ DEFUN (config_terminal_no_length, config_terminal_no_length_cmd, return CMD_SUCCESS; } -DEFUN (service_terminal_length, service_terminal_length_cmd, +DEFUN (service_terminal_length, + service_terminal_length_cmd, "service terminal-length (0-512)", "Set up miscellaneous service\n" "System wide terminal length configuration\n" @@ -1565,7 +1574,8 @@ DEFUN (service_terminal_length, service_terminal_length_cmd, return CMD_SUCCESS; } -DEFUN (no_service_terminal_length, no_service_terminal_length_cmd, +DEFUN (no_service_terminal_length, + no_service_terminal_length_cmd, "no service terminal-length [(0-512)]", NO_STR "Set up miscellaneous service\n" @@ -2085,13 +2095,11 @@ void install_default (enum node_type node) { install_element (node, &config_exit_cmd); - install_element (node, &config_quit_cmd); install_element (node, &config_end_cmd); install_element (node, &config_help_cmd); install_element (node, &config_list_cmd); install_element (node, &config_write_cmd); - install_element (node, &show_running_config_cmd); } /* Initialize command interface. Install basic nodes and commands. */ @@ -2125,7 +2133,6 @@ cmd_init (int terminal) { install_element (VIEW_NODE, &config_list_cmd); install_element (VIEW_NODE, &config_exit_cmd); - install_element (VIEW_NODE, &config_quit_cmd); install_element (VIEW_NODE, &config_help_cmd); install_element (VIEW_NODE, &config_enable_cmd); install_element (VIEW_NODE, &config_terminal_length_cmd); @@ -2136,7 +2143,6 @@ 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); @@ -2149,7 +2155,6 @@ cmd_init (int terminal) install_default (ENABLE_NODE); install_element (ENABLE_NODE, &config_disable_cmd); install_element (ENABLE_NODE, &config_terminal_cmd); - install_element (ENABLE_NODE, ©_runningconfig_startupconfig_cmd); } install_element (ENABLE_NODE, &show_startup_config_cmd); install_element (ENABLE_NODE, &show_version_cmd); diff --git a/lib/filter.c b/lib/filter.c index 33801ca11c..dee752f220 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1381,6 +1381,20 @@ 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", @@ -1396,18 +1410,6 @@ DEFUN (no_access_list_remark, return vty_access_list_remark_unset (vty, AFI_IP, argv[2]->arg); } -ALIAS (no_access_list_remark, - no_access_list_remark_arg_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") #ifdef HAVE_IPV6 DEFUN (ipv6_access_list, @@ -1550,6 +1552,17 @@ 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", @@ -1562,15 +1575,6 @@ DEFUN (no_ipv6_access_list_remark, return vty_access_list_remark_unset (vty, AFI_IP6, argv[3]->arg); } -ALIAS (no_ipv6_access_list_remark, - no_ipv6_access_list_remark_arg_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") #endif /* HAVE_IPV6 */ void config_write_access_zebra (struct vty *, struct filter *); @@ -1958,7 +1962,6 @@ 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_arg_cmd); } #ifdef HAVE_IPV6 @@ -2022,7 +2025,6 @@ 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_arg_cmd); } #endif /* HAVE_IPV6 */ diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 0e1199f21a..240a03cab4 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -209,6 +209,16 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type, return 1; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "route-map RMAP_NAME (in|out) IFNAME", + * "Route map set\n" + * "Route map name\n" + * "Route map set for input filtering\n" + * "Route map set for output filtering\n" + * "Route map interface name\n" + * + */ DEFUN (if_rmap, if_rmap_cmd, "route-map RMAP_NAME (in|out) IFNAME", @@ -235,15 +245,18 @@ DEFUN (if_rmap, return CMD_SUCCESS; } -ALIAS (if_rmap, - if_ipv6_rmap_cmd, - "route-map RMAP_NAME (in|out) IFNAME", - "Route map set\n" - "Route map name\n" - "Route map set for input filtering\n" - "Route map set for output filtering\n" - "Route map interface name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no route-map ROUTEMAP_NAME (in|out) IFNAME", + * NO_STR + * "Route map unset\n" + * "Route map name\n" + * "Route map for input filtering\n" + * "Route map for output filtering\n" + * "Route map interface name\n" + * + */ DEFUN (no_if_rmap, no_if_rmap_cmd, "no route-map ROUTEMAP_NAME (in|out) IFNAME", @@ -276,15 +289,6 @@ DEFUN (no_if_rmap, return CMD_SUCCESS; } -ALIAS (no_if_rmap, - no_if_ipv6_rmap_cmd, - "no route-map ROUTEMAP_NAME (in|out) IFNAME", - NO_STR - "Route map unset\n" - "Route map name\n" - "Route map for input filtering\n" - "Route map for output filtering\n" - "Route map interface name\n") /* Configuration write function. */ int @@ -333,8 +337,6 @@ if_rmap_init (int node) { ifrmaphash = hash_create (if_rmap_hash_make, if_rmap_hash_cmp); if (node == RIPNG_NODE) { - install_element (RIPNG_NODE, &if_ipv6_rmap_cmd); - install_element (RIPNG_NODE, &no_if_ipv6_rmap_cmd); } else if (node == RIP_NODE) { install_element (RIP_NODE, &if_rmap_cmd); install_element (RIP_NODE, &no_if_rmap_cmd); diff --git a/lib/plist.c b/lib/plist.c index 3de92887bf..d874e1d024 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1824,6 +1824,17 @@ DEFUN (ip_prefix_list_description, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip prefix-list WORD description .LINE", + * NO_STR + * IP_STR + * PREFIX_LIST_STR + * "Name of a prefix list\n" + * "Prefix-list specific description\n" + * "Up to 80 characters describing this prefix-list\n" + * + */ DEFUN (no_ip_prefix_list_description, no_ip_prefix_list_description_cmd, "no ip prefix-list WORD description", @@ -1836,15 +1847,6 @@ DEFUN (no_ip_prefix_list_description, return vty_prefix_list_desc_unset (vty, AFI_IP, argv[3]->arg); } -ALIAS (no_ip_prefix_list_description, - no_ip_prefix_list_description_arg_cmd, - "no ip prefix-list WORD description .LINE", - NO_STR - IP_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n" - "Up to 80 characters describing this prefix-list\n") DEFUN (show_ip_prefix_list, show_ip_prefix_list_cmd, @@ -2420,6 +2422,17 @@ DEFUN (ipv6_prefix_list_description, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 prefix-list WORD description .LINE", + * NO_STR + * IPV6_STR + * PREFIX_LIST_STR + * "Name of a prefix list\n" + * "Prefix-list specific description\n" + * "Up to 80 characters describing this prefix-list\n" + * + */ DEFUN (no_ipv6_prefix_list_description, no_ipv6_prefix_list_description_cmd, "no ipv6 prefix-list WORD description", @@ -2432,15 +2445,6 @@ DEFUN (no_ipv6_prefix_list_description, return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[3]->arg); } -ALIAS (no_ipv6_prefix_list_description, - no_ipv6_prefix_list_description_arg_cmd, - "no ipv6 prefix-list WORD description .LINE", - NO_STR - IPV6_STR - PREFIX_LIST_STR - "Name of a prefix list\n" - "Prefix-list specific description\n" - "Up to 80 characters describing this prefix-list\n") DEFUN (show_ipv6_prefix_list, show_ipv6_prefix_list_cmd, @@ -2946,7 +2950,6 @@ prefix_list_init_ipv4 (void) install_element (CONFIG_NODE, &ip_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd); - install_element (CONFIG_NODE, &no_ip_prefix_list_description_arg_cmd); install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd); @@ -3023,7 +3026,6 @@ prefix_list_init_ipv6 (void) install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd); - install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_arg_cmd); install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd); diff --git a/lib/routemap.c b/lib/routemap.c index 2d7a8be661..f89d078028 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1530,6 +1530,16 @@ 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)", @@ -1578,6 +1588,18 @@ 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", @@ -1596,30 +1618,10 @@ DEFUN (no_rmap_onmatch_goto, } /* Cisco/GNU Zebra compatible ALIASes for on-match next */ -ALIAS (rmap_onmatch_goto, - rmap_continue_cmd, - "continue", - "Continue on a different entry within the route-map\n") -ALIAS (no_rmap_onmatch_goto, - no_rmap_continue_cmd, - "no continue", - NO_STR - "Continue on a different entry within the route-map\n") /* GNU Zebra compatible */ -ALIAS (rmap_onmatch_goto, - rmap_continue_seq_cmd, - "continue (1-65535)", - "Continue on a different entry within the route-map\n" - "Route-map entry sequence number\n") -ALIAS (no_rmap_onmatch_goto, - no_rmap_continue_seq, - "no continue (1-65535)", - NO_STR - "Continue on a different entry within the route-map\n" - "Route-map entry sequence number\n") DEFUN (rmap_show_name, rmap_show_name_cmd, @@ -1809,8 +1811,6 @@ route_map_init_vty (void) install_element (RMAP_NODE, &no_rmap_onmatch_goto_cmd); /* Install the continue stuff (ALIAS of on-match). */ - install_element (RMAP_NODE, &rmap_continue_cmd); - install_element (RMAP_NODE, &no_rmap_continue_cmd); /* Install the call stuff. */ install_element (RMAP_NODE, &rmap_call_cmd); diff --git a/lib/vty.c b/lib/vty.c index a106d5d24d..2ecd1d5e0f 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2923,6 +2923,14 @@ 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", @@ -2934,12 +2942,6 @@ DEFUN (terminal_no_monitor, return CMD_SUCCESS; } -ALIAS (terminal_no_monitor, - no_terminal_monitor_cmd, - "no terminal monitor", - NO_STR - "Set terminal line parameters\n" - "Copy debug output to the current terminal line\n") DEFUN (show_history, show_history_cmd, @@ -3149,7 +3151,6 @@ 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); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index cd11cd2a89..4863342ef1 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -433,6 +433,32 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) oa = ospf6_area_get (area_id, ospf6); \ } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + * "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Configured address range\n" + * "Specify IPv6 prefix\n" + * + * + * "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + */ DEFUN (area_range, area_range_cmd, "area A.B.C.D range X:X::X:X/M", @@ -503,35 +529,37 @@ DEFUN (area_range, return CMD_SUCCESS; } -ALIAS (area_range, - area_range_advertise_cmd, - "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Configured address range\n" - "Specify IPv6 prefix\n" - ) -ALIAS (area_range, - area_range_cost_cmd, - "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") -ALIAS (area_range, - area_range_advertise_cost_cmd, - "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", + * NO_STR + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + * "no area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", + * NO_STR + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Configured address range\n" + * "Specify IPv6 prefix\n" + * + * "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", + * NO_STR + * "OSPF area parameters\n" + * OSPF6_AREA_ID_STR + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + */ DEFUN (no_area_range, no_area_range_cmd, "no area A.B.C.D range X:X::X:X/M", @@ -584,36 +612,8 @@ DEFUN (no_area_range, return CMD_SUCCESS; } -ALIAS (no_area_range, - no_area_range_advertise_cmd, - "no area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", - NO_STR - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Configured address range\n" - "Specify IPv6 prefix\n") -ALIAS (no_area_range, - no_area_range_cost_cmd, - "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", - NO_STR - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") -ALIAS (no_area_range, - no_area_range_advertise_cost_cmd, - "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", - NO_STR - "OSPF area parameters\n" - OSPF6_AREA_ID_STR - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") void ospf6_area_config_write (struct vty *vty) @@ -1094,13 +1094,7 @@ ospf6_area_init (void) install_element (ENABLE_NODE, &show_ipv6_ospf6_simulate_spf_tree_root_cmd); install_element (OSPF6_NODE, &area_range_cmd); - install_element (OSPF6_NODE, &area_range_advertise_cmd); - install_element (OSPF6_NODE, &area_range_cost_cmd); - install_element (OSPF6_NODE, &area_range_advertise_cost_cmd); install_element (OSPF6_NODE, &no_area_range_cmd); - install_element (OSPF6_NODE, &no_area_range_advertise_cmd); - install_element (OSPF6_NODE, &no_area_range_cost_cmd); - install_element (OSPF6_NODE, &no_area_range_advertise_cost_cmd); install_element (OSPF6_NODE, &ospf6_area_stub_no_summary_cmd); install_element (OSPF6_NODE, &ospf6_area_stub_cmd); install_element (OSPF6_NODE, &no_ospf6_area_stub_no_summary_cmd); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index f513e68f70..696f18f030 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -679,6 +679,16 @@ DEFUN (ospf6_redistribute_routemap, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", + * NO_STR + * "Redistribute\n" + * QUAGGA_REDIST_HELP_STR_OSPF6D + * "Route map reference\n" + * "Route map name\n" + * + */ DEFUN (no_ospf6_redistribute, no_ospf6_redistribute_cmd, "no redistribute " QUAGGA_REDIST_STR_OSPF6D, @@ -698,14 +708,6 @@ DEFUN (no_ospf6_redistribute, return CMD_SUCCESS; } -ALIAS (no_ospf6_redistribute, - no_ospf6_redistribute_route_map_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", - NO_STR - "Redistribute\n" - QUAGGA_REDIST_HELP_STR_OSPF6D - "Route map reference\n" - "Route map name\n") int ospf6_redistribute_config_write (struct vty *vty) @@ -1051,6 +1053,15 @@ DEFUN (ospf6_routemap_match_interface, } /* "no match interface WORD" */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * MATCH_STR + * NO_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (ospf6_routemap_no_match_interface, ospf6_routemap_no_match_interface_cmd, "no match interface", @@ -1063,13 +1074,6 @@ DEFUN (ospf6_routemap_no_match_interface, return route_map_command_status (vty, ret); } -ALIAS (ospf6_routemap_no_match_interface, - ospf6_routemap_no_match_interface_val_cmd, - "no match interface WORD", - MATCH_STR - NO_STR - "Match first hop interface of route\n" - "Interface name\n") /* add "set metric-type" */ DEFUN (ospf6_routemap_set_metric_type, @@ -1114,6 +1118,15 @@ DEFUN (set_metric, } /* delete "set metric" */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric <0-4294967295>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Metric value\n" + * + */ DEFUN (no_set_metric, no_set_metric_cmd, "no set metric", @@ -1132,13 +1145,6 @@ DEFUN (no_set_metric, return route_map_command_status (vty, ret); } -ALIAS (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") /* add "set forwarding-address" */ DEFUN (ospf6_routemap_set_forwarding, @@ -1189,7 +1195,6 @@ ospf6_routemap_init (void) /* Match interface */ install_element (RMAP_NODE, &ospf6_routemap_match_interface_cmd); install_element (RMAP_NODE, &ospf6_routemap_no_match_interface_cmd); - install_element (RMAP_NODE, &ospf6_routemap_no_match_interface_val_cmd); /* ASE Metric Type (e.g. Type-1/Type-2) */ install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd); @@ -1198,7 +1203,6 @@ ospf6_routemap_init (void) /* ASE Metric */ install_element (RMAP_NODE, &set_metric_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_val_cmd); /* ASE Metric */ install_element (RMAP_NODE, &ospf6_routemap_set_forwarding_cmd); @@ -1351,7 +1355,6 @@ ospf6_asbr_init (void) install_element (OSPF6_NODE, &ospf6_redistribute_cmd); install_element (OSPF6_NODE, &ospf6_redistribute_routemap_cmd); install_element (OSPF6_NODE, &no_ospf6_redistribute_cmd); - install_element (OSPF6_NODE, &no_ospf6_redistribute_route_map_cmd); } void @@ -1408,12 +1411,3 @@ config_write_ospf6_debug_asbr (struct vty *vty) } void -install_element_ospf6_debug_asbr () -{ - install_element (ENABLE_NODE, &debug_ospf6_asbr_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_asbr_cmd); - install_element (CONFIG_NODE, &debug_ospf6_asbr_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_asbr_cmd); -} - - diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index e53fb21800..66cc59bc32 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -986,6 +986,16 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp) } /* show interface */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 interface", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * INTERFACE_STR + * + * + */ DEFUN (show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd, "show ipv6 ospf6 interface IFNAME", @@ -1019,15 +1029,34 @@ DEFUN (show_ipv6_ospf6_interface, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_interface, - show_ipv6_ospf6_interface_cmd, - "show ipv6 ospf6 interface", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * INTERFACE_STR + * IFNAME_STR + * "Display connected prefixes to advertise\n" + * OSPF6_ROUTE_ADDRESS_STR + * OSPF6_ROUTE_PREFIX_STR + * "Display details of the prefixes\n" + * + * + * "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * INTERFACE_STR + * IFNAME_STR + * "Display connected prefixes to advertise\n" + * OSPF6_ROUTE_PREFIX_STR + * OSPF6_ROUTE_MATCH_STR + * "Display details of the prefixes\n" + * + * + */ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_cmd, "show ipv6 ospf6 interface IFNAME prefix", @@ -1063,34 +1092,33 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_interface_ifname_prefix, - show_ipv6_ospf6_interface_ifname_prefix_detail_cmd, - "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - IFNAME_STR - "Display connected prefixes to advertise\n" - OSPF6_ROUTE_ADDRESS_STR - OSPF6_ROUTE_PREFIX_STR - "Display details of the prefixes\n" - ) -ALIAS (show_ipv6_ospf6_interface_ifname_prefix, - show_ipv6_ospf6_interface_ifname_prefix_match_cmd, - "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - IFNAME_STR - "Display connected prefixes to advertise\n" - OSPF6_ROUTE_PREFIX_STR - OSPF6_ROUTE_MATCH_STR - "Display details of the prefixes\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * INTERFACE_STR + * "Display connected prefixes to advertise\n" + * OSPF6_ROUTE_PREFIX_STR + * OSPF6_ROUTE_MATCH_STR + * "Display details of the prefixes\n" + * + * + * "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * INTERFACE_STR + * "Display connected prefixes to advertise\n" + * OSPF6_ROUTE_ADDRESS_STR + * OSPF6_ROUTE_PREFIX_STR + * "Display details of the prefixes\n" + * + * + */ DEFUN (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd, "show ipv6 ospf6 interface prefix", @@ -1117,31 +1145,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_interface_prefix, - show_ipv6_ospf6_interface_prefix_detail_cmd, - "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - "Display connected prefixes to advertise\n" - OSPF6_ROUTE_ADDRESS_STR - OSPF6_ROUTE_PREFIX_STR - "Display details of the prefixes\n" - ) -ALIAS (show_ipv6_ospf6_interface_prefix, - show_ipv6_ospf6_interface_prefix_match_cmd, - "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - "Display connected prefixes to advertise\n" - OSPF6_ROUTE_PREFIX_STR - OSPF6_ROUTE_MATCH_STR - "Display details of the prefixes\n" - ) /* interface variable set command */ @@ -1352,6 +1356,15 @@ DEFUN (auto_cost_reference_bandwidth, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no auto-cost reference-bandwidth <1-4294967>", + * NO_STR + * "Calculate OSPF interface cost according to bandwidth\n" + * "Use reference bandwidth method to assign OSPF cost\n" + * "The reference bandwidth in terms of Mbits per second\n" + * + */ DEFUN (no_auto_cost_reference_bandwidth, no_auto_cost_reference_bandwidth_cmd, "no auto-cost reference-bandwidth", @@ -1375,13 +1388,6 @@ DEFUN (no_auto_cost_reference_bandwidth, return CMD_SUCCESS; } -ALIAS (no_auto_cost_reference_bandwidth, - no_auto_cost_reference_bandwidth_val_cmd, - "no auto-cost reference-bandwidth <1-4294967>", - NO_STR - "Calculate OSPF interface cost according to bandwidth\n" - "Use reference bandwidth method to assign OSPF cost\n" - "The reference bandwidth in terms of Mbits per second\n") DEFUN (ipv6_ospf6_hellointerval, ipv6_ospf6_hellointerval_cmd, @@ -1899,22 +1905,12 @@ ospf6_interface_init (void) /* Install interface node. */ install_node (&interface_node, config_write_ospf6_interface); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_prefix_match_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_interface_ifname_prefix_match_cmd); install_element (CONFIG_NODE, &interface_cmd); install_default (INTERFACE_NODE); @@ -1946,7 +1942,6 @@ ospf6_interface_init (void) /* reference bandwidth commands */ install_element (OSPF6_NODE, &auto_cost_reference_bandwidth_cmd); install_element (OSPF6_NODE, &no_auto_cost_reference_bandwidth_cmd); - install_element (OSPF6_NODE, &no_auto_cost_reference_bandwidth_val_cmd); } /* Clear the specified interface structure */ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index fbc72d6fe7..d58ab567b3 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -816,6 +816,16 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) return buf; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)", + * DEBUG_STR + * OSPF6_STR + * "Debug Link State Advertisements (LSAs)\n" + * "Specify LS type as Hexadecimal\n" + * + * + */ DEFUN (debug_ospf6_lsa_type, debug_ospf6_lsa_hex_cmd, "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)", @@ -860,15 +870,18 @@ DEFUN (debug_ospf6_lsa_type, return CMD_SUCCESS; } -ALIAS (debug_ospf6_lsa_type, - debug_ospf6_lsa_hex_detail_cmd, - "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)", - DEBUG_STR - OSPF6_STR - "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix) (originate|examine|flooding)", + * NO_STR + * DEBUG_STR + * OSPF6_STR + * "Debug Link State Advertisements (LSAs)\n" + * "Specify LS type as Hexadecimal\n" + * + * + */ DEFUN (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_cmd, "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)", @@ -913,27 +926,14 @@ DEFUN (no_debug_ospf6_lsa_type, return CMD_SUCCESS; } -ALIAS (no_debug_ospf6_lsa_type, - no_debug_ospf6_lsa_hex_detail_cmd, - "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix) (originate|examine|flooding)", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) void install_element_ospf6_debug_lsa (void) { install_element (ENABLE_NODE, &debug_ospf6_lsa_hex_cmd); - install_element (ENABLE_NODE, &debug_ospf6_lsa_hex_detail_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_lsa_hex_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_lsa_hex_detail_cmd); install_element (CONFIG_NODE, &debug_ospf6_lsa_hex_cmd); - install_element (CONFIG_NODE, &debug_ospf6_lsa_hex_detail_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_lsa_hex_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_lsa_hex_detail_cmd); } int diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index adaef2f9f3..e8f4990c9d 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2338,6 +2338,24 @@ ospf6_lsack_send_interface (struct thread *thread) /* Commands */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", + * DEBUG_STR + * OSPF6_STR + * "Debug OSPFv3 message\n" + * "Debug Unknown message\n" + * "Debug Hello message\n" + * "Debug Database Description message\n" + * "Debug Link State Request message\n" + * "Debug Link State Update message\n" + * "Debug Link State Acknowledgement message\n" + * "Debug All message\n" + * "Debug only sending message\n" + * "Debug only receiving message\n" + * + * + */ DEFUN (debug_ospf6_message, debug_ospf6_message_cmd, "debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)", @@ -2393,24 +2411,28 @@ DEFUN (debug_ospf6_message, return CMD_SUCCESS; } -ALIAS (debug_ospf6_message, - debug_ospf6_message_sendrecv_cmd, - "debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 message\n" - "Debug Unknown message\n" - "Debug Hello message\n" - "Debug Database Description message\n" - "Debug Link State Request message\n" - "Debug Link State Update message\n" - "Debug Link State Acknowledgement message\n" - "Debug All message\n" - "Debug only sending message\n" - "Debug only receiving message\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf6 message " + * "(unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", + * NO_STR + * DEBUG_STR + * OSPF6_STR + * "Debug OSPFv3 message\n" + * "Debug Unknown message\n" + * "Debug Hello message\n" + * "Debug Database Description message\n" + * "Debug Link State Request message\n" + * "Debug Link State Update message\n" + * "Debug Link State Acknowledgement message\n" + * "Debug All message\n" + * "Debug only sending message\n" + * "Debug only receiving message\n" + * + * + */ DEFUN (no_debug_ospf6_message, no_debug_ospf6_message_cmd, "no debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)", @@ -2467,24 +2489,6 @@ DEFUN (no_debug_ospf6_message, return CMD_SUCCESS; } -ALIAS (no_debug_ospf6_message, - no_debug_ospf6_message_sendrecv_cmd, - "no debug ospf6 message " - "(unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 message\n" - "Debug Unknown message\n" - "Debug Hello message\n" - "Debug Database Description message\n" - "Debug Link State Request message\n" - "Debug Link State Update message\n" - "Debug Link State Acknowledgement message\n" - "Debug All message\n" - "Debug only sending message\n" - "Debug only receiving message\n" - ) int config_write_ospf6_debug_message (struct vty *vty) @@ -2549,12 +2553,8 @@ install_element_ospf6_debug_message (void) { install_element (ENABLE_NODE, &debug_ospf6_message_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_message_cmd); - install_element (ENABLE_NODE, &debug_ospf6_message_sendrecv_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_message_sendrecv_cmd); install_element (CONFIG_NODE, &debug_ospf6_message_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_message_cmd); - install_element (CONFIG_NODE, &debug_ospf6_message_sendrecv_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_message_sendrecv_cmd); } diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 3e09771629..fbf0efed89 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -827,6 +827,18 @@ ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) ospf6_bfd_show_info(vty, on->bfd_info, 0); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 neighbor (detail|drchoice)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * "Neighbor list\n" + * "Display details\n" + * "Display DR choices\n" + * + * + */ DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, "show ipv6 ospf6 neighbor", @@ -870,16 +882,6 @@ DEFUN (show_ipv6_ospf6_neighbor, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_neighbor, - show_ipv6_ospf6_neighbor_detail_cmd, - "show ipv6 ospf6 neighbor (detail|drchoice)", - SHOW_STR - IP6_STR - OSPF6_STR - "Neighbor list\n" - "Display details\n" - "Display DR choices\n" - ) DEFUN (show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, @@ -920,11 +922,20 @@ void ospf6_neighbor_init (void) { install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_neighbor_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_detail_cmd); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf6 neighbor (state|event)", + * DEBUG_STR + * OSPF6_STR + * "Debug OSPFv3 Neighbor\n" + * "Debug OSPFv3 Neighbor State Change\n" + * "Debug OSPFv3 Neighbor Event\n" + * + * + */ DEFUN (debug_ospf6_neighbor, debug_ospf6_neighbor_cmd, "debug ospf6 neighbor", @@ -948,16 +959,19 @@ DEFUN (debug_ospf6_neighbor, return CMD_SUCCESS; } -ALIAS (debug_ospf6_neighbor, - debug_ospf6_neighbor_detail_cmd, - "debug ospf6 neighbor (state|event)", - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Neighbor\n" - "Debug OSPFv3 Neighbor State Change\n" - "Debug OSPFv3 Neighbor Event\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf6 neighbor (state|event)", + * NO_STR + * DEBUG_STR + * OSPF6_STR + * "Debug OSPFv3 Neighbor\n" + * "Debug OSPFv3 Neighbor State Change\n" + * "Debug OSPFv3 Neighbor Event\n" + * + * + */ DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, "no debug ospf6 neighbor", @@ -982,16 +996,6 @@ DEFUN (no_debug_ospf6_neighbor, return CMD_SUCCESS; } -ALIAS (no_debug_ospf6_neighbor, - no_debug_ospf6_neighbor_detail_cmd, - "no debug ospf6 neighbor (state|event)", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug OSPFv3 Neighbor\n" - "Debug OSPFv3 Neighbor State Change\n" - "Debug OSPFv3 Neighbor Event\n" - ) DEFUN (no_debug_ospf6, no_debug_ospf6_cmd, @@ -1054,14 +1058,10 @@ void install_element_ospf6_debug_neighbor (void) { install_element (ENABLE_NODE, &debug_ospf6_neighbor_cmd); - install_element (ENABLE_NODE, &debug_ospf6_neighbor_detail_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_neighbor_detail_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_cmd); install_element (CONFIG_NODE, &debug_ospf6_neighbor_cmd); - install_element (CONFIG_NODE, &debug_ospf6_neighbor_detail_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_neighbor_detail_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_cmd); } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index fe5006b24d..6511d0b363 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -900,6 +900,18 @@ DEFUN (ospf6_timers_throttle_spf, return ospf6_timers_spf_set (vty, delay, hold, max); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers throttle spf <0-600000> <0-600000> <0-600000>", + * NO_STR + * "Adjust routing timers\n" + * "Throttling adaptive timer\n" + * "OSPF6 SPF timers\n" + * "Delay (msec) from first change received till SPF calculation\n" + * "Initial hold time (msec) between consecutive SPF calculations\n" + * "Maximum hold time (msec)\n" + * + */ DEFUN (no_ospf6_timers_throttle_spf, no_ospf6_timers_throttle_spf_cmd, "no timers throttle spf", @@ -914,16 +926,6 @@ DEFUN (no_ospf6_timers_throttle_spf, OSPF_SPF_MAX_HOLDTIME_DEFAULT); } -ALIAS (no_ospf6_timers_throttle_spf, - no_ospf6_timers_throttle_spf_val_cmd, - "no timers throttle spf <0-600000> <0-600000> <0-600000>", - NO_STR - "Adjust routing timers\n" - "Throttling adaptive timer\n" - "OSPF6 SPF timers\n" - "Delay (msec) from first change received till SPF calculation\n" - "Initial hold time (msec) between consecutive SPF calculations\n" - "Maximum hold time (msec)\n") int config_write_ospf6_debug_spf (struct vty *vty) @@ -972,5 +974,4 @@ ospf6_spf_init (void) { install_element (OSPF6_NODE, &ospf6_timers_throttle_spf_cmd); install_element (OSPF6_NODE, &no_ospf6_timers_throttle_spf_cmd); - install_element (OSPF6_NODE, &no_ospf6_timers_throttle_spf_val_cmd); } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index e04f22fd09..8ddc6cfc8f 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -423,6 +423,16 @@ DEFUN (ospf6_timers_lsa, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers lsa min-arrival <0-600000>", + * NO_STR + * "Adjust routing timers\n" + * "OSPF6 LSA timers\n" + * "Minimum delay in receiving new version of a LSA\n" + * "Delay in milliseconds\n" + * + */ DEFUN (no_ospf6_timers_lsa, no_ospf6_timers_lsa_cmd, "no timers lsa min-arrival", @@ -451,14 +461,6 @@ DEFUN (no_ospf6_timers_lsa, return CMD_SUCCESS; } -ALIAS (no_ospf6_timers_lsa, - no_ospf6_timers_lsa_val_cmd, - "no timers lsa min-arrival <0-600000>", - NO_STR - "Adjust routing timers\n" - "OSPF6 LSA timers\n" - "Minimum delay in receiving new version of a LSA\n" - "Delay in milliseconds\n") DEFUN (ospf6_interface_area, ospf6_interface_area_cmd, @@ -774,6 +776,31 @@ DEFUN (show_ipv6_ospf6, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * ROUTE_STR + * "Display Intra-Area routes\n" + * "Display Inter-Area routes\n" + * "Display Type-1 External routes\n" + * "Display Type-2 External routes\n" + * + * + * "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * ROUTE_STR + * "Specify IPv6 address\n" + * "Specify IPv6 prefix\n" + * "Detailed information\n" + * "Summary of route table\n" + * + * + */ DEFUN (show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, "show ipv6 ospf6 route", @@ -789,19 +816,19 @@ DEFUN (show_ipv6_ospf6_route, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_route, - show_ipv6_ospf6_route_detail_cmd, - "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)", - SHOW_STR - IP6_STR - OSPF6_STR - ROUTE_STR - "Specify IPv6 address\n" - "Specify IPv6 prefix\n" - "Detailed information\n" - "Summary of route table\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 route X:X::X:X/M longer", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * ROUTE_STR + * "Specify IPv6 prefix\n" + * "Display routes longer than the specified route\n" + * + * + */ DEFUN (show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd, "show ipv6 ospf6 route X:X::X:X/M match", @@ -837,29 +864,7 @@ DEFUN (show_ipv6_ospf6_route_match_detail, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_route_match, - show_ipv6_ospf6_route_longer_cmd, - "show ipv6 ospf6 route X:X::X:X/M longer", - SHOW_STR - IP6_STR - OSPF6_STR - ROUTE_STR - "Specify IPv6 prefix\n" - "Display routes longer than the specified route\n" - ) -ALIAS (show_ipv6_ospf6_route, - show_ipv6_ospf6_route_type_cmd, - "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)", - SHOW_STR - IP6_STR - OSPF6_STR - ROUTE_STR - "Display Intra-Area routes\n" - "Display Inter-Area routes\n" - "Display Type-1 External routes\n" - "Display Type-2 External routes\n" - ) DEFUN (show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd, @@ -965,18 +970,12 @@ ospf6_top_init (void) install_element (CONFIG_NODE, &no_router_ospf6_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd); install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_route_detail_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd); install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd); install_default (OSPF6_NODE); @@ -989,7 +988,6 @@ ospf6_top_init (void) /* LSA timers commands */ install_element (OSPF6_NODE, &ospf6_timers_lsa_cmd); install_element (OSPF6_NODE, &no_ospf6_timers_lsa_cmd); - install_element (OSPF6_NODE, &no_ospf6_timers_lsa_val_cmd); install_element (OSPF6_NODE, &ospf6_interface_area_cmd); install_element (OSPF6_NODE, &no_ospf6_interface_area_cmd); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 1e22a3517e..f172b50f05 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -707,6 +707,15 @@ ospf6_zebra_init (struct thread_master *master) /* Debug */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf6 zebra", + * DEBUG_STR + * OSPF6_STR + * "Debug connection between zebra\n" + * + * + */ DEFUN (debug_ospf6_zebra_sendrecv, debug_ospf6_zebra_sendrecv_cmd, "debug ospf6 zebra (send|recv)", @@ -733,15 +742,18 @@ DEFUN (debug_ospf6_zebra_sendrecv, return CMD_SUCCESS; } -ALIAS (debug_ospf6_zebra_sendrecv, - debug_ospf6_zebra_cmd, - "debug ospf6 zebra", - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf6 zebra", + * NO_STR + * DEBUG_STR + * OSPF6_STR + * "Debug connection between zebra\n" + * + * + */ DEFUN (no_debug_ospf6_zebra_sendrecv, no_debug_ospf6_zebra_sendrecv_cmd, "no debug ospf6 zebra (send|recv)", @@ -769,14 +781,6 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, return CMD_SUCCESS; } -ALIAS (no_debug_ospf6_zebra_sendrecv, - no_debug_ospf6_zebra_cmd, - "no debug ospf6 zebra", - NO_STR - DEBUG_STR - OSPF6_STR - "Debug connection between zebra\n" - ) int config_write_ospf6_debug_zebra (struct vty *vty) @@ -796,12 +800,8 @@ config_write_ospf6_debug_zebra (struct vty *vty) void install_element_ospf6_debug_zebra (void) { - install_element (ENABLE_NODE, &debug_ospf6_zebra_cmd); - install_element (ENABLE_NODE, &no_debug_ospf6_zebra_cmd); install_element (ENABLE_NODE, &debug_ospf6_zebra_sendrecv_cmd); install_element (ENABLE_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); - install_element (CONFIG_NODE, &debug_ospf6_zebra_cmd); - install_element (CONFIG_NODE, &no_debug_ospf6_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf6_zebra_sendrecv_cmd); install_element (CONFIG_NODE, &no_debug_ospf6_zebra_sendrecv_cmd); } diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index ecd0c04718..74ca444d40 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -165,6 +165,19 @@ parse_type_spec (int argc, struct cmd_token **argv) return type; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database (detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, "show ipv6 ospf6 database", @@ -207,18 +220,32 @@ DEFUN (show_ipv6_ospf6_database, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database, - show_ipv6_ospf6_database_detail_cmd, - "show ipv6 ospf6 database (detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix)", @@ -287,30 +314,45 @@ DEFUN (show_ipv6_ospf6_database_type, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type, - show_ipv6_ospf6_database_type_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database * A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Any Link state Type\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database linkstate-id A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database linkstate-id A.B.C.D", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, "show ipv6 ospf6 database * A.B.C.D", @@ -365,47 +407,48 @@ DEFUN (show_ipv6_ospf6_database_id, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_id, - show_ipv6_ospf6_database_id_detail_cmd, - "show ipv6 ospf6 database * A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Any Link state Type\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) -ALIAS (show_ipv6_ospf6_database_id, - show_ipv6_ospf6_database_linkstate_id_cmd, - "show ipv6 ospf6 database linkstate-id A.B.C.D", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ) -ALIAS (show_ipv6_ospf6_database_id, - show_ipv6_ospf6_database_linkstate_id_detail_cmd, - "show ipv6 ospf6 database linkstate-id A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database * * A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Any Link state Type\n" + * "Any Link state ID\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database adv-router A.B.C.D", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * + * + * "show ipv6 ospf6 database adv-router A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, "show ipv6 ospf6 database * * A.B.C.D", @@ -461,48 +504,79 @@ DEFUN (show_ipv6_ospf6_database_router, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_router, - show_ipv6_ospf6_database_router_detail_cmd, - "show ipv6 ospf6 database * * A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Any Link state Type\n" - "Any Link state ID\n" - "Specify Advertising Router as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) -ALIAS (show_ipv6_ospf6_database_router, - show_ipv6_ospf6_database_adv_router_cmd, - "show ipv6 ospf6 database adv-router A.B.C.D", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - ) -ALIAS (show_ipv6_ospf6_database_router, - show_ipv6_ospf6_database_adv_router_detail_cmd, - "show ipv6 ospf6 database adv-router A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D", @@ -583,79 +657,80 @@ DEFUN (show_ipv6_ospf6_database_type_id, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_id, - show_ipv6_ospf6_database_type_id_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) -ALIAS (show_ipv6_ospf6_database_type_id, - show_ipv6_ospf6_database_type_linkstate_id_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - ) -ALIAS (show_ipv6_ospf6_database_type_id, - show_ipv6_ospf6_database_type_linkstate_id_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) * A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Any Link state ID\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) * A.B.C.D", @@ -737,80 +812,26 @@ DEFUN (show_ipv6_ospf6_database_type_router, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_router, - show_ipv6_ospf6_database_type_router_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) * A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Any Link state ID\n" - "Specify Advertising Router as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) -ALIAS (show_ipv6_ospf6_database_type_router, - show_ipv6_ospf6_database_type_adv_router_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - ) -ALIAS (show_ipv6_ospf6_database_type_router, - show_ipv6_ospf6_database_type_adv_router_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database * A.B.C.D A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Any Link state Type\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_id_router, show_ipv6_ospf6_database_id_router_cmd, "show ipv6 ospf6 database * A.B.C.D A.B.C.D", @@ -877,22 +898,25 @@ DEFUN (show_ipv6_ospf6_database_id_router, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_id_router, - show_ipv6_ospf6_database_id_router_detail_cmd, - "show ipv6 ospf6 database * A.B.C.D A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Any Link state Type\n" - "Specify Link state ID as IPv4 address notation\n" - "Specify Advertising Router as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D", @@ -960,23 +984,33 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id, - show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd, - "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D " + * "(dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D", @@ -1069,31 +1103,36 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_id_router, - show_ipv6_ospf6_database_type_id_router_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D " - "(dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Specify Link state ID as IPv4 address notation\n" - "Specify Advertising Router as IPv4 address notation\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) " + * "adv-router A.B.C.D linkstate-id A.B.C.D " + * "(dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Search by Advertising Router\n" + * "Specify Advertising Router as IPv4 address notation\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D", @@ -1188,34 +1227,21 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id, - show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) " - "adv-router A.B.C.D linkstate-id A.B.C.D " - "(dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Search by Advertising Router\n" - "Specify Advertising Router as IPv4 address notation\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database self-originated " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Self-originated LSAs\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_self_originated, show_ipv6_ospf6_database_self_originated_cmd, "show ipv6 ospf6 database self-originated", @@ -1261,19 +1287,33 @@ DEFUN (show_ipv6_ospf6_database_self_originated, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_self_originated, - show_ipv6_ospf6_database_self_originated_detail_cmd, - "show ipv6 ospf6 database self-originated " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Self-originated LSAs\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) self-originated " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Display Self-originated LSAs\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_self_originated, show_ipv6_ospf6_database_type_self_originated_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated", @@ -1346,31 +1386,35 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_self_originated, - show_ipv6_ospf6_database_type_self_originated_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) self-originated " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Display Self-originated LSAs\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) self-originated " + * "linkstate-id A.B.C.D (detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Display Self-originated LSAs\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D", @@ -1456,33 +1500,35 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id, - show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) self-originated " - "linkstate-id A.B.C.D (detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Display Self-originated LSAs\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 database " + * "(router|network|inter-prefix|inter-router|as-external|" + * "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated " + * "(detail|dump|internal)", + * SHOW_STR + * IPV6_STR + * OSPF6_STR + * "Display Link state database\n" + * "Display Router LSAs\n" + * "Display Network LSAs\n" + * "Display Inter-Area-Prefix LSAs\n" + * "Display Inter-Area-Router LSAs\n" + * "Display As-External LSAs\n" + * "Display Group-Membership LSAs\n" + * "Display Type-7 LSAs\n" + * "Display Link LSAs\n" + * "Display Intra-Area-Prefix LSAs\n" + * "Display Self-originated LSAs\n" + * "Search by Link state ID\n" + * "Specify Link state ID as IPv4 address notation\n" + * "Display details of LSAs\n" + * "Dump LSAs\n" + * "Display LSA's internal information\n" + * + * + */ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated", @@ -1567,34 +1613,20 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_database_type_id_self_originated, - show_ipv6_ospf6_database_type_id_self_originated_detail_cmd, - "show ipv6 ospf6 database " - "(router|network|inter-prefix|inter-router|as-external|" - "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated " - "(detail|dump|internal)", - SHOW_STR - IPV6_STR - OSPF6_STR - "Display Link state database\n" - "Display Router LSAs\n" - "Display Network LSAs\n" - "Display Inter-Area-Prefix LSAs\n" - "Display Inter-Area-Router LSAs\n" - "Display As-External LSAs\n" - "Display Group-Membership LSAs\n" - "Display Type-7 LSAs\n" - "Display Link LSAs\n" - "Display Intra-Area-Prefix LSAs\n" - "Display Self-originated LSAs\n" - "Search by Link state ID\n" - "Specify Link state ID as IPv4 address notation\n" - "Display details of LSAs\n" - "Dump LSAs\n" - "Display LSA's internal information\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 border-routers (A.B.C.D|detail)", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * "Display routing table for ABR and ASBR\n" + * "Specify Router-ID\n" + * "Display Detail\n" + * + * + */ DEFUN (show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd, "show ipv6 ospf6 border-routers", @@ -1650,17 +1682,29 @@ DEFUN (show_ipv6_ospf6_border_routers, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_border_routers, - show_ipv6_ospf6_border_routers_detail_cmd, - "show ipv6 ospf6 border-routers (A.B.C.D|detail)", - SHOW_STR - IP6_STR - OSPF6_STR - "Display routing table for ABR and ASBR\n" - "Specify Router-ID\n" - "Display Detail\n" - ) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * "Display linkstate routing table\n" + * "Display Network Entry\n" + * "Specify Router ID as IPv4 address notation\n" + * "Specify Link state ID as IPv4 address notation\n" + * + * + * "show ipv6 ospf6 linkstate router A.B.C.D", + * SHOW_STR + * IP6_STR + * OSPF6_STR + * "Display linkstate routing table\n" + * "Display Router Entry\n" + * "Specify Router ID as IPv4 address notation\n" + * + * + */ DEFUN (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, "show ipv6 ospf6 linkstate", @@ -1686,28 +1730,7 @@ DEFUN (show_ipv6_ospf6_linkstate, return CMD_SUCCESS; } -ALIAS (show_ipv6_ospf6_linkstate, - show_ipv6_ospf6_linkstate_router_cmd, - "show ipv6 ospf6 linkstate router A.B.C.D", - SHOW_STR - IP6_STR - OSPF6_STR - "Display linkstate routing table\n" - "Display Router Entry\n" - "Specify Router ID as IPv4 address notation\n" - ) -ALIAS (show_ipv6_ospf6_linkstate, - show_ipv6_ospf6_linkstate_network_cmd, - "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D", - SHOW_STR - IP6_STR - OSPF6_STR - "Display linkstate routing table\n" - "Display Network Entry\n" - "Specify Router ID as IPv4 address notation\n" - "Specify Link state ID as IPv4 address notation\n" - ) DEFUN (show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd, @@ -1757,126 +1780,3 @@ ospf6_init (void) ospf6_bfd_init(); install_node (&debug_node, config_write_ospf6_debug); - install_element_ospf6_debug_message (); - install_element_ospf6_debug_lsa (); - install_element_ospf6_debug_interface (); - install_element_ospf6_debug_neighbor (); - install_element_ospf6_debug_zebra (); - install_element_ospf6_debug_spf (); - install_element_ospf6_debug_route (); - install_element_ospf6_debug_brouter (); - install_element_ospf6_debug_asbr (); - install_element_ospf6_debug_abr (); - install_element_ospf6_debug_flood (); - - install_element_ospf6_clear_interface (); - - install_element (VIEW_NODE, &show_version_ospf6_cmd); - install_element (ENABLE_NODE, &show_version_ospf6_cmd); - - install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd); - - install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd); - install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd); - install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); - -#define INSTALL(n,c) \ - install_element (n ## _NODE, &show_ipv6_ospf6_ ## c) - - INSTALL (VIEW, database_cmd); - INSTALL (VIEW, database_detail_cmd); - INSTALL (VIEW, database_type_cmd); - INSTALL (VIEW, database_type_detail_cmd); - INSTALL (VIEW, database_id_cmd); - INSTALL (VIEW, database_id_detail_cmd); - INSTALL (VIEW, database_linkstate_id_cmd); - INSTALL (VIEW, database_linkstate_id_detail_cmd); - INSTALL (VIEW, database_router_cmd); - INSTALL (VIEW, database_router_detail_cmd); - INSTALL (VIEW, database_adv_router_cmd); - INSTALL (VIEW, database_adv_router_detail_cmd); - INSTALL (VIEW, database_type_id_cmd); - INSTALL (VIEW, database_type_id_detail_cmd); - INSTALL (VIEW, database_type_linkstate_id_cmd); - INSTALL (VIEW, database_type_linkstate_id_detail_cmd); - INSTALL (VIEW, database_type_router_cmd); - INSTALL (VIEW, database_type_router_detail_cmd); - INSTALL (VIEW, database_type_adv_router_cmd); - INSTALL (VIEW, database_type_adv_router_detail_cmd); - INSTALL (VIEW, database_adv_router_linkstate_id_cmd); - INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd); - INSTALL (VIEW, database_id_router_cmd); - INSTALL (VIEW, database_id_router_detail_cmd); - INSTALL (VIEW, database_type_id_router_cmd); - INSTALL (VIEW, database_type_id_router_detail_cmd); - INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd); - INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd); - INSTALL (VIEW, database_self_originated_cmd); - INSTALL (VIEW, database_self_originated_detail_cmd); - INSTALL (VIEW, database_type_self_originated_cmd); - INSTALL (VIEW, database_type_self_originated_detail_cmd); - INSTALL (VIEW, database_type_id_self_originated_cmd); - INSTALL (VIEW, database_type_id_self_originated_detail_cmd); - INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd); - INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd); - - INSTALL (ENABLE, database_cmd); - INSTALL (ENABLE, database_detail_cmd); - INSTALL (ENABLE, database_type_cmd); - INSTALL (ENABLE, database_type_detail_cmd); - INSTALL (ENABLE, database_id_cmd); - INSTALL (ENABLE, database_id_detail_cmd); - INSTALL (ENABLE, database_linkstate_id_cmd); - INSTALL (ENABLE, database_linkstate_id_detail_cmd); - INSTALL (ENABLE, database_router_cmd); - INSTALL (ENABLE, database_router_detail_cmd); - INSTALL (ENABLE, database_adv_router_cmd); - INSTALL (ENABLE, database_adv_router_detail_cmd); - INSTALL (ENABLE, database_type_id_cmd); - INSTALL (ENABLE, database_type_id_detail_cmd); - INSTALL (ENABLE, database_type_linkstate_id_cmd); - INSTALL (ENABLE, database_type_linkstate_id_detail_cmd); - INSTALL (ENABLE, database_type_router_cmd); - INSTALL (ENABLE, database_type_router_detail_cmd); - INSTALL (ENABLE, database_type_adv_router_cmd); - INSTALL (ENABLE, database_type_adv_router_detail_cmd); - INSTALL (ENABLE, database_adv_router_linkstate_id_cmd); - INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd); - INSTALL (ENABLE, database_id_router_cmd); - INSTALL (ENABLE, database_id_router_detail_cmd); - INSTALL (ENABLE, database_type_id_router_cmd); - INSTALL (ENABLE, database_type_id_router_detail_cmd); - INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd); - INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd); - INSTALL (ENABLE, database_self_originated_cmd); - INSTALL (ENABLE, database_self_originated_detail_cmd); - INSTALL (ENABLE, database_type_self_originated_cmd); - INSTALL (ENABLE, database_type_self_originated_detail_cmd); - INSTALL (ENABLE, database_type_id_self_originated_cmd); - INSTALL (ENABLE, database_type_id_self_originated_detail_cmd); - INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd); - INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd); - - /* Make ospf protocol socket. */ - ospf6_serv_sock (); - thread_add_read (master, ospf6_receive, NULL, ospf6_sock); -} - -void -ospf6_clean (void) -{ - if (!ospf6) - return; - if (ospf6->route_table) - ospf6_route_remove_all (ospf6->route_table); - if (ospf6->brouter_table) - ospf6_route_remove_all (ospf6->brouter_table); -} diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index dd44ab2ac1..2689cecc4a 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -404,6 +404,18 @@ DEFUN (ip_ospf_bfd_param, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Enables BFD support\n" + * "Detect Multiplier\n" + * "Required min receive interval\n" + * "Desired min transmit interval\n" + * + */ DEFUN (no_ip_ospf_bfd, no_ip_ospf_bfd_cmd, "no ip ospf bfd", @@ -427,16 +439,6 @@ DEFUN (no_ip_ospf_bfd, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_bfd, - no_ip_ospf_bfd_param_cmd, - "no ip ospf bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Enables BFD support\n" - "Detect Multiplier\n" - "Required min receive interval\n" - "Desired min transmit interval\n") void ospf_bfd_init(void) @@ -451,5 +453,4 @@ ospf_bfd_init(void) install_element (INTERFACE_NODE, &ip_ospf_bfd_cmd); install_element (INTERFACE_NODE, &ip_ospf_bfd_param_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_bfd_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_bfd_param_cmd); } diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 583a4d85d9..60356e774a 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -814,6 +814,37 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail information\n" + * + */ DEFUN (debug_ospf_packet, debug_ospf_packet_all_cmd, "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)", @@ -830,38 +861,41 @@ DEFUN (debug_ospf_packet, return (debug_ospf_packet_common(vty, 0, argc, argv)); } -ALIAS (debug_ospf_packet, - debug_ospf_packet_send_recv_cmd, - "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - "Debugging functions\n" - "OSPF information\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail information\n") -ALIAS (debug_ospf_packet, - debug_ospf_packet_send_recv_detail_cmd, - "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - "Debugging functions\n" - "OSPF information\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail information\n" + * + * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + */ DEFUN (debug_ospf_instance_packet, debug_ospf_instance_packet_all_cmd, "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all)", @@ -885,39 +919,7 @@ DEFUN (debug_ospf_instance_packet, return (debug_ospf_packet_common(vty, 1, argc, argv)); } -ALIAS (debug_ospf_instance_packet, - debug_ospf_instance_packet_send_recv_cmd, - "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail information\n") -ALIAS (debug_ospf_instance_packet, - debug_ospf_instance_packet_send_recv_detail_cmd, - "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") static int no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, @@ -982,6 +984,39 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + */ DEFUN (no_debug_ospf_packet, no_debug_ospf_packet_all_cmd, "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)", @@ -999,40 +1034,43 @@ DEFUN (no_debug_ospf_packet, return no_debug_ospf_packet_common(vty, 0, argc, argv); } -ALIAS (no_debug_ospf_packet, - no_debug_ospf_packet_send_recv_cmd, - "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") -ALIAS (no_debug_ospf_packet, - no_debug_ospf_packet_send_recv_detail_cmd, - "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF packets\n" + * "OSPF Hello\n" + * "OSPF Database Description\n" + * "OSPF Link State Request\n" + * "OSPF Link State Update\n" + * "OSPF Link State Acknowledgment\n" + * "OSPF all packets\n" + * "Packet sent\n" + * "Packet received\n" + * "Detail Information\n" + * + */ DEFUN (no_debug_ospf_instance_packet, no_debug_ospf_instance_packet_all_cmd, "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all)", @@ -1057,41 +1095,7 @@ DEFUN (no_debug_ospf_instance_packet, return (no_debug_ospf_packet_common(vty, 1, argc, argv)); } -ALIAS (no_debug_ospf_instance_packet, - no_debug_ospf_instance_packet_send_recv_cmd, - "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") -ALIAS (no_debug_ospf_instance_packet, - no_debug_ospf_instance_packet_send_recv_detail_cmd, - "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n" - "Packet sent\n" - "Packet received\n" - "Detail Information\n") static int @@ -1130,6 +1134,17 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf ism (status|events|timers)", + * DEBUG_STR + * OSPF_STR + * "OSPF Interface State Machine\n" + * "ISM Status Information\n" + * "ISM Event Information\n" + * "ISM TImer Information\n" + * + */ DEFUN (debug_ospf_ism, debug_ospf_ism_cmd, "debug ospf ism", @@ -1140,16 +1155,19 @@ DEFUN (debug_ospf_ism, return debug_ospf_ism_common(vty, 0, argc, argv); } -ALIAS (debug_ospf_ism, - debug_ospf_ism_sub_cmd, - "debug ospf ism (status|events|timers)", - DEBUG_STR - OSPF_STR - "OSPF Interface State Machine\n" - "ISM Status Information\n" - "ISM Event Information\n" - "ISM TImer Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf <1-65535> ism (status|events|timers)", + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Interface State Machine\n" + * "ISM Status Information\n" + * "ISM Event Information\n" + * "ISM TImer Information\n" + * + */ DEFUN (debug_ospf_instance_ism, debug_ospf_instance_ism_cmd, "debug ospf <1-65535> ism", @@ -1167,16 +1185,6 @@ DEFUN (debug_ospf_instance_ism, return debug_ospf_ism_common(vty, 1, argc, argv); } -ALIAS (debug_ospf_instance_ism, - debug_ospf_instance_ism_sub_cmd, - "debug ospf <1-65535> ism (status|events|timers)", - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Interface State Machine\n" - "ISM Status Information\n" - "ISM Event Information\n" - "ISM TImer Information\n") static int no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, @@ -1214,6 +1222,18 @@ no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf ism (status|events|timers)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF Interface State Machine\n" + * "ISM Status Information\n" + * "ISM Event Information\n" + * "ISM Timer Information\n" + * + */ DEFUN (no_debug_ospf_ism, no_debug_ospf_ism_cmd, "no debug ospf ism", @@ -1225,17 +1245,20 @@ DEFUN (no_debug_ospf_ism, return no_debug_ospf_ism_common(vty, 0, argc, argv); } -ALIAS (no_debug_ospf_ism, - no_debug_ospf_ism_sub_cmd, - "no debug ospf ism (status|events|timers)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "OSPF Interface State Machine\n" - "ISM Status Information\n" - "ISM Event Information\n" - "ISM Timer Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf <1-65535> ism (status|events|timers)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF Interface State Machine\n" + * "ISM Status Information\n" + * "ISM Event Information\n" + * "ISM Timer Information\n" + * + */ DEFUN (no_debug_ospf_instance_ism, no_debug_ospf_instance_ism_cmd, "no debug ospf <1-65535> ism", @@ -1254,17 +1277,6 @@ DEFUN (no_debug_ospf_instance_ism, return no_debug_ospf_ism_common(vty, 1, argc, argv); } -ALIAS (no_debug_ospf_instance_ism, - no_debug_ospf_instance_ism_sub_cmd, - "no debug ospf <1-65535> ism (status|events|timers)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF Interface State Machine\n" - "ISM Status Information\n" - "ISM Event Information\n" - "ISM Timer Information\n") static int debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) @@ -1302,6 +1314,17 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf nsm (status|events|timers)", + * DEBUG_STR + * OSPF_STR + * "OSPF Neighbor State Machine\n" + * "NSM Status Information\n" + * "NSM Event Information\n" + * "NSM Timer Information\n" + * + */ DEFUN (debug_ospf_nsm, debug_ospf_nsm_cmd, "debug ospf nsm", @@ -1312,16 +1335,19 @@ DEFUN (debug_ospf_nsm, return debug_ospf_nsm_common (vty, 0, argc, argv); } -ALIAS (debug_ospf_nsm, - debug_ospf_nsm_sub_cmd, - "debug ospf nsm (status|events|timers)", - DEBUG_STR - OSPF_STR - "OSPF Neighbor State Machine\n" - "NSM Status Information\n" - "NSM Event Information\n" - "NSM Timer Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf <1-65535> nsm (status|events|timers)", + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Neighbor State Machine\n" + * "NSM Status Information\n" + * "NSM Event Information\n" + * "NSM Timer Information\n" + * + */ DEFUN (debug_ospf_instance_nsm, debug_ospf_instance_nsm_cmd, "debug ospf <1-65535> nsm", @@ -1339,16 +1365,6 @@ DEFUN (debug_ospf_instance_nsm, return debug_ospf_nsm_common (vty, 1, argc, argv); } -ALIAS (debug_ospf_instance_nsm, - debug_ospf_instance_nsm_sub_cmd, - "debug ospf <1-65535> nsm (status|events|timers)", - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Neighbor State Machine\n" - "NSM Status Information\n" - "NSM Event Information\n" - "NSM Timer Information\n") static int no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) @@ -1386,6 +1402,18 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_to return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf nsm (status|events|timers)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "OSPF Interface State Machine\n" + * "NSM Status Information\n" + * "NSM Event Information\n" + * "NSM Timer Information\n" + * + */ DEFUN (no_debug_ospf_nsm, no_debug_ospf_nsm_cmd, "no debug ospf nsm", @@ -1397,17 +1425,20 @@ DEFUN (no_debug_ospf_nsm, return no_debug_ospf_nsm_common(vty, 0, argc, argv); } -ALIAS (no_debug_ospf_nsm, - no_debug_ospf_nsm_sub_cmd, - "no debug ospf nsm (status|events|timers)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "OSPF Interface State Machine\n" - "NSM Status Information\n" - "NSM Event Information\n" - "NSM Timer Information\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf <1-65535> nsm (status|events|timers)", + * NO_STR + * "Debugging functions\n" + * "OSPF information\n" + * "Instance ID\n" + * "OSPF Interface State Machine\n" + * "NSM Status Information\n" + * "NSM Event Information\n" + * "NSM Timer Information\n" + * + */ DEFUN (no_debug_ospf_instance_nsm, no_debug_ospf_instance_nsm_cmd, "no debug ospf <1-65535> nsm", @@ -1426,17 +1457,6 @@ DEFUN (no_debug_ospf_instance_nsm, return no_debug_ospf_nsm_common(vty, 1, argc, argv); } -ALIAS (no_debug_ospf_instance_nsm, - no_debug_ospf_instance_nsm_sub_cmd, - "no debug ospf <1-65535> nsm (status|events|timers)", - NO_STR - "Debugging functions\n" - "OSPF information\n" - "Instance ID\n" - "OSPF Interface State Machine\n" - "NSM Status Information\n" - "NSM Event Information\n" - "NSM Timer Information\n") static int @@ -1479,6 +1499,18 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf lsa (generate|flooding|install|refresh)", + * DEBUG_STR + * OSPF_STR + * "OSPF Link State Advertisement\n" + * "LSA Generation\n" + * "LSA Flooding\n" + * "LSA Install/Delete\n" + * "LSA Refresh\n" + * + */ DEFUN (debug_ospf_lsa, debug_ospf_lsa_cmd, "debug ospf lsa", @@ -1489,17 +1521,20 @@ DEFUN (debug_ospf_lsa, return debug_ospf_lsa_common(vty, 0, argc, argv); } -ALIAS (debug_ospf_lsa, - debug_ospf_lsa_sub_cmd, - "debug ospf lsa (generate|flooding|install|refresh)", - DEBUG_STR - OSPF_STR - "OSPF Link State Advertisement\n" - "LSA Generation\n" - "LSA Flooding\n" - "LSA Install/Delete\n" - "LSA Refresh\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf <1-65535> lsa (generate|flooding|install|refresh)", + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Link State Advertisement\n" + * "LSA Generation\n" + * "LSA Flooding\n" + * "LSA Install/Delete\n" + * "LSA Refresh\n" + * + */ DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, "debug ospf <1-65535> lsa", @@ -1517,17 +1552,6 @@ DEFUN (debug_ospf_instance_lsa, return debug_ospf_lsa_common(vty, 1, argc, argv); } -ALIAS (debug_ospf_instance_lsa, - debug_ospf_instance_lsa_sub_cmd, - "debug ospf <1-65535> lsa (generate|flooding|install|refresh)", - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Link State Advertisement\n" - "LSA Generation\n" - "LSA Flooding\n" - "LSA Install/Delete\n" - "LSA Refresh\n") static int no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) @@ -1569,6 +1593,19 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_to return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf lsa (generate|flooding|install|refresh)", + * NO_STR + * DEBUG_STR + * OSPF_STR + * "OSPF Link State Advertisement\n" + * "LSA Generation\n" + * "LSA Flooding\n" + * "LSA Install/Delete\n" + * "LSA Refres\n" + * + */ DEFUN (no_debug_ospf_lsa, no_debug_ospf_lsa_cmd, "no debug ospf lsa", @@ -1580,18 +1617,21 @@ DEFUN (no_debug_ospf_lsa, return no_debug_ospf_lsa_common (vty, 0, argc, argv); } -ALIAS (no_debug_ospf_lsa, - no_debug_ospf_lsa_sub_cmd, - "no debug ospf lsa (generate|flooding|install|refresh)", - NO_STR - DEBUG_STR - OSPF_STR - "OSPF Link State Advertisement\n" - "LSA Generation\n" - "LSA Flooding\n" - "LSA Install/Delete\n" - "LSA Refres\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf <1-65535> lsa (generate|flooding|install|refresh)", + * NO_STR + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Link State Advertisement\n" + * "LSA Generation\n" + * "LSA Flooding\n" + * "LSA Install/Delete\n" + * "LSA Refres\n" + * + */ DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, "no debug ospf <1-65535> lsa", @@ -1610,18 +1650,6 @@ DEFUN (no_debug_ospf_instance_lsa, return no_debug_ospf_lsa_common (vty, 1, argc, argv); } -ALIAS (no_debug_ospf_instance_lsa, - no_debug_ospf_instance_lsa_sub_cmd, - "no debug ospf <1-65535> lsa (generate|flooding|install|refresh)", - NO_STR - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Link State Advertisement\n" - "LSA Generation\n" - "LSA Flooding\n" - "LSA Install/Delete\n" - "LSA Refres\n") static int @@ -1656,6 +1684,16 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_tok return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf zebra (interface|redistribute)", + * DEBUG_STR + * OSPF_STR + * "OSPF Zebra information\n" + * "Zebra interface\n" + * "Zebra redistribute\n" + * + */ DEFUN (debug_ospf_zebra, debug_ospf_zebra_cmd, "debug ospf zebra", @@ -1666,15 +1704,18 @@ DEFUN (debug_ospf_zebra, return debug_ospf_zebra_common(vty, 0, argc, argv); } -ALIAS (debug_ospf_zebra, - debug_ospf_zebra_sub_cmd, - "debug ospf zebra (interface|redistribute)", - DEBUG_STR - OSPF_STR - "OSPF Zebra information\n" - "Zebra interface\n" - "Zebra redistribute\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "debug ospf <1-65535> zebra (interface|redistribute)", + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Zebra information\n" + * "Zebra interface\n" + * "Zebra redistribute\n" + * + */ DEFUN (debug_ospf_instance_zebra, debug_ospf_instance_zebra_cmd, "debug ospf <1-65535> zebra", @@ -1692,15 +1733,6 @@ DEFUN (debug_ospf_instance_zebra, return debug_ospf_zebra_common(vty, 1, argc, argv); } -ALIAS (debug_ospf_instance_zebra, - debug_ospf_instance_zebra_sub_cmd, - "debug ospf <1-65535> zebra (interface|redistribute)", - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Zebra information\n" - "Zebra interface\n" - "Zebra redistribute\n") static int no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, @@ -1735,6 +1767,17 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf zebra (interface|redistribute)", + * NO_STR + * DEBUG_STR + * OSPF_STR + * "OSPF Zebra information\n" + * "Zebra interface\n" + * "Zebra redistribute\n" + * + */ DEFUN (no_debug_ospf_zebra, no_debug_ospf_zebra_cmd, "no debug ospf zebra", @@ -1746,16 +1789,19 @@ DEFUN (no_debug_ospf_zebra, return no_debug_ospf_zebra_common(vty, 0, argc, argv); } -ALIAS (no_debug_ospf_zebra, - no_debug_ospf_zebra_sub_cmd, - "no debug ospf zebra (interface|redistribute)", - NO_STR - DEBUG_STR - OSPF_STR - "OSPF Zebra information\n" - "Zebra interface\n" - "Zebra redistribute\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no debug ospf <1-65535> zebra (interface|redistribute)", + * NO_STR + * DEBUG_STR + * OSPF_STR + * "Instance ID\n" + * "OSPF Zebra information\n" + * "Zebra interface\n" + * "Zebra redistribute\n" + * + */ DEFUN (no_debug_ospf_instance_zebra, no_debug_ospf_instance_zebra_cmd, "no debug ospf <1-65535> zebra", @@ -1774,16 +1820,6 @@ DEFUN (no_debug_ospf_instance_zebra, return no_debug_ospf_zebra_common(vty, 1, argc, argv); } -ALIAS (no_debug_ospf_instance_zebra, - no_debug_ospf_instance_zebra_sub_cmd, - "no debug ospf <1-65535> zebra (interface|redistribute)", - NO_STR - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Zebra information\n" - "Zebra interface\n" - "Zebra redistribute\n") DEFUN (debug_ospf_event, @@ -2286,116 +2322,68 @@ debug_init () install_node (&debug_node, config_write_debug); install_element (ENABLE_NODE, &show_debugging_ospf_cmd); - install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_detail_cmd); - install_element (ENABLE_NODE, &debug_ospf_packet_send_recv_cmd); install_element (ENABLE_NODE, &debug_ospf_packet_all_cmd); - install_element (ENABLE_NODE, &debug_ospf_ism_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_ism_cmd); - install_element (ENABLE_NODE, &debug_ospf_nsm_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_nsm_cmd); - install_element (ENABLE_NODE, &debug_ospf_lsa_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_lsa_cmd); - install_element (ENABLE_NODE, &debug_ospf_zebra_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_zebra_cmd); install_element (ENABLE_NODE, &debug_ospf_event_cmd); install_element (ENABLE_NODE, &debug_ospf_nssa_cmd); install_element (ENABLE_NODE, &debug_ospf_te_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_detail_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_packet_send_recv_cmd); install_element (ENABLE_NODE, &no_debug_ospf_packet_all_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_ism_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_nsm_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_lsa_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_zebra_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_zebra_cmd); install_element (ENABLE_NODE, &no_debug_ospf_event_cmd); install_element (ENABLE_NODE, &no_debug_ospf_nssa_cmd); install_element (ENABLE_NODE, &no_debug_ospf_te_cmd); install_element (ENABLE_NODE, &show_debugging_ospf_instance_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_packet_send_recv_detail_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_packet_send_recv_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_packet_all_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_ism_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_ism_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_nsm_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_nsm_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_lsa_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_lsa_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_zebra_sub_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_zebra_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_event_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_nssa_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_send_recv_detail_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_send_recv_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_all_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_ism_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_ism_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_sub_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_event_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd); install_element (ENABLE_NODE, &no_debug_ospf_cmd); - install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_detail_cmd); - install_element (CONFIG_NODE, &debug_ospf_packet_send_recv_cmd); install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd); - install_element (CONFIG_NODE, &debug_ospf_ism_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_ism_cmd); - install_element (CONFIG_NODE, &debug_ospf_nsm_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_nsm_cmd); - install_element (CONFIG_NODE, &debug_ospf_lsa_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_lsa_cmd); - install_element (CONFIG_NODE, &debug_ospf_zebra_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf_event_cmd); install_element (CONFIG_NODE, &debug_ospf_nssa_cmd); install_element (CONFIG_NODE, &debug_ospf_te_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_detail_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_packet_send_recv_cmd); install_element (CONFIG_NODE, &no_debug_ospf_packet_all_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_ism_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_nsm_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_lsa_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_zebra_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_zebra_cmd); install_element (CONFIG_NODE, &no_debug_ospf_event_cmd); install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd); install_element (CONFIG_NODE, &no_debug_ospf_te_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_packet_send_recv_detail_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_packet_send_recv_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_packet_all_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_ism_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_ism_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_nsm_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_nsm_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_lsa_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_lsa_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_zebra_sub_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_event_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_nssa_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_send_recv_detail_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_send_recv_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_all_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_ism_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_ism_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_sub_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_event_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_nssa_cmd); diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 33980b35c6..9ffb50896f 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -763,6 +763,13 @@ out: * Followings are (vty) configuration functions for Opaque-LSAs handling. *------------------------------------------------------------------------*/ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ospf opaque-lsa", + * "OSPF specific commands\n" + * "Enable the Opaque-LSA capability (rfc2370)\n" + * + */ DEFUN (capability_opaque, capability_opaque_cmd, "capability opaque", @@ -786,12 +793,15 @@ DEFUN (capability_opaque, return CMD_SUCCESS; } -ALIAS (capability_opaque, - ospf_opaque_capable_cmd, - "ospf opaque-lsa", - "OSPF specific commands\n" - "Enable the Opaque-LSA capability (rfc2370)\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf opaque-lsa", + * NO_STR + * "OSPF specific commands\n" + * "Disable the Opaque-LSA capability (rfc2370)\n" + * + */ DEFUN (no_capability_opaque, no_capability_opaque_cmd, "no capability opaque", @@ -816,20 +826,12 @@ DEFUN (no_capability_opaque, return CMD_SUCCESS; } -ALIAS (no_capability_opaque, - no_ospf_opaque_capable_cmd, - "no ospf opaque-lsa", - NO_STR - "OSPF specific commands\n" - "Disable the Opaque-LSA capability (rfc2370)\n") static void ospf_opaque_register_vty (void) { install_element (OSPF_NODE, &capability_opaque_cmd); install_element (OSPF_NODE, &no_capability_opaque_cmd); - install_element (OSPF_NODE, &ospf_opaque_capable_cmd); - install_element (OSPF_NODE, &no_ospf_opaque_capable_cmd); return; } diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 0ea25ceb94..04601b994d 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1174,6 +1174,13 @@ ospf_router_info_config_write_router (struct vty *vty) * Followings are vty command functions. *------------------------------------------------------------------------*/ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "router-info as", + * OSPF_RI_STR + * "Enable the Router Information functionality with AS flooding scope\n" + * + */ DEFUN (router_info, router_info_area_cmd, "router-info area A.B.C.D", @@ -1236,11 +1243,6 @@ DEFUN (router_info, } -ALIAS (router_info, - router_info_as_cmd, - "router-info as", - OSPF_RI_STR - "Enable the Router Information functionality with AS flooding scope\n") DEFUN (no_router_info, no_router_info_cmd, @@ -1625,7 +1627,6 @@ ospf_router_info_register_vty (void) install_element (ENABLE_NODE, &show_ip_ospf_router_info_pce_cmd); install_element (OSPF_NODE, &router_info_area_cmd); - install_element (OSPF_NODE, &router_info_as_cmd); install_element (OSPF_NODE, &no_router_info_cmd); install_element (OSPF_NODE, &pce_address_cmd); install_element (OSPF_NODE, &pce_path_scope_cmd); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 1836660844..f38e45e426 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -703,6 +703,18 @@ DEFUN (match_ip_nexthop, return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP access-list name\n" + * + */ DEFUN (no_match_ip_nexthop, no_match_ip_nexthop_cmd, "no match ip next-hop", @@ -714,16 +726,6 @@ DEFUN (no_match_ip_nexthop, return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } -ALIAS (no_match_ip_nexthop, - no_match_ip_nexthop_val_cmd, - "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP access-list name\n") DEFUN (match_ip_next_hop_prefix_list, match_ip_next_hop_prefix_list_cmd, @@ -738,6 +740,17 @@ DEFUN (match_ip_next_hop_prefix_list, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, "no match ip next-hop prefix-list", @@ -751,15 +764,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, argv[5]->arg); } -ALIAS (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_val_cmd, - "no match ip next-hop prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") DEFUN (match_ip_address, match_ip_address_cmd, @@ -774,6 +778,18 @@ DEFUN (match_ip_address, return ospf_route_match_add (vty, vty->index, "ip address", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP access-list name\n" + * + */ DEFUN (no_match_ip_address, no_match_ip_address_cmd, "no match ip address", @@ -785,16 +801,6 @@ DEFUN (no_match_ip_address, return ospf_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); } -ALIAS (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP access-list name\n") DEFUN (match_ip_address_prefix_list, match_ip_address_prefix_list_cmd, @@ -809,6 +815,17 @@ DEFUN (match_ip_address_prefix_list, argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, "no match ip address prefix-list", @@ -822,15 +839,6 @@ DEFUN (no_match_ip_address_prefix_list, argv[5]->arg); } -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") DEFUN (match_interface, match_interface_cmd, @@ -842,6 +850,15 @@ DEFUN (match_interface, return ospf_route_match_add (vty, vty->index, "interface", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * NO_STR + * MATCH_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (no_match_interface, no_match_interface_cmd, "no match interface", @@ -852,13 +869,6 @@ DEFUN (no_match_interface, return ospf_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } -ALIAS (no_match_interface, - no_match_interface_val_cmd, - "no match interface WORD", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") DEFUN (match_tag, match_tag_cmd, @@ -870,6 +880,15 @@ DEFUN (match_tag, return ospf_route_match_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match tag <1-65535>", + * NO_STR + * MATCH_STR + * "Match tag of route\n" + * "Tag value\n" + * + */ DEFUN (no_match_tag, no_match_tag_cmd, "no match tag", @@ -880,13 +899,6 @@ DEFUN (no_match_tag, return ospf_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_match_tag, - no_match_tag_val_cmd, - "no match tag <1-65535>", - NO_STR - MATCH_STR - "Match tag of route\n" - "Tag value\n") DEFUN (set_metric, set_metric_cmd, @@ -898,6 +910,15 @@ DEFUN (set_metric, return ospf_route_set_add (vty, vty->index, "metric", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric <0-4294967295>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Metric value\n" + * + */ DEFUN (no_set_metric, no_set_metric_cmd, "no set metric", @@ -908,13 +929,6 @@ DEFUN (no_set_metric, return ospf_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") DEFUN (set_metric_type, set_metric_type_cmd, @@ -932,6 +946,16 @@ DEFUN (set_metric_type, return ospf_route_set_add (vty, vty->index, "metric-type", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric-type (type-1|type-2)", + * NO_STR + * SET_STR + * "Type of metric for destination routing protocol\n" + * "OSPF[6] external type 1 metric\n" + * "OSPF[6] external type 2 metric\n" + * + */ DEFUN (no_set_metric_type, no_set_metric_type_cmd, "no set metric-type", @@ -942,14 +966,6 @@ DEFUN (no_set_metric_type, return ospf_route_set_delete (vty, vty->index, "metric-type", argv[3]->arg); } -ALIAS (no_set_metric_type, - no_set_metric_type_val_cmd, - "no set metric-type (type-1|type-2)", - NO_STR - SET_STR - "Type of metric for destination routing protocol\n" - "OSPF[6] external type 1 metric\n" - "OSPF[6] external type 2 metric\n") DEFUN (set_tag, set_tag_cmd, @@ -961,6 +977,15 @@ DEFUN (set_tag, return ospf_route_set_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set tag <1-65535>", + * NO_STR + * SET_STR + * "Tag value for routing protocol\n" + * "Tag value\n" + * + */ DEFUN (no_set_tag, no_set_tag_cmd, "no set tag", @@ -971,13 +996,6 @@ DEFUN (no_set_tag, return ospf_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_set_tag, - no_set_tag_val_cmd, - "no set tag <1-65535>", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") /* Route-map init */ void @@ -1003,30 +1021,21 @@ ospf_route_map_init (void) install_element (RMAP_NODE, &match_ip_nexthop_cmd); install_element (RMAP_NODE, &no_match_ip_nexthop_cmd); - install_element (RMAP_NODE, &no_match_ip_nexthop_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_address_cmd); install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_val_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); install_element (RMAP_NODE, &match_interface_cmd); install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_val_cmd); install_element (RMAP_NODE, &match_tag_cmd); install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_val_cmd); install_element (RMAP_NODE, &set_metric_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_val_cmd); install_element (RMAP_NODE, &set_metric_type_cmd); install_element (RMAP_NODE, &no_set_metric_type_cmd); - install_element (RMAP_NODE, &no_set_metric_type_val_cmd); install_element (RMAP_NODE, &set_tag_cmd); install_element (RMAP_NODE, &no_set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_val_cmd); } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 4b02475267..4505fb3c47 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2297,6 +2297,14 @@ DEFUN (ospf_mpls_te_on, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no mpls-te on", + * NO_STR + * MPLS_TE_STR + * "Disable the MPLS-TE functionality\n" + * + */ DEFUN (no_ospf_mpls_te, no_ospf_mpls_te_cmd, "no mpls-te", @@ -2325,12 +2333,6 @@ DEFUN (no_ospf_mpls_te, return CMD_SUCCESS; } -ALIAS (no_ospf_mpls_te, - no_ospf_mpls_te_val_cmd, - "no mpls-te on", - NO_STR - MPLS_TE_STR - "Disable the MPLS-TE functionality\n") DEFUN (ospf_mpls_te_router_addr, ospf_mpls_te_router_addr_cmd, @@ -2655,7 +2657,6 @@ ospf_mpls_te_register_vty (void) install_element (OSPF_NODE, &ospf_mpls_te_on_cmd); install_element (OSPF_NODE, &no_ospf_mpls_te_cmd); - install_element (OSPF_NODE, &no_ospf_mpls_te_val_cmd); install_element (OSPF_NODE, &ospf_mpls_te_router_addr_cmd); install_element (OSPF_NODE, &ospf_mpls_te_inter_as_cmd); install_element (OSPF_NODE, &ospf_mpls_te_inter_as_area_cmd); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 30c63ea353..e88f9789e0 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -144,6 +144,14 @@ ospf_oi_count (struct interface *ifp) } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "router ospf <1-65535>", + * "Enable a routing process\n" + * "Start OSPF configuration\n" + * "Instance ID\n" + * + */ DEFUN (router_ospf, router_ospf_cmd, "router ospf", @@ -181,13 +189,16 @@ DEFUN (router_ospf, return CMD_SUCCESS; } -ALIAS (router_ospf, - router_ospf_instance_cmd, - "router ospf <1-65535>", - "Enable a routing process\n" - "Start OSPF configuration\n" - "Instance ID\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no router ospf <1-65535>", + * NO_STR + * "Enable a routing process\n" + * "Start OSPF configuration\n" + * "Instance ID\n" + * + */ DEFUN (no_router_ospf, no_router_ospf_cmd, "no router ospf", @@ -209,13 +220,6 @@ DEFUN (no_router_ospf, return CMD_SUCCESS; } -ALIAS (no_router_ospf, - no_router_ospf_instance_cmd, - "no router ospf <1-65535>", - NO_STR - "Enable a routing process\n" - "Start OSPF configuration\n" - "Instance ID\n") DEFUN (ospf_router_id, ospf_router_id_cmd, @@ -261,6 +265,15 @@ ALIAS_HIDDEN (ospf_router_id, "router-id for the OSPF process\n" "OSPF router-id in IP address format\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf router-id A.B.C.D", + * NO_STR + * "OSPF specific commands\n" + * "router-id for the OSPF process\n" + * "OSPF router-id in IP address format\n" + * + */ DEFUN (no_ospf_router_id, no_ospf_router_id_cmd, "no ospf router-id", @@ -290,13 +303,6 @@ DEFUN (no_ospf_router_id, return CMD_SUCCESS; } -ALIAS (no_ospf_router_id, - no_ospf_router_id_val_cmd, - "no ospf router-id A.B.C.D", - NO_STR - "OSPF specific commands\n" - "router-id for the OSPF process\n" - "OSPF router-id in IP address format\n") static void ospf_passive_interface_default (struct ospf *ospf, u_char newval) @@ -361,6 +367,17 @@ ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, } } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "passive-interface IFNAME", + * "Suppress routing updates on an interface\n" + * "Interface's name\n" + * + * "passive-interface default", + * "Suppress routing updates on an interface\n" + * "Suppress routing updates on interfaces by default\n" + * + */ DEFUN (ospf_passive_interface, ospf_passive_interface_addr_cmd, "passive-interface IFNAME A.B.C.D", @@ -430,18 +447,21 @@ DEFUN (ospf_passive_interface, return CMD_SUCCESS; } -ALIAS (ospf_passive_interface, - ospf_passive_interface_cmd, - "passive-interface IFNAME", - "Suppress routing updates on an interface\n" - "Interface's name\n") -ALIAS (ospf_passive_interface, - ospf_passive_interface_default_cmd, - "passive-interface default", - "Suppress routing updates on an interface\n" - "Suppress routing updates on interfaces by default\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no passive-interface default", + * NO_STR + * "Allow routing updates on an interface\n" + * "Allow routing updates on interfaces by default\n" + * + * "no passive-interface IFNAME", + * NO_STR + * "Allow routing updates on an interface\n" + * "Interface's name\n" + * + */ DEFUN (no_ospf_passive_interface, no_ospf_passive_interface_addr_cmd, "no passive-interface IFNAME A.B.C.D", @@ -505,19 +525,7 @@ DEFUN (no_ospf_passive_interface, return CMD_SUCCESS; } -ALIAS (no_ospf_passive_interface, - no_ospf_passive_interface_cmd, - "no passive-interface IFNAME", - NO_STR - "Allow routing updates on an interface\n" - "Interface's name\n") -ALIAS (no_ospf_passive_interface, - no_ospf_passive_interface_default_cmd, - "no passive-interface default", - NO_STR - "Allow routing updates on an interface\n" - "Allow routing updates on interfaces by default\n") DEFUN (ospf_network_area, ospf_network_area_cmd, @@ -605,6 +613,36 @@ DEFUN (no_ospf_network_area, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "OSPF area range for route advertise (default)\n" + * "Area range prefix\n" + * "Advertise this range (default)\n" + * + * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "Advertise this range (default)\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + */ DEFUN (ospf_area_range, ospf_area_range_cmd, "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", @@ -636,38 +674,8 @@ DEFUN (ospf_area_range, return CMD_SUCCESS; } -ALIAS (ospf_area_range, - ospf_area_range_advertise_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "OSPF area range for route advertise (default)\n" - "Area range prefix\n" - "Advertise this range (default)\n") -ALIAS (ospf_area_range, - ospf_area_range_cost_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") -ALIAS (ospf_area_range, - ospf_area_range_advertise_cost_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "Advertise this range (default)\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") DEFUN (ospf_area_range_not_advertise, ospf_area_range_not_advertise_cmd, @@ -695,6 +703,40 @@ DEFUN (ospf_area_range_not_advertise, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", + * NO_STR + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "Advertise this range (default)\n" + * "DoNotAdvertise this range\n" + * + * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", + * NO_STR + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "Advertise this range (default)\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", + * NO_STR + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Summarize routes matching address/mask (border routers only)\n" + * "Area range prefix\n" + * "User specified metric for this range\n" + * "Advertised metric for this range\n" + * + */ DEFUN (no_ospf_area_range, no_ospf_area_range_cmd, "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", @@ -721,42 +763,8 @@ DEFUN (no_ospf_area_range, return CMD_SUCCESS; } -ALIAS (no_ospf_area_range, - no_ospf_area_range_advertise_cmd, - "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", - NO_STR - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "Advertise this range (default)\n" - "DoNotAdvertise this range\n") -ALIAS (no_ospf_area_range, - no_ospf_area_range_cost_cmd, - "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", - NO_STR - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") -ALIAS (no_ospf_area_range, - no_ospf_area_range_advertise_cost_cmd, - "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", - NO_STR - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n" - "Advertise this range (default)\n" - "User specified metric for this range\n" - "Advertised metric for this range\n") DEFUN (ospf_area_range_substitute, ospf_area_range_substitute_cmd, @@ -1069,6 +1077,89 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) "Use MD5 algorithm\n" \ "The OSPF password (key)" +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null) " + * "(authentication-key|) AUTH_KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * VLINK_HELPSTR_AUTH_SIMPLE + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) " + * "(authentication-key|) AUTH_KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * VLINK_HELPSTR_AUTH_SIMPLE + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null)", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(message-digest-key|) <1-255> md5 KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTH_MD5 + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) " + * "(message-digest-key|) <1-255> md5 KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * VLINK_HELPSTR_AUTH_MD5 + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null) " + * "(message-digest-key|) <1-255> md5 KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * VLINK_HELPSTR_AUTH_MD5 + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|)", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * + * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication-key|) AUTH_KEY", + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTH_SIMPLE + * + */ DEFUN (ospf_area_vlink, ospf_area_vlink_cmd, "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", @@ -1206,6 +1297,101 @@ DEFUN (ospf_area_vlink, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) " + * "(message-digest-key|) <1-255> md5 KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * VLINK_HELPSTR_AUTH_MD5 + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * VLINK_HELPSTR_TIME_PARAM + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_TIME_PARAM + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(message-digest-key|) <1-255> md5 KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTH_MD5 + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|)", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null) " + * "(message-digest-key|) <1-255> md5 KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * VLINK_HELPSTR_AUTH_MD5 + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) " + * "(authentication-key|) AUTH_KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_SIMPLE + * VLINK_HELPSTR_AUTH_SIMPLE + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication-key|) AUTH_KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTH_SIMPLE + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null)", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * + * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " + * "(authentication|) (message-digest|null) " + * "(authentication-key|) AUTH_KEY", + * NO_STR + * VLINK_HELPSTR_IPADDR + * VLINK_HELPSTR_AUTHTYPE_ALL + * VLINK_HELPSTR_AUTH_SIMPLE + * + */ DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", @@ -1325,225 +1511,29 @@ DEFUN (no_ospf_area_vlink, return ospf_vl_set (ospf, &vl_config); } -ALIAS (ospf_area_vlink, - ospf_area_vlink_param1_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_param1_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM) -ALIAS (ospf_area_vlink, - ospf_area_vlink_param2_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_param2_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (ospf_area_vlink, - ospf_area_vlink_param3_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_param3_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (ospf_area_vlink, - ospf_area_vlink_param4_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_param4_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_args_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null)", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_args_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null)", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|)", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|)", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE) -ALIAS (ospf_area_vlink, - ospf_area_vlink_md5_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(message-digest-key|) <1-255> md5 KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTH_MD5) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_md5_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(message-digest-key|) <1-255> md5 KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTH_MD5) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authkey_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication-key|) AUTH_KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authkey_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication-key|) AUTH_KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_args_authkey_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null) " - "(authentication-key|) AUTH_KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_args_authkey_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null) " - "(authentication-key|) AUTH_KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_authkey_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) " - "(authentication-key|) AUTH_KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_authkey_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) " - "(authentication-key|) AUTH_KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE - VLINK_HELPSTR_AUTH_SIMPLE) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_args_md5_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null) " - "(message-digest-key|) <1-255> md5 KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL - VLINK_HELPSTR_AUTH_MD5) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_args_md5_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) (message-digest|null) " - "(message-digest-key|) <1-255> md5 KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_ALL - VLINK_HELPSTR_AUTH_MD5) -ALIAS (ospf_area_vlink, - ospf_area_vlink_authtype_md5_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) " - "(message-digest-key|) <1-255> md5 KEY", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE - VLINK_HELPSTR_AUTH_MD5) -ALIAS (no_ospf_area_vlink, - no_ospf_area_vlink_authtype_md5_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - "(authentication|) " - "(message-digest-key|) <1-255> md5 KEY", - NO_STR - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_AUTHTYPE_SIMPLE - VLINK_HELPSTR_AUTH_MD5) DEFUN (ospf_area_shortcut, @@ -1829,6 +1819,20 @@ DEFUN (ospf_area_nssa_no_summary, return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always|) {no-summary}", + * NO_STR + * "OSPF area parameters\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * "Configure OSPF area as nssa\n" + * "Configure NSSA-ABR for translate election (default)\n" + * "Configure NSSA-ABR to never translate\n" + * "Configure NSSA-ABR to always translate\n" + * "Do not inject inter-area routes into nssa\n" + * + */ DEFUN (no_ospf_area_nssa, no_ospf_area_nssa_cmd, "no area (A.B.C.D|<0-4294967295>) nssa", @@ -1855,18 +1859,6 @@ DEFUN (no_ospf_area_nssa, return CMD_SUCCESS; } -ALIAS (no_ospf_area_nssa, - no_ospf_area_nssa_no_summary_cmd, - "no area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always|) {no-summary}", - NO_STR - "OSPF area parameters\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n" - "Configure OSPF area as nssa\n" - "Configure NSSA-ABR for translate election (default)\n" - "Configure NSSA-ABR to never translate\n" - "Configure NSSA-ABR to always translate\n" - "Do not inject inter-area routes into nssa\n") DEFUN (ospf_area_default_cost, ospf_area_default_cost_cmd, @@ -2394,6 +2386,13 @@ DEFUN (no_ospf_log_adjacency_changes_detail, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ospf rfc1583compatibility", + * "OSPF specific commands\n" + * "Enable the RFC1583Compatibility flag\n" + * + */ DEFUN (ospf_compatible_rfc1583, ospf_compatible_rfc1583_cmd, "compatible rfc1583", @@ -2413,6 +2412,14 @@ DEFUN (ospf_compatible_rfc1583, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf rfc1583compatibility", + * NO_STR + * "OSPF specific commands\n" + * "Disable the RFC1583Compatibility flag\n" + * + */ DEFUN (no_ospf_compatible_rfc1583, no_ospf_compatible_rfc1583_cmd, "no compatible rfc1583", @@ -2433,18 +2440,7 @@ DEFUN (no_ospf_compatible_rfc1583, return CMD_SUCCESS; } -ALIAS (ospf_compatible_rfc1583, - ospf_rfc1583_flag_cmd, - "ospf rfc1583compatibility", - "OSPF specific commands\n" - "Enable the RFC1583Compatibility flag\n") -ALIAS (no_ospf_compatible_rfc1583, - no_ospf_rfc1583_flag_cmd, - "no ospf rfc1583compatibility", - NO_STR - "OSPF specific commands\n" - "Disable the RFC1583Compatibility flag\n") static int ospf_timers_spf_set (struct vty *vty, unsigned int delay, @@ -2491,6 +2487,17 @@ DEFUN (ospf_timers_min_ls_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers throttle lsa all <0-5000>", + * NO_STR + * "Adjust routing timers\n" + * "Throttling adaptive timer\n" + * "LSA delay between transmissions\n" + * "All LSA types\n" + * "Delay (msec) between sending LSAs\n" + * + */ DEFUN (no_ospf_timers_min_ls_interval, no_ospf_timers_min_ls_interval_cmd, "no timers throttle lsa all", @@ -2506,15 +2513,6 @@ DEFUN (no_ospf_timers_min_ls_interval, return CMD_SUCCESS; } -ALIAS (no_ospf_timers_min_ls_interval, - no_ospf_timers_min_ls_interval_val_cmd, - "no timers throttle lsa all <0-5000>", - NO_STR - "Adjust routing timers\n" - "Throttling adaptive timer\n" - "LSA delay between transmissions\n" - "All LSA types\n" - "Delay (msec) between sending LSAs\n") DEFUN (ospf_timers_min_ls_arrival, ospf_timers_min_ls_arrival_cmd, @@ -2543,6 +2541,16 @@ DEFUN (ospf_timers_min_ls_arrival, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers lsa arrival <0-1000>", + * NO_STR + * "Adjust routing timers\n" + * "Throttling link state advertisement delays\n" + * "OSPF minimum arrival interval delay\n" + * "Delay (msec) between accepted LSAs\n" + * + */ DEFUN (no_ospf_timers_min_ls_arrival, no_ospf_timers_min_ls_arrival_cmd, "no timers lsa arrival", @@ -2561,14 +2569,6 @@ DEFUN (no_ospf_timers_min_ls_arrival, return CMD_SUCCESS; } -ALIAS (no_ospf_timers_min_ls_arrival, - no_ospf_timers_min_ls_arrival_val_cmd, - "no timers lsa arrival <0-1000>", - NO_STR - "Adjust routing timers\n" - "Throttling link state advertisement delays\n" - "OSPF minimum arrival interval delay\n" - "Delay (msec) between accepted LSAs\n") DEFUN (ospf_timers_throttle_spf, ospf_timers_throttle_spf_cmd, @@ -2595,6 +2595,18 @@ DEFUN (ospf_timers_throttle_spf, return ospf_timers_spf_set (vty, delay, hold, max); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers throttle spf <0-600000> <0-600000> <0-600000>", + * NO_STR + * "Adjust routing timers\n" + * "Throttling adaptive timer\n" + * "OSPF SPF timers\n" + * "Delay (msec) from first change received till SPF calculation\n" + * "Initial hold time (msec) between consecutive SPF calculations\n" + * "Maximum hold time (msec)\n" + * + */ DEFUN (no_ospf_timers_throttle_spf, no_ospf_timers_throttle_spf_cmd, "no timers throttle spf", @@ -2609,16 +2621,6 @@ DEFUN (no_ospf_timers_throttle_spf, OSPF_SPF_MAX_HOLDTIME_DEFAULT); } -ALIAS (no_ospf_timers_throttle_spf, - no_ospf_timers_throttle_spf_val_cmd, - "no timers throttle spf <0-600000> <0-600000> <0-600000>", - NO_STR - "Adjust routing timers\n" - "Throttling adaptive timer\n" - "OSPF SPF timers\n" - "Delay (msec) from first change received till SPF calculation\n" - "Initial hold time (msec) between consecutive SPF calculations\n" - "Maximum hold time (msec)\n") DEFUN (ospf_timers_lsa, ospf_timers_lsa_cmd, @@ -2647,6 +2649,16 @@ DEFUN (ospf_timers_lsa, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers lsa min-arrival <0-600000>", + * NO_STR + * "Adjust routing timers\n" + * "OSPF LSA timers\n" + * "Minimum delay in receiving new version of a LSA\n" + * "Delay in milliseconds\n" + * + */ DEFUN (no_ospf_timers_lsa, no_ospf_timers_lsa_cmd, "no timers lsa min-arrival", @@ -2675,16 +2687,25 @@ DEFUN (no_ospf_timers_lsa, return CMD_SUCCESS; } -ALIAS (no_ospf_timers_lsa, - no_ospf_timers_lsa_val_cmd, - "no timers lsa min-arrival <0-600000>", - NO_STR - "Adjust routing timers\n" - "OSPF LSA timers\n" - "Minimum delay in receiving new version of a LSA\n" - "Delay in milliseconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Neighbor Priority\n" + * "Priority\n" + * "Dead Neighbor Polling interval\n" + * "Seconds\n" + * + * "neighbor A.B.C.D priority <0-255>", + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Neighbor Priority\n" + * "Seconds\n" + * + */ DEFUN (ospf_neighbor, ospf_neighbor_cmd, "neighbor A.B.C.D", @@ -2716,24 +2737,19 @@ DEFUN (ospf_neighbor, return CMD_SUCCESS; } -ALIAS (ospf_neighbor, - ospf_neighbor_priority_poll_interval_cmd, - "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", - NEIGHBOR_STR - "Neighbor IP address\n" - "Neighbor Priority\n" - "Priority\n" - "Dead Neighbor Polling interval\n" - "Seconds\n") -ALIAS (ospf_neighbor, - ospf_neighbor_priority_cmd, - "neighbor A.B.C.D priority <0-255>", - NEIGHBOR_STR - "Neighbor IP address\n" - "Neighbor Priority\n" - "Seconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", + * NEIGHBOR_STR + * "Neighbor address\n" + * "OSPF dead-router polling interval\n" + * "Seconds\n" + * "OSPF priority of non-broadcast neighbor\n" + * "Priority\n" + * + */ DEFUN (ospf_neighbor_poll_interval, ospf_neighbor_poll_interval_cmd, "neighbor A.B.C.D poll-interval <1-65535>", @@ -2767,16 +2783,42 @@ DEFUN (ospf_neighbor_poll_interval, return CMD_SUCCESS; } -ALIAS (ospf_neighbor_poll_interval, - ospf_neighbor_poll_interval_priority_cmd, - "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", - NEIGHBOR_STR - "Neighbor address\n" - "OSPF dead-router polling interval\n" - "Seconds\n" - "OSPF priority of non-broadcast neighbor\n" - "Priority\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", + * NO_STR + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Neighbor Priority\n" + * "Priority\n" + * "Dead Neighbor Polling interval\n" + * "Seconds\n" + * + * "no neighbor A.B.C.D priority <0-255>", + * NO_STR + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Neighbor Priority\n" + * "Priority\n" + * + * "no neighbor A.B.C.D poll-interval <1-65535>", + * NO_STR + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Dead Neighbor Polling interval\n" + * "Seconds\n" + * + * "no neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", + * NO_STR + * NEIGHBOR_STR + * "Neighbor IP address\n" + * "Dead Neighbor Polling interval\n" + * "Seconds\n" + * "OSPF priority of non-broadcast neighbor\n" + * "Priority\n" + * + */ DEFUN (no_ospf_neighbor, no_ospf_neighbor_cmd, "no neighbor A.B.C.D", @@ -2797,45 +2839,9 @@ DEFUN (no_ospf_neighbor, return CMD_SUCCESS; } -ALIAS (no_ospf_neighbor, - no_ospf_neighbor_priority_cmd, - "no neighbor A.B.C.D priority <0-255>", - NO_STR - NEIGHBOR_STR - "Neighbor IP address\n" - "Neighbor Priority\n" - "Priority\n") -ALIAS (no_ospf_neighbor, - no_ospf_neighbor_poll_interval_cmd, - "no neighbor A.B.C.D poll-interval <1-65535>", - NO_STR - NEIGHBOR_STR - "Neighbor IP address\n" - "Dead Neighbor Polling interval\n" - "Seconds\n") -ALIAS (no_ospf_neighbor, - no_ospf_neighbor_poll_interval_priority_cmd, - "no neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", - NO_STR - NEIGHBOR_STR - "Neighbor IP address\n" - "Dead Neighbor Polling interval\n" - "Seconds\n" - "OSPF priority of non-broadcast neighbor\n" - "Priority\n") -ALIAS (no_ospf_neighbor, - no_ospf_neighbor_priority_pollinterval_cmd, - "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", - NO_STR - NEIGHBOR_STR - "Neighbor IP address\n" - "Neighbor Priority\n" - "Priority\n" - "Dead Neighbor Polling interval\n" - "Seconds\n") DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, @@ -2858,6 +2864,13 @@ DEFUN (ospf_refresh_timer, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no refresh timer", + * "Adjust refresh parameters\n" + * "Unset refresh timer\n" + * + */ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, "no refresh timer <10-1800>", @@ -2885,11 +2898,6 @@ DEFUN (no_ospf_refresh_timer, return CMD_SUCCESS; } -ALIAS (no_ospf_refresh_timer, - no_ospf_refresh_timer_cmd, - "no refresh timer", - "Adjust refresh parameters\n" - "Unset refresh timer\n") DEFUN (ospf_auto_cost_reference_bandwidth, ospf_auto_cost_reference_bandwidth_cmd, @@ -2924,6 +2932,15 @@ DEFUN (ospf_auto_cost_reference_bandwidth, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no auto-cost reference-bandwidth <1-4294967>", + * NO_STR + * "Calculate OSPF interface cost according to bandwidth\n" + * "Use reference bandwidth method to assign OSPF cost\n" + * "The reference bandwidth in terms of Mbits per second\n" + * + */ DEFUN (no_ospf_auto_cost_reference_bandwidth, no_ospf_auto_cost_reference_bandwidth_cmd, "no auto-cost reference-bandwidth", @@ -2951,14 +2968,14 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth, return CMD_SUCCESS; } -ALIAS (no_ospf_auto_cost_reference_bandwidth, - no_ospf_auto_cost_reference_bandwidth_val_cmd, - "no auto-cost reference-bandwidth <1-4294967>", - NO_STR - "Calculate OSPF interface cost according to bandwidth\n" - "Use reference bandwidth method to assign OSPF cost\n" - "The reference bandwidth in terms of Mbits per second\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "write-multiplier <1-100>", + * "Write multiplier\n" + * "Maximum number of interface serviced per write\n" + * + */ DEFUN (ospf_write_multiplier, ospf_write_multiplier_cmd, "ospf write-multiplier <1-100>", @@ -2983,12 +3000,19 @@ DEFUN (ospf_write_multiplier, return CMD_SUCCESS; } -ALIAS (ospf_write_multiplier, - write_multiplier_cmd, - "write-multiplier <1-100>", - "Write multiplier\n" - "Maximum number of interface serviced per write\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no write-multiplier", + * NO_STR + * "Write multiplier\n" + * + * "no write-multiplier <1-100>", + * NO_STR + * "Write multiplier\n" + * "Maximum number of interface serviced per write\n" + * + */ DEFUN (no_ospf_write_multiplier, no_ospf_write_multiplier_cmd, "no ospf write-multiplier <1-100>", @@ -3006,18 +3030,7 @@ DEFUN (no_ospf_write_multiplier, return CMD_SUCCESS; } -ALIAS (no_ospf_write_multiplier, - no_write_multiplier_cmd, - "no write-multiplier", - NO_STR - "Write multiplier\n") -ALIAS (no_ospf_write_multiplier, - no_write_multiplier_val_cmd, - "no write-multiplier <1-100>", - NO_STR - "Write multiplier\n" - "Maximum number of interface serviced per write\n") const char *ospf_abr_type_descr_str[] = { @@ -5770,6 +5783,46 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * + * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * "Self-originated link states\n" + * "\n" + * + * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * "Advertising Router link states\n" + * "Advertising Router (as an IP address)\n" + * + * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "LSAs in MaxAge list\n" + * "Self-originated link states\n" + * + */ DEFUN (show_ip_ospf_database, show_ip_ospf_database_cmd, "show ip ospf database", @@ -5786,51 +5839,54 @@ DEFUN (show_ip_ospf_database, return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv)); } -ALIAS (show_ip_ospf_database, - show_ip_ospf_database_type_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "LSAs in MaxAge list\n" - "Self-originated link states\n") -ALIAS (show_ip_ospf_database, - show_ip_ospf_database_type_id_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n") -ALIAS (show_ip_ospf_database, - show_ip_ospf_database_type_id_adv_router_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n" - "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") -ALIAS (show_ip_ospf_database, - show_ip_ospf_database_type_id_self_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n" - "Self-originated link states\n" - "\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Instance ID\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * "Advertising Router link states\n" + * "Advertising Router (as an IP address)\n" + * + * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Instance ID\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * + * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Instance ID\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Link State ID (as an IP address)\n" + * "Self-originated link states\n" + * "\n" + * + * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Instance ID\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "LSAs in MaxAge list\n" + * "Self-originated link states\n" + * + */ DEFUN (show_ip_ospf_instance_database, show_ip_ospf_instance_database_cmd, "show ip ospf <1-65535> database", @@ -5851,54 +5907,9 @@ DEFUN (show_ip_ospf_instance_database, return (show_ip_ospf_database_common(vty, ospf, 1, argc, argv)); } -ALIAS (show_ip_ospf_instance_database, - show_ip_ospf_instance_database_type_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", - SHOW_STR - IP_STR - "OSPF information\n" - "Instance ID\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "LSAs in MaxAge list\n" - "Self-originated link states\n") -ALIAS (show_ip_ospf_instance_database, - show_ip_ospf_instance_database_type_id_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", - SHOW_STR - IP_STR - "OSPF information\n" - "Instance ID\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n") -ALIAS (show_ip_ospf_instance_database, - show_ip_ospf_instance_database_type_id_adv_router_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", - SHOW_STR - IP_STR - "OSPF information\n" - "Instance ID\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n" - "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") -ALIAS (show_ip_ospf_instance_database, - show_ip_ospf_instance_database_type_id_self_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", - SHOW_STR - IP_STR - "OSPF information\n" - "Instance ID\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n" - "Self-originated link states\n" - "\n") static int @@ -5955,6 +5966,17 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Self-originated link states\n" + * + */ DEFUN (show_ip_ospf_database_type_adv_router, show_ip_ospf_database_type_adv_router_cmd, "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", @@ -5974,16 +5996,19 @@ DEFUN (show_ip_ospf_database_type_adv_router, return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 0, argc, argv)); } -ALIAS (show_ip_ospf_database_type_adv_router, - show_ip_ospf_database_type_self_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Self-originated link states\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", + * SHOW_STR + * IP_STR + * "OSPF information\n" + * "Instance ID\n" + * "Database summary\n" + * OSPF_LSA_TYPES_DESC + * "Self-originated link states\n" + * + */ DEFUN (show_ip_ospf_instance_database_type_adv_router, show_ip_ospf_instance_database_type_adv_router_cmd, "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", @@ -6007,17 +6032,17 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv)); } -ALIAS (show_ip_ospf_instance_database_type_adv_router, - show_ip_ospf_instance_database_type_self_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", - SHOW_STR - IP_STR - "OSPF information\n" - "Instance ID\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Self-originated link states\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf authentication (null|message-digest)", + * "IP Information\n" + * "OSPF interface commands\n" + * "Enable authentication on this interface\n" + * "Use null authentication\n" + * "Use message-digest authentication\n" + * + */ DEFUN (ip_ospf_authentication_args, ip_ospf_authentication_args_addr_cmd, "ip ospf authentication (null|message-digest) A.B.C.D", @@ -6070,15 +6095,15 @@ DEFUN (ip_ospf_authentication_args, return CMD_WARNING; } -ALIAS (ip_ospf_authentication_args, - ip_ospf_authentication_args_cmd, - "ip ospf authentication (null|message-digest)", - "IP Information\n" - "OSPF interface commands\n" - "Enable authentication on this interface\n" - "Use null authentication\n" - "Use message-digest authentication\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf authentication", + * "IP Information\n" + * "OSPF interface commands\n" + * "Enable authentication on this interface\n" + * + */ DEFUN (ip_ospf_authentication, ip_ospf_authentication_addr_cmd, "ip ospf authentication A.B.C.D", @@ -6115,13 +6140,18 @@ DEFUN (ip_ospf_authentication, return CMD_SUCCESS; } -ALIAS (ip_ospf_authentication, - ip_ospf_authentication_cmd, - "ip ospf authentication", - "IP Information\n" - "OSPF interface commands\n" - "Enable authentication on this interface\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf authentication (null|message-digest)", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Enable authentication on this interface\n" + * "Use null authentication\n" + * "Use message-digest authentication\n" + * + */ DEFUN (no_ip_ospf_authentication_args, no_ip_ospf_authentication_args_addr_cmd, "no ip ospf authentication (null|message-digest) A.B.C.D", @@ -6215,16 +6245,16 @@ DEFUN (no_ip_ospf_authentication_args, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_authentication_args, - no_ip_ospf_authentication_args_cmd, - "no ip ospf authentication (null|message-digest)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Enable authentication on this interface\n" - "Use null authentication\n" - "Use message-digest authentication\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf authentication", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Enable authentication on this interface\n" + * + */ DEFUN (no_ip_ospf_authentication, no_ip_ospf_authentication_addr_cmd, "no ip ospf authentication A.B.C.D", @@ -6307,14 +6337,16 @@ DEFUN (no_ip_ospf_authentication, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_authentication, - no_ip_ospf_authentication_cmd, - "no ip ospf authentication", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Enable authentication on this interface\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf authentication-key AUTH_KEY", + * "IP Information\n" + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * "The OSPF password (key)" + * + */ DEFUN (ip_ospf_authentication_key, ip_ospf_authentication_key_addr_cmd, "ip ospf authentication-key AUTH_KEY A.B.C.D", @@ -6353,13 +6385,6 @@ DEFUN (ip_ospf_authentication_key, return CMD_SUCCESS; } -ALIAS (ip_ospf_authentication_key, - ip_ospf_authentication_key_cmd, - "ip ospf authentication-key AUTH_KEY", - "IP Information\n" - "OSPF interface commands\n" - "Authentication password (key)\n" - "The OSPF password (key)") ALIAS_HIDDEN (ip_ospf_authentication_key, ospf_authentication_key_cmd, @@ -6368,6 +6393,39 @@ ALIAS_HIDDEN (ip_ospf_authentication_key, "Authentication password (key)\n" "The OSPF password (key)") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf authentication-key AUTH_KEY A.B.C.D", + * NO_STR + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * "The OSPF password (key)\n" + * "Address of interface" + * + * "no ospf authentication-key AUTH_KEY", + * NO_STR + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * "The OSPF password (key)\n" + * + * "no ip ospf authentication-key", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * + * "no ip ospf authentication-key AUTH_KEY", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * + * "no ospf authentication-key", + * NO_STR + * "OSPF interface commands\n" + * "Authentication password (key)\n" + * + */ DEFUN (no_ip_ospf_authentication_key, no_ip_ospf_authentication_key_authkey_addr_cmd, "no ip ospf authentication-key AUTH_KEY A.B.C.D", @@ -6412,46 +6470,22 @@ DEFUN (no_ip_ospf_authentication_key, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_authentication_key, - no_ip_ospf_authentication_key_authkey_cmd, - "no ip ospf authentication-key AUTH_KEY", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Authentication password (key)\n") -ALIAS (no_ip_ospf_authentication_key, - no_ip_ospf_authentication_key_cmd, - "no ip ospf authentication-key", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Authentication password (key)\n") -ALIAS (no_ip_ospf_authentication_key, - no_ospf_authentication_key_cmd, - "no ospf authentication-key", - NO_STR - "OSPF interface commands\n" - "Authentication password (key)\n") -ALIAS (no_ip_ospf_authentication_key, - no_ospf_authentication_key_authkey_cmd, - "no ospf authentication-key AUTH_KEY", - NO_STR - "OSPF interface commands\n" - "Authentication password (key)\n" - "The OSPF password (key)\n") -ALIAS (no_ip_ospf_authentication_key, - no_ospf_authentication_key_authkey_ip_cmd, - "no ospf authentication-key AUTH_KEY A.B.C.D", - NO_STR - "OSPF interface commands\n" - "Authentication password (key)\n" - "The OSPF password (key)\n" - "Address of interface") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf message-digest-key <1-255> md5 KEY", + * "IP Information\n" + * "OSPF interface commands\n" + * "Message digest authentication password (key)\n" + * "Key ID\n" + * "Use MD5 algorithm\n" + * "The OSPF password (key)" + * + */ DEFUN (ip_ospf_message_digest_key, ip_ospf_message_digest_key_addr_cmd, "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", @@ -6505,15 +6539,6 @@ DEFUN (ip_ospf_message_digest_key, return CMD_SUCCESS; } -ALIAS (ip_ospf_message_digest_key, - ip_ospf_message_digest_key_cmd, - "ip ospf message-digest-key <1-255> md5 KEY", - "IP Information\n" - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n" - "Use MD5 algorithm\n" - "The OSPF password (key)") ALIAS_HIDDEN (ip_ospf_message_digest_key, ospf_message_digest_key_cmd, @@ -6524,6 +6549,18 @@ ALIAS_HIDDEN (ip_ospf_message_digest_key, "Use MD5 algorithm\n" "The OSPF password (key)") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf message-digest-key <1-255> md5 KEY", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Message digest authentication password (key)\n" + * "Key ID\n" + * "Use MD5 algorithm\n" + * "The OSPF password (key)" + * + */ DEFUN (no_ip_ospf_message_digest_key_md5, no_ip_ospf_message_digest_key_md5_addr_cmd, "no ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", @@ -6580,17 +6617,23 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_message_digest_key_md5, - no_ip_ospf_message_digest_key_md5_cmd, - "no ip ospf message-digest-key <1-255> md5 KEY", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n" - "Use MD5 algorithm\n" - "The OSPF password (key)") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf message-digest-key <1-255>", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Message digest authentication password (key)\n" + * "Key ID\n" + * + * "no ospf message-digest-key <1-255>", + * NO_STR + * "OSPF interface commands\n" + * "Message digest authentication password (key)\n" + * "Key ID\n" + * + */ DEFUN (no_ip_ospf_message_digest_key, no_ip_ospf_message_digest_key_addr_cmd, "no ip ospf message-digest-key <1-255> A.B.C.D", @@ -6645,23 +6688,17 @@ DEFUN (no_ip_ospf_message_digest_key, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_message_digest_key, - no_ip_ospf_message_digest_key_cmd, - "no ip ospf message-digest-key <1-255>", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n") -ALIAS (no_ip_ospf_message_digest_key, - no_ospf_message_digest_key_cmd, - "no ospf message-digest-key <1-255>", - NO_STR - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf cost <1-65535>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Interface cost\n" + * "Cost" + * + */ DEFUN (ip_ospf_cost, ip_ospf_cost_u32_inet4_cmd, "ip ospf cost <1-65535> A.B.C.D", @@ -6710,13 +6747,6 @@ DEFUN (ip_ospf_cost, return CMD_SUCCESS; } -ALIAS (ip_ospf_cost, - ip_ospf_cost_u32_cmd, - "ip ospf cost <1-65535>", - "IP Information\n" - "OSPF interface commands\n" - "Interface cost\n" - "Cost") ALIAS_HIDDEN (ip_ospf_cost, ospf_cost_u32_cmd, @@ -6733,6 +6763,26 @@ ALIAS_HIDDEN (ip_ospf_cost, "Cost\n" "Address of interface") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf cost A.B.C.D", + * NO_STR + * "OSPF interface commands\n" + * "Interface cost\n" + * "Address of interface" + * + * "no ospf cost", + * NO_STR + * "OSPF interface commands\n" + * "Interface cost\n" + * + * "no ip ospf cost", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interface cost\n" + * + */ DEFUN (no_ip_ospf_cost, no_ip_ospf_cost_inet4_cmd, "no ip ospf cost A.B.C.D", @@ -6778,29 +6828,33 @@ DEFUN (no_ip_ospf_cost, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_cost, - no_ip_ospf_cost_cmd, - "no ip ospf cost", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interface cost\n") -ALIAS (no_ip_ospf_cost, - no_ospf_cost_cmd, - "no ospf cost", - NO_STR - "OSPF interface commands\n" - "Interface cost\n") -ALIAS (no_ip_ospf_cost, - no_ospf_cost_inet4_cmd, - "no ospf cost A.B.C.D", - NO_STR - "OSPF interface commands\n" - "Interface cost\n" - "Address of interface") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf cost <1-65535>", + * NO_STR + * "OSPF interface commands\n" + * "Interface cost\n" + * "Cost" + * + * "no ospf cost <1-65535> A.B.C.D", + * NO_STR + * "OSPF interface commands\n" + * "Interface cost\n" + * "Cost\n" + * "Address of interface" + * + * "no ip ospf cost <1-65535> A.B.C.D", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interface cost\n" + * "Cost\n" + * "Address of interface" + * + */ DEFUN (no_ip_ospf_cost2, no_ip_ospf_cost_u32_cmd, "no ip ospf cost <1-65535>", @@ -6859,32 +6913,8 @@ DEFUN (no_ip_ospf_cost2, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_cost2, - no_ospf_cost_u32_cmd, - "no ospf cost <1-65535>", - NO_STR - "OSPF interface commands\n" - "Interface cost\n" - "Cost") -ALIAS (no_ip_ospf_cost2, - no_ip_ospf_cost_u32_inet4_cmd, - "no ip ospf cost <1-65535> A.B.C.D", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interface cost\n" - "Cost\n" - "Address of interface") -ALIAS (no_ip_ospf_cost2, - no_ospf_cost_u32_inet4_cmd, - "no ospf cost <1-65535> A.B.C.D", - NO_STR - "OSPF interface commands\n" - "Interface cost\n" - "Cost\n" - "Address of interface") static void ospf_nbr_timer_update (struct ospf_interface *oi) @@ -6982,6 +7012,15 @@ ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf dead-interval <1-65535>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * "Seconds\n" + * + */ DEFUN (ip_ospf_dead_interval, ip_ospf_dead_interval_addr_cmd, "ip ospf dead-interval <1-65535> A.B.C.D", @@ -6997,13 +7036,6 @@ DEFUN (ip_ospf_dead_interval, return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL); } -ALIAS (ip_ospf_dead_interval, - ip_ospf_dead_interval_cmd, - "ip ospf dead-interval <1-65535>", - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" - "Seconds\n") ALIAS_HIDDEN (ip_ospf_dead_interval, ospf_dead_interval_cmd, @@ -7012,6 +7044,17 @@ ALIAS_HIDDEN (ip_ospf_dead_interval, "Interval after which a neighbor is declared dead\n" "Seconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf dead-interval minimal hello-multiplier <1-10>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * "Minimal 1s dead-interval with fast sub-second hellos\n" + * "Hello multiplier factor\n" + * "Number of Hellos to send each second\n" + * + */ DEFUN (ip_ospf_dead_interval_minimal, ip_ospf_dead_interval_minimal_addr_cmd, "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", @@ -7029,16 +7072,47 @@ DEFUN (ip_ospf_dead_interval_minimal, return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg); } -ALIAS (ip_ospf_dead_interval_minimal, - ip_ospf_dead_interval_minimal_cmd, - "ip ospf dead-interval minimal hello-multiplier <1-10>", - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" - "Minimal 1s dead-interval with fast sub-second hellos\n" - "Hello multiplier factor\n" - "Number of Hellos to send each second\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf dead-interval", + * NO_STR + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * + * "no ip ospf dead-interval minimal hello-multiplier <1-10>", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * "Minimal 1s dead-interval with fast sub-second hellos\n" + * "Hello multiplier factor\n" + * "Number of Hellos to send each second\n" + * + * "no ip ospf dead-interval <1-65535>", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * "Seconds\n" + * + * "no ip ospf dead-interval", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * + * "no ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Interval after which a neighbor is declared dead\n" + * "Minimal 1s dead-interval with fast sub-second hellos\n" + * "Hello multiplier factor\n" + * "Number of Hellos to send each second\n" + * "Address of interface\n" + * + */ DEFUN (no_ip_ospf_dead_interval, no_ip_ospf_dead_interval_addr_cmd, "no ip ospf dead-interval <1-65535> A.B.C.D", @@ -7108,53 +7182,20 @@ DEFUN (no_ip_ospf_dead_interval, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_dead_interval, - no_ip_ospf_dead_interval_seconds_cmd, - "no ip ospf dead-interval <1-65535>", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" - "Seconds\n") -ALIAS (no_ip_ospf_dead_interval, - no_ip_ospf_dead_interval_cmd, - "no ip ospf dead-interval", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n") -ALIAS (no_ip_ospf_dead_interval, - no_ospf_dead_interval_cmd, - "no ospf dead-interval", - NO_STR - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n") -ALIAS (no_ip_ospf_dead_interval, - no_ip_ospf_dead_interval_minimal_addr_cmd, - "no ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" - "Minimal 1s dead-interval with fast sub-second hellos\n" - "Hello multiplier factor\n" - "Number of Hellos to send each second\n" - "Address of interface\n") -ALIAS (no_ip_ospf_dead_interval, - no_ip_ospf_dead_interval_minimal_cmd, - "no ip ospf dead-interval minimal hello-multiplier <1-10>", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" - "Minimal 1s dead-interval with fast sub-second hellos\n" - "Hello multiplier factor\n" - "Number of Hellos to send each second\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf hello-interval <1-65535>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between HELLO packets\n" + * "Seconds\n" + * + */ DEFUN (ip_ospf_hello_interval, ip_ospf_hello_interval_addr_cmd, "ip ospf hello-interval <1-65535> A.B.C.D", @@ -7201,13 +7242,6 @@ DEFUN (ip_ospf_hello_interval, return CMD_SUCCESS; } -ALIAS (ip_ospf_hello_interval, - ip_ospf_hello_interval_cmd, - "ip ospf hello-interval <1-65535>", - "IP Information\n" - "OSPF interface commands\n" - "Time between HELLO packets\n" - "Seconds\n") ALIAS_HIDDEN (ip_ospf_hello_interval, ospf_hello_interval_cmd, @@ -7216,6 +7250,28 @@ ALIAS_HIDDEN (ip_ospf_hello_interval, "Time between HELLO packets\n" "Seconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf hello-interval <1-65535>", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between HELLO packets\n" + * "Seconds\n" + * + * "no ip ospf hello-interval", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between HELLO packets\n" + * + * "no ospf hello-interval <1-65535>", + * NO_STR + * "OSPF interface commands\n" + * "Time between HELLO packets\n" + * "Seconds\n" + * + */ DEFUN (no_ip_ospf_hello_interval, no_ip_ospf_hello_interval_addr_cmd, "no ip ospf hello-interval <1-65535> A.B.C.D", @@ -7261,30 +7317,8 @@ DEFUN (no_ip_ospf_hello_interval, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_hello_interval, - no_ip_ospf_hello_interval_seconds_cmd, - "no ip ospf hello-interval <1-65535>", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Time between HELLO packets\n" - "Seconds\n") -ALIAS (no_ip_ospf_hello_interval, - no_ip_ospf_hello_interval_cmd, - "no ip ospf hello-interval", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Time between HELLO packets\n") -ALIAS (no_ip_ospf_hello_interval, - no_ospf_hello_interval_cmd, - "no ospf hello-interval <1-65535>", - NO_STR - "OSPF interface commands\n" - "Time between HELLO packets\n" - "Seconds\n") DEFUN (ip_ospf_network, ip_ospf_network_cmd, @@ -7350,6 +7384,33 @@ ALIAS_HIDDEN (ip_ospf_network, "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", + * NO_STR + * "OSPF interface commands\n" + * "Network type\n" + * "Specify OSPF broadcast multi-access network\n" + * "Specify OSPF NBMA network\n" + * "Specify OSPF point-to-multipoint network\n" + * "Specify OSPF point-to-point network\n" + * + * "no ospf network", + * NO_STR + * "OSPF interface commands\n" + * "Network type\n" + * + * "no ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Network type\n" + * "Specify OSPF broadcast multi-access network\n" + * "Specify OSPF NBMA network\n" + * "Specify OSPF point-to-multipoint network\n" + * "Specify OSPF point-to-point network\n" + * + */ DEFUN (no_ip_ospf_network, no_ip_ospf_network_cmd, "no ip ospf network", @@ -7386,36 +7447,18 @@ DEFUN (no_ip_ospf_network, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_network, - no_ip_ospf_network_val_cmd, - "no ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Network type\n" - "Specify OSPF broadcast multi-access network\n" - "Specify OSPF NBMA network\n" - "Specify OSPF point-to-multipoint network\n" - "Specify OSPF point-to-point network\n") -ALIAS (no_ip_ospf_network, - no_ospf_network_cmd, - "no ospf network", - NO_STR - "OSPF interface commands\n" - "Network type\n") -ALIAS (no_ip_ospf_network, - no_ospf_network_val_cmd, - "no ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", - NO_STR - "OSPF interface commands\n" - "Network type\n" - "Specify OSPF broadcast multi-access network\n" - "Specify OSPF NBMA network\n" - "Specify OSPF point-to-multipoint network\n" - "Specify OSPF point-to-point network\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf priority <0-255>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Router priority\n" + * "Priority\n" + * + */ DEFUN (ip_ospf_priority, ip_ospf_priority_addr_cmd, "ip ospf priority <0-255> A.B.C.D", @@ -7478,13 +7521,6 @@ DEFUN (ip_ospf_priority, return CMD_SUCCESS; } -ALIAS (ip_ospf_priority, - ip_ospf_priority_cmd, - "ip ospf priority <0-255>", - "IP Information\n" - "OSPF interface commands\n" - "Router priority\n" - "Priority\n") ALIAS_HIDDEN (ip_ospf_priority, ospf_priority_cmd, @@ -7493,6 +7529,28 @@ ALIAS_HIDDEN (ip_ospf_priority, "Router priority\n" "Priority\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf priority", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Router priority\n" + * + * "no ip ospf priority <0-255>", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Router priority\n" + * "Priority\n" + * + * "no ospf priority <0-255>", + * NO_STR + * "OSPF interface commands\n" + * "Router priority\n" + * "Priority\n" + * + */ DEFUN (no_ip_ospf_priority, no_ip_ospf_priority_addr_cmd, "no ip ospf priority <0-255> A.B.C.D", @@ -7554,32 +7612,19 @@ DEFUN (no_ip_ospf_priority, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_priority, - no_ip_ospf_priority_no_param_cmd, - "no ip ospf priority", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Router priority\n"); - -ALIAS (no_ip_ospf_priority, - no_ip_ospf_priority_cmd, - "no ip ospf priority <0-255>", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Router priority\n" - "Priority\n") - -ALIAS (no_ip_ospf_priority, - no_ospf_priority_cmd, - "no ospf priority <0-255>", - NO_STR - "OSPF interface commands\n" - "Router priority\n" - "Priority\n") + + +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf retransmit-interval <3-65535>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between retransmitting lost link state advertisements\n" + * "Seconds\n" + * + */ DEFUN (ip_ospf_retransmit_interval, ip_ospf_retransmit_interval_addr_cmd, "ip ospf retransmit-interval <3-65535> A.B.C.D", @@ -7626,13 +7671,6 @@ DEFUN (ip_ospf_retransmit_interval, return CMD_SUCCESS; } -ALIAS (ip_ospf_retransmit_interval, - ip_ospf_retransmit_interval_cmd, - "ip ospf retransmit-interval <3-65535>", - "IP Information\n" - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n" - "Seconds\n") ALIAS_HIDDEN (ip_ospf_retransmit_interval, ospf_retransmit_interval_cmd, @@ -7641,6 +7679,28 @@ ALIAS_HIDDEN (ip_ospf_retransmit_interval, "Time between retransmitting lost link state advertisements\n" "Seconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf retransmit-interval <3-65535> A.B.C.D", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between retransmitting lost link state advertisements\n" + * "Seconds\n" + * "Address of interface" + * + * "no ip ospf retransmit-interval", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Time between retransmitting lost link state advertisements\n" + * + * "no ospf retransmit-interval", + * NO_STR + * "OSPF interface commands\n" + * "Time between retransmitting lost link state advertisements\n" + * + */ DEFUN (no_ip_ospf_retransmit_interval, no_ip_ospf_retransmit_interval_addr_cmd, "no ip ospf retransmit-interval A.B.C.D", @@ -7691,30 +7751,8 @@ DEFUN (no_ip_ospf_retransmit_interval, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_retransmit_interval, - no_ip_ospf_retransmit_interval_sec_addr_cmd, - "no ip ospf retransmit-interval <3-65535> A.B.C.D", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n" - "Seconds\n" - "Address of interface") -ALIAS (no_ip_ospf_retransmit_interval, - no_ip_ospf_retransmit_interval_cmd, - "no ip ospf retransmit-interval", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n") -ALIAS (no_ip_ospf_retransmit_interval, - no_ospf_retransmit_interval_cmd, - "no ospf retransmit-interval", - NO_STR - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n") DEFUN (no_ip_ospf_retransmit_interval_sec, no_ip_ospf_retransmit_interval_sec_cmd, @@ -7738,6 +7776,15 @@ DEFUN (no_ip_ospf_retransmit_interval_sec, } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf transmit-delay <1-65535>", + * "IP Information\n" + * "OSPF interface commands\n" + * "Link state transmit delay\n" + * "Seconds\n" + * + */ DEFUN (ip_ospf_transmit_delay, ip_ospf_transmit_delay_addr_cmd, "ip ospf transmit-delay <1-65535> A.B.C.D", @@ -7783,13 +7830,6 @@ DEFUN (ip_ospf_transmit_delay, return CMD_SUCCESS; } -ALIAS (ip_ospf_transmit_delay, - ip_ospf_transmit_delay_cmd, - "ip ospf transmit-delay <1-65535>", - "IP Information\n" - "OSPF interface commands\n" - "Link state transmit delay\n" - "Seconds\n") ALIAS_HIDDEN (ip_ospf_transmit_delay, ospf_transmit_delay_cmd, @@ -7798,6 +7838,28 @@ ALIAS_HIDDEN (ip_ospf_transmit_delay, "Link state transmit delay\n" "Seconds\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ospf transmit-delay", + * NO_STR + * "OSPF interface commands\n" + * "Link state transmit delay\n" + * + * "no ip ospf transmit-delay", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Link state transmit delay\n" + * + * "no ip ospf transmit-delay <1-65535> A.B.C.D", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Link state transmit delay\n" + * "Seconds\n" + * "Address of interface" + * + */ DEFUN (no_ip_ospf_transmit_delay, no_ip_ospf_transmit_delay_addr_cmd, "no ip ospf transmit-delay A.B.C.D", @@ -7848,30 +7910,8 @@ DEFUN (no_ip_ospf_transmit_delay, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_transmit_delay, - no_ip_ospf_transmit_delay_sec_addr_cmd, - "no ip ospf transmit-delay <1-65535> A.B.C.D", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Link state transmit delay\n" - "Seconds\n" - "Address of interface") -ALIAS (no_ip_ospf_transmit_delay, - no_ip_ospf_transmit_delay_cmd, - "no ip ospf transmit-delay", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Link state transmit delay\n") -ALIAS (no_ip_ospf_transmit_delay, - no_ospf_transmit_delay_cmd, - "no ospf transmit-delay", - NO_STR - "OSPF interface commands\n" - "Link state transmit delay\n") DEFUN (no_ip_ospf_transmit_delay_sec, no_ip_ospf_transmit_delay_sec_cmd, @@ -7895,6 +7935,17 @@ DEFUN (no_ip_ospf_transmit_delay_sec, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", + * "IP Information\n" + * "OSPF interface commands\n" + * "Instance ID\n" + * "Enable OSPF on this interface\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * + */ DEFUN (ip_ospf_area, ip_ospf_area_cmd, "ip ospf area (A.B.C.D|<0-4294967295>)", @@ -7966,16 +8017,18 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } -ALIAS (ip_ospf_area, - ip_ospf_instance_area_cmd, - "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", - "IP Information\n" - "OSPF interface commands\n" - "Instance ID\n" - "Enable OSPF on this interface\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf area (A.B.C.D|<0-4294967295>)", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Disable OSPF on this interface\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * + */ DEFUN (no_ip_ospf_area, no_ip_ospf_area_cmd, "no ip ospf area", @@ -8004,16 +8057,19 @@ DEFUN (no_ip_ospf_area, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_area, - no_ip_ospf_area_val_cmd, - "no ip ospf area (A.B.C.D|<0-4294967295>)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Disable OSPF on this interface\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", + * NO_STR + * "IP Information\n" + * "OSPF interface commands\n" + * "Instance ID\n" + * "Disable OSPF on this interface\n" + * "OSPF area ID in IP address format\n" + * "OSPF area ID as a decimal value\n" + * + */ DEFUN (no_ip_ospf_instance_area, no_ip_ospf_instance_area_cmd, "no ip ospf <1-65535> area", @@ -8045,16 +8101,6 @@ DEFUN (no_ip_ospf_instance_area, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_instance_area, - no_ip_ospf_instance_area_val_cmd, - "no ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Instance ID\n" - "Disable OSPF on this interface\n" - "OSPF area ID in IP address format\n" - "OSPF area ID as a decimal value\n") DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, @@ -8421,6 +8467,14 @@ DEFUN (ospf_default_metric, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no default-metric <0-16777214>", + * NO_STR + * "Set metric of redistributed routes\n" + * "Default metric\n" + * + */ DEFUN (no_ospf_default_metric, no_ospf_default_metric_cmd, "no default-metric", @@ -8437,12 +8491,6 @@ DEFUN (no_ospf_default_metric, return CMD_SUCCESS; } -ALIAS (no_ospf_default_metric, - no_ospf_default_metric_val_cmd, - "no default-metric <0-16777214>", - NO_STR - "Set metric of redistributed routes\n" - "Default metric\n") DEFUN (ospf_distance, ospf_distance_cmd, @@ -8632,6 +8680,14 @@ DEFUN (no_ospf_distance_source_access_list, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip ospf mtu-ignore", + * "IP Information\n" + * "OSPF interface commands\n" + * "Disable mtu mismatch detection\n" + * + */ DEFUN (ip_ospf_mtu_ignore, ip_ospf_mtu_ignore_addr_cmd, "ip ospf mtu-ignore A.B.C.D", @@ -8674,14 +8730,16 @@ DEFUN (ip_ospf_mtu_ignore, return CMD_SUCCESS; } -ALIAS (ip_ospf_mtu_ignore, - ip_ospf_mtu_ignore_cmd, - "ip ospf mtu-ignore", - "IP Information\n" - "OSPF interface commands\n" - "Disable mtu mismatch detection\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip ospf mtu-ignore", + * "IP Information\n" + * "OSPF interface commands\n" + * "Disable mtu mismatch detection\n" + * + */ DEFUN (no_ip_ospf_mtu_ignore, no_ip_ospf_mtu_ignore_addr_cmd, "no ip ospf mtu-ignore A.B.C.D", @@ -8724,12 +8782,6 @@ DEFUN (no_ip_ospf_mtu_ignore, return CMD_SUCCESS; } -ALIAS (no_ip_ospf_mtu_ignore, - no_ip_ospf_mtu_ignore_cmd, - "no ip ospf mtu-ignore", - "IP Information\n" - "OSPF interface commands\n" - "Disable mtu mismatch detection\n") DEFUN (ospf_max_metric_router_lsa_admin, ospf_max_metric_router_lsa_admin_cmd, @@ -8817,6 +8869,15 @@ DEFUN (ospf_max_metric_router_lsa_startup, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no max-metric router-lsa on-startup", + * NO_STR + * "OSPF maximum / infinite-distance metric\n" + * "Advertise own Router-LSA with infinite distance (stub router)\n" + * "Automatically advertise stub Router-LSA on startup of OSPF\n" + * + */ DEFUN (no_ospf_max_metric_router_lsa_startup, no_ospf_max_metric_router_lsa_startup_cmd, "no max-metric router-lsa on-startup <5-86400>", @@ -8850,13 +8911,6 @@ DEFUN (no_ospf_max_metric_router_lsa_startup, return CMD_SUCCESS; } -ALIAS (no_ospf_max_metric_router_lsa_startup, - no_ospf_max_metric_router_lsa_startup_no_param_cmd, - "no max-metric router-lsa on-startup", - NO_STR - "OSPF maximum / infinite-distance metric\n" - "Advertise own Router-LSA with infinite distance (stub router)\n" - "Automatically advertise stub Router-LSA on startup of OSPF\n"); DEFUN (ospf_max_metric_router_lsa_shutdown, ospf_max_metric_router_lsa_shutdown_cmd, @@ -8885,6 +8939,18 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no max-metric router-lsa on-shutdown", + * NO_STR + * "OSPF maximum / infinite-distance metric\n" + * "Advertise own Router-LSA with infinite distance (stub router)\n" + * "Advertise stub-router prior to full shutdown of OSPF\n"); + * + * static void + * config_write_stub_router (struct vty *vty, struct ospf *ospf + * + */ DEFUN (no_ospf_max_metric_router_lsa_shutdown, no_ospf_max_metric_router_lsa_shutdown_cmd, "no max-metric router-lsa on-shutdown <5-100>", @@ -8904,16 +8970,6 @@ DEFUN (no_ospf_max_metric_router_lsa_shutdown, return CMD_SUCCESS; } -ALIAS (no_ospf_max_metric_router_lsa_shutdown, - no_ospf_max_metric_router_lsa_shutdown_no_param_cmd, - "no max-metric router-lsa on-shutdown", - NO_STR - "OSPF maximum / infinite-distance metric\n" - "Advertise own Router-LSA with infinite distance (stub router)\n" - "Advertise stub-router prior to full shutdown of OSPF\n"); - -static void -config_write_stub_router (struct vty *vty, struct ospf *ospf) { struct listnode *ln; struct ospf_area *area; @@ -9977,34 +10033,14 @@ ospf_vty_show_init (void) install_element (ENABLE_NODE, &show_ip_ospf_instance_cmd); /* "show ip ospf database" commands. */ - install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); - install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); - install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); - install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); - install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); install_element (VIEW_NODE, &show_ip_ospf_database_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); - install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_cmd); - install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_id_cmd); - install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_id_adv_router_cmd); install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd); - install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_id_self_cmd); - install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_self_cmd); install_element (VIEW_NODE, &show_ip_ospf_instance_database_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_id_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_id_adv_router_cmd); install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_id_self_cmd); - install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_self_cmd); install_element (ENABLE_NODE, &show_ip_ospf_instance_database_cmd); /* "show ip ospf interface" commands. */ @@ -10083,121 +10119,69 @@ ospf_vty_if_init (void) /* "ip ospf authentication" commands. */ install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_authentication_args_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_authentication_args_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_authkey_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_authkey_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); /* "ip ospf message-digest-key" commands. */ install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_cmd); /* "ip ospf cost" commands. */ install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); - install_element (INTERFACE_NODE, &ip_ospf_cost_u32_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_inet4_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); /* "ip ospf mtu-ignore" commands. */ install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); /* "ip ospf dead-interval" commands. */ install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_seconds_cmd); /* "ip ospf hello-interval" commands. */ install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_seconds_cmd); /* "ip ospf network" commands. */ install_element (INTERFACE_NODE, &ip_ospf_network_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_network_val_cmd); /* "ip ospf priority" commands. */ install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_priority_no_param_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); /* "ip ospf retransmit-interval" commands. */ install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_sec_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_sec_cmd); /* "ip ospf transmit-delay" commands. */ install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); - install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_cmd); /* "ip ospf area" commands. */ install_element (INTERFACE_NODE, &ip_ospf_area_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_area_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_area_val_cmd); - install_element (INTERFACE_NODE, &ip_ospf_instance_area_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_instance_area_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_instance_area_val_cmd); /* These commands are compatibitliy for previous version. */ install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); - install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); - install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_cmd); - install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_ip_cmd); install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); - install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); install_element (INTERFACE_NODE, &ospf_cost_u32_cmd); install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_u32_inet4_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); - install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_minimal_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_minimal_cmd); install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); - install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); install_element (INTERFACE_NODE, &ospf_network_cmd); - install_element (INTERFACE_NODE, &no_ospf_network_cmd); - install_element (INTERFACE_NODE, &no_ospf_network_val_cmd); install_element (INTERFACE_NODE, &ospf_priority_cmd); - install_element (INTERFACE_NODE, &no_ospf_priority_cmd); install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); - install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); - install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); } static void @@ -10216,7 +10200,6 @@ ospf_vty_zebra_init (void) install_element (OSPF_NODE, &ospf_default_metric_cmd); install_element (OSPF_NODE, &no_ospf_default_metric_cmd); - install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); install_element (OSPF_NODE, &ospf_distance_cmd); install_element (OSPF_NODE, &no_ospf_distance_cmd); @@ -10294,8 +10277,6 @@ ospf_vty_init (void) install_element (CONFIG_NODE, &router_ospf_cmd); install_element (CONFIG_NODE, &no_router_ospf_cmd); - install_element (CONFIG_NODE, &router_ospf_instance_cmd); - install_element (CONFIG_NODE, &no_router_ospf_instance_cmd); install_default (OSPF_NODE); @@ -10303,15 +10284,10 @@ ospf_vty_init (void) install_element (OSPF_NODE, &ospf_router_id_cmd); install_element (OSPF_NODE, &ospf_router_id_old_cmd); install_element (OSPF_NODE, &no_ospf_router_id_cmd); - install_element (OSPF_NODE, &no_ospf_router_id_val_cmd); /* "passive-interface" commands. */ install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); - install_element (OSPF_NODE, &ospf_passive_interface_cmd); - install_element (OSPF_NODE, &ospf_passive_interface_default_cmd); install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); - install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); - install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd); /* "ospf abr-type" commands. */ install_element (OSPF_NODE, &ospf_abr_type_cmd); @@ -10324,8 +10300,6 @@ ospf_vty_init (void) install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd); /* "ospf rfc1583-compatible" commands. */ - install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); - install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); @@ -10340,14 +10314,8 @@ ospf_vty_init (void) /* "area range" commands. */ install_element (OSPF_NODE, &ospf_area_range_cmd); - install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); - install_element (OSPF_NODE, &ospf_area_range_cost_cmd); - install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); install_element (OSPF_NODE, &no_ospf_area_range_cmd); - install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); - install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); - install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); @@ -10355,38 +10323,14 @@ ospf_vty_init (void) install_element (OSPF_NODE, &ospf_area_vlink_cmd); install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_args_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_args_authkey_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_args_md5_cmd); - install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); - install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); /* "area stub" commands. */ install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); @@ -10400,7 +10344,6 @@ ospf_vty_init (void) install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); - install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); install_element (OSPF_NODE, &ospf_area_default_cost_cmd); install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); @@ -10420,57 +10363,39 @@ ospf_vty_init (void) /* SPF timer commands */ install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); - install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_val_cmd); /* LSA timers commands */ install_element (OSPF_NODE, &ospf_timers_min_ls_interval_cmd); install_element (OSPF_NODE, &no_ospf_timers_min_ls_interval_cmd); - install_element (OSPF_NODE, &no_ospf_timers_min_ls_interval_val_cmd); install_element (OSPF_NODE, &ospf_timers_min_ls_arrival_cmd); install_element (OSPF_NODE, &no_ospf_timers_min_ls_arrival_cmd); - install_element (OSPF_NODE, &no_ospf_timers_min_ls_arrival_val_cmd); install_element (OSPF_NODE, &ospf_timers_lsa_cmd); install_element (OSPF_NODE, &no_ospf_timers_lsa_cmd); - install_element (OSPF_NODE, &no_ospf_timers_lsa_val_cmd); /* refresh timer commands */ install_element (OSPF_NODE, &ospf_refresh_timer_cmd); install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); - install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); /* max-metric commands */ install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); - install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_no_param_cmd); install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); - install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_no_param_cmd); /* reference bandwidth commands */ install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); - install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_val_cmd); /* "neighbor" commands. */ install_element (OSPF_NODE, &ospf_neighbor_cmd); - install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); - install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); - install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); install_element (OSPF_NODE, &no_ospf_neighbor_cmd); - install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); - install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); - install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_priority_cmd); - install_element (OSPF_NODE, &no_ospf_neighbor_priority_pollinterval_cmd); /* write multiplier commands */ install_element (OSPF_NODE, &ospf_write_multiplier_cmd); install_element (OSPF_NODE, &no_ospf_write_multiplier_cmd); - install_element (OSPF_NODE, &write_multiplier_cmd); - install_element (OSPF_NODE, &no_write_multiplier_cmd); - install_element (OSPF_NODE, &no_write_multiplier_val_cmd); /* Init interface related vty commands. */ ospf_vty_if_init (); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 8753106515..62159ad088 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3531,6 +3531,16 @@ DEFUN (interface_no_ip_mroute_source, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip pim hello <1-180> <1-180>", + * IP_STR + * PIM_STR + * IFACE_PIM_HELLO_STR + * IFACE_PIM_HELLO_TIME_STR + * IFACE_PIM_HELLO_HOLD_STR + * + */ DEFUN (interface_ip_pim_hello, interface_ip_pim_hello_cmd, "ip pim hello <1-180>", @@ -3558,14 +3568,6 @@ DEFUN (interface_ip_pim_hello, return CMD_SUCCESS; } -ALIAS (interface_ip_pim_hello, - interface_ip_pim_hello_hold_cmd, - "ip pim hello <1-180> <1-180>", - IP_STR - PIM_STR - IFACE_PIM_HELLO_STR - IFACE_PIM_HELLO_TIME_STR - IFACE_PIM_HELLO_HOLD_STR) DEFUN (interface_no_ip_pim_hello, @@ -3607,6 +3609,13 @@ DEFUN (debug_igmp, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug igmp", + * UNDEBUG_STR + * DEBUG_IGMP_STR + * + */ DEFUN (no_debug_igmp, no_debug_igmp_cmd, "no debug igmp", @@ -3620,11 +3629,6 @@ DEFUN (no_debug_igmp, return CMD_SUCCESS; } -ALIAS (no_debug_igmp, - undebug_igmp_cmd, - "undebug igmp", - UNDEBUG_STR - DEBUG_IGMP_STR) DEFUN (debug_igmp_events, debug_igmp_events_cmd, @@ -3637,6 +3641,14 @@ DEFUN (debug_igmp_events, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug igmp events", + * UNDEBUG_STR + * DEBUG_IGMP_STR + * DEBUG_IGMP_EVENTS_STR + * + */ DEFUN (no_debug_igmp_events, no_debug_igmp_events_cmd, "no debug igmp events", @@ -3649,12 +3661,6 @@ DEFUN (no_debug_igmp_events, return CMD_SUCCESS; } -ALIAS (no_debug_igmp_events, - undebug_igmp_events_cmd, - "undebug igmp events", - UNDEBUG_STR - DEBUG_IGMP_STR - DEBUG_IGMP_EVENTS_STR) DEFUN (debug_igmp_packets, debug_igmp_packets_cmd, @@ -3667,6 +3673,14 @@ DEFUN (debug_igmp_packets, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug igmp packets", + * UNDEBUG_STR + * DEBUG_IGMP_STR + * DEBUG_IGMP_PACKETS_STR + * + */ DEFUN (no_debug_igmp_packets, no_debug_igmp_packets_cmd, "no debug igmp packets", @@ -3679,12 +3693,6 @@ DEFUN (no_debug_igmp_packets, return CMD_SUCCESS; } -ALIAS (no_debug_igmp_packets, - undebug_igmp_packets_cmd, - "undebug igmp packets", - UNDEBUG_STR - DEBUG_IGMP_STR - DEBUG_IGMP_PACKETS_STR) DEFUN (debug_igmp_trace, debug_igmp_trace_cmd, @@ -3697,6 +3705,14 @@ DEFUN (debug_igmp_trace, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug igmp trace", + * UNDEBUG_STR + * DEBUG_IGMP_STR + * DEBUG_IGMP_TRACE_STR + * + */ DEFUN (no_debug_igmp_trace, no_debug_igmp_trace_cmd, "no debug igmp trace", @@ -3709,12 +3725,6 @@ DEFUN (no_debug_igmp_trace, return CMD_SUCCESS; } -ALIAS (no_debug_igmp_trace, - undebug_igmp_trace_cmd, - "undebug igmp trace", - UNDEBUG_STR - DEBUG_IGMP_STR - DEBUG_IGMP_TRACE_STR) DEFUN (debug_mroute, debug_mroute_cmd, @@ -3726,6 +3736,13 @@ DEFUN (debug_mroute, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug mroute", + * UNDEBUG_STR + * DEBUG_MROUTE_STR + * + */ DEFUN (no_debug_mroute, no_debug_mroute_cmd, "no debug mroute", @@ -3737,11 +3754,6 @@ DEFUN (no_debug_mroute, return CMD_SUCCESS; } -ALIAS (no_debug_mroute, - undebug_mroute_cmd, - "undebug mroute", - UNDEBUG_STR - DEBUG_MROUTE_STR) DEFUN (debug_static, debug_static_cmd, @@ -3753,6 +3765,13 @@ DEFUN (debug_static, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug static", + * UNDEBUG_STR + * DEBUG_STATIC_STR + * + */ DEFUN (no_debug_static, no_debug_static_cmd, "no debug static", @@ -3764,11 +3783,6 @@ DEFUN (no_debug_static, return CMD_SUCCESS; } -ALIAS (no_debug_static, - undebug_static_cmd, - "undebug static", - UNDEBUG_STR - DEBUG_STATIC_STR) DEFUN (debug_pim, debug_pim_cmd, @@ -3782,6 +3796,13 @@ DEFUN (debug_pim, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim", + * UNDEBUG_STR + * DEBUG_PIM_STR + * + */ DEFUN (no_debug_pim, no_debug_pim_cmd, "no debug pim", @@ -3799,11 +3820,6 @@ DEFUN (no_debug_pim, return CMD_SUCCESS; } -ALIAS (no_debug_pim, - undebug_pim_cmd, - "undebug pim", - UNDEBUG_STR - DEBUG_PIM_STR) DEFUN (debug_pim_events, debug_pim_events_cmd, @@ -3816,6 +3832,14 @@ DEFUN (debug_pim_events, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim events", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_EVENTS_STR + * + */ DEFUN (no_debug_pim_events, no_debug_pim_events_cmd, "no debug pim events", @@ -3828,12 +3852,6 @@ DEFUN (no_debug_pim_events, return CMD_SUCCESS; } -ALIAS (no_debug_pim_events, - undebug_pim_events_cmd, - "undebug pim events", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_EVENTS_STR) DEFUN (debug_pim_packets, debug_pim_packets_cmd, @@ -3869,6 +3887,14 @@ DEFUN (debug_pim_packets_filter, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim packets", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_PACKETS_STR + * + */ DEFUN (no_debug_pim_packets, no_debug_pim_packets_cmd, "no debug pim packets", @@ -3907,12 +3933,6 @@ DEFUN (no_debug_pim_packets_filter, return CMD_SUCCESS; } -ALIAS (no_debug_pim_packets, - undebug_pim_packets_cmd, - "undebug pim packets", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_PACKETS_STR) DEFUN (debug_pim_packetdump_send, debug_pim_packetdump_send_cmd, @@ -3926,6 +3946,15 @@ DEFUN (debug_pim_packetdump_send, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim packet-dump send", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_PACKETDUMP_STR + * DEBUG_PIM_PACKETDUMP_SEND_STR + * + */ DEFUN (no_debug_pim_packetdump_send, no_debug_pim_packetdump_send_cmd, "no debug pim packet-dump send", @@ -3939,13 +3968,6 @@ DEFUN (no_debug_pim_packetdump_send, return CMD_SUCCESS; } -ALIAS (no_debug_pim_packetdump_send, - undebug_pim_packetdump_send_cmd, - "undebug pim packet-dump send", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_PACKETDUMP_STR - DEBUG_PIM_PACKETDUMP_SEND_STR) DEFUN (debug_pim_packetdump_recv, debug_pim_packetdump_recv_cmd, @@ -3959,6 +3981,15 @@ DEFUN (debug_pim_packetdump_recv, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim packet-dump receive", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_PACKETDUMP_STR + * DEBUG_PIM_PACKETDUMP_RECV_STR + * + */ DEFUN (no_debug_pim_packetdump_recv, no_debug_pim_packetdump_recv_cmd, "no debug pim packet-dump receive", @@ -3972,13 +4003,6 @@ DEFUN (no_debug_pim_packetdump_recv, return CMD_SUCCESS; } -ALIAS (no_debug_pim_packetdump_recv, - undebug_pim_packetdump_recv_cmd, - "undebug pim packet-dump receive", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_PACKETDUMP_STR - DEBUG_PIM_PACKETDUMP_RECV_STR) DEFUN (debug_pim_trace, debug_pim_trace_cmd, @@ -3991,6 +4015,14 @@ DEFUN (debug_pim_trace, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim trace", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_TRACE_STR + * + */ DEFUN (no_debug_pim_trace, no_debug_pim_trace_cmd, "no debug pim trace", @@ -4003,12 +4035,6 @@ DEFUN (no_debug_pim_trace, return CMD_SUCCESS; } -ALIAS (no_debug_pim_trace, - undebug_pim_trace_cmd, - "undebug pim trace", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_TRACE_STR) DEFUN (debug_ssmpingd, debug_ssmpingd_cmd, @@ -4021,6 +4047,14 @@ DEFUN (debug_ssmpingd, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug ssmpingd", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_SSMPINGD_STR + * + */ DEFUN (no_debug_ssmpingd, no_debug_ssmpingd_cmd, "no debug ssmpingd", @@ -4033,12 +4067,6 @@ DEFUN (no_debug_ssmpingd, return CMD_SUCCESS; } -ALIAS (no_debug_ssmpingd, - undebug_ssmpingd_cmd, - "undebug ssmpingd", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_SSMPINGD_STR) DEFUN (debug_pim_zebra, debug_pim_zebra_cmd, @@ -4051,6 +4079,14 @@ DEFUN (debug_pim_zebra, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "undebug pim zebra", + * UNDEBUG_STR + * DEBUG_PIM_STR + * DEBUG_PIM_ZEBRA_STR + * + */ DEFUN (no_debug_pim_zebra, no_debug_pim_zebra_cmd, "no debug pim zebra", @@ -4063,12 +4099,6 @@ DEFUN (no_debug_pim_zebra, return CMD_SUCCESS; } -ALIAS (no_debug_pim_zebra, - undebug_pim_zebra_cmd, - "undebug pim zebra", - UNDEBUG_STR - DEBUG_PIM_STR - DEBUG_PIM_ZEBRA_STR) DEFUN (show_debugging_pim, show_debugging_pim_cmd, @@ -4901,7 +4931,6 @@ void pim_cmd_init() install_element (INTERFACE_NODE, &interface_ip_pim_drprio_cmd); install_element (INTERFACE_NODE, &interface_no_ip_pim_drprio_cmd); install_element (INTERFACE_NODE, &interface_ip_pim_hello_cmd); - install_element (INTERFACE_NODE, &interface_ip_pim_hello_hold_cmd); install_element (INTERFACE_NODE, &interface_no_ip_pim_hello_cmd); // Static mroutes NEB @@ -4991,81 +5020,59 @@ void pim_cmd_init() install_element (ENABLE_NODE, &debug_igmp_cmd); install_element (ENABLE_NODE, &no_debug_igmp_cmd); - install_element (ENABLE_NODE, &undebug_igmp_cmd); install_element (ENABLE_NODE, &debug_igmp_events_cmd); install_element (ENABLE_NODE, &no_debug_igmp_events_cmd); - install_element (ENABLE_NODE, &undebug_igmp_events_cmd); install_element (ENABLE_NODE, &debug_igmp_packets_cmd); install_element (ENABLE_NODE, &no_debug_igmp_packets_cmd); - install_element (ENABLE_NODE, &undebug_igmp_packets_cmd); install_element (ENABLE_NODE, &debug_igmp_trace_cmd); install_element (ENABLE_NODE, &no_debug_igmp_trace_cmd); - install_element (ENABLE_NODE, &undebug_igmp_trace_cmd); install_element (ENABLE_NODE, &debug_mroute_cmd); install_element (ENABLE_NODE, &no_debug_mroute_cmd); install_element (ENABLE_NODE, &debug_static_cmd); install_element (ENABLE_NODE, &no_debug_static_cmd); install_element (ENABLE_NODE, &debug_pim_cmd); install_element (ENABLE_NODE, &no_debug_pim_cmd); - install_element (ENABLE_NODE, &undebug_pim_cmd); install_element (ENABLE_NODE, &debug_pim_events_cmd); install_element (ENABLE_NODE, &no_debug_pim_events_cmd); - install_element (ENABLE_NODE, &undebug_pim_events_cmd); install_element (ENABLE_NODE, &debug_pim_packets_cmd); install_element (ENABLE_NODE, &debug_pim_packets_filter_cmd); install_element (ENABLE_NODE, &no_debug_pim_packets_cmd); install_element (ENABLE_NODE, &no_debug_pim_packets_filter_cmd); - install_element (ENABLE_NODE, &undebug_pim_packets_cmd); install_element (ENABLE_NODE, &debug_pim_packetdump_send_cmd); install_element (ENABLE_NODE, &no_debug_pim_packetdump_send_cmd); - install_element (ENABLE_NODE, &undebug_pim_packetdump_send_cmd); install_element (ENABLE_NODE, &debug_pim_packetdump_recv_cmd); install_element (ENABLE_NODE, &no_debug_pim_packetdump_recv_cmd); - install_element (ENABLE_NODE, &undebug_pim_packetdump_recv_cmd); install_element (ENABLE_NODE, &debug_pim_trace_cmd); install_element (ENABLE_NODE, &no_debug_pim_trace_cmd); - install_element (ENABLE_NODE, &undebug_pim_trace_cmd); install_element (ENABLE_NODE, &debug_ssmpingd_cmd); install_element (ENABLE_NODE, &no_debug_ssmpingd_cmd); - install_element (ENABLE_NODE, &undebug_ssmpingd_cmd); install_element (ENABLE_NODE, &debug_pim_zebra_cmd); install_element (ENABLE_NODE, &no_debug_pim_zebra_cmd); - install_element (ENABLE_NODE, &undebug_pim_zebra_cmd); install_element (CONFIG_NODE, &debug_igmp_cmd); install_element (CONFIG_NODE, &no_debug_igmp_cmd); - install_element (CONFIG_NODE, &undebug_igmp_cmd); install_element (CONFIG_NODE, &debug_igmp_events_cmd); install_element (CONFIG_NODE, &no_debug_igmp_events_cmd); - install_element (CONFIG_NODE, &undebug_igmp_events_cmd); install_element (CONFIG_NODE, &debug_igmp_packets_cmd); install_element (CONFIG_NODE, &no_debug_igmp_packets_cmd); - install_element (CONFIG_NODE, &undebug_igmp_packets_cmd); install_element (CONFIG_NODE, &debug_igmp_trace_cmd); install_element (CONFIG_NODE, &no_debug_igmp_trace_cmd); - install_element (CONFIG_NODE, &undebug_igmp_trace_cmd); install_element (CONFIG_NODE, &debug_mroute_cmd); install_element (CONFIG_NODE, &no_debug_mroute_cmd); install_element (CONFIG_NODE, &debug_static_cmd); install_element (CONFIG_NODE, &no_debug_static_cmd); install_element (CONFIG_NODE, &debug_pim_cmd); install_element (CONFIG_NODE, &no_debug_pim_cmd); - install_element (CONFIG_NODE, &undebug_pim_cmd); install_element (CONFIG_NODE, &debug_pim_events_cmd); install_element (CONFIG_NODE, &no_debug_pim_events_cmd); - install_element (CONFIG_NODE, &undebug_pim_events_cmd); install_element (CONFIG_NODE, &debug_pim_packets_cmd); install_element (CONFIG_NODE, &debug_pim_packets_filter_cmd); install_element (CONFIG_NODE, &no_debug_pim_packets_cmd); install_element (CONFIG_NODE, &no_debug_pim_packets_filter_cmd); - install_element (CONFIG_NODE, &undebug_pim_packets_cmd); install_element (CONFIG_NODE, &debug_pim_trace_cmd); install_element (CONFIG_NODE, &no_debug_pim_trace_cmd); - install_element (CONFIG_NODE, &undebug_pim_trace_cmd); install_element (CONFIG_NODE, &debug_ssmpingd_cmd); install_element (CONFIG_NODE, &no_debug_ssmpingd_cmd); - install_element (CONFIG_NODE, &undebug_ssmpingd_cmd); install_element (CONFIG_NODE, &debug_pim_zebra_cmd); install_element (CONFIG_NODE, &no_debug_pim_zebra_cmd); - install_element (CONFIG_NODE, &undebug_pim_zebra_cmd); } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 749939da2e..122a53eba0 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1393,6 +1393,18 @@ DEFUN (ip_rip_receive_version_2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip rip receive version (1|2)", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Advertisement reception\n" + * "Version control\n" + * "Version 1\n" + * "Version 2\n" + * + */ DEFUN (no_ip_rip_receive_version, no_ip_rip_receive_version_cmd, "no ip rip receive version", @@ -1412,16 +1424,6 @@ DEFUN (no_ip_rip_receive_version, return CMD_SUCCESS; } -ALIAS (no_ip_rip_receive_version, - no_ip_rip_receive_version_num_cmd, - "no ip rip receive version (1|2)", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Advertisement reception\n" - "Version control\n" - "Version 1\n" - "Version 2\n") DEFUN (ip_rip_send_version, ip_rip_send_version_cmd, @@ -1495,6 +1497,18 @@ DEFUN (ip_rip_send_version_2, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip rip send version (1|2)", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Advertisement transmission\n" + * "Version control\n" + * "Version 1\n" + * "Version 2\n" + * + */ DEFUN (no_ip_rip_send_version, no_ip_rip_send_version_cmd, "no ip rip send version", @@ -1514,17 +1528,21 @@ DEFUN (no_ip_rip_send_version, return CMD_SUCCESS; } -ALIAS (no_ip_rip_send_version, - no_ip_rip_send_version_num_cmd, - "no ip rip send version (1|2)", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Advertisement transmission\n" - "Version control\n" - "Version 1\n" - "Version 2\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", + * IP_STR + * "Routing Information Protocol\n" + * "Authentication control\n" + * "Authentication mode\n" + * "Keyed message digest\n" + * "Clear text authentication\n" + * "MD5 authentication data length\n" + * "RFC compatible\n" + * "Old ripd compatible\n" + * + */ DEFUN (ip_rip_authentication_mode, ip_rip_authentication_mode_cmd, "ip rip authentication mode (md5|text)", @@ -1582,19 +1600,31 @@ DEFUN (ip_rip_authentication_mode, return CMD_SUCCESS; } -ALIAS (ip_rip_authentication_mode, - ip_rip_authentication_mode_authlen_cmd, - "ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", - IP_STR - "Routing Information Protocol\n" - "Authentication control\n" - "Authentication mode\n" - "Keyed message digest\n" - "Clear text authentication\n" - "MD5 authentication data length\n" - "RFC compatible\n" - "Old ripd compatible\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip rip authentication mode (md5|text)", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Authentication control\n" + * "Authentication mode\n" + * "Keyed message digest\n" + * "Clear text authentication\n" + * + * "no ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Authentication control\n" + * "Authentication mode\n" + * "Keyed message digest\n" + * "Clear text authentication\n" + * "MD5 authentication data length\n" + * "RFC compatible\n" + * "Old ripd compatible\n" + * + */ DEFUN (no_ip_rip_authentication_mode, no_ip_rip_authentication_mode_cmd, "no ip rip authentication mode", @@ -1616,30 +1646,7 @@ DEFUN (no_ip_rip_authentication_mode, return CMD_SUCCESS; } -ALIAS (no_ip_rip_authentication_mode, - no_ip_rip_authentication_mode_type_cmd, - "no ip rip authentication mode (md5|text)", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Authentication control\n" - "Authentication mode\n" - "Keyed message digest\n" - "Clear text authentication\n") -ALIAS (no_ip_rip_authentication_mode, - no_ip_rip_authentication_mode_type_authlen_cmd, - "no ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Authentication control\n" - "Authentication mode\n" - "Keyed message digest\n" - "Clear text authentication\n" - "MD5 authentication data length\n" - "RFC compatible\n" - "Old ripd compatible\n") DEFUN (ip_rip_authentication_string, ip_rip_authentication_string_cmd, @@ -1677,6 +1684,17 @@ DEFUN (ip_rip_authentication_string, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip rip authentication string LINE", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Authentication control\n" + * "Authentication string\n" + * "Authentication string\n" + * + */ DEFUN (no_ip_rip_authentication_string, no_ip_rip_authentication_string_cmd, "no ip rip authentication string", @@ -1700,15 +1718,6 @@ DEFUN (no_ip_rip_authentication_string, return CMD_SUCCESS; } -ALIAS (no_ip_rip_authentication_string, - no_ip_rip_authentication_string2_cmd, - "no ip rip authentication string LINE", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Authentication control\n" - "Authentication string\n" - "Authentication string\n") DEFUN (ip_rip_authentication_key_chain, ip_rip_authentication_key_chain_cmd, @@ -1740,6 +1749,17 @@ DEFUN (ip_rip_authentication_key_chain, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip rip authentication key-chain LINE", + * NO_STR + * IP_STR + * "Routing Information Protocol\n" + * "Authentication control\n" + * "Authentication key-chain\n" + * "name of key-chain\n" + * + */ DEFUN (no_ip_rip_authentication_key_chain, no_ip_rip_authentication_key_chain_cmd, "no ip rip authentication key-chain", @@ -1763,15 +1783,6 @@ DEFUN (no_ip_rip_authentication_key_chain, return CMD_SUCCESS; } -ALIAS (no_ip_rip_authentication_key_chain, - no_ip_rip_authentication_key_chain2_cmd, - "no ip rip authentication key-chain LINE", - NO_STR - IP_STR - "Routing Information Protocol\n" - "Authentication control\n" - "Authentication key-chain\n" - "name of key-chain\n") /* CHANGED: ip rip split-horizon Cisco and Zebra's command is @@ -2098,27 +2109,20 @@ rip_if_init (void) install_element (INTERFACE_NODE, &ip_rip_send_version_1_cmd); install_element (INTERFACE_NODE, &ip_rip_send_version_2_cmd); install_element (INTERFACE_NODE, &no_ip_rip_send_version_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_send_version_num_cmd); install_element (INTERFACE_NODE, &ip_rip_receive_version_cmd); install_element (INTERFACE_NODE, &ip_rip_receive_version_1_cmd); install_element (INTERFACE_NODE, &ip_rip_receive_version_2_cmd); install_element (INTERFACE_NODE, &no_ip_rip_receive_version_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_receive_version_num_cmd); install_element (INTERFACE_NODE, &ip_rip_authentication_mode_cmd); - install_element (INTERFACE_NODE, &ip_rip_authentication_mode_authlen_cmd); install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_authlen_cmd); install_element (INTERFACE_NODE, &ip_rip_authentication_key_chain_cmd); install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain2_cmd); install_element (INTERFACE_NODE, &ip_rip_authentication_string_cmd); install_element (INTERFACE_NODE, &no_ip_rip_authentication_string_cmd); - install_element (INTERFACE_NODE, &no_ip_rip_authentication_string2_cmd); install_element (INTERFACE_NODE, &ip_rip_split_horizon_cmd); install_element (INTERFACE_NODE, &ip_rip_split_horizon_poisoned_reverse_cmd); diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 76186cdf66..4bb5958e9d 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -735,7 +735,7 @@ static struct route_map_rule_cmd route_set_tag_cmd = #define MATCH_STR "Match values from routing table\n" #define SET_STR "Set values in destination routing protocol\n" -DEFUN (match_metric, +DEFUN (match_metric, match_metric_cmd, "match metric <0-4294967295>", MATCH_STR @@ -745,6 +745,15 @@ DEFUN (match_metric, return rip_route_match_add (vty, vty->index, "metric", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match metric <0-4294967295>", + * NO_STR + * MATCH_STR + * "Match metric of route\n" + * "Metric value\n" + * + */ DEFUN (no_match_metric, no_match_metric_cmd, "no match metric", @@ -755,13 +764,6 @@ DEFUN (no_match_metric, return rip_route_match_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_match_metric, - no_match_metric_val_cmd, - "no match metric <0-4294967295>", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") DEFUN (match_interface, match_interface_cmd, @@ -773,6 +775,15 @@ DEFUN (match_interface, return rip_route_match_add (vty, vty->index, "interface", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * NO_STR + * MATCH_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (no_match_interface, no_match_interface_cmd, "no match interface", @@ -783,13 +794,6 @@ DEFUN (no_match_interface, return rip_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } -ALIAS (no_match_interface, - no_match_interface_val_cmd, - "no match interface WORD", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, @@ -804,6 +808,18 @@ DEFUN (match_ip_next_hop, return rip_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, "no match ip next-hop", @@ -815,16 +831,6 @@ DEFUN (no_match_ip_next_hop, return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } -ALIAS (no_match_ip_next_hop, - no_match_ip_next_hop_val_cmd, - "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") DEFUN (match_ip_next_hop_prefix_list, match_ip_next_hop_prefix_list_cmd, @@ -838,6 +844,17 @@ DEFUN (match_ip_next_hop_prefix_list, return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, "no match ip next-hop prefix-list", @@ -850,15 +867,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[5]->arg); } -ALIAS (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_val_cmd, - "no match ip next-hop prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") DEFUN (match_ip_address, match_ip_address_cmd, @@ -874,7 +882,19 @@ DEFUN (match_ip_address, return rip_route_match_add (vty, vty->index, "ip address", argv[3]->arg); } -DEFUN (no_match_ip_address, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ +DEFUN (no_match_ip_address, no_match_ip_address_cmd, "no match ip address", NO_STR @@ -885,18 +905,8 @@ DEFUN (no_match_ip_address, return rip_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); } -ALIAS (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -DEFUN (match_ip_address_prefix_list, +DEFUN (match_ip_address_prefix_list, match_ip_address_prefix_list_cmd, "match ip address prefix-list WORD", MATCH_STR @@ -908,6 +918,17 @@ DEFUN (match_ip_address_prefix_list, return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, "no match ip address prefix-list", @@ -920,17 +941,8 @@ DEFUN (no_match_ip_address_prefix_list, return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[5]->arg); } -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -DEFUN (match_tag, +DEFUN (match_tag, match_tag_cmd, "match tag <1-65535>", MATCH_STR @@ -940,6 +952,15 @@ DEFUN (match_tag, return rip_route_match_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match tag <1-65535>", + * NO_STR + * MATCH_STR + * "Match tag of route\n" + * "Metric value\n" + * + */ DEFUN (no_match_tag, no_match_tag_cmd, "no match tag", @@ -950,16 +971,17 @@ DEFUN (no_match_tag, return rip_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_match_tag, - no_match_tag_val_cmd, - "no match tag <1-65535>", - NO_STR - MATCH_STR - "Match tag of route\n" - "Metric value\n") /* set functions */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "set metric <+/-metric>", + * SET_STR + * "Metric value for destination routing protocol\n" + * "Add or subtract metric\n" + * + */ DEFUN (set_metric, set_metric_cmd, "set metric <0-4294967295>", @@ -970,13 +992,22 @@ DEFUN (set_metric, return rip_route_set_add (vty, vty->index, "metric", argv[2]->arg); } -ALIAS (set_metric, - set_metric_addsub_cmd, - "set metric <+/-metric>", - SET_STR - "Metric value for destination routing protocol\n" - "Add or subtract metric\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric <+/-metric>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Add or subtract metric\n" + * + * "no set metric <0-4294967295>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Metric value\n" + * + */ DEFUN (no_set_metric, no_set_metric_cmd, "no set metric", @@ -987,21 +1018,7 @@ DEFUN (no_set_metric, return rip_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -ALIAS (no_set_metric, - no_set_metric_addsub_cmd, - "no set metric <+/-metric>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Add or subtract metric\n") DEFUN (set_ip_nexthop, set_ip_nexthop_cmd, @@ -1031,6 +1048,16 @@ DEFUN (set_ip_nexthop, return rip_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set ip next-hop A.B.C.D", + * NO_STR + * SET_STR + * IP_STR + * "Next hop address\n" + * "IP address of next hop\n" + * + */ DEFUN (no_set_ip_nexthop, no_set_ip_nexthop_cmd, "no set ip next-hop", @@ -1042,14 +1069,6 @@ DEFUN (no_set_ip_nexthop, return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); } -ALIAS (no_set_ip_nexthop, - no_set_ip_nexthop_val_cmd, - "no set ip next-hop A.B.C.D", - NO_STR - SET_STR - IP_STR - "Next hop address\n" - "IP address of next hop\n") DEFUN (set_tag, set_tag_cmd, @@ -1061,6 +1080,15 @@ DEFUN (set_tag, return rip_route_set_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set tag <1-65535>", + * NO_STR + * SET_STR + * "Tag value for routing protocol\n" + * "Tag value\n" + * + */ DEFUN (no_set_tag, no_set_tag_cmd, "no set tag", @@ -1071,13 +1099,6 @@ DEFUN (no_set_tag, return rip_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_set_tag, - no_set_tag_val_cmd, - "no set tag <1-65535>", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") void rip_route_map_reset () @@ -1108,35 +1129,23 @@ rip_route_map_init () install_element (RMAP_NODE, &match_metric_cmd); install_element (RMAP_NODE, &no_match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_val_cmd); install_element (RMAP_NODE, &match_interface_cmd); install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_address_cmd); install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_val_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); install_element (RMAP_NODE, &match_tag_cmd); install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_val_cmd); install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &set_metric_addsub_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_val_cmd); - install_element (RMAP_NODE, &no_set_metric_addsub_cmd); install_element (RMAP_NODE, &set_ip_nexthop_cmd); install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); - install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd); install_element (RMAP_NODE, &set_tag_cmd); install_element (RMAP_NODE, &no_set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_val_cmd); } diff --git a/ripd/ripd.c b/ripd/ripd.c index 3446bb579c..d483d1ef31 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2962,6 +2962,14 @@ DEFUN (rip_version, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no version <1-2>", + * NO_STR + * "Set routing protocol version\n" + * "version\n" + * + */ DEFUN (no_rip_version, no_rip_version_cmd, "no version", @@ -2975,12 +2983,6 @@ DEFUN (no_rip_version, return CMD_SUCCESS; } -ALIAS (no_rip_version, - no_rip_version_val_cmd, - "no version <1-2>", - NO_STR - "Set routing protocol version\n" - "version\n") DEFUN (rip_route, rip_route_cmd, @@ -3085,6 +3087,14 @@ DEFUN (rip_default_metric, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no default-metric <1-16>", + * NO_STR + * "Set a metric of redistribute routes\n" + * "Default metric\n" + * + */ DEFUN (no_rip_default_metric, no_rip_default_metric_cmd, "no default-metric", @@ -3100,12 +3110,6 @@ DEFUN (no_rip_default_metric, return CMD_SUCCESS; } -ALIAS (no_rip_default_metric, - no_rip_default_metric_val_cmd, - "no default-metric <1-16>", - NO_STR - "Set a metric of redistribute routes\n" - "Default metric\n") DEFUN (rip_timers, rip_timers_cmd, @@ -3155,6 +3159,17 @@ DEFUN (rip_timers, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers basic <0-65535> <0-65535> <0-65535>", + * NO_STR + * "Adjust routing timers\n" + * "Basic routing protocol update timers\n" + * "Routing table update timer value in second. Default is 30.\n" + * "Routing information timeout timer. Default is 180.\n" + * "Garbage collection timer. Default is 120.\n" + * + */ DEFUN (no_rip_timers, no_rip_timers_cmd, "no timers basic", @@ -3173,15 +3188,6 @@ DEFUN (no_rip_timers, return CMD_SUCCESS; } -ALIAS (no_rip_timers, - no_rip_timers_val_cmd, - "no timers basic <0-65535> <0-65535> <0-65535>", - NO_STR - "Adjust routing timers\n" - "Basic routing protocol update timers\n" - "Routing table update timer value in second. Default is 30.\n" - "Routing information timeout timer. Default is 180.\n" - "Garbage collection timer. Default is 120.\n") struct route_table *rip_distance_table; @@ -4156,13 +4162,10 @@ rip_init (void) install_default (RIP_NODE); install_element (RIP_NODE, &rip_version_cmd); install_element (RIP_NODE, &no_rip_version_cmd); - install_element (RIP_NODE, &no_rip_version_val_cmd); install_element (RIP_NODE, &rip_default_metric_cmd); install_element (RIP_NODE, &no_rip_default_metric_cmd); - install_element (RIP_NODE, &no_rip_default_metric_val_cmd); install_element (RIP_NODE, &rip_timers_cmd); install_element (RIP_NODE, &no_rip_timers_cmd); - install_element (RIP_NODE, &no_rip_timers_val_cmd); install_element (RIP_NODE, &rip_route_cmd); install_element (RIP_NODE, &no_rip_route_cmd); install_element (RIP_NODE, &rip_distance_cmd); diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index c6167dad6d..930752abd0 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -1038,6 +1038,16 @@ DEFUN (ipv6_ripng_split_horizon_poisoned_reverse, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 ripng split-horizon poisoned-reverse", + * NO_STR + * IPV6_STR + * "Routing Information Protocol\n" + * "Perform split horizon\n" + * "With poisoned-reverse\n" + * + */ DEFUN (no_ipv6_ripng_split_horizon, no_ipv6_ripng_split_horizon_cmd, "no ipv6 ripng split-horizon", @@ -1056,14 +1066,6 @@ DEFUN (no_ipv6_ripng_split_horizon, return CMD_SUCCESS; } -ALIAS (no_ipv6_ripng_split_horizon, - no_ipv6_ripng_split_horizon_poisoned_reverse_cmd, - "no ipv6 ripng split-horizon poisoned-reverse", - NO_STR - IPV6_STR - "Routing Information Protocol\n" - "Perform split horizon\n" - "With poisoned-reverse\n") DEFUN (ripng_passive_interface, ripng_passive_interface_cmd, @@ -1210,5 +1212,4 @@ ripng_if_init () install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_cmd); install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_poisoned_reverse_cmd); install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_cmd); - install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_poisoned_reverse_cmd); } diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 52495aa3ff..9c25d60033 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -500,7 +500,7 @@ static struct route_map_rule_cmd route_set_tag_cmd = #define MATCH_STR "Match values from routing table\n" #define SET_STR "Set values in destination routing protocol\n" -DEFUN (match_metric, +DEFUN (match_metric, match_metric_cmd, "match metric <0-4294967295>", MATCH_STR @@ -510,6 +510,15 @@ DEFUN (match_metric, return ripng_route_match_add (vty, vty->index, "metric", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match metric <0-4294967295>", + * NO_STR + * MATCH_STR + * "Match metric of route\n" + * "Metric value\n" + * + */ DEFUN (no_match_metric, no_match_metric_cmd, "no match metric", @@ -520,13 +529,6 @@ DEFUN (no_match_metric, return ripng_route_match_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_match_metric, - no_match_metric_val_cmd, - "no match metric <0-4294967295>", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") DEFUN (match_interface, match_interface_cmd, @@ -538,6 +540,15 @@ DEFUN (match_interface, return ripng_route_match_add (vty, vty->index, "interface", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * NO_STR + * MATCH_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (no_match_interface, no_match_interface_cmd, "no match interface", @@ -548,13 +559,6 @@ DEFUN (no_match_interface, return ripng_route_match_delete (vty, vty->index, "interface", argv[3]->arg); } -ALIAS (no_match_interface, - no_match_interface_val_cmd, - "no match interface WORD", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") DEFUN (match_tag, match_tag_cmd, @@ -566,6 +570,15 @@ DEFUN (match_tag, return ripng_route_match_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match tag <1-65535>", + * NO_STR + * MATCH_STR + * "Match tag of route\n" + * "Metric value\n" + * + */ DEFUN (no_match_tag, no_match_tag_cmd, "no match tag", @@ -576,13 +589,6 @@ DEFUN (no_match_tag, return ripng_route_match_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_match_tag, - no_match_tag_val_cmd, - "no match tag <1-65535>", - NO_STR - MATCH_STR - "Match tag of route\n" - "Metric value\n") /* set functions */ @@ -596,6 +602,15 @@ DEFUN (set_metric, return ripng_route_set_add (vty, vty->index, "metric", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set metric <0-4294967295>", + * NO_STR + * SET_STR + * "Metric value for destination routing protocol\n" + * "Metric value\n" + * + */ DEFUN (no_set_metric, no_set_metric_cmd, "no set metric", @@ -606,13 +621,6 @@ DEFUN (no_set_metric, return ripng_route_set_delete (vty, vty->index, "metric", argv[3]->arg); } -ALIAS (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") DEFUN (set_ipv6_nexthop_local, set_ipv6_nexthop_local_cmd, @@ -642,6 +650,17 @@ DEFUN (set_ipv6_nexthop_local, return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set ipv6 next-hop local X:X::X:X", + * NO_STR + * SET_STR + * IPV6_STR + * "IPv6 next-hop address\n" + * "IPv6 local address\n" + * "IPv6 address of next hop\n" + * + */ DEFUN (no_set_ipv6_nexthop_local, no_set_ipv6_nexthop_local_cmd, "no set ipv6 next-hop local", @@ -654,15 +673,6 @@ DEFUN (no_set_ipv6_nexthop_local, return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); } -ALIAS (no_set_ipv6_nexthop_local, - no_set_ipv6_nexthop_local_val_cmd, - "no set ipv6 next-hop local X:X::X:X", - NO_STR - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") DEFUN (set_tag, set_tag_cmd, @@ -674,6 +684,15 @@ DEFUN (set_tag, return ripng_route_set_add (vty, vty->index, "tag", argv[2]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no set tag <1-65535>", + * NO_STR + * SET_STR + * "Tag value for routing protocol\n" + * "Tag value\n" + * + */ DEFUN (no_set_tag, no_set_tag_cmd, "no set tag", @@ -684,13 +703,6 @@ DEFUN (no_set_tag, return ripng_route_set_delete (vty, vty->index, "tag", argv[3]->arg); } -ALIAS (no_set_tag, - no_set_tag_val_cmd, - "no set tag <1-65535>", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") void ripng_route_map_reset () @@ -715,21 +727,15 @@ ripng_route_map_init () install_element (RMAP_NODE, &match_metric_cmd); install_element (RMAP_NODE, &no_match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_val_cmd); install_element (RMAP_NODE, &match_interface_cmd); install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_val_cmd); install_element (RMAP_NODE, &match_tag_cmd); install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_val_cmd); install_element (RMAP_NODE, &set_metric_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_val_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd); - install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_val_cmd); install_element (RMAP_NODE, &set_tag_cmd); install_element (RMAP_NODE, &no_set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_val_cmd); } diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 06ff558ab6..055a074cc7 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -345,6 +345,30 @@ DEFUN (ripng_redistribute_type, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", + * NO_STR + * "Redistribute\n" + * QUAGGA_REDIST_HELP_STR_RIPNGD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", + * NO_STR + * "Redistribute\n" + * QUAGGA_REDIST_HELP_STR_RIPNGD + * "Metric\n" + * "Metric value\n" + * + * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", + * NO_STR + * "Redistribute\n" + * QUAGGA_REDIST_HELP_STR_RIPNGD + * "Route map reference\n" + * "Pointer to route-map entries\n" + * + */ DEFUN (no_ripng_redistribute_type, no_ripng_redistribute_type_cmd, "no redistribute " QUAGGA_REDIST_STR_RIPNGD, @@ -394,14 +418,6 @@ DEFUN (ripng_redistribute_type_metric, return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_metric_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", - NO_STR - "Redistribute\n" - QUAGGA_REDIST_HELP_STR_RIPNGD - "Metric\n" - "Metric value\n") DEFUN (ripng_redistribute_type_routemap, ripng_redistribute_type_routemap_cmd, @@ -427,14 +443,6 @@ DEFUN (ripng_redistribute_type_routemap, return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", - NO_STR - "Redistribute\n" - QUAGGA_REDIST_HELP_STR_RIPNGD - "Route map reference\n" - "Pointer to route-map entries\n") DEFUN (ripng_redistribute_type_metric_routemap, ripng_redistribute_type_metric_routemap_cmd, @@ -464,14 +472,6 @@ DEFUN (ripng_redistribute_type_metric_routemap, return CMD_SUCCESS; } -ALIAS (no_ripng_redistribute_type, - no_ripng_redistribute_type_metric_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", - NO_STR - "Redistribute\n" - QUAGGA_REDIST_HELP_STR_RIPNGD - "Route map reference\n" - "Pointer to route-map entries\n") void ripng_redistribute_write (struct vty *vty, int config_mode) @@ -582,7 +582,4 @@ zebra_init (struct thread_master *master) install_element (RIPNG_NODE, &ripng_redistribute_type_metric_cmd); install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd); install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_routemap_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_cmd); - install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_routemap_cmd); } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index dc00d96298..dd8f1fc39a 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2400,6 +2400,14 @@ DEFUN (ripng_default_metric, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no default-metric <1-16>", + * NO_STR + * "Set a metric of redistribute routes\n" + * "Default metric\n" + * + */ DEFUN (no_ripng_default_metric, no_ripng_default_metric_cmd, "no default-metric", @@ -2414,12 +2422,6 @@ DEFUN (no_ripng_default_metric, return CMD_SUCCESS; } -ALIAS (no_ripng_default_metric, - no_ripng_default_metric_val_cmd, - "no default-metric <1-16>", - NO_STR - "Set a metric of redistribute routes\n" - "Default metric\n") #if 0 /* RIPng update timer setup. */ @@ -2552,6 +2554,17 @@ DEFUN (ripng_timers, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no timers basic <0-65535> <0-65535> <0-65535>", + * NO_STR + * "RIPng timers setup\n" + * "Basic timer\n" + * "Routing table update timer value in second. Default is 30.\n" + * "Routing information timeout timer. Default is 180.\n" + * "Garbage collection timer. Default is 120.\n" + * + */ DEFUN (no_ripng_timers, no_ripng_timers_cmd, "no timers basic", @@ -2570,15 +2583,6 @@ DEFUN (no_ripng_timers, return CMD_SUCCESS; } -ALIAS (no_ripng_timers, - no_ripng_timers_val_cmd, - "no timers basic <0-65535> <0-65535> <0-65535>", - NO_STR - "RIPng timers setup\n" - "Basic timer\n" - "Routing table update timer value in second. Default is 30.\n" - "Routing information timeout timer. Default is 180.\n" - "Garbage collection timer. Default is 120.\n") DEFUN (show_ipv6_protocols, show_ipv6_protocols_cmd, @@ -3110,11 +3114,9 @@ ripng_init () install_element (RIPNG_NODE, &ripng_default_metric_cmd); install_element (RIPNG_NODE, &no_ripng_default_metric_cmd); - install_element (RIPNG_NODE, &no_ripng_default_metric_val_cmd); install_element (RIPNG_NODE, &ripng_timers_cmd); install_element (RIPNG_NODE, &no_ripng_timers_cmd); - install_element (RIPNG_NODE, &no_ripng_timers_val_cmd); #if 0 install_element (RIPNG_NODE, &ripng_update_timer_cmd); install_element (RIPNG_NODE, &no_ripng_update_timer_cmd); diff --git a/zebra/interface.c b/zebra/interface.c index 737bf9665e..5e2f64b544 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1249,13 +1249,6 @@ DEFUN_NOSH (zebra_interface, return ret; } -ALIAS (zebra_interface, - zebra_interface_vrf_cmd, - "interface IFNAME " VRF_CMD_STR, - "Select an interface to configure\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - static void interface_update_stats (void) { @@ -1305,6 +1298,14 @@ struct cmd_node vrf_node = }; /* Show all interfaces to vty. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show interface " VRF_CMD_STR, + * SHOW_STR + * "Interface status and configuration\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_interface, show_interface_cmd, "show interface", @@ -1327,12 +1328,6 @@ DEFUN (show_interface, return CMD_SUCCESS; } -ALIAS (show_interface, - show_interface_vrf_cmd, - "show interface " VRF_CMD_STR, - SHOW_STR - "Interface status and configuration\n" - VRF_CMD_HELP_STR) /* Show all interfaces to vty. */ DEFUN (show_interface_vrf_all, @@ -1388,6 +1383,14 @@ DEFUN (show_interface_name_vrf, } /* Show specified interface to vty. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show interface IFNAME", + * SHOW_STR + * "Interface status and configuration\n" + * "Interface name\n" + * + */ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, "show interface IFNAME " VRF_ALL_CMD_STR, @@ -1423,11 +1426,6 @@ DEFUN (show_interface_name_vrf_all, return CMD_SUCCESS; } -ALIAS (show_interface_name_vrf_all, show_interface_name_cmd, - "show interface IFNAME", - SHOW_STR - "Interface status and configuration\n" - "Interface name\n") static void if_show_description (struct vty *vty, vrf_id_t vrf_id) @@ -1469,6 +1467,15 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id) } } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show interface description " VRF_CMD_STR, + * SHOW_STR + * "Interface status and configuration\n" + * "Interface description\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_interface_desc, show_interface_desc_cmd, "show interface description", @@ -1486,13 +1493,6 @@ DEFUN (show_interface_desc, return CMD_SUCCESS; } -ALIAS (show_interface_desc, - show_interface_desc_vrf_cmd, - "show interface description " VRF_CMD_STR, - SHOW_STR - "Interface status and configuration\n" - "Interface description\n" - VRF_CMD_HELP_STR) DEFUN (show_interface_desc_vrf_all, show_interface_desc_vrf_all_cmd, @@ -1700,6 +1700,14 @@ DEFUN (bandwidth_if, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no bandwidth <1-100000>", + * NO_STR + * "Set bandwidth informational parameter\n" + * "Bandwidth in megabits\n" + * + */ DEFUN (no_bandwidth_if, no_bandwidth_if_cmd, "no bandwidth", @@ -1719,12 +1727,6 @@ DEFUN (no_bandwidth_if, return CMD_SUCCESS; } -ALIAS (no_bandwidth_if, - no_bandwidth_if_val_cmd, - "no bandwidth <1-100000>", - NO_STR - "Set bandwidth informational parameter\n" - "Bandwidth in megabits\n") struct cmd_node link_params_node = { @@ -2086,6 +2088,17 @@ DEFUN (no_link_params_inter_as, } /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "delay <0-16777215> min <0-16777215> max <0-16777215>", + * "Unidirectional Average Link Delay (optionally Minimum and Maximum delays)\n" + * "Average delay in micro-second as decimal (0...16777215)\n" + * "Minimum delay\n" + * "Minimum delay in micro-second as decimal (0...16777215)\n" + * "Maximum delay\n" + * "Maximum delay in micro-second as decimal (0...16777215)\n" + * + */ DEFUN (link_params_delay, link_params_delay_cmd, "delay <0-16777215>", @@ -2169,15 +2182,6 @@ DEFUN (link_params_delay, return CMD_SUCCESS; } -ALIAS (link_params_delay, - link_params_delay_mm_cmd, - "delay <0-16777215> min <0-16777215> max <0-16777215>", - "Unidirectional Average Link Delay (optionally Minimum and Maximum delays)\n" - "Average delay in micro-second as decimal (0...16777215)\n" - "Minimum delay\n" - "Minimum delay in micro-second as decimal (0...16777215)\n" - "Maximum delay\n" - "Maximum delay in micro-second as decimal (0...16777215)\n") DEFUN (no_link_params_delay, no_link_params_delay_cmd, @@ -2946,22 +2950,16 @@ zebra_if_init (void) install_node (&vrf_node, vrf_config_write); install_element (VIEW_NODE, &show_interface_cmd); - install_element (VIEW_NODE, &show_interface_vrf_cmd); install_element (VIEW_NODE, &show_interface_vrf_all_cmd); - install_element (VIEW_NODE, &show_interface_name_cmd); install_element (VIEW_NODE, &show_interface_name_vrf_cmd); install_element (VIEW_NODE, &show_interface_name_vrf_all_cmd); install_element (ENABLE_NODE, &show_interface_cmd); - install_element (ENABLE_NODE, &show_interface_vrf_cmd); install_element (ENABLE_NODE, &show_interface_vrf_all_cmd); - install_element (ENABLE_NODE, &show_interface_name_cmd); install_element (ENABLE_NODE, &show_interface_name_vrf_cmd); install_element (ENABLE_NODE, &show_interface_name_vrf_all_cmd); install_element (ENABLE_NODE, &show_interface_desc_cmd); - install_element (ENABLE_NODE, &show_interface_desc_vrf_cmd); install_element (ENABLE_NODE, &show_interface_desc_vrf_all_cmd); install_element (CONFIG_NODE, &zebra_interface_cmd); - install_element (CONFIG_NODE, &zebra_interface_vrf_cmd); install_element (CONFIG_NODE, &no_interface_cmd); install_element (CONFIG_NODE, &no_interface_vrf_cmd); install_default (INTERFACE_NODE); @@ -2975,7 +2973,6 @@ zebra_if_init (void) install_element (INTERFACE_NODE, &no_shutdown_if_cmd); install_element (INTERFACE_NODE, &bandwidth_if_cmd); install_element (INTERFACE_NODE, &no_bandwidth_if_cmd); - install_element (INTERFACE_NODE, &no_bandwidth_if_val_cmd); install_element (INTERFACE_NODE, &ip_address_cmd); install_element (INTERFACE_NODE, &no_ip_address_cmd); #ifdef HAVE_IPV6 @@ -2998,7 +2995,6 @@ zebra_if_init (void) install_element(LINK_PARAMS_NODE, &link_params_inter_as_cmd); install_element(LINK_PARAMS_NODE, &no_link_params_inter_as_cmd); install_element(LINK_PARAMS_NODE, &link_params_delay_cmd); - install_element(LINK_PARAMS_NODE, &link_params_delay_mm_cmd); install_element(LINK_PARAMS_NODE, &link_params_delay_var_cmd); install_element(LINK_PARAMS_NODE, &link_params_pkt_loss_cmd); install_element(LINK_PARAMS_NODE, &link_params_ava_bw_cmd); diff --git a/zebra/router-id.c b/zebra/router-id.c index fbd9e2b0cf..05eee8ad33 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -214,6 +214,14 @@ router_id_write (struct vty *vty) } } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "router-id A.B.C.D " VRF_CMD_STR, + * "Manually set the router-id\n" + * "IP address to use for router-id\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (router_id, router_id_cmd, "router-id A.B.C.D", @@ -238,13 +246,21 @@ DEFUN (router_id, return CMD_SUCCESS; } -ALIAS (router_id, - router_id_vrf_cmd, - "router-id A.B.C.D " VRF_CMD_STR, - "Manually set the router-id\n" - "IP address to use for router-id\n" - VRF_CMD_HELP_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no router-id A.B.C.D", + * NO_STR + * "Remove the manually configured router-id\n" + * "IP address to use for router-id\n" + * + * "no router-id A.B.C.D " VRF_CMD_STR, + * NO_STR + * "Remove the manually configured router-id\n" + * "IP address to use for router-id\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (no_router_id, no_router_id_cmd, "no router-id", @@ -266,20 +282,7 @@ DEFUN (no_router_id, return CMD_SUCCESS; } -ALIAS (no_router_id, - no_router_id_val_cmd, - "no router-id A.B.C.D", - NO_STR - "Remove the manually configured router-id\n" - "IP address to use for router-id\n") -ALIAS (no_router_id, - no_router_id_vrf_cmd, - "no router-id A.B.C.D " VRF_CMD_STR, - NO_STR - "Remove the manually configured router-id\n" - "IP address to use for router-id\n" - VRF_CMD_HELP_STR) static int router_id_cmp (void *a, void *b) @@ -295,9 +298,6 @@ router_id_cmd_init (void) { install_element (CONFIG_NODE, &router_id_cmd); install_element (CONFIG_NODE, &no_router_id_cmd); - install_element (CONFIG_NODE, &router_id_vrf_cmd); - install_element (CONFIG_NODE, &no_router_id_val_cmd); - install_element (CONFIG_NODE, &no_router_id_vrf_cmd); } void diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 331838e92a..d372c985f9 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -985,6 +985,22 @@ DEFUN (ipv6_nd_ra_interval, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd ra-interval <1-1800>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Router Advertisement interval\n" + * + * "no ipv6 nd ra-interval msec <1-1800000>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Router Advertisement interval\n" + * "Router Advertisement interval in milliseconds\n" + * + */ DEFUN (no_ipv6_nd_ra_interval, no_ipv6_nd_ra_interval_cmd, "no ipv6 nd ra-interval", @@ -1013,22 +1029,7 @@ DEFUN (no_ipv6_nd_ra_interval, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_ra_interval, - no_ipv6_nd_ra_interval_val_cmd, - "no ipv6 nd ra-interval <1-1800>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Router Advertisement interval\n") -ALIAS (no_ipv6_nd_ra_interval, - no_ipv6_nd_ra_interval_msec_val_cmd, - "no ipv6 nd ra-interval msec <1-1800000>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Router Advertisement interval\n" - "Router Advertisement interval in milliseconds\n") DEFUN (ipv6_nd_ra_lifetime, ipv6_nd_ra_lifetime_cmd, @@ -1062,6 +1063,16 @@ DEFUN (ipv6_nd_ra_lifetime, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd ra-lifetime <0-9000>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Router lifetime\n" + * "Router lifetime in seconds (0 stands for a non-default gw)\n" + * + */ DEFUN (no_ipv6_nd_ra_lifetime, no_ipv6_nd_ra_lifetime_cmd, "no ipv6 nd ra-lifetime", @@ -1081,14 +1092,6 @@ DEFUN (no_ipv6_nd_ra_lifetime, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_ra_lifetime, - no_ipv6_nd_ra_lifetime_val_cmd, - "no ipv6 nd ra-lifetime <0-9000>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Router lifetime\n" - "Router lifetime in seconds (0 stands for a non-default gw)\n") DEFUN (ipv6_nd_reachable_time, ipv6_nd_reachable_time_cmd, @@ -1104,6 +1107,16 @@ DEFUN (ipv6_nd_reachable_time, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd reachable-time <1-3600000>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Reachable time\n" + * "Reachable time in milliseconds\n" + * + */ DEFUN (no_ipv6_nd_reachable_time, no_ipv6_nd_reachable_time_cmd, "no ipv6 nd reachable-time", @@ -1123,14 +1136,6 @@ DEFUN (no_ipv6_nd_reachable_time, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_reachable_time, - no_ipv6_nd_reachable_time_val_cmd, - "no ipv6 nd reachable-time <1-3600000>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Reachable time\n" - "Reachable time in milliseconds\n") DEFUN (ipv6_nd_homeagent_preference, ipv6_nd_homeagent_preference_cmd, @@ -1146,6 +1151,16 @@ DEFUN (ipv6_nd_homeagent_preference, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd home-agent-preference <0-65535>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Home Agent preference\n" + * "preference value (default is 0, least preferred)\n" + * + */ DEFUN (no_ipv6_nd_homeagent_preference, no_ipv6_nd_homeagent_preference_cmd, "no ipv6 nd home-agent-preference", @@ -1165,14 +1180,6 @@ DEFUN (no_ipv6_nd_homeagent_preference, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_homeagent_preference, - no_ipv6_nd_homeagent_preference_val_cmd, - "no ipv6 nd home-agent-preference <0-65535>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Home Agent preference\n" - "preference value (default is 0, least preferred)\n") DEFUN (ipv6_nd_homeagent_lifetime, ipv6_nd_homeagent_lifetime_cmd, @@ -1188,6 +1195,16 @@ DEFUN (ipv6_nd_homeagent_lifetime, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd home-agent-lifetime <0-65520>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Home Agent lifetime\n" + * "Home Agent lifetime in seconds (0 to track ra-lifetime)\n" + * + */ DEFUN (no_ipv6_nd_homeagent_lifetime, no_ipv6_nd_homeagent_lifetime_cmd, "no ipv6 nd home-agent-lifetime", @@ -1207,14 +1224,6 @@ DEFUN (no_ipv6_nd_homeagent_lifetime, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_homeagent_lifetime, - no_ipv6_nd_homeagent_lifetime_val_cmd, - "no ipv6 nd home-agent-lifetime <0-65520>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Home Agent lifetime\n" - "Home Agent lifetime in seconds (0 to track ra-lifetime)\n") DEFUN (ipv6_nd_managed_config_flag, ipv6_nd_managed_config_flag_cmd, @@ -1364,6 +1373,139 @@ DEFUN (no_ipv6_nd_other_config_flag, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for autoconfiguration\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * + * "ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for onlink determination\n" + * "Do not use prefix for autoconfiguration\n" + * + * "ipv6 nd prefix X:X::X:X/M (router-address|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Set Router Address flag\n" + * + * "ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (router-address|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Set Router Address flag\n" + * + * "ipv6 nd prefix X:X::X:X/M", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for onlink determination\n" + * "Do not use prefix for autoconfiguration\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * + * "ipv6 nd prefix X:X::X:X/M (off-link|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for onlink determination\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (no-autoconfig|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (off-link|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for onlink determination\n" + * + * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " + * "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * "Set Router Address flag\n" + * + */ DEFUN (ipv6_nd_prefix, ipv6_nd_prefix_cmd, "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", @@ -1445,162 +1587,152 @@ DEFUN (ipv6_nd_prefix, return CMD_SUCCESS; } -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_nortaddr_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for onlink determination\n" - "Do not use prefix for autoconfiguration\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_rev_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_rev_rtaddr_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n" - "Set Router Address flag\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_noauto_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (no-autoconfig|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_offlink_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (off-link|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for onlink determination\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_rtaddr_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite) (router-address|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Set Router Address flag\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_val_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - "(<0-4294967295>|infinite)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_noval_cmd, - "ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_noval_rev_cmd, - "ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for onlink determination\n" - "Do not use prefix for autoconfiguration\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_noval_noauto_cmd, - "ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for autoconfiguration\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_noval_offlink_cmd, - "ipv6 nd prefix X:X::X:X/M (off-link|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for onlink determination\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_noval_rtaddr_cmd, - "ipv6 nd prefix X:X::X:X/M (router-address|)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Set Router Address flag\n") -ALIAS (ipv6_nd_prefix, - ipv6_nd_prefix_prefix_cmd, - "ipv6 nd prefix X:X::X:X/M", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for onlink determination\n" + * "Do not use prefix for autoconfiguration\n" + * "Set Router Address flag\n" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for onlink determination\n" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * "Set Router Address flag\n" + * + * "no ipv6 nd prefix X:X::X:X/M (router-address|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Set Router Address flag\n" + * + * "no ipv6 nd prefix X:X::X:X/M (off-link|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for onlink determination\n" + * + * "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for autoconfiguration\n" + * + * "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for autoconfiguration\n" + * "Do not use prefix for onlink determination\n" + * + * "no ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Do not use prefix for onlink determination\n" + * "Do not use prefix for autoconfiguration\n" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (router-address|)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * "Set Router Address flag\n" + * + * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Prefix information\n" + * "IPv6 prefix\n" + * "Valid lifetime in seconds\n" + * "Infinite valid lifetime\n" + * "Preferred lifetime in seconds\n" + * "Infinite preferred lifetime\n" + * + */ DEFUN (no_ipv6_nd_prefix, no_ipv6_nd_prefix_cmd, "no ipv6 nd prefix IPV6PREFIX", @@ -1636,159 +1768,17 @@ DEFUN (no_ipv6_nd_prefix, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_nortaddr_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for onlink determination\n" - "Do not use prefix for autoconfiguration\n" - "Set Router Address flag\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_rev_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_rev_rtaddr_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n" - "Set Router Address flag\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_noauto_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for autoconfiguration") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_offlink_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Do not use prefix for onlink determination\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_rtaddr_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (router-address|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n" - "Set Router Address flag\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_val_cmd, - "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Valid lifetime in seconds\n" - "Infinite valid lifetime\n" - "Preferred lifetime in seconds\n" - "Infinite preferred lifetime\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_noval_cmd, - "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for autoconfiguration\n" - "Do not use prefix for onlink determination\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_noval_rev_cmd, - "no ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for onlink determination\n" - "Do not use prefix for autoconfiguration\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_noval_noauto_cmd, - "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for autoconfiguration\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_noval_offlink_cmd, - "no ipv6 nd prefix X:X::X:X/M (off-link|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Do not use prefix for onlink determination\n") -ALIAS (no_ipv6_nd_prefix, - no_ipv6_nd_prefix_noval_rtaddr_cmd, - "no ipv6 nd prefix X:X::X:X/M (router-address|)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Prefix information\n" - "IPv6 prefix\n" - "Set Router Address flag\n") DEFUN (ipv6_nd_router_preference, ipv6_nd_router_preference_cmd, @@ -1820,6 +1810,18 @@ DEFUN (ipv6_nd_router_preference, return CMD_ERR_NO_MATCH; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd router-preference (high|medium|low)", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Default router preference\n" + * "High default router preference\n" + * "Low default router preference\n" + * "Medium default router preference (default)\n" + * + */ DEFUN (no_ipv6_nd_router_preference, no_ipv6_nd_router_preference_cmd, "no ipv6 nd router-preference", @@ -1839,16 +1841,6 @@ DEFUN (no_ipv6_nd_router_preference, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_router_preference, - no_ipv6_nd_router_preference_val_cmd, - "no ipv6 nd router-preference (high|medium|low)", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Default router preference\n" - "High default router preference\n" - "Low default router preference\n" - "Medium default router preference (default)\n") DEFUN (ipv6_nd_mtu, ipv6_nd_mtu_cmd, @@ -1864,6 +1856,16 @@ DEFUN (ipv6_nd_mtu, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nd mtu <1-65535>", + * NO_STR + * "Interface IPv6 config commands\n" + * "Neighbor discovery\n" + * "Advertised MTU\n" + * "MTU in bytes\n" + * + */ DEFUN (no_ipv6_nd_mtu, no_ipv6_nd_mtu_cmd, "no ipv6 nd mtu", @@ -1878,14 +1880,6 @@ DEFUN (no_ipv6_nd_mtu, return CMD_SUCCESS; } -ALIAS (no_ipv6_nd_mtu, - no_ipv6_nd_mtu_val_cmd, - "no ipv6 nd mtu <1-65535>", - NO_STR - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Advertised MTU\n" - "MTU in bytes\n") /* Write configuration about router advertisement. */ void @@ -2052,14 +2046,10 @@ rtadv_cmd_init (void) install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_cmd); install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_msec_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_val_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_msec_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_reachable_time_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd); install_element (INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd); @@ -2068,45 +2058,16 @@ rtadv_cmd_init (void) install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_config_flag_cmd); install_element (INTERFACE_NODE, &ipv6_nd_homeagent_preference_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_adv_interval_config_option_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_adv_interval_config_option_cmd); install_element (INTERFACE_NODE, &ipv6_nd_prefix_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rev_rtaddr_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_nortaddr_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rev_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_noauto_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_offlink_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rtaddr_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_rev_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_noauto_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_offlink_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_rtaddr_cmd); - install_element (INTERFACE_NODE, &ipv6_nd_prefix_prefix_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rev_rtaddr_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_nortaddr_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rev_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_noauto_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_offlink_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_rtaddr_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_val_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_rev_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_noauto_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_offlink_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_noval_rtaddr_cmd); install_element (INTERFACE_NODE, &ipv6_nd_router_preference_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_val_cmd); install_element (INTERFACE_NODE, &ipv6_nd_mtu_cmd); install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_cmd); - install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_val_cmd); } static int diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index c70b207d64..88cc7977fa 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -305,6 +305,15 @@ DEFUN (match_interface, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match interface WORD", + * NO_STR + * MATCH_STR + * "Match first hop interface of route\n" + * "Interface name\n" + * + */ DEFUN (no_match_interface, no_match_interface_cmd, "no match interface", @@ -318,13 +327,6 @@ DEFUN (no_match_interface, return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_interface, - no_match_interface_val_cmd, - "no match interface WORD", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") DEFUN (match_tag, match_tag_cmd, @@ -337,6 +339,14 @@ DEFUN (match_tag, RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match tag <1-65535>", + * NO_STR + * MATCH_STR + * "Match tag of route\n" + * + */ DEFUN (no_match_tag, no_match_tag_cmd, "no match tag", @@ -352,12 +362,6 @@ DEFUN (no_match_tag, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_tag, - no_match_tag_val_cmd, - "no match tag <1-65535>", - NO_STR - MATCH_STR - "Match tag of route\n") DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, @@ -372,6 +376,18 @@ DEFUN (match_ip_next_hop, return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, "no match ip next-hop", @@ -388,16 +404,6 @@ DEFUN (no_match_ip_next_hop, RMAP_EVENT_FILTER_DELETED); } -ALIAS (no_match_ip_next_hop, - no_match_ip_next_hop_val_cmd, - "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") DEFUN (match_ip_next_hop_prefix_list, match_ip_next_hop_prefix_list_cmd, @@ -412,6 +418,17 @@ DEFUN (match_ip_next_hop_prefix_list, argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match next-hop address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, "no match ip next-hop prefix-list", @@ -431,15 +448,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, RMAP_EVENT_PLIST_DELETED); } -ALIAS (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_val_cmd, - "no match ip next-hop prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") DEFUN (match_ip_address, match_ip_address_cmd, @@ -456,7 +464,19 @@ DEFUN (match_ip_address, RMAP_EVENT_FILTER_ADDED); } -DEFUN (no_match_ip_address, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address (<1-199>|<1300-2699>|WORD)", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "IP access-list number\n" + * "IP access-list number (expanded range)\n" + * "IP Access-list name\n" + * + */ +DEFUN (no_match_ip_address, no_match_ip_address_cmd, "no match ip address", NO_STR @@ -472,18 +492,8 @@ DEFUN (no_match_ip_address, RMAP_EVENT_FILTER_DELETED); } -ALIAS (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -DEFUN (match_ip_address_prefix_list, +DEFUN (match_ip_address_prefix_list, match_ip_address_prefix_list_cmd, "match ip address prefix-list WORD", MATCH_STR @@ -496,6 +506,17 @@ DEFUN (match_ip_address_prefix_list, argv[4]->arg, RMAP_EVENT_PLIST_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-list WORD", + * NO_STR + * MATCH_STR + * IP_STR + * "Match address of route\n" + * "Match entries of prefix-lists\n" + * "IP prefix-list name\n" + * + */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, "no match ip address prefix-list", @@ -515,15 +536,6 @@ DEFUN (no_match_ip_address_prefix_list, RMAP_EVENT_PLIST_DELETED); } -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") DEFUN (match_ip_address_prefix_len, match_ip_address_prefix_len_cmd, @@ -538,6 +550,16 @@ DEFUN (match_ip_address_prefix_len, argv[0], RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip address prefix-len NUMBER", + * NO_STR + * MATCH_STR + * IP_STR + * "Match prefixlen of ip address of route\n" + * "prefix length of ip address\n" + * + */ DEFUN (no_match_ip_address_prefix_len, no_match_ip_address_prefix_len_cmd, "no match ip address prefix-len", @@ -557,14 +579,6 @@ DEFUN (no_match_ip_address_prefix_len, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_ip_address_prefix_len, - no_match_ip_address_prefix_len_val_cmd, - "no match ip address prefix-len NUMBER", - NO_STR - MATCH_STR - IP_STR - "Match prefixlen of ip address of route\n" - "prefix length of ip address\n") DEFUN (match_ip_nexthop_prefix_len, match_ip_nexthop_prefix_len_cmd, @@ -579,6 +593,14 @@ DEFUN (match_ip_nexthop_prefix_len, argv[0], RMAP_EVENT_MATCH_ADDED); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no match ip next-hop prefix-len NUMBER", + * MATCH_STR + * "Match prefixlen of ip address of route\n" + * "prefix length of ip address\n" + * + */ DEFUN (no_match_ip_nexthop_prefix_len, no_match_ip_nexthop_prefix_len_cmd, "no match ip next-hop prefix-len", @@ -598,12 +620,6 @@ DEFUN (no_match_ip_nexthop_prefix_len, RMAP_EVENT_MATCH_DELETED); } -ALIAS (no_match_ip_nexthop_prefix_len, - no_match_ip_nexthop_prefix_len_val_cmd, - "no match ip next-hop prefix-len NUMBER", - MATCH_STR - "Match prefixlen of ip address of route\n" - "prefix length of ip address\n") DEFUN (match_source_protocol, match_source_protocol_cmd, @@ -736,6 +752,15 @@ DEFUN (zebra_route_map_timer, return (CMD_SUCCESS); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no zebra route-map delay-timer <0-600>", + * NO_STR + * "Time to wait before route-map updates are processed\n" + * "Reset delay-timer to default value, 30 secs\n" + * "0 means event-driven updates are disabled\n" + * + */ DEFUN (no_zebra_route_map_timer, no_zebra_route_map_timer_cmd, "no zebra route-map delay-timer", @@ -748,13 +773,6 @@ DEFUN (no_zebra_route_map_timer, return (CMD_SUCCESS); } -ALIAS (no_zebra_route_map_timer, - no_zebra_route_map_timer_val_cmd, - "no zebra route-map delay-timer <0-600>", - NO_STR - "Time to wait before route-map updates are processed\n" - "Reset delay-timer to default value, 30 secs\n" - "0 means event-driven updates are disabled\n") DEFUN (ip_protocol, ip_protocol_cmd, @@ -793,6 +811,16 @@ DEFUN (ip_protocol, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + * NO_STR + * IP_STR + * "Stop filtering routing info between zebra and protocol\n" + * QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA + * "route map name" + * + */ DEFUN (no_ip_protocol, no_ip_protocol_cmd, "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA, @@ -831,14 +859,6 @@ DEFUN (no_ip_protocol, return CMD_SUCCESS; } -ALIAS (no_ip_protocol, - no_ip_protocol_val_cmd, - "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - NO_STR - IP_STR - "Stop filtering routing info between zebra and protocol\n" - QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA - "route map name") DEFUN (show_ip_protocol, show_ip_protocol_cmd, @@ -906,6 +926,16 @@ DEFUN (ipv6_protocol, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + * NO_STR + * IP6_STR + * "Stop filtering IPv6 routing info between zebra and protocol\n" + * QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA + * "route map name" + * + */ DEFUN (no_ipv6_protocol, no_ipv6_protocol_cmd, "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA, @@ -945,14 +975,6 @@ DEFUN (no_ipv6_protocol, return CMD_SUCCESS; } -ALIAS (no_ipv6_protocol, - no_ipv6_protocol_val_cmd, - "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - NO_STR - IP6_STR - "Stop filtering IPv6 routing info between zebra and protocol\n" - QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA - "route map name") DEFUN (show_ipv6_protocol, show_ipv6_protocol_cmd, @@ -1017,6 +1039,15 @@ DEFUN (ip_protocol_nht_rmap, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + * IP_STR + * "Filter Next Hop tracking route resolution\n" + * QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA + * "Route map name\n" + * + */ DEFUN (no_ip_protocol_nht_rmap, no_ip_protocol_nht_rmap_cmd, "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA, @@ -1050,13 +1081,6 @@ DEFUN (no_ip_protocol_nht_rmap, return CMD_SUCCESS; } -ALIAS (no_ip_protocol_nht_rmap, - no_ip_protocol_nht_rmap_val_cmd, - "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - IP_STR - "Filter Next Hop tracking route resolution\n" - QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA - "Route map name\n") DEFUN (show_ip_protocol_nht, show_ip_protocol_nht_cmd, @@ -1115,6 +1139,16 @@ DEFUN (ipv6_protocol_nht_rmap, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + * NO_STR + * IP6_STR + * "Filter Next Hop tracking route resolution\n" + * QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA + * "Route map name\n" + * + */ DEFUN (no_ipv6_protocol_nht_rmap, no_ipv6_protocol_nht_rmap_cmd, "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA, @@ -1153,14 +1187,6 @@ DEFUN (no_ipv6_protocol_nht_rmap, return CMD_SUCCESS; } -ALIAS (no_ipv6_protocol_nht_rmap, - no_ipv6_protocol_nht_rmap_val_cmd, - "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - NO_STR - IP6_STR - "Filter Next Hop tracking route resolution\n" - QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA - "Route map name\n") DEFUN (show_ipv6_protocol_nht, show_ipv6_protocol_nht_cmd, @@ -1816,27 +1842,22 @@ zebra_route_map_init () { install_element (CONFIG_NODE, &ip_protocol_cmd); install_element (CONFIG_NODE, &no_ip_protocol_cmd); - install_element (CONFIG_NODE, &no_ip_protocol_val_cmd); install_element (VIEW_NODE, &show_ip_protocol_cmd); install_element (ENABLE_NODE, &show_ip_protocol_cmd); install_element (CONFIG_NODE, &ipv6_protocol_cmd); install_element (CONFIG_NODE, &no_ipv6_protocol_cmd); - install_element (CONFIG_NODE, &no_ipv6_protocol_val_cmd); install_element (VIEW_NODE, &show_ipv6_protocol_cmd); install_element (ENABLE_NODE, &show_ipv6_protocol_cmd); install_element (CONFIG_NODE, &ip_protocol_nht_rmap_cmd); install_element (CONFIG_NODE, &no_ip_protocol_nht_rmap_cmd); - install_element (CONFIG_NODE, &no_ip_protocol_nht_rmap_val_cmd); install_element (VIEW_NODE, &show_ip_protocol_nht_cmd); install_element (ENABLE_NODE, &show_ip_protocol_nht_cmd); install_element (CONFIG_NODE, &ipv6_protocol_nht_rmap_cmd); install_element (CONFIG_NODE, &no_ipv6_protocol_nht_rmap_cmd); - install_element (CONFIG_NODE, &no_ipv6_protocol_nht_rmap_val_cmd); install_element (VIEW_NODE, &show_ipv6_protocol_nht_cmd); install_element (ENABLE_NODE, &show_ipv6_protocol_nht_cmd); install_element (CONFIG_NODE, &zebra_route_map_timer_cmd); install_element (CONFIG_NODE, &no_zebra_route_map_timer_cmd); - install_element (CONFIG_NODE, &no_zebra_route_map_timer_val_cmd); route_map_init (); route_map_init_vty (); @@ -1859,28 +1880,20 @@ zebra_route_map_init () /* */ install_element (RMAP_NODE, &match_tag_cmd); install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_val_cmd); install_element (RMAP_NODE, &match_interface_cmd); install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd); install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_address_cmd); install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_val_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); install_element (RMAP_NODE, &match_ip_nexthop_prefix_len_cmd); install_element (RMAP_NODE, &no_match_ip_nexthop_prefix_len_cmd); - install_element (RMAP_NODE, &no_match_ip_nexthop_prefix_len_val_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_len_cmd); install_element (RMAP_NODE, &no_match_ip_address_prefix_len_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_len_val_cmd); install_element (RMAP_NODE, &match_source_protocol_cmd); install_element (RMAP_NODE, &no_match_source_protocol_cmd); /* */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index dfcf1829d1..491abbba4a 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -181,6 +181,16 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd, } /* Static unicast routes for multicast RPF lookup. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", + * IP_STR + * "Configure static unicast route into MRIB for multicast RPF lookup\n" + * "IP destination prefix (e.g. 10.0.0.0/8)\n" + * "Nexthop address\n" + * "Nexthop interface name\n" + * + */ DEFUN (ip_mroute_dist, ip_mroute_dist_cmd, "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", @@ -194,15 +204,18 @@ DEFUN (ip_mroute_dist, return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argc > 2 ? argv[4]->arg : NULL, NULL); } -ALIAS (ip_mroute_dist, - ip_mroute_cmd, - "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", - IP_STR - "Configure static unicast route into MRIB for multicast RPF lookup\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Nexthop address\n" - "Nexthop interface name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", + * NO_STR + * IP_STR + * "Configure static unicast route into MRIB for multicast RPF lookup\n" + * "IP destination prefix (e.g. 10.0.0.0/8)\n" + * "Nexthop address\n" + * "Nexthop interface name\n" + * + */ DEFUN (no_ip_mroute_dist, no_ip_mroute_dist_cmd, "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", @@ -216,15 +229,6 @@ DEFUN (no_ip_mroute_dist, return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argc > 2 ? argv[5]->arg : NULL, NULL); } -ALIAS (no_ip_mroute_dist, - no_ip_mroute_cmd, - "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", - NO_STR - IP_STR - "Configure static unicast route into MRIB for multicast RPF lookup\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Nexthop address\n" - "Nexthop interface name\n") DEFUN (ip_multicast_mode, ip_multicast_mode_cmd, @@ -258,6 +262,15 @@ DEFUN (ip_multicast_mode, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip multicast rpf-lookup-mode", + * NO_STR + * IP_STR + * "Multicast options\n" + * "RPF lookup behavior\n" + * + */ DEFUN (no_ip_multicast_mode, no_ip_multicast_mode_cmd, "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", @@ -275,13 +288,6 @@ DEFUN (no_ip_multicast_mode, return CMD_SUCCESS; } -ALIAS (no_ip_multicast_mode, - no_ip_multicast_mode_noarg_cmd, - "no ip multicast rpf-lookup-mode", - NO_STR - IP_STR - "Multicast options\n" - "RPF lookup behavior\n") DEFUN (show_ip_rpf, show_ip_rpf_cmd, @@ -324,7 +330,7 @@ DEFUN (show_ip_rpf_addr, } /* Static route configuration. */ -DEFUN (ip_route, +DEFUN (ip_route, ip_route_cmd, "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", IP_STR @@ -716,7 +722,20 @@ DEFUN (ip_route_mask_flags_tag_distance2, argv[7]->arg, NULL); } -DEFUN (no_ip_route, +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", + * NO_STR + * IP_STR + * "Establish static routes\n" + * "IP destination prefix (e.g. 10.0.0.0/8)\n" + * "IP gateway address\n" + * "IP gateway interface name\n" + * "Emit an ICMP unreachable when matched\n" + * "Silently discard pkts when matched\n" + * + */ +DEFUN (no_ip_route, no_ip_route_cmd, "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", NO_STR @@ -731,6 +750,21 @@ DEFUN (no_ip_route, NULL, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", + * NO_STR + * IP_STR + * "Establish static routes\n" + * "IP destination prefix (e.g. 10.0.0.0/8)\n" + * "IP gateway address\n" + * "IP gateway interface name\n" + * "Emit an ICMP unreachable when matched\n" + * "Silently discard pkts when matched\n" + * "Tag of this route\n" + * "Tag value\n" + * + */ DEFUN (no_ip_route_tag, no_ip_route_tag_cmd, "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>", @@ -748,31 +782,7 @@ DEFUN (no_ip_route_tag, NULL, NULL); } -ALIAS (no_ip_route, - no_ip_route_flags_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -ALIAS (no_ip_route_tag, - no_ip_route_flags_tag_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n") DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, @@ -804,6 +814,20 @@ DEFUN (no_ip_route_flags2_tag, NULL, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", + * NO_STR + * IP_STR + * "Establish static routes\n" + * "IP destination prefix\n" + * "IP destination prefix mask\n" + * "IP gateway address\n" + * "IP gateway interface name\n" + * "Emit an ICMP unreachable when matched\n" + * "Silently discard pkts when matched\n" + * + */ DEFUN (no_ip_route_mask, no_ip_route_mask_cmd, "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)", @@ -820,6 +844,22 @@ DEFUN (no_ip_route_mask, NULL, NULL); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", + * NO_STR + * IP_STR + * "Establish static routes\n" + * "IP destination prefix\n" + * "IP destination prefix mask\n" + * "IP gateway address\n" + * "IP gateway interface name\n" + * "Emit an ICMP unreachable when matched\n" + * "Silently discard pkts when matched\n" + * "Tag of this route\n" + * "Tag value\n" + * + */ DEFUN (no_ip_route_mask_tag, no_ip_route_mask_tag_cmd, "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>", @@ -838,33 +878,7 @@ DEFUN (no_ip_route_mask_tag, NULL, NULL); } -ALIAS (no_ip_route_mask, - no_ip_route_mask_flags_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -ALIAS (no_ip_route_mask_tag, - no_ip_route_mask_flags_tag_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n") DEFUN (no_ip_route_mask_flags2, no_ip_route_mask_flags2_cmd, @@ -1109,7 +1123,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, } /* Static route configuration. */ -DEFUN (ip_route_vrf, +DEFUN (ip_route_vrf, ip_route_vrf_cmd, "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, IP_STR @@ -1501,7 +1515,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[10]->arg); } -DEFUN (no_ip_route_vrf, +DEFUN (no_ip_route_vrf, no_ip_route_vrf_cmd, "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, NO_STR @@ -2436,6 +2450,15 @@ DEFUN (show_ip_route_vrf, return do_show_ip_route (vty, argv[5]->arg, SAFI_UNICAST, uj); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip nht " VRF_CMD_STR, + * SHOW_STR + * IP_STR + * "IP nexthop tracking table\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_ip_nht, show_ip_nht_cmd, "show ip nht", @@ -2452,13 +2475,6 @@ DEFUN (show_ip_nht, return CMD_SUCCESS; } -ALIAS (show_ip_nht, - show_ip_nht_vrf_cmd, - "show ip nht " VRF_CMD_STR, - SHOW_STR - IP_STR - "IP nexthop tracking table\n" - VRF_CMD_HELP_STR) DEFUN (show_ip_nht_vrf_all, show_ip_nht_vrf_all_cmd, @@ -2481,6 +2497,15 @@ DEFUN (show_ip_nht_vrf_all, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 nht " VRF_CMD_STR, + * SHOW_STR + * IPV6_STR + * "IPv6 nexthop tracking table\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_ipv6_nht, show_ipv6_nht_cmd, "show ipv6 nht", @@ -2497,13 +2522,6 @@ DEFUN (show_ipv6_nht, return CMD_SUCCESS; } -ALIAS (show_ipv6_nht, - show_ipv6_nht_vrf_cmd, - "show ipv6 nht " VRF_CMD_STR, - SHOW_STR - IPV6_STR - "IPv6 nexthop tracking table\n" - VRF_CMD_HELP_STR) DEFUN (show_ipv6_nht_vrf_all, show_ipv6_nht_vrf_all_cmd, @@ -2588,6 +2606,17 @@ DEFUN (no_ipv6_nht_default_route, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " tag <1-65535>", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "Show only routes with tag\n" + * "Tag value\n" + * + */ DEFUN (show_ip_route_tag, show_ip_route_tag_cmd, "show ip route tag <1-65535>", @@ -2633,16 +2662,18 @@ DEFUN (show_ip_route_tag, return CMD_SUCCESS; } -ALIAS (show_ip_route_tag, - show_ip_route_vrf_tag_cmd, - "show ip route " VRF_CMD_STR " tag <1-65535>", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "Show only routes with tag\n" - "Tag value\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " A.B.C.D/M longer-prefixes", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "IP prefix /, e.g., 35.0.0.0/8\n" + * "Show route matching the specified Network/Mask pair only\n" + * + */ DEFUN (show_ip_route_prefix_longer, show_ip_route_prefix_longer_cmd, "show ip route A.B.C.D/M longer-prefixes", @@ -2693,16 +2724,17 @@ DEFUN (show_ip_route_prefix_longer, return CMD_SUCCESS; } -ALIAS (show_ip_route_prefix_longer, - show_ip_route_vrf_prefix_longer_cmd, - "show ip route " VRF_CMD_STR " A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Show route matching the specified Network/Mask pair only\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " supernets-only", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "Show supernet entries only\n" + * + */ DEFUN (show_ip_route_supernets, show_ip_route_supernets_cmd, "show ip route supernets-only", @@ -2746,15 +2778,17 @@ DEFUN (show_ip_route_supernets, return CMD_SUCCESS; } -ALIAS (show_ip_route_supernets, - show_ip_route_vrf_supernets_cmd, - "show ip route " VRF_CMD_STR " supernets-only", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "Show supernet entries only\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * QUAGGA_IP_REDIST_HELP_STR_ZEBRA + * + */ DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA, @@ -2803,14 +2837,6 @@ DEFUN (show_ip_route_protocol, return CMD_SUCCESS; } -ALIAS (show_ip_route_protocol, - show_ip_route_vrf_protocol_cmd, - "show ip route " VRF_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - QUAGGA_IP_REDIST_HELP_STR_ZEBRA) DEFUN (show_ip_route_ospf_instance, show_ip_route_ospf_instance_cmd, @@ -2848,6 +2874,16 @@ DEFUN (show_ip_route_ospf_instance, return CMD_SUCCESS; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " A.B.C.D", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "Network in the IP routing table to display\n" + * + */ DEFUN (show_ip_route_addr, show_ip_route_addr_cmd, "show ip route A.B.C.D", @@ -2894,15 +2930,17 @@ DEFUN (show_ip_route_addr, return CMD_SUCCESS; } -ALIAS (show_ip_route_addr, - show_ip_route_vrf_addr_cmd, - "show ip route " VRF_CMD_STR " A.B.C.D", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "Network in the IP routing table to display\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " A.B.C.D/M", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "IP prefix /, e.g., 35.0.0.0/8\n" + * + */ DEFUN (show_ip_route_prefix, show_ip_route_prefix_cmd, "show ip route A.B.C.D/M", @@ -2949,14 +2987,6 @@ DEFUN (show_ip_route_prefix, return CMD_SUCCESS; } -ALIAS (show_ip_route_prefix, - show_ip_route_vrf_prefix_cmd, - "show ip route " VRF_CMD_STR " A.B.C.D/M", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "IP prefix /, e.g., 35.0.0.0/8\n") static void vty_show_ip_route_summary (struct vty *vty, struct route_table *table) @@ -3108,6 +3138,16 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) } /* Show route summary. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " summary", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "Summary of all routes\n" + * + */ DEFUN (show_ip_route_summary, show_ip_route_summary_cmd, "show ip route summary", @@ -3131,16 +3171,19 @@ DEFUN (show_ip_route_summary, return CMD_SUCCESS; } -ALIAS (show_ip_route_summary, - show_ip_route_vrf_summary_cmd, - "show ip route " VRF_CMD_STR " summary", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "Summary of all routes\n") /* Show route summary prefix. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ip route " VRF_CMD_STR " summary prefix", + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * "Summary of all routes\n" + * "Prefix routes\n" + * + */ DEFUN (show_ip_route_summary_prefix, show_ip_route_summary_prefix_cmd, "show ip route summary prefix", @@ -3165,15 +3208,6 @@ DEFUN (show_ip_route_summary_prefix, return CMD_SUCCESS; } -ALIAS (show_ip_route_summary_prefix, - show_ip_route_vrf_summary_prefix_cmd, - "show ip route " VRF_CMD_STR " summary prefix", - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - "Summary of all routes\n" - "Prefix routes\n") DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, @@ -4740,6 +4774,15 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " {json}", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_ipv6_route, show_ipv6_route_cmd, "show ipv6 route {json}", @@ -4834,14 +4877,18 @@ DEFUN (show_ipv6_route, return CMD_SUCCESS; } -ALIAS (show_ipv6_route, - show_ipv6_route_vrf_cmd, - "show ipv6 route " VRF_CMD_STR " {json}", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " tag <1-65535>", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "Show only routes with tag\n" + * "Tag value\n" + * + */ DEFUN (show_ipv6_route_tag, show_ipv6_route_tag_cmd, "show ipv6 route tag <1-65535>", @@ -4887,16 +4934,18 @@ DEFUN (show_ipv6_route_tag, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_tag, - show_ipv6_route_vrf_tag_cmd, - "show ipv6 route " VRF_CMD_STR " tag <1-65535>", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "Show only routes with tag\n" - "Tag value\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " X:X::X:X/M longer-prefixes", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "IPv6 prefix\n" + * "Show route matching the specified Network/Mask pair only\n" + * + */ DEFUN (show_ipv6_route_prefix_longer, show_ipv6_route_prefix_longer_cmd, "show ipv6 route X:X::X:X/M longer-prefixes", @@ -4947,16 +4996,17 @@ DEFUN (show_ipv6_route_prefix_longer, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_prefix_longer, - show_ipv6_route_vrf_prefix_longer_cmd, - "show ipv6 route " VRF_CMD_STR " X:X::X:X/M longer-prefixes", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "IPv6 prefix\n" - "Show route matching the specified Network/Mask pair only\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, + * SHOW_STR + * IP_STR + * "IP routing table\n" + * VRF_CMD_HELP_STR + * QUAGGA_IP6_REDIST_HELP_STR_ZEBRA + * + */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, @@ -5005,15 +5055,17 @@ DEFUN (show_ipv6_route_protocol, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_protocol, - show_ipv6_route_vrf_protocol_cmd, - "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IP routing table\n" - VRF_CMD_HELP_STR - QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " X:X::X:X", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "IPv6 Address\n" + * + */ DEFUN (show_ipv6_route_addr, show_ipv6_route_addr_cmd, "show ipv6 route X:X::X:X", @@ -5060,15 +5112,17 @@ DEFUN (show_ipv6_route_addr, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_addr, - show_ipv6_route_vrf_addr_cmd, - "show ipv6 route " VRF_CMD_STR " X:X::X:X", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "IPv6 Address\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " X:X::X:X/M ", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "IPv6 prefix\n" + * + */ DEFUN (show_ipv6_route_prefix, show_ipv6_route_prefix_cmd, "show ipv6 route X:X::X:X/M", @@ -5115,16 +5169,18 @@ DEFUN (show_ipv6_route_prefix, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_prefix, - show_ipv6_route_vrf_prefix_cmd, - "show ipv6 route " VRF_CMD_STR " X:X::X:X/M ", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "IPv6 prefix\n") /* Show route summary. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " summary", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "Summary of all IPv6 routes\n" + * + */ DEFUN (show_ipv6_route_summary, show_ipv6_route_summary_cmd, "show ipv6 route summary", @@ -5148,16 +5204,19 @@ DEFUN (show_ipv6_route_summary, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_summary, - show_ipv6_route_vrf_summary_cmd, - "show ipv6 route " VRF_CMD_STR " summary", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "Summary of all IPv6 routes\n") /* Show ipv6 route summary prefix. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 route " VRF_CMD_STR " summary prefix", + * SHOW_STR + * IP_STR + * "IPv6 routing table\n" + * VRF_CMD_HELP_STR + * "Summary of all IPv6 routes\n" + * "Prefix routes\n" + * + */ DEFUN (show_ipv6_route_summary_prefix, show_ipv6_route_summary_prefix_cmd, "show ipv6 route summary prefix", @@ -5182,21 +5241,21 @@ DEFUN (show_ipv6_route_summary_prefix, return CMD_SUCCESS; } -ALIAS (show_ipv6_route_summary_prefix, - show_ipv6_route_vrf_summary_prefix_cmd, - "show ipv6 route " VRF_CMD_STR " summary prefix", - SHOW_STR - IP_STR - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "Summary of all IPv6 routes\n" - "Prefix routes\n") /* * Show IPv6 mroute command.Used to dump * the Multicast routing table. */ +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "show ipv6 mroute " VRF_CMD_STR, + * SHOW_STR + * IP_STR + * "IPv6 Multicast routing table\n" + * VRF_CMD_HELP_STR + * + */ DEFUN (show_ipv6_mroute, show_ipv6_mroute_cmd, "show ipv6 mroute", @@ -5231,13 +5290,6 @@ DEFUN (show_ipv6_mroute, return CMD_SUCCESS; } -ALIAS (show_ipv6_mroute, - show_ipv6_mroute_vrf_cmd, - "show ipv6 mroute " VRF_CMD_STR, - SHOW_STR - IP_STR - "IPv6 Multicast routing table\n" - VRF_CMD_HELP_STR) DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, @@ -5738,6 +5790,14 @@ zebra_ip_config (struct vty *vty) return write; } +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip import-table <1-252>", + * IP_STR + * "import routes from non-main kernel table\n" + * "kernel routing table id\n" + * + */ DEFUN (ip_zebra_import_table_distance, ip_zebra_import_table_distance_cmd, "ip import-table <1-252> distance <1-255>", @@ -5773,13 +5833,17 @@ DEFUN (ip_zebra_import_table_distance, } -ALIAS (ip_zebra_import_table_distance, - ip_zebra_import_table_cmd, - "ip import-table <1-252>", - IP_STR - "import routes from non-main kernel table\n" - "kernel routing table id\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "ip import-table <1-252> route-map WORD", + * IP_STR + * "import routes from non-main kernel table\n" + * "kernel routing table id\n" + * "route-map for filtering\n" + * "route-map name\n" + * + */ DEFUN (ip_zebra_import_table_distance_routemap, ip_zebra_import_table_distance_routemap_cmd, "ip import-table <1-252> distance <1-255> route-map WORD", @@ -5823,15 +5887,16 @@ DEFUN (ip_zebra_import_table_distance_routemap, return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); } -ALIAS (ip_zebra_import_table_distance_routemap, - ip_zebra_import_table_routemap_cmd, - "ip import-table <1-252> route-map WORD", - IP_STR - "import routes from non-main kernel table\n" - "kernel routing table id\n" - "route-map for filtering\n" - "route-map name\n") +/* + * CHECK ME - The following ALIASes need to be implemented in this DEFUN + * "no ip import-table <1-252> distance <1-255> {route-map NAME}", + * IP_STR + * "import routes from non-main kernel table to main table" + * "kernel routing table id\n" + * "distance to be used\n" + * + */ DEFUN (no_ip_zebra_import_table, no_ip_zebra_import_table_cmd, "no ip import-table <1-252> {route-map NAME}", @@ -5865,13 +5930,6 @@ DEFUN (no_ip_zebra_import_table, return (zebra_import_table(AFI_IP, table_id, 0, NULL, 0)); } -ALIAS (no_ip_zebra_import_table, - no_ip_zebra_import_table_distance_cmd, - "no ip import-table <1-252> distance <1-255> {route-map NAME}", - IP_STR - "import routes from non-main kernel table to main table" - "kernel routing table id\n" - "distance to be used\n") static int config_write_protocol (struct vty *vty) @@ -5914,13 +5972,10 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &allow_external_route_update_cmd); install_element (CONFIG_NODE, &no_allow_external_route_update_cmd); - install_element (CONFIG_NODE, &ip_mroute_cmd); install_element (CONFIG_NODE, &ip_mroute_dist_cmd); - install_element (CONFIG_NODE, &no_ip_mroute_cmd); install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd); install_element (CONFIG_NODE, &ip_multicast_mode_cmd); install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd); - install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd); install_element (CONFIG_NODE, &ip_route_cmd); install_element (CONFIG_NODE, &ip_route_tag_cmd); install_element (CONFIG_NODE, &ip_route_flags_cmd); @@ -5935,14 +5990,10 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_cmd); install_element (CONFIG_NODE, &no_ip_route_tag_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd); install_element (CONFIG_NODE, &ip_route_distance_cmd); @@ -5969,22 +6020,17 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd); - install_element (CONFIG_NODE, &ip_zebra_import_table_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_cmd); - install_element (CONFIG_NODE, &ip_zebra_import_table_routemap_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_routemap_cmd); install_element (CONFIG_NODE, &no_ip_zebra_import_table_cmd); - install_element (CONFIG_NODE, &no_ip_zebra_import_table_distance_cmd); install_element (VIEW_NODE, &show_vrf_cmd); install_element (VIEW_NODE, &show_ip_route_cmd); install_element (VIEW_NODE, &show_ip_route_ospf_instance_cmd); install_element (VIEW_NODE, &show_ip_route_tag_cmd); install_element (VIEW_NODE, &show_ip_nht_cmd); - install_element (VIEW_NODE, &show_ip_nht_vrf_cmd); install_element (VIEW_NODE, &show_ip_nht_vrf_all_cmd); install_element (VIEW_NODE, &show_ipv6_nht_cmd); - install_element (VIEW_NODE, &show_ipv6_nht_vrf_cmd); install_element (VIEW_NODE, &show_ipv6_nht_vrf_all_cmd); install_element (VIEW_NODE, &show_ip_route_addr_cmd); install_element (VIEW_NODE, &show_ip_route_prefix_cmd); @@ -5998,10 +6044,8 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ip_route_ospf_instance_cmd); install_element (ENABLE_NODE, &show_ip_route_tag_cmd); install_element (ENABLE_NODE, &show_ip_nht_cmd); - install_element (ENABLE_NODE, &show_ip_nht_vrf_cmd); install_element (ENABLE_NODE, &show_ip_nht_vrf_all_cmd); install_element (ENABLE_NODE, &show_ipv6_nht_cmd); - install_element (ENABLE_NODE, &show_ipv6_nht_vrf_cmd); install_element (ENABLE_NODE, &show_ipv6_nht_vrf_all_cmd); install_element (ENABLE_NODE, &show_ip_route_addr_cmd); install_element (ENABLE_NODE, &show_ip_route_prefix_cmd); @@ -6068,23 +6112,7 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_addr_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_tag_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_prefix_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_protocol_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_supernets_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_summary_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_summary_prefix_cmd); install_element (ENABLE_NODE, &show_ip_route_vrf_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_addr_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_tag_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_protocol_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_supernets_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_summary_cmd); - install_element (ENABLE_NODE, &show_ip_route_vrf_summary_prefix_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_tag_cmd); @@ -6198,22 +6226,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_tag_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_summary_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_protocol_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_addr_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_tag_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_protocol_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_addr_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_summary_cmd); - install_element (ENABLE_NODE, &show_ipv6_route_vrf_summary_prefix_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); @@ -6232,8 +6244,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_cmd); install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd); - install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_cmd); install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); From 9b8fa94e1fe6f4148698b1bacc816bdf48ddbb6f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 04:12:43 +0000 Subject: [PATCH 114/280] tools: alias_destroyer re_install_element None check Signed-off-by: Daniel Walton --- tools/alias_destroyer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/alias_destroyer.py b/tools/alias_destroyer.py index b5aba48fb1..0eec78e463 100755 --- a/tools/alias_destroyer.py +++ b/tools/alias_destroyer.py @@ -241,8 +241,12 @@ def alias_destroy(filename): if 'install_element' in line: # install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); re_install_element = re.search('install_element\s*\(\w+,\s*&(.*)\s*\)', line.strip()) - cmd = re_install_element.group(1) - if cmd not in aliases: + + if re_install_element: + cmd = re_install_element.group(1) + if cmd not in aliases: + fh.write(line) + else: fh.write(line) else: fh.write(line) From 8d1fc5b581e149a7e9212e387bc5f646d4a8920e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 11:33:50 +0000 Subject: [PATCH 115/280] lib: undo <> -> () change I made yesterday Signed-off-by: Daniel Walton --- lib/command.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/command.h b/lib/command.h index 7b0fbfb780..eef4b558af 100644 --- a/lib/command.h +++ b/lib/command.h @@ -372,25 +372,25 @@ struct cmd_element /* IPv4 only machine should not accept IPv6 address for peer's IP address. So we replace VTY command string like below. */ #ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor (A.B.C.D|X:X::X:X) " -#define NO_NEIGHBOR_CMD "no neighbor (A.B.C.D|X:X::X:X) " +#define NEIGHBOR_CMD "neighbor " +#define NO_NEIGHBOR_CMD "no neighbor " #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|X:X::X:X|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|X:X::X:X|WORD) " +#define NEIGHBOR_CMD2 "neighbor " +#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" #else #define NEIGHBOR_CMD "neighbor A.B.C.D " #define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " #define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor (A.B.C.D|WORD) " -#define NO_NEIGHBOR_CMD2 "no neighbor (A.B.C.D|WORD) " +#define NEIGHBOR_CMD2 "neighbor " +#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ /* Dynamic neighbor (listen range) configuration */ #ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range (A.B.C.D/M|X:X::X:X/M) " +#define LISTEN_RANGE_CMD "bgp listen range " #define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" #else #define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " From b162fa7858af5503570065690f139b4ccdd3a9c3 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 11:39:50 +0000 Subject: [PATCH 116/280] Change {json} to [json] Signed-off-by: Daniel Walton --- bgpd/bgp_mplsvpn.c | 16 ++-- bgpd/bgp_route.c | 234 ++++++++++++++++++++++----------------------- bgpd/bgp_vty.c | 80 ++++++++-------- ospfd/ospf_vty.c | 36 +++---- zebra/zebra_vty.c | 8 +- 5 files changed, 187 insertions(+), 187 deletions(-) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 4721a2e8e1..629cfffb30 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -760,7 +760,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, DEFUN (show_bgp_ivp4_vpn, show_bgp_ipv4_vpn_cmd, - "show bgp ipv4 vpn {json}", + "show bgp ipv4 vpn [json]", SHOW_STR BGP_STR "Address Family\n" @@ -771,7 +771,7 @@ DEFUN (show_bgp_ivp4_vpn, DEFUN (show_bgp_ipv6_vpn, show_bgp_ipv6_vpn_cmd, - "show bgp ipv6 vpn {json}", + "show bgp ipv6 vpn [json]", SHOW_STR BGP_STR "Address Family\n" @@ -782,7 +782,7 @@ DEFUN (show_bgp_ipv6_vpn, DEFUN (show_bgp_ipv4_vpn_rd, show_bgp_ipv4_vpn_rd_cmd, - "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn {json}", + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn [json]", SHOW_STR BGP_STR "Address Family\n" @@ -805,7 +805,7 @@ DEFUN (show_bgp_ipv4_vpn_rd, DEFUN (show_bgp_ipv6_vpn_rd, show_bgp_ipv6_vpn_rd_cmd, - "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn {json}", + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn [json]", SHOW_STR BGP_STR "Address Family\n" @@ -899,7 +899,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, show_ip_bgp_vpnv4_all_neighbor_routes_cmd, - "show ip bgp vpnv4 all neighbors A.B.C.D routes {json}", + "show ip bgp vpnv4 all neighbors A.B.C.D routes [json]", SHOW_STR IP_STR BGP_STR @@ -952,7 +952,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, show_ip_bgp_vpnv4_rd_neighbor_routes_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes {json}", + "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]", SHOW_STR IP_STR BGP_STR @@ -1023,7 +1023,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd, - "show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes {json}", + "show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -1075,7 +1075,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes {json}", + "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 37009e1ab9..e408154f20 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7941,7 +7941,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp, show_ip_bgp_cmd, - "show ip bgp {json}", + "show ip bgp [json]", SHOW_STR IP_STR BGP_STR @@ -7952,7 +7952,7 @@ DEFUN (show_ip_bgp, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) {json}", + * "show bgp ipv4 (unicast|multicast) [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -7963,7 +7963,7 @@ DEFUN (show_ip_bgp, */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show ip bgp ipv4 (unicast|multicast) {json}", + "show ip bgp ipv4 (unicast|multicast) [json]", SHOW_STR IP_STR BGP_STR @@ -7984,7 +7984,7 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show ip bgp A.B.C.D {json}", + "show ip bgp A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -7996,7 +7996,7 @@ DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_route_pathtype, show_ip_bgp_route_pathtype_cmd, - "show ip bgp A.B.C.D (bestpath|multipath) {json}", + "show ip bgp A.B.C.D (bestpath|multipath) [json]", SHOW_STR IP_STR BGP_STR @@ -8015,7 +8015,7 @@ DEFUN (show_ip_bgp_route_pathtype, DEFUN (show_bgp_ipv4_safi_route_pathtype, show_bgp_ipv4_safi_route_pathtype_cmd, - "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath) {json}", + "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath) [json]", SHOW_STR BGP_STR "Address family\n" @@ -8042,7 +8042,7 @@ DEFUN (show_bgp_ipv4_safi_route_pathtype, DEFUN (show_bgp_ipv4_prefix, show_bgp_ipv4_prefix_cmd, - "show bgp ipv4 A.B.C.D/M {json}", + "show bgp ipv4 A.B.C.D/M [json]", SHOW_STR BGP_STR IP_STR @@ -8054,7 +8054,7 @@ DEFUN (show_bgp_ipv4_prefix, DEFUN (show_bgp_ipv6_route, show_bgp_ipv6_route_cmd, - "show bgp ipv6 X:X::X:X {JSON}", + "show bgp ipv6 X:X::X:X [json]", SHOW_STR BGP_STR "Address family\n" @@ -8066,7 +8066,7 @@ DEFUN (show_bgp_ipv6_route, DEFUN (show_bgp_ipv6_prefix, show_bgp_ipv6_prefix_cmd, - "show bgp ipv6 X:X::X:X/M {json}", + "show bgp ipv6 X:X::X:X/M [json]", SHOW_STR BGP_STR IP_STR @@ -8078,7 +8078,7 @@ DEFUN (show_bgp_ipv6_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D {json}", + * "show bgp ipv4 (unicast|multicast) A.B.C.D [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8090,7 +8090,7 @@ DEFUN (show_bgp_ipv6_prefix, */ DEFUN (show_ip_bgp_ipv4_route, show_ip_bgp_ipv4_route_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D {json}", + "show ip bgp ipv4 (unicast|multicast) A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8111,7 +8111,7 @@ DEFUN (show_ip_bgp_ipv4_route, DEFUN (show_ip_bgp_vpnv4_all_route, show_ip_bgp_vpnv4_all_route_cmd, - "show ip bgp vpnv4 all A.B.C.D {json}", + "show ip bgp vpnv4 all A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8125,7 +8125,7 @@ DEFUN (show_ip_bgp_vpnv4_all_route, DEFUN (show_bgp_ipv4_vpn_route, show_bgp_ipv4_vpn_route_cmd, - "show bgp ipv4 vpn A.B.C.D {json}", + "show bgp ipv4 vpn A.B.C.D [json]", SHOW_STR BGP_STR "Address Family\n" @@ -8138,7 +8138,7 @@ DEFUN (show_bgp_ipv4_vpn_route, DEFUN (show_bgp_ipv6_vpn_route, show_bgp_ipv6_vpn_route_cmd, - "show bgp ipv6 vpn X:X::X:X {json}", + "show bgp ipv6 vpn X:X::X:X [json]", SHOW_STR BGP_STR "Address Family\n" @@ -8151,7 +8151,7 @@ DEFUN (show_bgp_ipv6_vpn_route, DEFUN (show_bgp_ipv4_vpn_rd_route, show_bgp_ipv4_vpn_rd_route_cmd, - "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn A.B.C.D {json}", + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn A.B.C.D [json]", SHOW_STR BGP_STR IP_STR @@ -8175,7 +8175,7 @@ DEFUN (show_bgp_ipv4_vpn_rd_route, DEFUN (show_bgp_ipv6_vpn_rd_route, show_bgp_ipv6_vpn_rd_route_cmd, - "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn X:X::X:X {json}", + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn X:X::X:X [json]", SHOW_STR BGP_STR "Address Family\n" @@ -8199,7 +8199,7 @@ DEFUN (show_bgp_ipv6_vpn_rd_route, DEFUN (show_ip_bgp_vpnv4_rd_route, show_ip_bgp_vpnv4_rd_route_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D {json}", + "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8224,7 +8224,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, DEFUN (show_ip_bgp_prefix, show_ip_bgp_prefix_cmd, - "show ip bgp A.B.C.D/M {json}", + "show ip bgp A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8236,7 +8236,7 @@ DEFUN (show_ip_bgp_prefix, DEFUN (show_ip_bgp_prefix_pathtype, show_ip_bgp_prefix_pathtype_cmd, - "show ip bgp A.B.C.D/M (bestpath|multipath) {json}", + "show ip bgp A.B.C.D/M (bestpath|multipath) [json]", SHOW_STR IP_STR BGP_STR @@ -8254,7 +8254,7 @@ DEFUN (show_ip_bgp_prefix_pathtype, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D/M {json}", + * "show bgp ipv4 (unicast|multicast) A.B.C.D/M [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8266,7 +8266,7 @@ DEFUN (show_ip_bgp_prefix_pathtype, */ DEFUN (show_ip_bgp_ipv4_prefix, show_ip_bgp_ipv4_prefix_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M {json}", + "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8287,7 +8287,7 @@ DEFUN (show_ip_bgp_ipv4_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) {json}", + * "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8301,7 +8301,7 @@ DEFUN (show_ip_bgp_ipv4_prefix, */ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, show_ip_bgp_ipv4_prefix_pathtype_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) {json}", + "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) [json]", SHOW_STR IP_STR BGP_STR @@ -8330,7 +8330,7 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, DEFUN (show_ip_bgp_vpnv4_all_prefix, show_ip_bgp_vpnv4_all_prefix_cmd, - "show ip bgp vpnv4 all A.B.C.D/M {json}", + "show ip bgp vpnv4 all A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8344,7 +8344,7 @@ DEFUN (show_ip_bgp_vpnv4_all_prefix, DEFUN (show_ip_bgp_vpnv4_rd_prefix, show_ip_bgp_vpnv4_rd_prefix_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M {json}", + "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8368,7 +8368,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, DEFUN (show_ip_bgp_view, show_ip_bgp_instance_cmd, - "show ip bgp " BGP_INSTANCE_CMD " {json}", + "show ip bgp " BGP_INSTANCE_CMD " [json]", SHOW_STR IP_STR BGP_STR @@ -8390,7 +8390,7 @@ DEFUN (show_ip_bgp_view, DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " {json}", + "show ip bgp " BGP_INSTANCE_ALL_CMD " [json]", SHOW_STR IP_STR BGP_STR @@ -8405,7 +8405,7 @@ DEFUN (show_ip_bgp_instance_all, DEFUN (show_ip_bgp_instance_route, show_ip_bgp_instance_route_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D {json}", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8418,7 +8418,7 @@ DEFUN (show_ip_bgp_instance_route, DEFUN (show_ip_bgp_instance_route_pathtype, show_ip_bgp_instance_route_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D (bestpath|multipath) {json}", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D (bestpath|multipath) [json]", SHOW_STR IP_STR BGP_STR @@ -8438,7 +8438,7 @@ DEFUN (show_ip_bgp_instance_route_pathtype, DEFUN (show_ip_bgp_instance_prefix, show_ip_bgp_instance_prefix_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M {json}", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8451,7 +8451,7 @@ DEFUN (show_ip_bgp_instance_prefix, DEFUN (show_ip_bgp_instance_prefix_pathtype, show_ip_bgp_instance_prefix_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M (bestpath|multipath) {json}", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M (bestpath|multipath) [json]", SHOW_STR IP_STR BGP_STR @@ -8471,7 +8471,7 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 {json}", + * "show bgp ipv6 [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8480,7 +8480,7 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, */ DEFUN (show_bgp, show_bgp_cmd, - "show bgp {json}", + "show bgp [json]", SHOW_STR BGP_STR "JavaScript Object Notation\n") @@ -8492,7 +8492,7 @@ DEFUN (show_bgp, DEFUN (show_bgp_ipv6_safi, show_bgp_ipv6_safi_cmd, - "show bgp ipv6 (unicast|multicast) {json}", + "show bgp ipv6 (unicast|multicast) [json]", SHOW_STR BGP_STR "Address family\n" @@ -8519,7 +8519,7 @@ bgp_show_ipv6_bgp_deprecate_warning (struct vty *vty) /* old command */ DEFUN (show_ipv6_bgp, show_ipv6_bgp_cmd, - "show ipv6 bgp {json}", + "show ipv6 bgp [json]", SHOW_STR IP_STR BGP_STR @@ -8532,7 +8532,7 @@ DEFUN (show_ipv6_bgp, DEFUN (show_bgp_route, show_bgp_route_cmd, - "show bgp X:X::X:X {json}", + "show bgp X:X::X:X [json]", SHOW_STR BGP_STR "Network in the BGP routing table to display\n" @@ -8543,7 +8543,7 @@ DEFUN (show_bgp_route, DEFUN (show_bgp_ipv6_safi_route, show_bgp_ipv6_safi_route_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X {json}", + "show bgp ipv6 (unicast|multicast) X:X::X:X [json]", SHOW_STR BGP_STR "Address family\n" @@ -8561,7 +8561,7 @@ DEFUN (show_bgp_ipv6_safi_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 X:X::X:X (bestpath|multipath) {json}", + * "show bgp ipv6 X:X::X:X (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8573,7 +8573,7 @@ DEFUN (show_bgp_ipv6_safi_route, */ DEFUN (show_bgp_route_pathtype, show_bgp_route_pathtype_cmd, - "show bgp X:X::X:X (bestpath|multipath) {json}", + "show bgp X:X::X:X (bestpath|multipath) [json]", SHOW_STR BGP_STR "Network in the BGP routing table to display\n" @@ -8591,7 +8591,7 @@ DEFUN (show_bgp_route_pathtype, DEFUN (show_bgp_ipv6_safi_route_pathtype, show_bgp_ipv6_safi_route_pathtype_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath) {json}", + "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath) [json]", SHOW_STR BGP_STR "Address family\n" @@ -8618,7 +8618,7 @@ DEFUN (show_bgp_ipv6_safi_route_pathtype, /* old command */ DEFUN (show_ipv6_bgp_route, show_ipv6_bgp_route_cmd, - "show ipv6 bgp X:X::X:X {json}", + "show ipv6 bgp X:X::X:X [json]", SHOW_STR IP_STR BGP_STR @@ -8631,7 +8631,7 @@ DEFUN (show_ipv6_bgp_route, DEFUN (show_bgp_prefix, show_bgp_prefix_cmd, - "show bgp X:X::X:X/M {json}", + "show bgp X:X::X:X/M [json]", SHOW_STR BGP_STR "IPv6 prefix /\n" @@ -8642,7 +8642,7 @@ DEFUN (show_bgp_prefix, DEFUN (show_bgp_ipv6_safi_prefix, show_bgp_ipv6_safi_prefix_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X/M {json}", + "show bgp ipv6 (unicast|multicast) X:X::X:X/M [json]", SHOW_STR BGP_STR "Address family\n" @@ -8660,7 +8660,7 @@ DEFUN (show_bgp_ipv6_safi_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 X:X::X:X/M (bestpath|multipath) {json}", + * "show bgp ipv6 X:X::X:X/M (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -8672,7 +8672,7 @@ DEFUN (show_bgp_ipv6_safi_prefix, */ DEFUN (show_bgp_prefix_pathtype, show_bgp_prefix_pathtype_cmd, - "show bgp X:X::X:X/M (bestpath|multipath) {json}", + "show bgp X:X::X:X/M (bestpath|multipath) [json]", SHOW_STR BGP_STR "IPv6 prefix /\n" @@ -8690,7 +8690,7 @@ DEFUN (show_bgp_prefix_pathtype, DEFUN (show_bgp_ipv6_safi_prefix_pathtype, show_bgp_ipv6_safi_prefix_pathtype_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath) {json}", + "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath) [json]", SHOW_STR BGP_STR "Address family\n" @@ -8717,7 +8717,7 @@ DEFUN (show_bgp_ipv6_safi_prefix_pathtype, /* old command */ DEFUN (show_ipv6_bgp_prefix, show_ipv6_bgp_prefix_cmd, - "show ipv6 bgp X:X::X:X/M {json}", + "show ipv6 bgp X:X::X:X/M [json]", SHOW_STR IP_STR BGP_STR @@ -8730,7 +8730,7 @@ DEFUN (show_ipv6_bgp_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8740,7 +8740,7 @@ DEFUN (show_ipv6_bgp_prefix, */ DEFUN (show_bgp_view, show_bgp_instance_cmd, - "show bgp " BGP_INSTANCE_CMD " {json}", + "show bgp " BGP_INSTANCE_CMD " [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8761,7 +8761,7 @@ DEFUN (show_bgp_view, DEFUN (show_bgp_instance_all, show_bgp_instance_all_cmd, - "show bgp " BGP_INSTANCE_ALL_CMD " {json}", + "show bgp " BGP_INSTANCE_ALL_CMD " [json]", SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR @@ -8776,7 +8776,7 @@ DEFUN (show_bgp_instance_all, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8787,7 +8787,7 @@ DEFUN (show_bgp_instance_all, */ DEFUN (show_bgp_instance_route, show_bgp_instance_route_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X {json}", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8800,7 +8800,7 @@ DEFUN (show_bgp_instance_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X (bestpath|multipath) {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8813,7 +8813,7 @@ DEFUN (show_bgp_instance_route, */ DEFUN (show_bgp_instance_route_pathtype, show_bgp_instance_route_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X (bestpath|multipath) {json}", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X (bestpath|multipath) [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8832,7 +8832,7 @@ DEFUN (show_bgp_instance_route_pathtype, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8843,7 +8843,7 @@ DEFUN (show_bgp_instance_route_pathtype, */ DEFUN (show_bgp_instance_prefix, show_bgp_instance_prefix_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M {json}", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8856,7 +8856,7 @@ DEFUN (show_bgp_instance_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M (bestpath|multipath) {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8869,7 +8869,7 @@ DEFUN (show_bgp_instance_prefix, */ DEFUN (show_bgp_instance_prefix_pathtype, show_bgp_instance_prefix_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M (bestpath|multipath) {json}", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M (bestpath|multipath) [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9015,7 +9015,7 @@ DEFUN (show_bgp_instance_prefix_longer, /* old command */ DEFUN (show_ipv6_mbgp, show_ipv6_mbgp_cmd, - "show ipv6 mbgp {json}", + "show ipv6 mbgp [json]", SHOW_STR IP_STR MBGP_STR @@ -9029,7 +9029,7 @@ DEFUN (show_ipv6_mbgp, /* old command */ DEFUN (show_ipv6_mbgp_route, show_ipv6_mbgp_route_cmd, - "show ipv6 mbgp X:X::X:X {json}", + "show ipv6 mbgp X:X::X:X [json]", SHOW_STR IP_STR MBGP_STR @@ -9043,7 +9043,7 @@ DEFUN (show_ipv6_mbgp_route, /* old command */ DEFUN (show_ipv6_mbgp_prefix, show_ipv6_mbgp_prefix_cmd, - "show ipv6 mbgp X:X::X:X/M {json}", + "show ipv6 mbgp X:X::X:X/M [json]", SHOW_STR IP_STR MBGP_STR @@ -12045,7 +12045,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_neighbor_prefix_counts, show_ip_bgp_neighbor_prefix_counts_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12068,7 +12068,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12092,7 +12092,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, DEFUN (show_bgp_ipv6_neighbor_prefix_counts, show_bgp_ipv6_neighbor_prefix_counts_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR BGP_STR "Address family\n" @@ -12115,7 +12115,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, show_bgp_instance_ipv6_neighbor_prefix_counts_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12139,7 +12139,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, show_ip_bgp_ipv4_neighbor_prefix_counts_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12168,7 +12168,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd, - "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}", + "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12434,7 +12434,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12449,7 +12449,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, */ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12476,7 +12476,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12490,7 +12490,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, */ DEFUN (show_ip_bgp_neighbor_advertised_route, show_ip_bgp_neighbor_advertised_route_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12521,7 +12521,7 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}", + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12539,7 +12539,7 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, */ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, show_ip_bgp_ipv4_neighbor_advertised_route_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12574,7 +12574,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -12589,7 +12589,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_advertised_route, show_bgp_instance_neighbor_advertised_route_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12617,7 +12617,7 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -12628,7 +12628,7 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, * "Display the routes advertised to a BGP neighbor\n" * "JavaScript Object Notation\n" * - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", * SHOW_STR * IPV6_STR * BGP_STR @@ -12642,7 +12642,7 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, */ DEFUN (show_bgp_neighbor_advertised_route, show_bgp_neighbor_advertised_route_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -12674,7 +12674,7 @@ DEFUN (show_bgp_neighbor_advertised_route, /* old command */ DEFUN (ipv6_mbgp_neighbor_advertised_route, ipv6_mbgp_neighbor_advertised_route_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}", + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", SHOW_STR IPV6_STR MBGP_STR @@ -12700,7 +12700,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -12715,7 +12715,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_received_routes, show_bgp_instance_neighbor_received_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12738,7 +12738,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12753,7 +12753,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, */ DEFUN (show_ip_bgp_instance_neighbor_received_routes, show_ip_bgp_instance_neighbor_received_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12778,7 +12778,7 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12792,7 +12792,7 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, */ DEFUN (show_ip_bgp_neighbor_received_routes, show_ip_bgp_neighbor_received_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12823,7 +12823,7 @@ DEFUN (show_ip_bgp_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}", + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12840,7 +12840,7 @@ DEFUN (show_ip_bgp_neighbor_received_routes, */ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, show_ip_bgp_ipv4_neighbor_received_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12874,7 +12874,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}", + "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12910,7 +12910,7 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", SHOW_STR IP_STR BGP_STR @@ -12997,7 +12997,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", SHOW_STR IP_STR BGP_STR @@ -13114,7 +13114,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13125,7 +13125,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, * "Display the received routes from neighbor\n" * "JavaScript Object Notation\n" * - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", * SHOW_STR * IPV6_STR * BGP_STR @@ -13139,7 +13139,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, */ DEFUN (show_bgp_neighbor_received_routes, show_bgp_neighbor_received_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13167,7 +13167,7 @@ DEFUN (show_bgp_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13182,7 +13182,7 @@ DEFUN (show_bgp_neighbor_received_routes, */ DEFUN (show_bgp_neighbor_received_prefix_filter, show_bgp_neighbor_received_prefix_filter_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13272,7 +13272,7 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, /* old command */ DEFUN (ipv6_mbgp_neighbor_received_routes, ipv6_mbgp_neighbor_received_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}", + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", SHOW_STR IPV6_STR MBGP_STR @@ -13296,7 +13296,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13312,7 +13312,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, */ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, show_bgp_instance_neighbor_received_prefix_filter_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13428,7 +13428,7 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR IP_STR BGP_STR @@ -13452,7 +13452,7 @@ DEFUN (show_ip_bgp_neighbor_routes, DEFUN (show_ip_bgp_instance_neighbor_routes, show_ip_bgp_instance_neighbor_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR IP_STR BGP_STR @@ -13477,7 +13477,7 @@ DEFUN (show_ip_bgp_instance_neighbor_routes, DEFUN (show_ip_bgp_neighbor_flap, show_ip_bgp_neighbor_flap_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", SHOW_STR IP_STR BGP_STR @@ -13501,7 +13501,7 @@ DEFUN (show_ip_bgp_neighbor_flap, DEFUN (show_ip_bgp_neighbor_damp, show_ip_bgp_neighbor_damp_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", SHOW_STR IP_STR BGP_STR @@ -13525,7 +13525,7 @@ DEFUN (show_ip_bgp_neighbor_damp, DEFUN (show_ip_bgp_ipv4_neighbor_routes, show_ip_bgp_ipv4_neighbor_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR IP_STR BGP_STR @@ -13557,7 +13557,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13572,7 +13572,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_routes, show_bgp_instance_neighbor_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13597,7 +13597,7 @@ DEFUN (show_bgp_instance_neighbor_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", * SHOW_STR * BGP_STR * "Detailed information on TCP and BGP neighbor connections\n" @@ -13607,7 +13607,7 @@ DEFUN (show_bgp_instance_neighbor_routes, * "Display the dampened routes received from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13619,7 +13619,7 @@ DEFUN (show_bgp_instance_neighbor_routes, * "Display the dampened routes received from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13633,7 +13633,7 @@ DEFUN (show_bgp_instance_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_damp, show_bgp_instance_neighbor_damp_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13663,7 +13663,7 @@ DEFUN (show_bgp_instance_neighbor_damp, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", * SHOW_STR * BGP_STR * "Detailed information on TCP and BGP neighbor connections\n" @@ -13673,7 +13673,7 @@ DEFUN (show_bgp_instance_neighbor_damp, * "Display flap statistics of the routes learned from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13685,7 +13685,7 @@ DEFUN (show_bgp_instance_neighbor_damp, * "Display flap statistics of the routes learned from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13699,7 +13699,7 @@ DEFUN (show_bgp_instance_neighbor_damp, */ DEFUN (show_bgp_instance_neighbor_flap, show_bgp_instance_neighbor_flap_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics {json}", + "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13729,7 +13729,7 @@ DEFUN (show_bgp_instance_neighbor_flap, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", * SHOW_STR * IPV6_STR * BGP_STR @@ -13740,7 +13740,7 @@ DEFUN (show_bgp_instance_neighbor_flap, * "Display routes learned from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13754,7 +13754,7 @@ DEFUN (show_bgp_instance_neighbor_flap, */ DEFUN (show_bgp_neighbor_routes, show_bgp_neighbor_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13782,7 +13782,7 @@ DEFUN (show_bgp_neighbor_routes, /* old command */ DEFUN (ipv6_mbgp_neighbor_routes, ipv6_mbgp_neighbor_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}", + "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", SHOW_STR IPV6_STR MBGP_STR diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 60e8d36c98..5a06dd8e8a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10115,7 +10115,7 @@ DEFUN (show_bgp_views, DEFUN (show_bgp_vrfs, show_bgp_vrfs_cmd, - "show bgp vrfs {json}", + "show bgp vrfs [json]", SHOW_STR BGP_STR "Show BGP VRFs\n" @@ -10761,7 +10761,7 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show ip bgp summary {json}", + "show ip bgp summary [json]", SHOW_STR IP_STR BGP_STR @@ -10774,7 +10774,7 @@ DEFUN (show_ip_bgp_summary, DEFUN (show_ip_bgp_instance_summary, show_ip_bgp_instance_summary_cmd, - "show ip bgp " BGP_INSTANCE_CMD " summary {json}", + "show ip bgp " BGP_INSTANCE_CMD " summary [json]", SHOW_STR IP_STR BGP_STR @@ -10788,7 +10788,7 @@ DEFUN (show_ip_bgp_instance_summary, DEFUN (show_ip_bgp_instance_all_summary, show_ip_bgp_instance_all_summary_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}", + "show ip bgp " BGP_INSTANCE_ALL_CMD " summary [json]", SHOW_STR IP_STR BGP_STR @@ -10804,7 +10804,7 @@ DEFUN (show_ip_bgp_instance_all_summary, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) summary {json}", + * "show bgp ipv4 (unicast|multicast) summary [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -10815,7 +10815,7 @@ DEFUN (show_ip_bgp_instance_all_summary, */ DEFUN (show_ip_bgp_ipv4_summary, show_ip_bgp_ipv4_summary_cmd, - "show ip bgp ipv4 (unicast|multicast) summary {json}", + "show ip bgp ipv4 (unicast|multicast) summary [json]", SHOW_STR IP_STR BGP_STR @@ -10835,7 +10835,7 @@ DEFUN (show_ip_bgp_ipv4_summary, DEFUN (show_bgp_ipv4_vpn_summary, show_bgp_ipv4_vpn_summary_cmd, - "show bgp ipv4 vpn summary {json}", + "show bgp ipv4 vpn summary [json]", SHOW_STR BGP_STR "IPv4\n" @@ -10849,7 +10849,7 @@ DEFUN (show_bgp_ipv4_vpn_summary, /* `show ip bgp summary' commands. */ DEFUN (show_bgp_ipv6_vpn_summary, show_bgp_ipv6_vpn_summary_cmd, - "show bgp ipv6 vpn summary {json}", + "show bgp ipv6 vpn summary [json]", SHOW_STR BGP_STR "IPv6\n" @@ -10862,7 +10862,7 @@ DEFUN (show_bgp_ipv6_vpn_summary, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp view WORD ipv4 (unicast|multicast) summary {json}", + * "show bgp view WORD ipv4 (unicast|multicast) summary [json]", * SHOW_STR * BGP_STR * "BGP view\n" @@ -10875,7 +10875,7 @@ DEFUN (show_bgp_ipv6_vpn_summary, */ DEFUN (show_ip_bgp_instance_ipv4_summary, show_ip_bgp_instance_ipv4_summary_cmd, - "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", + "show ip bgp view WORD ipv4 (unicast|multicast) summary [json]", SHOW_STR IP_STR BGP_STR @@ -10897,7 +10897,7 @@ DEFUN (show_ip_bgp_instance_ipv4_summary, DEFUN (show_ip_bgp_vpnv4_all_summary, show_ip_bgp_vpnv4_all_summary_cmd, - "show ip bgp vpnv4 all summary {json}", + "show ip bgp vpnv4 all summary [json]", SHOW_STR IP_STR BGP_STR @@ -10912,7 +10912,7 @@ DEFUN (show_ip_bgp_vpnv4_all_summary, DEFUN (show_ip_bgp_vpnv4_rd_summary, show_ip_bgp_vpnv4_rd_summary_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", + "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json]", SHOW_STR IP_STR BGP_STR @@ -10939,7 +10939,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 summary {json}", + * "show bgp ipv6 summary [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -10948,7 +10948,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary, */ DEFUN (show_bgp_summary, show_bgp_summary_cmd, - "show bgp summary {json}", + "show bgp summary [json]", SHOW_STR BGP_STR "Summary of BGP neighbor status\n" @@ -10959,7 +10959,7 @@ DEFUN (show_bgp_summary, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 summary [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -10969,7 +10969,7 @@ DEFUN (show_bgp_summary, */ DEFUN (show_bgp_instance_summary, show_bgp_instance_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " summary {json}", + "show bgp " BGP_INSTANCE_CMD " summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10981,7 +10981,7 @@ DEFUN (show_bgp_instance_summary, DEFUN (show_bgp_instance_all_summary, show_bgp_instance_all_summary_cmd, - "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}", + "show bgp " BGP_INSTANCE_ALL_CMD " summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR @@ -10998,7 +10998,7 @@ DEFUN (show_bgp_instance_all_summary, DEFUN (show_bgp_ipv6_safi_summary, show_bgp_ipv6_safi_summary_cmd, - "show bgp ipv6 (unicast|multicast) summary {json}", + "show bgp ipv6 (unicast|multicast) summary [json]", SHOW_STR BGP_STR "Address family\n" @@ -11016,7 +11016,7 @@ DEFUN (show_bgp_ipv6_safi_summary, DEFUN (show_bgp_instance_ipv6_safi_summary, show_bgp_instance_ipv6_safi_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}", + "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -11036,7 +11036,7 @@ DEFUN (show_bgp_instance_ipv6_safi_summary, /* old command */ DEFUN (show_ipv6_bgp_summary, show_ipv6_bgp_summary_cmd, - "show ipv6 bgp summary {json}", + "show ipv6 bgp summary [json]", SHOW_STR IPV6_STR BGP_STR @@ -11050,7 +11050,7 @@ DEFUN (show_ipv6_bgp_summary, /* old command */ DEFUN (show_ipv6_mbgp_summary, show_ipv6_mbgp_summary_cmd, - "show ipv6 mbgp summary {json}", + "show ipv6 mbgp summary [json]", SHOW_STR IPV6_STR MBGP_STR @@ -12894,7 +12894,7 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) /* "show ip bgp neighbors" commands. */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", + * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12904,13 +12904,13 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show bgp neighbors {json}", + * "show bgp neighbors [json]", * SHOW_STR * BGP_STR * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show ip bgp vpnv4 all neighbors {json}", + * "show ip bgp vpnv4 all neighbors [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12919,7 +12919,7 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show ip bgp ipv4 (unicast|multicast) neighbors {json}", + * "show ip bgp ipv4 (unicast|multicast) neighbors [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12929,7 +12929,7 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show bgp ipv6 neighbors {json}", + * "show bgp ipv6 neighbors [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -12939,7 +12939,7 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) */ DEFUN (show_ip_bgp_neighbors, show_ip_bgp_neighbors_cmd, - "show ip bgp neighbors {json}", + "show ip bgp neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -12958,7 +12958,7 @@ DEFUN (show_ip_bgp_neighbors, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12971,7 +12971,7 @@ DEFUN (show_ip_bgp_neighbors, * "Neighbor on bgp configured interface\n" * "JavaScript Object Notation\n" * - * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", + * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12981,7 +12981,7 @@ DEFUN (show_ip_bgp_neighbors, * "Neighbor to display information about\n" * "JavaScript Object Notation\n" * - * "show ip bgp vpnv4 all neighbors A.B.C.D {json}", + * "show ip bgp vpnv4 all neighbors A.B.C.D [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12991,7 +12991,7 @@ DEFUN (show_ip_bgp_neighbors, * "Neighbor to display information about\n" * "JavaScript Object Notation\n" * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * "Address family\n" @@ -13001,7 +13001,7 @@ DEFUN (show_ip_bgp_neighbors, * "Neighbor on bgp configured interface\n" * "JavaScript Object Notation\n" * - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * "Detailed information on TCP and BGP neighbor connections\n" @@ -13013,7 +13013,7 @@ DEFUN (show_ip_bgp_neighbors, */ DEFUN (show_ip_bgp_neighbors_peer, show_ip_bgp_neighbors_peer_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", SHOW_STR IP_STR BGP_STR @@ -13035,14 +13035,14 @@ DEFUN (show_ip_bgp_neighbors_peer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " neighbors {json}", + * "show bgp " BGP_INSTANCE_CMD " neighbors [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13053,7 +13053,7 @@ DEFUN (show_ip_bgp_neighbors_peer, */ DEFUN (show_ip_bgp_instance_neighbors, show_ip_bgp_instance_neighbors_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -13068,7 +13068,7 @@ DEFUN (show_ip_bgp_instance_neighbors, DEFUN (show_ip_bgp_instance_all_neighbors, show_ip_bgp_instance_all_neighbors_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}", + "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -13086,7 +13086,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13097,7 +13097,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, * "Neighbor on bgp configured interface\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + * "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13110,7 +13110,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, */ DEFUN (show_ip_bgp_instance_neighbors_peer, show_ip_bgp_instance_neighbors_peer_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", + "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", SHOW_STR IP_STR BGP_STR diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index e88f9789e0..e34c0bbeb3 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3601,7 +3601,7 @@ show_ip_ospf_common (struct vty *vty, struct ospf *ospf, u_char use_json) DEFUN (show_ip_ospf, show_ip_ospf_cmd, - "show ip ospf {json}", + "show ip ospf [json]", SHOW_STR IP_STR "OSPF information\n" @@ -3618,7 +3618,7 @@ DEFUN (show_ip_ospf, DEFUN (show_ip_ospf_instance, show_ip_ospf_instance_cmd, - "show ip ospf <1-65535> {json}", + "show ip ospf <1-65535> [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4009,7 +4009,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, DEFUN (show_ip_ospf_interface, show_ip_ospf_interface_cmd, - "show ip ospf interface [INTERFACE] {json}", + "show ip ospf interface [INTERFACE] [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4028,7 +4028,7 @@ DEFUN (show_ip_ospf_interface, DEFUN (show_ip_ospf_instance_interface, show_ip_ospf_instance_interface_cmd, - "show ip ospf <1-65535> interface [INTERFACE] {json}", + "show ip ospf <1-65535> interface [INTERFACE] [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4166,7 +4166,7 @@ show_ip_ospf_neighbor_common (struct vty *vty, struct ospf *ospf, u_char use_jso DEFUN (show_ip_ospf_neighbor, show_ip_ospf_neighbor_cmd, - "show ip ospf neighbor {json}", + "show ip ospf neighbor [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4185,7 +4185,7 @@ DEFUN (show_ip_ospf_neighbor, DEFUN (show_ip_ospf_instance_neighbor, show_ip_ospf_instance_neighbor_cmd, - "show ip ospf <1-65535> neighbor {json}", + "show ip ospf <1-65535> neighbor [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4277,7 +4277,7 @@ show_ip_ospf_neighbor_all_common (struct vty *vty, struct ospf *ospf, u_char use DEFUN (show_ip_ospf_neighbor_all, show_ip_ospf_neighbor_all_cmd, - "show ip ospf neighbor all {json}", + "show ip ospf neighbor all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4296,7 +4296,7 @@ DEFUN (show_ip_ospf_neighbor_all, DEFUN (show_ip_ospf_instance_neighbor_all, show_ip_ospf_instance_neighbor_all_cmd, - "show ip ospf <1-65535> neighbor all {json}", + "show ip ospf <1-65535> neighbor all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4371,7 +4371,7 @@ show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_ba DEFUN (show_ip_ospf_neighbor_int, show_ip_ospf_neighbor_int_cmd, - "show ip ospf neighbor IFNAME {json}", + "show ip ospf neighbor IFNAME [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4390,7 +4390,7 @@ DEFUN (show_ip_ospf_neighbor_int, DEFUN (show_ip_ospf_instance_neighbor_int, show_ip_ospf_instance_neighbor_int_cmd, - "show ip ospf <1-65535> neighbor IFNAME {json}", + "show ip ospf <1-65535> neighbor IFNAME [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4737,7 +4737,7 @@ show_ip_ospf_neighbor_id_common (struct vty *vty, struct ospf *ospf, DEFUN (show_ip_ospf_neighbor_id, show_ip_ospf_neighbor_id_cmd, - "show ip ospf neighbor A.B.C.D {json}", + "show ip ospf neighbor A.B.C.D [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4756,7 +4756,7 @@ DEFUN (show_ip_ospf_neighbor_id, DEFUN (show_ip_ospf_instance_neighbor_id, show_ip_ospf_instance_neighbor_id_cmd, - "show ip ospf <1-65535> neighbor A.B.C.D {json}", + "show ip ospf <1-65535> neighbor A.B.C.D [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4828,7 +4828,7 @@ show_ip_ospf_neighbor_detail_common (struct vty *vty, struct ospf *ospf, u_char DEFUN (show_ip_ospf_neighbor_detail, show_ip_ospf_neighbor_detail_cmd, - "show ip ospf neighbor detail {json}", + "show ip ospf neighbor detail [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4847,7 +4847,7 @@ DEFUN (show_ip_ospf_neighbor_detail, DEFUN (show_ip_ospf_instance_neighbor_detail, show_ip_ospf_instance_neighbor_detail_cmd, - "show ip ospf <1-65535> neighbor detail {json}", + "show ip ospf <1-65535> neighbor detail [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4925,7 +4925,7 @@ show_ip_ospf_neighbor_detail_all_common (struct vty *vty, struct ospf *ospf, u_c DEFUN (show_ip_ospf_neighbor_detail_all, show_ip_ospf_neighbor_detail_all_cmd, - "show ip ospf neighbor detail all {json}", + "show ip ospf neighbor detail all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4945,7 +4945,7 @@ DEFUN (show_ip_ospf_neighbor_detail_all, DEFUN (show_ip_ospf_instance_neighbor_detail_all, show_ip_ospf_instance_neighbor_detail_all_cmd, - "show ip ospf <1-65535> neighbor detail all {json}", + "show ip ospf <1-65535> neighbor detail all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -5027,7 +5027,7 @@ show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf, DEFUN (show_ip_ospf_neighbor_int_detail, show_ip_ospf_neighbor_int_detail_cmd, - "show ip ospf neighbor IFNAME detail {json}", + "show ip ospf neighbor IFNAME detail [json]", SHOW_STR IP_STR "OSPF information\n" @@ -5047,7 +5047,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, DEFUN (show_ip_ospf_instance_neighbor_int_detail, show_ip_ospf_instance_neighbor_int_detail_cmd, - "show ip ospf <1-65535> neighbor IFNAME detail {json}", + "show ip ospf <1-65535> neighbor IFNAME detail [json]", SHOW_STR IP_STR "OSPF information\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 491abbba4a..f4a663ab3a 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2342,7 +2342,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib, DEFUN (show_ip_route, show_ip_route_cmd, - "show ip route {json}", + "show ip route [json]", SHOW_STR IP_STR "IP routing table\n") @@ -2436,7 +2436,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route " VRF_CMD_STR " {json}", + "show ip route " VRF_CMD_STR " [json]", SHOW_STR IP_STR "IP routing table\n" @@ -4776,7 +4776,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " {json}", + * "show ipv6 route " VRF_CMD_STR " [json]", * SHOW_STR * IP_STR * "IPv6 routing table\n" @@ -4785,7 +4785,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, */ DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 route {json}", + "show ipv6 route [json]", SHOW_STR IP_STR "IPv6 routing table\n") From a5b5627b8b7e63f73d856802394ed7e39e26da0b Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 13:27:26 +0000 Subject: [PATCH 117/280] tools: argv_translator convert <1-255> to (1-255), ()s to <>s, etc Signed-off-by: Daniel Walton --- tools/argv_translator.py | 256 +++++++++++++++++++++++++++++++++------ 1 file changed, 219 insertions(+), 37 deletions(-) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 3464a81d71..08a680066c 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -3,7 +3,9 @@ import re import sys import os -from pprint import pformat +import subprocess +from copy import deepcopy +from pprint import pformat, pprint def token_is_variable(line_number, token): @@ -28,26 +30,16 @@ def token_is_variable(line_number, token): assert '|' not in token, "%d: Weird token %s has a | but does not start with [ or (" % (line_number, token) if token in ('WORD', - '.LINE', # where is this defined? - 'LINE', - 'BANDWIDTH', - 'RMAP_NAME', - 'ROUTEMAP_NAME', - 'IPV6ADDR', - 'IF_OR_ADDR', - 'INTERFACE', - 'PERCENTAGE', - 'IFNAME', - 'NAME', - 'BITPATTERN', - 'PATH', + '.LINE', + '.AA:NN', 'A.B.C.D', 'A.B.C.D/M', 'X:X::X:X', 'X:X::X:X/M', - 'ASN:nn_or_IP-address:nn'): # where is this defined? + 'ASN:nn_or_IP-address:nn'): return True + # Anything in all caps in a variable if token.upper() == token: return True @@ -58,10 +50,7 @@ def token_is_variable(line_number, token): return False - tokens = [] - - -def line_to_tokens(text): +def line_to_tokens(line_number, text): """ Most of the time whitespace can be used to split tokens (set|clear) clagd-enable (no|yes) @@ -92,7 +81,8 @@ def line_to_tokens(text): for char in text: if char == ' ': if parens == 0 and brackets == 0 and curlys == 0 and less_greater == 0: - tokens.append(''.join(token_text)) + if token_text: + tokens.append(''.join(token_text)) token_index += 1 token_text = [] else: @@ -122,7 +112,8 @@ def line_to_tokens(text): elif char == '>': less_greater -= 1 - token_text.append(char) + if char: + token_text.append(char) if token_text: tokens.append(''.join(token_text)) @@ -130,6 +121,8 @@ def line_to_tokens(text): return tokens +''' +# No longer used now that all indexes have been updated def get_argv_translator(line_number, line): table = {} line = line.strip() @@ -149,14 +142,146 @@ def get_argv_translator(line_number, line): continue if token_is_variable(line_number, token): - print "%s is a token" % token + # print "%s is a token" % token table[old_style_index] = token_index old_style_index += 1 else: - print "%s is NOT a token" % token + # print "%s is NOT a token" % token pass return table +''' + +def get_argv_variable_indexes(line_number, line): + indexes = {} + + line = line.strip() + assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line) + assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line) + line = line[1:-2] + max_index = 0 + + for (token_index, token) in enumerate(line_to_tokens(line_number, line)): + if not token: + raise Exception("%d: empty token" % line_number) + + if token_is_variable(line_number, token): + # print "%s is a token" % token + indexes[token_index] = True + max_index = token_index + + return (max_index, indexes) + + +class DEFUN(object): + + def __init__(self, line_number, command_string_expanded, lines): + # name, name_cmd, command_string, help_strings, guts): + self.line_number = line_number + self.name = None + self.name_cmd = None + self.command_string = None + self.command_string_expanded = command_string_expanded + self.help_strings = [] + self.guts = [] + + ''' +DEFUN (no_bgp_maxmed_onstartup, + no_bgp_maxmed_onstartup_cmd, + "no bgp max-med on-startup", + NO_STR + BGP_STR + "Advertise routes with max-med\n" + "Effective on a startup\n") + + ''' + state = 'HEADER' + for (line_number, line) in enumerate(lines): + + if state == 'HEADER': + if line_number == 0: + re_name = re.search('DEFUN \((.*),', line.strip()) + self.name = re_name.group(1) + + elif line_number == 1: + self.name_cmd = line.strip()[0:-1] # chop the trailing comma + + elif line_number == 2: + self.command_string = line + state = 'HELP' + + elif state == 'HELP': + if line.strip() == '{': + self.guts.append(line) + state = 'BODY' + else: + self.help_strings.append(line) + + elif state == 'BODY': + if line.rstrip() == '}': + self.guts.append(line) + state = None + else: + self.guts.append(line) + + else: + raise Exception("invalid state %s" % state) + + # print "%d %7s: %s" % (line_number, state, line.rstrip()) + + assert self.command_string, "No command string for\n%s" % pformat(lines) + + def __str__(self): + return self.name + + def sanity_check(self): + (max_index, variable_indexes) = get_argv_variable_indexes(self.line_number, self.command_string_expanded) + + # sanity check that each argv index matches a variable in the command string + for line in self.guts: + if 'argv[' in line and '->arg' in line: + tmp_line = deepcopy(line) + re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line) + + while re_argv: + index = int(re_argv.group(1)) + if index not in variable_indexes and index <= max_index: + raise Exception("%d: index %s is not a variable in the command string" % (self.line_number, index)) + tmp_line = re_argv.group(2) + re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line) + + def get_new_command_string(self): + line = self.command_string + # dwalton + # Change <1-255> to (1-255) + # Change (foo|bar) to + # Change {wazzup} to [wazzup]....there shouldn't be many of these + + line = line.replace('(', '<') + line = line.replace(')', '>') + line = line.replace('{', '[') + line = line.replace('}', ']') + re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) + + while re_range: + line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3)) + re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) + + if not line.endswith('\n'): + line += '\n' + + return line + + def dump(self): + lines = [] + lines.append("DEFUN (%s,\n" % self.name) + lines.append(" %s,\n" % self.name_cmd) + lines.append(self.get_new_command_string()) + lines.extend(self.help_strings) + lines.extend(self.guts) + return ''.join(lines) + + def update_argvs(filename): @@ -166,19 +291,27 @@ def update_argvs(filename): state = None defun_line_number = None cmd_string = None - argv_translator = {} - print_translator = False + # argv_translator = {} + # print_translator = False + variable_indexes = {} + max_index = 0 + defun_lines = [] + defuns = {} + command_string = None for (line_number, line) in enumerate(fh.readlines()): - new_line = line + # new_line = line if state is None: if line.startswith('DEFUN ('): assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) state = 'DEFUN_HEADER' defun_line_number = line_number + defun_lines.append(line) elif state == 'DEFUN_HEADER': + defun_lines.append(line) + if line.startswith('DEFUN'): raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number) @@ -259,40 +392,89 @@ def update_argvs(filename): if line.rstrip().endswith('" ,'): line = line.replace('" ,', '",') + command_string = line + ''' + # No longer used now that all indexes have been updated argv_translator = get_argv_translator(line_number, line) print_translator = True + ''' elif state == 'DEFUN_BODY': - if line.rstrip() == '}': - state = None - defun_line_number = None - cmd_string = None - argv_translator = {} + defun_lines.append(line) + if line.rstrip() == '}': + new_defun = DEFUN(defun_line_number, command_string, defun_lines) + defuns[new_defun.name] = new_defun + state = None + command_string = None + defun_lines = [] + + # cmd_string = None + # defun_line_number = None + # argv_translator = {} + + ''' + # No longer used now that all indexes have been updated elif 'argv[' in new_line and '->arg' not in new_line: for index in reversed(argv_translator.keys()): old_argv = "argv[%d]" % index new_argv = "argv[%d]->arg" % argv_translator[index] new_line = new_line.replace(old_argv, new_argv) + ''' # uncomment to debug state machine - print "%5d %12s: %s" % (line_number, state, new_line.rstrip()) + # print "%5d %12s: %s" % (line_number, state, line.rstrip()) + + ''' + # No longer used now that all indexes have been updated if print_translator: print "%s\n" % pformat(argv_translator) print_translator = False + ''' - lines.append(new_line) + lines.append(line) + + for defun in defuns.itervalues(): + defun.sanity_check() + + + # Now write the file but allow the DEFUN object to update the contents of the DEFUN () with open(filename, 'w') as fh: + state = None + for line in lines: - fh.write(line) + + if state is None: + if line.startswith('DEFUN ('): + state = 'DEFUN_HEADER' + re_name = re.search('DEFUN \((.*),', line.strip()) + name = re_name.group(1) + defun = defuns.get(name) + fh.write(defun.dump()) + else: + fh.write(line) + + elif state == 'DEFUN_HEADER': + if line.strip() == '{': + state = 'DEFUN_BODY' + + elif state == 'DEFUN_BODY': + if line.rstrip() == '}': + state = None + if __name__ == '__main__': - filename = sys.argv[1] - if os.path.exists(filename): + if len(sys.argv) == 2: + filename = sys.argv[1] update_argvs(filename) + else: - print "ERROR: could not find file %s" % filename + output = subprocess.check_output("grep -l DEFUN *.c", shell=True).splitlines() + for filename in output: + filename = filename.strip() + print "crunching %s" % filename + update_argvs(filename) From 6147e2c694b53647895f048645182065bc25fd05 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 13:47:20 +0000 Subject: [PATCH 118/280] convert <1-255> to (1-255), ()s to <>s, etc Signed-off-by: Daniel Walton --- bgpd/bgp_debug.c | 28 ++-- bgpd/bgp_dump.c | 4 +- bgpd/bgp_encap.c | 8 +- bgpd/bgp_filter.c | 4 +- bgpd/bgp_route.c | 180 ++++++++++----------- bgpd/bgp_routemap.c | 36 ++--- bgpd/bgp_vty.c | 340 +++++++++++++++++++-------------------- isisd/isis_redist.c | 8 +- isisd/isis_routemap.c | 8 +- isisd/isis_te.c | 2 +- isisd/isis_vty.c | 84 +++++----- isisd/isisd.c | 2 +- lib/command.c | 12 +- lib/filter.c | 84 +++++----- lib/if.c | 4 +- lib/if_rmap.c | 4 +- lib/keychain.c | 36 ++--- lib/ns.c | 4 +- lib/plist.c | 84 +++++----- lib/vrf.c | 4 +- ospf6d/ospf6_area.c | 12 +- ospf6d/ospf6_asbr.c | 6 +- ospf6d/ospf6_interface.c | 20 +-- ospf6d/ospf6_lsa.c | 4 +- ospf6d/ospf6_message.c | 4 +- ospf6d/ospf6_route.c | 4 +- ospf6d/ospf6_spf.c | 2 +- ospf6d/ospf6_top.c | 8 +- ospf6d/ospf6_zebra.c | 4 +- ospf6d/ospf6d.c | 16 +- ospfd/ospf_dump.c | 34 ++-- ospfd/ospf_ri.c | 8 +- ospfd/ospf_routemap.c | 12 +- ospfd/ospf_te.c | 2 +- ospfd/ospf_vty.c | 194 +++++++++++----------- ripd/rip_debug.c | 4 +- ripd/rip_interface.c | 14 +- ripd/rip_offset.c | 8 +- ripd/rip_routemap.c | 12 +- ripd/rip_zebra.c | 8 +- ripd/ripd.c | 18 +-- ripngd/ripng_debug.c | 4 +- ripngd/ripng_offset.c | 8 +- ripngd/ripng_routemap.c | 8 +- ripngd/ripng_zebra.c | 4 +- ripngd/ripngd.c | 4 +- tools/argv_translator.py | 8 +- vtysh/vtysh.c | 6 +- zebra/debug.c | 10 +- zebra/interface.c | 14 +- zebra/irdp_interface.c | 12 +- zebra/rtadv.c | 18 +-- zebra/test_main.c | 2 +- zebra/zebra_routemap.c | 16 +- zebra/zebra_vty.c | 330 ++++++++++++++++++------------------- zebra/zserv.c | 2 +- 56 files changed, 891 insertions(+), 885 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index e64730624a..89b970d97c 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -622,7 +622,7 @@ DEFUN (debug_bgp_neighbor_events, DEFUN (debug_bgp_neighbor_events_peer, debug_bgp_neighbor_events_peer_cmd, - "debug bgp neighbor-events (A.B.C.D|X:X::X:X|WORD)", + "debug bgp neighbor-events ", DEBUG_STR BGP_STR "BGP Neighbor Events\n" @@ -675,7 +675,7 @@ DEFUN (no_debug_bgp_neighbor_events, DEFUN (no_debug_bgp_neighbor_events_peer, no_debug_bgp_neighbor_events_peer_cmd, - "no debug bgp neighbor-events (A.B.C.D|X:X::X:X|WORD)", + "no debug bgp neighbor-events ", NO_STR DEBUG_STR BGP_STR @@ -766,7 +766,7 @@ DEFUN (debug_bgp_keepalive, DEFUN (debug_bgp_keepalive_peer, debug_bgp_keepalive_peer_cmd, - "debug bgp keepalives (A.B.C.D|X:X::X:X|WORD)", + "debug bgp keepalives ", DEBUG_STR BGP_STR "BGP Neighbor Events\n" @@ -819,7 +819,7 @@ DEFUN (no_debug_bgp_keepalive, DEFUN (no_debug_bgp_keepalive_peer, no_debug_bgp_keepalive_peer_cmd, - "no debug bgp keepalives (A.B.C.D|X:X::X:X|WORD)", + "no debug bgp keepalives ", NO_STR DEBUG_STR BGP_STR @@ -855,7 +855,7 @@ DEFUN (no_debug_bgp_keepalive_peer, /* debug bgp bestpath */ DEFUN (debug_bgp_bestpath_prefix, debug_bgp_bestpath_prefix_cmd, - "debug bgp bestpath (A.B.C.D/M|X:X::X:X/M)", + "debug bgp bestpath ", DEBUG_STR BGP_STR "BGP bestpath\n" @@ -902,7 +902,7 @@ DEFUN (debug_bgp_bestpath_prefix, DEFUN (no_debug_bgp_bestpath_prefix, no_debug_bgp_bestpath_prefix_cmd, - "no debug bgp bestpath (A.B.C.D/M|X:X::X:X/M)", + "no debug bgp bestpath ", NO_STR DEBUG_STR BGP_STR @@ -998,7 +998,7 @@ DEFUN (debug_bgp_update, DEFUN (debug_bgp_update_direct, debug_bgp_update_direct_cmd, - "debug bgp updates (in|out)", + "debug bgp updates ", DEBUG_STR BGP_STR "BGP updates\n" @@ -1036,7 +1036,7 @@ DEFUN (debug_bgp_update_direct, DEFUN (debug_bgp_update_direct_peer, debug_bgp_update_direct_peer_cmd, - "debug bgp updates (in|out) (A.B.C.D|X:X::X:X|WORD)", + "debug bgp updates ", DEBUG_STR BGP_STR "BGP updates\n" @@ -1130,7 +1130,7 @@ DEFUN (debug_bgp_update_direct_peer, DEFUN (no_debug_bgp_update_direct, no_debug_bgp_update_direct_cmd, - "no debug bgp updates (in|out)", + "no debug bgp updates ", NO_STR DEBUG_STR BGP_STR @@ -1172,7 +1172,7 @@ DEFUN (no_debug_bgp_update_direct, DEFUN (no_debug_bgp_update_direct_peer, no_debug_bgp_update_direct_peer_cmd, - "no debug bgp updates (in|out) (A.B.C.D|X:X::X:X|WORD)", + "no debug bgp updates ", NO_STR DEBUG_STR BGP_STR @@ -1262,7 +1262,7 @@ DEFUN (no_debug_bgp_update_direct_peer, DEFUN (debug_bgp_update_prefix, debug_bgp_update_prefix_cmd, - "debug bgp updates prefix (A.B.C.D/M|X:X::X:X/M)", + "debug bgp updates prefix ", DEBUG_STR BGP_STR "BGP updates\n" @@ -1310,7 +1310,7 @@ DEFUN (debug_bgp_update_prefix, DEFUN (no_debug_bgp_update_prefix, no_debug_bgp_update_prefix_cmd, - "no debug bgp updates prefix (A.B.C.D/M|X:X::X:X/M)", + "no debug bgp updates prefix ", NO_STR DEBUG_STR BGP_STR @@ -1409,7 +1409,7 @@ DEFUN (debug_bgp_zebra, DEFUN (debug_bgp_zebra_prefix, debug_bgp_zebra_prefix_cmd, - "debug bgp zebra prefix (A.B.C.D/M|X:X::X:X/M)", + "debug bgp zebra prefix ", DEBUG_STR BGP_STR "BGP Zebra messages\n" @@ -1474,7 +1474,7 @@ DEFUN (no_debug_bgp_zebra, DEFUN (no_debug_bgp_zebra_prefix, no_debug_bgp_zebra_prefix_cmd, - "no debug bgp zebra prefix (A.B.C.D/M|X:X::X:X/M)", + "no debug bgp zebra prefix ", NO_STR DEBUG_STR BGP_STR diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 52989385d1..c5fc052009 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -727,7 +727,7 @@ bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump) DEFUN (dump_bgp_all, dump_bgp_all_cmd, - "dump bgp (all|all-et|updates|updates-et|routes-mrt) PATH [INTERVAL]", + "dump bgp PATH [INTERVAL]", "Dump packet\n" "BGP packet dump\n" "Dump all BGP packets\nDump all BGP packets (Extended Timestamp Header)\n" @@ -771,7 +771,7 @@ DEFUN (dump_bgp_all, DEFUN (no_dump_bgp_all, no_dump_bgp_all_cmd, - "no dump bgp (all|all-et|updates|updates-et|routes-mrt) [PATH] [INTERVAL]", + "no dump bgp [PATH] [INTERVAL]", NO_STR "Stop dump packet\n" "Stop BGP packet dump\n" diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 4b1b6757a9..0c7657f8bb 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -707,7 +707,7 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, show_bgp_ipv4_encap_rd_neighbor_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors routes", SHOW_STR BGP_STR "Address Family\n" @@ -750,7 +750,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, show_bgp_ipv6_encap_rd_neighbor_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes", + "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors routes", SHOW_STR BGP_STR "Address Family\n" @@ -857,7 +857,7 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes", SHOW_STR BGP_STR "Address Family\n" @@ -899,7 +899,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes", + "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes", SHOW_STR BGP_STR "Address Family\n" diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 1235e50d22..6a39d02174 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -428,7 +428,7 @@ as_list_dup_check (struct as_list *aslist, struct as_filter *new) DEFUN (ip_as_path, ip_as_path_cmd, - "ip as-path access-list WORD (deny|permit) .LINE", + "ip as-path access-list WORD .LINE", IP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" @@ -484,7 +484,7 @@ DEFUN (ip_as_path, DEFUN (no_ip_as_path, no_ip_as_path_cmd, - "no ip as-path access-list WORD (deny|permit) .LINE", + "no ip as-path access-list WORD .LINE", NO_STR IP_STR "BGP autonomous system path filter\n" diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e408154f20..d0eff6e206 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7963,7 +7963,7 @@ DEFUN (show_ip_bgp, */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show ip bgp ipv4 (unicast|multicast) [json]", + "show ip bgp ipv4 [json]", SHOW_STR IP_STR BGP_STR @@ -7996,7 +7996,7 @@ DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_route_pathtype, show_ip_bgp_route_pathtype_cmd, - "show ip bgp A.B.C.D (bestpath|multipath) [json]", + "show ip bgp A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8015,7 +8015,7 @@ DEFUN (show_ip_bgp_route_pathtype, DEFUN (show_bgp_ipv4_safi_route_pathtype, show_bgp_ipv4_safi_route_pathtype_cmd, - "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath) [json]", + "show bgp ipv4 A.B.C.D [json]", SHOW_STR BGP_STR "Address family\n" @@ -8090,7 +8090,7 @@ DEFUN (show_bgp_ipv6_prefix, */ DEFUN (show_ip_bgp_ipv4_route, show_ip_bgp_ipv4_route_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D [json]", + "show ip bgp ipv4 A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8236,7 +8236,7 @@ DEFUN (show_ip_bgp_prefix, DEFUN (show_ip_bgp_prefix_pathtype, show_ip_bgp_prefix_pathtype_cmd, - "show ip bgp A.B.C.D/M (bestpath|multipath) [json]", + "show ip bgp A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8266,7 +8266,7 @@ DEFUN (show_ip_bgp_prefix_pathtype, */ DEFUN (show_ip_bgp_ipv4_prefix, show_ip_bgp_ipv4_prefix_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M [json]", + "show ip bgp ipv4 A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8301,7 +8301,7 @@ DEFUN (show_ip_bgp_ipv4_prefix, */ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, show_ip_bgp_ipv4_prefix_pathtype_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) [json]", + "show ip bgp ipv4 A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8418,7 +8418,7 @@ DEFUN (show_ip_bgp_instance_route, DEFUN (show_ip_bgp_instance_route_pathtype, show_ip_bgp_instance_route_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D (bestpath|multipath) [json]", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8451,7 +8451,7 @@ DEFUN (show_ip_bgp_instance_prefix, DEFUN (show_ip_bgp_instance_prefix_pathtype, show_ip_bgp_instance_prefix_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M (bestpath|multipath) [json]", + "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8492,7 +8492,7 @@ DEFUN (show_bgp, DEFUN (show_bgp_ipv6_safi, show_bgp_ipv6_safi_cmd, - "show bgp ipv6 (unicast|multicast) [json]", + "show bgp ipv6 [json]", SHOW_STR BGP_STR "Address family\n" @@ -8543,7 +8543,7 @@ DEFUN (show_bgp_route, DEFUN (show_bgp_ipv6_safi_route, show_bgp_ipv6_safi_route_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X [json]", + "show bgp ipv6 X:X::X:X [json]", SHOW_STR BGP_STR "Address family\n" @@ -8573,7 +8573,7 @@ DEFUN (show_bgp_ipv6_safi_route, */ DEFUN (show_bgp_route_pathtype, show_bgp_route_pathtype_cmd, - "show bgp X:X::X:X (bestpath|multipath) [json]", + "show bgp X:X::X:X [json]", SHOW_STR BGP_STR "Network in the BGP routing table to display\n" @@ -8591,7 +8591,7 @@ DEFUN (show_bgp_route_pathtype, DEFUN (show_bgp_ipv6_safi_route_pathtype, show_bgp_ipv6_safi_route_pathtype_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath) [json]", + "show bgp ipv6 X:X::X:X [json]", SHOW_STR BGP_STR "Address family\n" @@ -8642,7 +8642,7 @@ DEFUN (show_bgp_prefix, DEFUN (show_bgp_ipv6_safi_prefix, show_bgp_ipv6_safi_prefix_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X/M [json]", + "show bgp ipv6 X:X::X:X/M [json]", SHOW_STR BGP_STR "Address family\n" @@ -8672,7 +8672,7 @@ DEFUN (show_bgp_ipv6_safi_prefix, */ DEFUN (show_bgp_prefix_pathtype, show_bgp_prefix_pathtype_cmd, - "show bgp X:X::X:X/M (bestpath|multipath) [json]", + "show bgp X:X::X:X/M [json]", SHOW_STR BGP_STR "IPv6 prefix /\n" @@ -8690,7 +8690,7 @@ DEFUN (show_bgp_prefix_pathtype, DEFUN (show_bgp_ipv6_safi_prefix_pathtype, show_bgp_ipv6_safi_prefix_pathtype_cmd, - "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath) [json]", + "show bgp ipv6 X:X::X:X/M [json]", SHOW_STR BGP_STR "Address family\n" @@ -8813,7 +8813,7 @@ DEFUN (show_bgp_instance_route, */ DEFUN (show_bgp_instance_route_pathtype, show_bgp_instance_route_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X (bestpath|multipath) [json]", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8869,7 +8869,7 @@ DEFUN (show_bgp_instance_prefix, */ DEFUN (show_bgp_instance_prefix_pathtype, show_bgp_instance_prefix_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M (bestpath|multipath) [json]", + "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8975,7 +8975,7 @@ DEFUN (show_bgp_instance_route_map, */ DEFUN (show_bgp_instance_community_list, show_bgp_instance_community_list_cmd, - "show bgp " BGP_INSTANCE_CMD " community-list (<1-500>|WORD)", + "show bgp " BGP_INSTANCE_CMD " community-list <(1-500)|WORD>", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9143,7 +9143,7 @@ DEFUN (show_ip_bgp_flap_regexp, DEFUN (show_ip_bgp_ipv4_regexp, show_ip_bgp_ipv4_regexp_cmd, - "show ip bgp ipv4 (unicast|multicast) regexp .LINE", + "show ip bgp ipv4 regexp .LINE", SHOW_STR IP_STR BGP_STR @@ -9297,7 +9297,7 @@ DEFUN (show_ip_bgp_flap_prefix_list, DEFUN (show_ip_bgp_ipv4_prefix_list, show_ip_bgp_ipv4_prefix_list_cmd, - "show ip bgp ipv4 (unicast|multicast) prefix-list WORD", + "show ip bgp ipv4 prefix-list WORD", SHOW_STR IP_STR BGP_STR @@ -9450,7 +9450,7 @@ DEFUN (show_ip_bgp_flap_filter_list, DEFUN (show_ip_bgp_ipv4_filter_list, show_ip_bgp_ipv4_filter_list_cmd, - "show ip bgp ipv4 (unicast|multicast) filter-list WORD", + "show ip bgp ipv4 filter-list WORD", SHOW_STR IP_STR BGP_STR @@ -9538,7 +9538,7 @@ DEFUN (show_ip_bgp_dampening_info, DEFUN (show_ip_bgp_ipv4_dampening_parameters, show_ip_bgp_ipv4_dampening_parameters_cmd, - "show ip bgp ipv4 (unicast|multicast) dampening parameters", + "show ip bgp ipv4 dampening parameters", SHOW_STR IP_STR BGP_STR @@ -9557,7 +9557,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, show_ip_bgp_ipv4_dampening_flap_stats_cmd, - "show ip bgp ipv4 (unicast|multicast) dampening flap-statistics", + "show ip bgp ipv4 dampening flap-statistics", SHOW_STR IP_STR BGP_STR @@ -9577,7 +9577,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, show_ip_bgp_ipv4_dampening_dampd_paths_cmd, - "show ip bgp ipv4 (unicast|multicast) dampening dampened-paths", + "show ip bgp ipv4 dampening dampened-paths", SHOW_STR IP_STR BGP_STR @@ -9676,7 +9676,7 @@ DEFUN (show_ip_bgp_flap_route_map, DEFUN (show_ip_bgp_ipv4_route_map, show_ip_bgp_ipv4_route_map_cmd, - "show ip bgp ipv4 (unicast|multicast) route-map WORD", + "show ip bgp ipv4 route-map WORD", SHOW_STR IP_STR BGP_STR @@ -9756,7 +9756,7 @@ DEFUN (show_ip_bgp_flap_cidr_only, DEFUN (show_ip_bgp_ipv4_cidr_only, show_ip_bgp_ipv4_cidr_only_cmd, - "show ip bgp ipv4 (unicast|multicast) cidr-only", + "show ip bgp ipv4 cidr-only", SHOW_STR IP_STR BGP_STR @@ -9787,7 +9787,7 @@ DEFUN (show_ip_bgp_community_all, DEFUN (show_ip_bgp_ipv4_community_all, show_ip_bgp_ipv4_community_all_cmd, - "show ip bgp ipv4 (unicast|multicast) community", + "show ip bgp ipv4 community", SHOW_STR IP_STR BGP_STR @@ -9977,7 +9977,7 @@ bgp_show_community (struct vty *vty, const char *view_name, int argc, */ DEFUN (show_ip_bgp_community, show_ip_bgp_community_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp community ", SHOW_STR IP_STR BGP_STR @@ -10061,7 +10061,7 @@ DEFUN (show_ip_bgp_community, */ DEFUN (show_ip_bgp_ipv4_community, show_ip_bgp_ipv4_community_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", + "show ip bgp ipv4 community ", SHOW_STR IP_STR BGP_STR @@ -10085,7 +10085,7 @@ DEFUN (show_ip_bgp_ipv4_community, DEFUN (show_bgp_instance_afi_safi_community_all, show_bgp_instance_afi_safi_community_all_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community", + "show bgp " BGP_INSTANCE_CMD " community", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10183,7 +10183,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, */ DEFUN (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)", + "show bgp " BGP_INSTANCE_CMD " community ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10270,7 +10270,7 @@ DEFUN (show_bgp_instance_afi_safi_community, */ DEFUN (show_ip_bgp_community_exact, show_ip_bgp_community_exact_cmd, - "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp community exact-match", SHOW_STR IP_STR BGP_STR @@ -10358,7 +10358,7 @@ DEFUN (show_ip_bgp_community_exact, */ DEFUN (show_ip_bgp_ipv4_community_exact, show_ip_bgp_ipv4_community_exact_cmd, - "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ip bgp ipv4 community exact-match", SHOW_STR IP_STR BGP_STR @@ -10502,7 +10502,7 @@ DEFUN (show_ip_bgp_ipv4_community_exact, */ DEFUN (show_bgp_community, show_bgp_community_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export)", + "show bgp community ", SHOW_STR BGP_STR "Display routes matching the communities\n" @@ -10581,7 +10581,7 @@ DEFUN (show_bgp_community, */ DEFUN (show_ipv6_bgp_community, show_ipv6_bgp_community_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)", + "show ipv6 bgp community ", SHOW_STR IPV6_STR BGP_STR @@ -10728,7 +10728,7 @@ DEFUN (show_ipv6_bgp_community, */ DEFUN (show_bgp_community_exact, show_bgp_community_exact_cmd, - "show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show bgp community exact-match", SHOW_STR BGP_STR "Display routes matching the communities\n" @@ -10811,7 +10811,7 @@ DEFUN (show_bgp_community_exact, */ DEFUN (show_ipv6_bgp_community_exact, show_ipv6_bgp_community_exact_cmd, - "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ipv6 bgp community exact-match", SHOW_STR IPV6_STR BGP_STR @@ -10892,7 +10892,7 @@ DEFUN (show_ipv6_bgp_community_exact, */ DEFUN (show_ipv6_mbgp_community, show_ipv6_mbgp_community_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)", + "show ipv6 mbgp community ", SHOW_STR IPV6_STR MBGP_STR @@ -10975,7 +10975,7 @@ DEFUN (show_ipv6_mbgp_community, */ DEFUN (show_ipv6_mbgp_community_exact, show_ipv6_mbgp_community_exact_cmd, - "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match", + "show ipv6 mbgp community exact-match", SHOW_STR IPV6_STR MBGP_STR @@ -11026,7 +11026,7 @@ bgp_show_community_list (struct vty *vty, const char *name, DEFUN (show_ip_bgp_community_list, show_ip_bgp_community_list_cmd, - "show ip bgp community-list (<1-500>|WORD)", + "show ip bgp community-list <(1-500)|WORD>", SHOW_STR IP_STR BGP_STR @@ -11039,7 +11039,7 @@ DEFUN (show_ip_bgp_community_list, DEFUN (show_ip_bgp_instance_community_list, show_ip_bgp_instance_community_list_cmd, - "show ip bgp " BGP_INSTANCE_CMD " community-list (<1-500>|WORD)", + "show ip bgp " BGP_INSTANCE_CMD " community-list <(1-500)|WORD>", SHOW_STR IP_STR BGP_STR @@ -11053,7 +11053,7 @@ DEFUN (show_ip_bgp_instance_community_list, DEFUN (show_ip_bgp_ipv4_community_list, show_ip_bgp_ipv4_community_list_cmd, - "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)", + "show ip bgp ipv4 community-list <(1-500)|WORD>", SHOW_STR IP_STR BGP_STR @@ -11072,7 +11072,7 @@ DEFUN (show_ip_bgp_ipv4_community_list, DEFUN (show_ip_bgp_community_list_exact, show_ip_bgp_community_list_exact_cmd, - "show ip bgp community-list (<1-500>|WORD) exact-match", + "show ip bgp community-list <(1-500)|WORD> exact-match", SHOW_STR IP_STR BGP_STR @@ -11086,7 +11086,7 @@ DEFUN (show_ip_bgp_community_list_exact, DEFUN (show_ip_bgp_ipv4_community_list_exact, show_ip_bgp_ipv4_community_list_exact_cmd, - "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match", + "show ip bgp ipv4 community-list <(1-500)|WORD> exact-match", SHOW_STR IP_STR BGP_STR @@ -11118,7 +11118,7 @@ DEFUN (show_ip_bgp_ipv4_community_list_exact, */ DEFUN (show_bgp_community_list, show_bgp_community_list_cmd, - "show bgp community-list (<1-500>|WORD)", + "show bgp community-list <(1-500)|WORD>", SHOW_STR BGP_STR "Display routes matching the community-list\n" @@ -11171,7 +11171,7 @@ DEFUN (show_ipv6_mbgp_community_list, */ DEFUN (show_bgp_community_list_exact, show_bgp_community_list_exact_cmd, - "show bgp community-list (<1-500>|WORD) exact-match", + "show bgp community-list <(1-500)|WORD> exact-match", SHOW_STR BGP_STR "Display routes matching the community-list\n" @@ -11299,7 +11299,7 @@ DEFUN (show_ip_bgp_flap_prefix_longer, DEFUN (show_ip_bgp_ipv4_prefix_longer, show_ip_bgp_ipv4_prefix_longer_cmd, - "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes", + "show ip bgp ipv4 A.B.C.D/M longer-prefixes", SHOW_STR IP_STR BGP_STR @@ -11821,7 +11821,7 @@ bgp_table_stats_vty (struct vty *vty, const char *name, DEFUN (show_bgp_statistics, show_bgp_statistics_cmd, - "show bgp (ipv4|ipv6) (encap|multicast|unicast|vpn) statistics", + "show bgp statistics", SHOW_STR BGP_STR "Address family\n" @@ -11837,7 +11837,7 @@ DEFUN (show_bgp_statistics, DEFUN (show_bgp_statistics_view, show_bgp_statistics_view_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast|vpn|encap) statistics", + "show bgp " BGP_INSTANCE_CMD " statistics", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12045,7 +12045,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_neighbor_prefix_counts, show_ip_bgp_neighbor_prefix_counts_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show ip bgp neighbors prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12068,7 +12068,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show ip bgp " BGP_INSTANCE_CMD " neighbors prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12092,7 +12092,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, DEFUN (show_bgp_ipv6_neighbor_prefix_counts, show_bgp_ipv6_neighbor_prefix_counts_cmd, - "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show bgp ipv6 neighbors prefix-counts [json]", SHOW_STR BGP_STR "Address family\n" @@ -12115,7 +12115,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, show_bgp_instance_ipv6_neighbor_prefix_counts_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors prefix-counts [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12139,7 +12139,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, show_ip_bgp_ipv4_neighbor_prefix_counts_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show ip bgp ipv4 neighbors prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12168,7 +12168,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd, - "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts [json]", + "show ip bgp vpnv4 all neighbors prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12449,7 +12449,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, */ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show ip bgp " BGP_INSTANCE_CMD " neighbors advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12490,7 +12490,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, */ DEFUN (show_ip_bgp_neighbor_advertised_route, show_ip_bgp_neighbor_advertised_route_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show ip bgp neighbors advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12539,7 +12539,7 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, */ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, show_ip_bgp_ipv4_neighbor_advertised_route_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show ip bgp ipv4 neighbors advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12589,7 +12589,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_advertised_route, show_bgp_instance_neighbor_advertised_route_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors advertised-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12642,7 +12642,7 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, */ DEFUN (show_bgp_neighbor_advertised_route, show_bgp_neighbor_advertised_route_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show bgp neighbors advertised-routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -12674,7 +12674,7 @@ DEFUN (show_bgp_neighbor_advertised_route, /* old command */ DEFUN (ipv6_mbgp_neighbor_advertised_route, ipv6_mbgp_neighbor_advertised_route_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + "show ipv6 mbgp neighbors advertised-routes [json]", SHOW_STR IPV6_STR MBGP_STR @@ -12715,7 +12715,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_received_routes, show_bgp_instance_neighbor_received_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors received-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12753,7 +12753,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, */ DEFUN (show_ip_bgp_instance_neighbor_received_routes, show_ip_bgp_instance_neighbor_received_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show ip bgp " BGP_INSTANCE_CMD " neighbors received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12792,7 +12792,7 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, */ DEFUN (show_ip_bgp_neighbor_received_routes, show_ip_bgp_neighbor_received_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show ip bgp neighbors received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12840,7 +12840,7 @@ DEFUN (show_ip_bgp_neighbor_received_routes, */ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, show_ip_bgp_ipv4_neighbor_received_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show ip bgp ipv4 neighbors received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12874,7 +12874,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12910,7 +12910,7 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", + "show ip bgp neighbors received prefix-filter [json]", SHOW_STR IP_STR BGP_STR @@ -12997,7 +12997,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", + "show ip bgp ipv4 neighbors received prefix-filter [json]", SHOW_STR IP_STR BGP_STR @@ -13139,7 +13139,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, */ DEFUN (show_bgp_neighbor_received_routes, show_bgp_neighbor_received_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show bgp neighbors received-routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13182,7 +13182,7 @@ DEFUN (show_bgp_neighbor_received_routes, */ DEFUN (show_bgp_neighbor_received_prefix_filter, show_bgp_neighbor_received_prefix_filter_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", + "show bgp neighbors received prefix-filter [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13272,7 +13272,7 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, /* old command */ DEFUN (ipv6_mbgp_neighbor_received_routes, ipv6_mbgp_neighbor_received_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + "show ipv6 mbgp neighbors received-routes [json]", SHOW_STR IPV6_STR MBGP_STR @@ -13312,7 +13312,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, */ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, show_bgp_instance_neighbor_received_prefix_filter_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors received prefix-filter [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13428,7 +13428,7 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show ip bgp neighbors routes [json]", SHOW_STR IP_STR BGP_STR @@ -13452,7 +13452,7 @@ DEFUN (show_ip_bgp_neighbor_routes, DEFUN (show_ip_bgp_instance_neighbor_routes, show_ip_bgp_instance_neighbor_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show ip bgp " BGP_INSTANCE_CMD " neighbors routes [json]", SHOW_STR IP_STR BGP_STR @@ -13477,7 +13477,7 @@ DEFUN (show_ip_bgp_instance_neighbor_routes, DEFUN (show_ip_bgp_neighbor_flap, show_ip_bgp_neighbor_flap_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", + "show ip bgp neighbors flap-statistics [json]", SHOW_STR IP_STR BGP_STR @@ -13501,7 +13501,7 @@ DEFUN (show_ip_bgp_neighbor_flap, DEFUN (show_ip_bgp_neighbor_damp, show_ip_bgp_neighbor_damp_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", + "show ip bgp neighbors dampened-routes [json]", SHOW_STR IP_STR BGP_STR @@ -13525,7 +13525,7 @@ DEFUN (show_ip_bgp_neighbor_damp, DEFUN (show_ip_bgp_ipv4_neighbor_routes, show_ip_bgp_ipv4_neighbor_routes_cmd, - "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show ip bgp ipv4 neighbors routes [json]", SHOW_STR IP_STR BGP_STR @@ -13572,7 +13572,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_routes, show_bgp_instance_neighbor_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13633,7 +13633,7 @@ DEFUN (show_bgp_instance_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_damp, show_bgp_instance_neighbor_damp_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors dampened-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13699,7 +13699,7 @@ DEFUN (show_bgp_instance_neighbor_damp, */ DEFUN (show_bgp_instance_neighbor_flap, show_bgp_instance_neighbor_flap_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", + "show bgp " BGP_INSTANCE_CMD " neighbors flap-statistics [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13754,7 +13754,7 @@ DEFUN (show_bgp_instance_neighbor_flap, */ DEFUN (show_bgp_neighbor_routes, show_bgp_neighbor_routes_cmd, - "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show bgp neighbors routes [json]", SHOW_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" @@ -13782,7 +13782,7 @@ DEFUN (show_bgp_neighbor_routes, /* old command */ DEFUN (ipv6_mbgp_neighbor_routes, ipv6_mbgp_neighbor_routes_cmd, - "show ipv6 mbgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + "show ipv6 mbgp neighbors routes [json]", SHOW_STR IPV6_STR MBGP_STR @@ -14001,7 +14001,7 @@ bgp_distance_apply (struct prefix *p, struct bgp_info *rinfo, struct bgp *bgp) DEFUN (bgp_distance, bgp_distance_cmd, - "distance bgp <1-255> <1-255> <1-255>", + "distance bgp (1-255) (1-255) (1-255)", "Define an administrative distance\n" "BGP distance\n" "Distance for routes external to the AS\n" @@ -14028,7 +14028,7 @@ DEFUN (bgp_distance, */ DEFUN (no_bgp_distance, no_bgp_distance_cmd, - "no distance bgp <1-255> <1-255> <1-255>", + "no distance bgp (1-255) (1-255) (1-255)", NO_STR "Define an administrative distance\n" "BGP distance\n" @@ -14049,7 +14049,7 @@ DEFUN (no_bgp_distance, DEFUN (bgp_distance_source, bgp_distance_source_cmd, - "distance <1-255> A.B.C.D/M", + "distance (1-255) A.B.C.D/M", "Define an administrative distance\n" "Administrative distance\n" "IP source prefix\n") @@ -14060,7 +14060,7 @@ DEFUN (bgp_distance_source, DEFUN (no_bgp_distance_source, no_bgp_distance_source_cmd, - "no distance <1-255> A.B.C.D/M", + "no distance (1-255) A.B.C.D/M", NO_STR "Define an administrative distance\n" "Administrative distance\n" @@ -14072,7 +14072,7 @@ DEFUN (no_bgp_distance_source, DEFUN (bgp_distance_source_access_list, bgp_distance_source_access_list_cmd, - "distance <1-255> A.B.C.D/M WORD", + "distance (1-255) A.B.C.D/M WORD", "Define an administrative distance\n" "Administrative distance\n" "IP source prefix\n" @@ -14084,7 +14084,7 @@ DEFUN (bgp_distance_source_access_list, DEFUN (no_bgp_distance_source_access_list, no_bgp_distance_source_access_list_cmd, - "no distance <1-255> A.B.C.D/M WORD", + "no distance (1-255) A.B.C.D/M WORD", NO_STR "Define an administrative distance\n" "Administrative distance\n" @@ -14109,7 +14109,7 @@ DEFUN (no_bgp_distance_source_access_list, */ DEFUN (bgp_damp_set, bgp_damp_set_cmd, - "bgp dampening <1-45> <1-20000> <1-20000> <1-255>", + "bgp dampening (1-45) (1-20000) (1-20000) (1-255)", "BGP Specific commands\n" "Enable route-flap dampening\n" "Half-life time for the penalty\n" diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 5b170f88f4..dc342b110f 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2994,7 +2994,7 @@ bgp_route_map_event (route_map_event_t event, const char *rmap_name) DEFUN (match_peer, match_peer_cmd, - "match peer (A.B.C.D|X:X::X:X)", + "match peer ", MATCH_STR "Match peer address\n" "IP address of peer\n" @@ -3046,7 +3046,7 @@ DEFUN (no_match_peer, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", + "match ip address <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match address of route\n" @@ -3085,7 +3085,7 @@ DEFUN (no_match_ip_address, DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, - "match ip next-hop (<1-199>|<1300-2699>|WORD)", + "match ip next-hop <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -3126,7 +3126,7 @@ DEFUN (no_match_ip_next_hop, DEFUN (match_probability, match_probability_cmd, - "match probability <0-100>", + "match probability (0-100)", MATCH_STR "Match portion of routes defined by percentage value\n" "Percentage of routes\n") @@ -3160,7 +3160,7 @@ DEFUN (no_match_probability, DEFUN (match_ip_route_source, match_ip_route_source_cmd, - "match ip route-source (<1-199>|<1300-2699>|WORD)", + "match ip route-source <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match advertising source address of route\n" @@ -3313,7 +3313,7 @@ DEFUN (no_match_ip_route_source_prefix_list, DEFUN (match_metric, match_metric_cmd, - "match metric <0-4294967295>", + "match metric (0-4294967295)", MATCH_STR "Match metric of route\n" "Metric value\n") @@ -3346,7 +3346,7 @@ DEFUN (no_match_metric, DEFUN (match_local_pref, match_local_pref_cmd, - "match local-preference <0-4294967295>", + "match local-preference (0-4294967295)", MATCH_STR "Match local-preference of route\n" "Metric value\n") @@ -3379,7 +3379,7 @@ DEFUN (no_match_local_pref, DEFUN (match_community, match_community_cmd, - "match community (<1-99>|<100-500>|WORD)", + "match community <(1-99)|(100-500)|WORD>", MATCH_STR "Match BGP community list\n" "Community-list number (standard)\n" @@ -3392,7 +3392,7 @@ DEFUN (match_community, DEFUN (match_community_exact, match_community_exact_cmd, - "match community (<1-99>|<100-500>|WORD) exact-match", + "match community <(1-99)|(100-500)|WORD> exact-match", MATCH_STR "Match BGP community list\n" "Community-list number (standard)\n" @@ -3451,7 +3451,7 @@ DEFUN (no_match_community, DEFUN (match_ecommunity, match_ecommunity_cmd, - "match extcommunity (<1-99>|<100-500>|WORD)", + "match extcommunity <(1-99)|(100-500)|WORD>", MATCH_STR "Match BGP/VPN extended community list\n" "Extended community-list number (standard)\n" @@ -3519,7 +3519,7 @@ DEFUN (no_match_aspath, DEFUN (match_origin, match_origin_cmd, - "match origin (egp|igp|incomplete)", + "match origin ", MATCH_STR "BGP origin code\n" "remote EGP\n" @@ -3596,7 +3596,7 @@ DEFUN (no_match_interface, DEFUN (match_tag, match_tag_cmd, - "match tag <1-65535>", + "match tag (1-65535)", MATCH_STR "Match tag of route\n" "Tag value\n") @@ -3723,7 +3723,7 @@ DEFUN (no_set_ip_nexthop, */ DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", SET_STR "Metric value for destination routing protocol\n" "Metric value\n") @@ -3755,7 +3755,7 @@ DEFUN (no_set_metric, DEFUN (set_local_pref, set_local_pref_cmd, - "set local-preference <0-4294967295>", + "set local-preference (0-4294967295)", SET_STR "BGP local preference path attribute\n" "Preference value\n") @@ -3785,7 +3785,7 @@ DEFUN (no_set_local_pref, DEFUN (set_weight, set_weight_cmd, - "set weight <0-4294967295>", + "set weight (0-4294967295)", SET_STR "BGP weight for routing table\n" "Weight value\n") @@ -4047,7 +4047,7 @@ DEFUN (no_set_community, DEFUN (set_community_delete, set_community_delete_cmd, - "set comm-list (<1-99>|<100-500>|WORD) delete", + "set comm-list <(1-99)|(100-500)|WORD> delete", SET_STR "set BGP community list (for deletion)\n" "Community-list number (standard)\n" @@ -4171,7 +4171,7 @@ DEFUN (no_set_ecommunity_soo, DEFUN (set_origin, set_origin_cmd, - "set origin (egp|igp|incomplete)", + "set origin ", SET_STR "BGP origin code\n" "remote EGP\n" @@ -4309,7 +4309,7 @@ DEFUN (no_set_aggregator_as, DEFUN (set_tag, set_tag_cmd, - "set tag <1-65535>", + "set tag (1-65535)", SET_STR "Tag value for routing protocol\n" "Tag value\n") diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5a06dd8e8a..3d2ddacbbb 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -608,7 +608,7 @@ DEFUN (no_bgp_multiple_instance, DEFUN (bgp_config_type, bgp_config_type_cmd, - "bgp config-type (cisco|zebra)", + "bgp config-type ", BGP_STR "Configuration type\n" "cisco\n" @@ -1145,7 +1145,7 @@ DEFUN (bgp_maxmed_admin, DEFUN (bgp_maxmed_admin_medv, bgp_maxmed_admin_medv_cmd, - "bgp max-med administrative <0-4294967294>", + "bgp max-med administrative (0-4294967294)", BGP_STR "Advertise routes with max-med\n" "Administratively applied, for an indefinite period\n" @@ -1197,7 +1197,7 @@ DEFUN (no_bgp_maxmed_admin, DEFUN (bgp_maxmed_onstartup, bgp_maxmed_onstartup_cmd, - "bgp max-med on-startup <5-86400>", + "bgp max-med on-startup (5-86400)", BGP_STR "Advertise routes with max-med\n" "Effective on a startup\n" @@ -1223,7 +1223,7 @@ DEFUN (bgp_maxmed_onstartup, DEFUN (bgp_maxmed_onstartup_medv, bgp_maxmed_onstartup_medv_cmd, - "bgp max-med on-startup <5-86400> <0-4294967294>", + "bgp max-med on-startup (5-86400) (0-4294967294)", BGP_STR "Advertise routes with max-med\n" "Effective on a startup\n" @@ -1362,7 +1362,7 @@ bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) /* Update-delay configuration */ DEFUN (bgp_update_delay, bgp_update_delay_cmd, - "update-delay <0-3600>", + "update-delay (0-3600)", "Force initial delay for best-path and updates\n" "Seconds\n") { @@ -1371,7 +1371,7 @@ DEFUN (bgp_update_delay, DEFUN (bgp_update_delay_establish_wait, bgp_update_delay_establish_wait_cmd, - "update-delay <0-3600> <1-3600>", + "update-delay (0-3600) (1-3600)", "Force initial delay for best-path and updates\n" "Seconds\n" "Wait for peers to be established\n" @@ -1392,7 +1392,7 @@ DEFUN (bgp_update_delay_establish_wait, */ DEFUN (no_bgp_update_delay, no_bgp_update_delay_cmd, - "no update-delay <0-3600>", + "no update-delay (0-3600)", "Force initial delay for best-path and updates\n" "Seconds\n") { @@ -1430,7 +1430,7 @@ bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) /* Update-delay configuration */ DEFUN (bgp_wpkt_quanta, bgp_wpkt_quanta_cmd, - "write-quanta <1-10000>", + "write-quanta (1-10000)", "How many packets to write to peer socket per run\n" "Number of packets\n") { @@ -1440,7 +1440,7 @@ DEFUN (bgp_wpkt_quanta, /* Update-delay deconfiguration */ DEFUN (no_bgp_wpkt_quanta, no_bgp_wpkt_quanta_cmd, - "no write-quanta <1-10000>", + "no write-quanta (1-10000)", "How many packets to write to peer socket per run\n" "Number of packets\n") { @@ -1476,7 +1476,7 @@ bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) DEFUN (bgp_coalesce_time, bgp_coalesce_time_cmd, - "coalesce-time <0-4294967295>", + "coalesce-time (0-4294967295)", "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { @@ -1485,7 +1485,7 @@ DEFUN (bgp_coalesce_time, DEFUN (no_bgp_coalesce_time, no_bgp_coalesce_time_cmd, - "no coalesce-time <0-4294967295>", + "no coalesce-time (0-4294967295)", "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { @@ -1495,7 +1495,7 @@ DEFUN (no_bgp_coalesce_time, /* Maximum-paths configuration */ DEFUN (bgp_maxpaths, bgp_maxpaths_cmd, - "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), + "maximum-paths " CMD_RANGE_STR<1, MULTIPATH_NUM>, "Forward packets over multiple paths\n" "Number of paths\n") { @@ -1504,7 +1504,7 @@ DEFUN (bgp_maxpaths, DEFUN (bgp_maxpaths_ibgp, bgp_maxpaths_ibgp_cmd, - "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), + "maximum-paths ibgp " CMD_RANGE_STR<1, MULTIPATH_NUM>, "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n") @@ -1514,7 +1514,7 @@ DEFUN (bgp_maxpaths_ibgp, DEFUN (bgp_maxpaths_ibgp_cluster, bgp_maxpaths_ibgp_cluster_cmd, - "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", + "maximum-paths ibgp " CMD_RANGE_STR<1, MULTIPATH_NUM> " equal-cluster-length", "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n" @@ -1601,7 +1601,7 @@ bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, DEFUN (bgp_timers, bgp_timers_cmd, - "timers bgp <0-65535> <0-65535>", + "timers bgp (0-65535) (0-65535)", "Adjust routing timers\n" "BGP timers\n" "Keepalive interval\n" @@ -1820,7 +1820,7 @@ DEFUN (no_bgp_graceful_restart, DEFUN (bgp_graceful_restart_stalepath_time, bgp_graceful_restart_stalepath_time_cmd, - "bgp graceful-restart stalepath-time <1-3600>", + "bgp graceful-restart stalepath-time (1-3600)", "BGP specific commands\n" "Graceful restart capability parameters\n" "Set the max time to hold onto restarting peer's stale paths\n" @@ -1840,7 +1840,7 @@ DEFUN (bgp_graceful_restart_stalepath_time, DEFUN (bgp_graceful_restart_restart_time, bgp_graceful_restart_restart_time_cmd, - "bgp graceful-restart restart-time <1-3600>", + "bgp graceful-restart restart-time (1-3600)", "BGP specific commands\n" "Graceful restart capability parameters\n" "Set the time to wait to delete stale routes before a BGP open message is received\n" @@ -2085,7 +2085,7 @@ DEFUN (no_bgp_bestpath_aspath_confed, /* "bgp bestpath as-path multipath-relax" configuration. */ DEFUN (bgp_bestpath_aspath_multipath_relax, bgp_bestpath_aspath_multipath_relax_cmd, - "bgp bestpath as-path multipath-relax {as-set|no-as-set}", + "bgp bestpath as-path multipath-relax [as-set|no-as-set]", "BGP specific commands\n" "Change the default bestpath selection\n" "AS-path attribute\n" @@ -2112,7 +2112,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, DEFUN (no_bgp_bestpath_aspath_multipath_relax, no_bgp_bestpath_aspath_multipath_relax_cmd, - "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", + "no bgp bestpath as-path multipath-relax [as-set|no-as-set]", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" @@ -2162,7 +2162,7 @@ DEFUN (no_bgp_log_neighbor_changes, /* "bgp bestpath med" configuration. */ DEFUN (bgp_bestpath_med, bgp_bestpath_med_cmd, - "bgp bestpath med (confed|missing-as-worst)", + "bgp bestpath med ", "BGP specific commands\n" "Change the default bestpath selection\n" "MED attribute\n" @@ -2215,7 +2215,7 @@ DEFUN (bgp_bestpath_med2, DEFUN (no_bgp_bestpath_med, no_bgp_bestpath_med_cmd, - "no bgp bestpath med (confed|missing-as-worst)", + "no bgp bestpath med ", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" @@ -2379,7 +2379,7 @@ DEFUN (no_bgp_network_import_check, DEFUN (bgp_default_local_preference, bgp_default_local_preference_cmd, - "bgp default local-preference <0-4294967295>", + "bgp default local-preference (0-4294967295)", "BGP specific commands\n" "Configure BGP defaults\n" "local preference (higher=more preferred)\n" @@ -2428,7 +2428,7 @@ DEFUN (no_bgp_default_local_preference, DEFUN (bgp_default_subgroup_pkt_queue_max, bgp_default_subgroup_pkt_queue_max_cmd, - "bgp default subgroup-pkt-queue-max <20-100>", + "bgp default subgroup-pkt-queue-max (20-100)", "BGP specific commands\n" "Configure BGP defaults\n" "subgroup-pkt-queue-max\n" @@ -2852,7 +2852,7 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_remote_as, neighbor_remote_as_cmd, - NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", + NEIGHBOR_CMD2 "remote-as <" CMD_AS_RANGE "|external|internal>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" @@ -3015,7 +3015,7 @@ DEFUN (neighbor_interface_config_v6only, DEFUN (neighbor_interface_config_remote_as, neighbor_interface_config_remote_as_cmd, - "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)", + "neighbor WORD interface remote-as <" CMD_AS_RANGE "|external|internal>", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" @@ -3027,7 +3027,7 @@ DEFUN (neighbor_interface_config_remote_as, DEFUN (neighbor_interface_v6only_config_remote_as, neighbor_interface_v6only_config_remote_as_cmd, - "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)", + "neighbor WORD interface v6only remote-as <" CMD_AS_RANGE "|external|internal>", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" @@ -3229,7 +3229,7 @@ DEFUN (no_neighbor_peer_group, DEFUN (no_neighbor_interface_peer_group_remote_as, no_neighbor_interface_peer_group_remote_as_cmd, - "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", + "no neighbor WORD remote-as <" CMD_AS_RANGE "|internal|external>", NO_STR NEIGHBOR_STR "Interface name or neighbor tag\n" @@ -3786,7 +3786,7 @@ peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, /* neighbor capability orf prefix-list. */ DEFUN (neighbor_capability_orf_prefix, neighbor_capability_orf_prefix_cmd, - NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", + NEIGHBOR_CMD2 "capability orf prefix-list ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Advertise capability to the peer\n" @@ -3813,7 +3813,7 @@ DEFUN (neighbor_capability_orf_prefix, DEFUN (no_neighbor_capability_orf_prefix, no_neighbor_capability_orf_prefix_cmd, - NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", + NO_NEIGHBOR_CMD2 "capability orf prefix-list ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4057,7 +4057,7 @@ DEFUN (no_neighbor_send_community, /* neighbor send-community extended. */ DEFUN (neighbor_send_community_type, neighbor_send_community_type_cmd, - NEIGHBOR_CMD2 "send-community (both|extended|standard)", + NEIGHBOR_CMD2 "send-community ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n" @@ -4082,7 +4082,7 @@ DEFUN (neighbor_send_community_type, DEFUN (no_neighbor_send_community_type, no_neighbor_send_community_type_cmd, - NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", + NO_NEIGHBOR_CMD2 "send-community ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4291,7 +4291,7 @@ DEFUN (neighbor_attr_unchanged, DEFUN (neighbor_attr_unchanged1, neighbor_attr_unchanged1_cmd, - NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", + NEIGHBOR_CMD2 "attribute-unchanged ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4314,7 +4314,7 @@ DEFUN (neighbor_attr_unchanged1, DEFUN (neighbor_attr_unchanged2, neighbor_attr_unchanged2_cmd, - NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", + NEIGHBOR_CMD2 "attribute-unchanged as-path ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4336,7 +4336,7 @@ DEFUN (neighbor_attr_unchanged2, DEFUN (neighbor_attr_unchanged3, neighbor_attr_unchanged3_cmd, - NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", + NEIGHBOR_CMD2 "attribute-unchanged next-hop ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4357,7 +4357,7 @@ DEFUN (neighbor_attr_unchanged3, DEFUN (neighbor_attr_unchanged4, neighbor_attr_unchanged4_cmd, - NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", + NEIGHBOR_CMD2 "attribute-unchanged med ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4456,7 +4456,7 @@ DEFUN (no_neighbor_attr_unchanged, DEFUN (no_neighbor_attr_unchanged1, no_neighbor_attr_unchanged1_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", + NO_NEIGHBOR_CMD2 "attribute-unchanged ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4480,7 +4480,7 @@ DEFUN (no_neighbor_attr_unchanged1, DEFUN (no_neighbor_attr_unchanged2, no_neighbor_attr_unchanged2_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", + NO_NEIGHBOR_CMD2 "attribute-unchanged as-path ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4502,7 +4502,7 @@ DEFUN (no_neighbor_attr_unchanged2, DEFUN (no_neighbor_attr_unchanged3, no_neighbor_attr_unchanged3_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", + NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4524,7 +4524,7 @@ DEFUN (no_neighbor_attr_unchanged3, DEFUN (no_neighbor_attr_unchanged4, no_neighbor_attr_unchanged4_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", + NO_NEIGHBOR_CMD2 "attribute-unchanged med ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4598,7 +4598,7 @@ DEFUN (neighbor_ebgp_multihop, DEFUN (neighbor_ebgp_multihop_ttl, neighbor_ebgp_multihop_ttl_cmd, - NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), + NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR<1, MAXTTL>, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n" @@ -4890,7 +4890,7 @@ peer_port_vty (struct vty *vty, const char *ip_str, int afi, /* Set specified peer's BGP port. */ DEFUN (neighbor_port, neighbor_port_cmd, - NEIGHBOR_CMD "port <0-65535>", + NEIGHBOR_CMD "port (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR "Neighbor's BGP port\n" @@ -4956,7 +4956,7 @@ peer_weight_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_weight, neighbor_weight_cmd, - NEIGHBOR_CMD2 "weight <0-65535>", + NEIGHBOR_CMD2 "weight (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Set default weight for routes from this neighbor\n" @@ -5068,7 +5068,7 @@ peer_timers_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_timers, neighbor_timers_cmd, - NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", + NEIGHBOR_CMD2 "timers (0-65535) (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n" @@ -5137,7 +5137,7 @@ peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_timers_connect, neighbor_timers_connect_cmd, - NEIGHBOR_CMD2 "timers connect <1-65535>", + NEIGHBOR_CMD2 "timers connect (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n" @@ -5196,7 +5196,7 @@ peer_advertise_interval_vty (struct vty *vty, const char *ip_str, DEFUN (neighbor_advertise_interval, neighbor_advertise_interval_cmd, - NEIGHBOR_CMD2 "advertisement-interval <0-600>", + NEIGHBOR_CMD2 "advertisement-interval (0-600)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Minimum interval between sending BGP routing updates\n" @@ -5230,7 +5230,7 @@ DEFUN (no_neighbor_advertise_interval, /* Time to wait before processing route-map updates */ DEFUN (bgp_set_route_map_delay_timer, bgp_set_route_map_delay_timer_cmd, - "bgp route-map delay-timer <0-600>", + "bgp route-map delay-timer (0-600)", SET_STR "BGP route-map delay timer\n" "Time in secs to wait before processing route-map changes\n" @@ -5374,7 +5374,7 @@ peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_distribute_list, neighbor_distribute_list_cmd, - NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", + NEIGHBOR_CMD2 "distribute-list <(1-199)|(1300-2699)|WORD> ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" @@ -5390,7 +5390,7 @@ DEFUN (neighbor_distribute_list, DEFUN (no_neighbor_distribute_list, no_neighbor_distribute_list_cmd, - NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", + NO_NEIGHBOR_CMD2 "distribute-list <(1-199)|(1300-2699)|WORD> ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5455,7 +5455,7 @@ peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_prefix_list, neighbor_prefix_list_cmd, - NEIGHBOR_CMD2 "prefix-list WORD (in|out)", + NEIGHBOR_CMD2 "prefix-list WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" @@ -5469,7 +5469,7 @@ DEFUN (neighbor_prefix_list, DEFUN (no_neighbor_prefix_list, no_neighbor_prefix_list_cmd, - NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", + NO_NEIGHBOR_CMD2 "prefix-list WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5532,7 +5532,7 @@ peer_aslist_unset_vty (struct vty *vty, const char *ip_str, DEFUN (neighbor_filter_list, neighbor_filter_list_cmd, - NEIGHBOR_CMD2 "filter-list WORD (in|out)", + NEIGHBOR_CMD2 "filter-list WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" @@ -5546,7 +5546,7 @@ DEFUN (neighbor_filter_list, DEFUN (no_neighbor_filter_list, no_neighbor_filter_list_cmd, - NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", + NO_NEIGHBOR_CMD2 "filter-list WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5609,7 +5609,7 @@ peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_route_map, neighbor_route_map_cmd, - NEIGHBOR_CMD2 "route-map WORD (in|out)", + NEIGHBOR_CMD2 "route-map WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Apply route map to neighbor\n" @@ -5623,7 +5623,7 @@ DEFUN (neighbor_route_map, DEFUN (no_neighbor_route_map, no_neighbor_route_map_cmd, - NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", + NO_NEIGHBOR_CMD2 "route-map WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5748,7 +5748,7 @@ peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, each peer configuration. */ DEFUN (neighbor_maximum_prefix, neighbor_maximum_prefix_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5761,7 +5761,7 @@ DEFUN (neighbor_maximum_prefix, DEFUN (neighbor_maximum_prefix_threshold, neighbor_maximum_prefix_threshold_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5775,7 +5775,7 @@ DEFUN (neighbor_maximum_prefix_threshold, DEFUN (neighbor_maximum_prefix_warning, neighbor_maximum_prefix_warning_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) warning-only", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5789,7 +5789,7 @@ DEFUN (neighbor_maximum_prefix_warning, DEFUN (neighbor_maximum_prefix_threshold_warning, neighbor_maximum_prefix_threshold_warning_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100) warning-only", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5803,7 +5803,7 @@ DEFUN (neighbor_maximum_prefix_threshold_warning, DEFUN (neighbor_maximum_prefix_restart, neighbor_maximum_prefix_restart_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) restart (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5817,7 +5817,7 @@ DEFUN (neighbor_maximum_prefix_restart, DEFUN (neighbor_maximum_prefix_threshold_restart, neighbor_maximum_prefix_threshold_restart_cmd, - NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", + NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100) restart (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5972,7 +5972,7 @@ DEFUN (no_neighbor_allowas_in, DEFUN (neighbor_ttl_security, neighbor_ttl_security_cmd, - NEIGHBOR_CMD2 "ttl-security hops <1-254>", + NEIGHBOR_CMD2 "ttl-security hops (1-254)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify the maximum number of hops to the BGP peer\n") @@ -6001,7 +6001,7 @@ DEFUN (neighbor_ttl_security, DEFUN (no_neighbor_ttl_security, no_neighbor_ttl_security_cmd, - NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", + NO_NEIGHBOR_CMD2 "ttl-security hops (1-254)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -6092,7 +6092,7 @@ DEFUN (address_family_ipv4, DEFUN (address_family_ipv4_safi, address_family_ipv4_safi_cmd, - "address-family ipv4 (unicast|multicast)", + "address-family ipv4 ", "Enter Address Family command mode\n" "Address family\n" "Address Family modifier\n" @@ -6118,7 +6118,7 @@ DEFUN (address_family_ipv6, DEFUN (address_family_ipv6_safi, address_family_ipv6_safi_cmd, - "address-family ipv6 (unicast|multicast)", + "address-family ipv6 ", "Enter Address Family command mode\n" "Address family\n" "Address Family modifier\n" @@ -6392,7 +6392,7 @@ DEFUN (clear_ip_bgp_all, */ DEFUN (clear_ip_bgp_peer, clear_ip_bgp_peer_cmd, - "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", + "clear ip bgp ", CLEAR_STR IP_STR BGP_STR @@ -6682,7 +6682,7 @@ DEFUN (clear_ip_bgp_all_soft_out, */ DEFUN (clear_ip_bgp_all_ipv4_soft_out, clear_ip_bgp_all_ipv4_soft_out_cmd, - "clear ip bgp * ipv4 (unicast|multicast) soft out", + "clear ip bgp * ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -6717,7 +6717,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, clear_ip_bgp_instance_all_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", + "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -6878,7 +6878,7 @@ DEFUN (clear_bgp_all_soft_out, DEFUN (clear_bgp_ipv6_safi_prefix, clear_bgp_ipv6_safi_prefix_cmd, - "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", + "clear bgp ipv6 prefix X:X::X:X/M", CLEAR_STR BGP_STR "Address family\n" @@ -6894,7 +6894,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, DEFUN (clear_bgp_instance_ipv6_safi_prefix, clear_bgp_instance_ipv6_safi_prefix_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", + "clear bgp " BGP_INSTANCE_CMD " ipv6 prefix X:X::X:X/M", CLEAR_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -6941,7 +6941,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, */ DEFUN (clear_ip_bgp_peer_soft_out, clear_ip_bgp_peer_soft_out_cmd, - "clear ip bgp (A.B.C.D|WORD) soft out", + "clear ip bgp soft out", CLEAR_STR IP_STR BGP_STR @@ -6977,7 +6977,7 @@ DEFUN (clear_ip_bgp_peer_soft_out, */ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, clear_ip_bgp_peer_ipv4_soft_out_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", + "clear ip bgp ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7014,7 +7014,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", + "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7053,7 +7053,7 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, clear_ip_bgp_peer_vpnv4_soft_out_cmd, - "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", + "clear ip bgp vpnv4 unicast soft out", CLEAR_STR IP_STR BGP_STR @@ -7170,7 +7170,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft_out, */ DEFUN (clear_bgp_peer_soft_out, clear_bgp_peer_soft_out_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", + "clear bgp soft out", CLEAR_STR BGP_STR "BGP neighbor address to clear\n" @@ -7262,7 +7262,7 @@ DEFUN (clear_ip_bgp_peer_group_soft_out, */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, clear_ip_bgp_peer_group_ipv4_soft_out_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", + "clear ip bgp peer-group WORD ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7299,7 +7299,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", + "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7473,7 +7473,7 @@ DEFUN (clear_ip_bgp_external_soft_out, */ DEFUN (clear_ip_bgp_external_ipv4_soft_out, clear_ip_bgp_external_ipv4_soft_out_cmd, - "clear ip bgp external ipv4 (unicast|multicast) soft out", + "clear ip bgp external ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7508,7 +7508,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, clear_ip_bgp_instance_external_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", + "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7673,7 +7673,7 @@ DEFUN (clear_ip_bgp_as_soft_out, */ DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", + "clear ip bgp " CMD_AS_RANGE " ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7708,7 +7708,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, clear_ip_bgp_instance_as_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", + "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft out", CLEAR_STR IP_STR BGP_STR @@ -7950,7 +7950,7 @@ DEFUN (clear_ip_bgp_all_in_prefix_filter, */ DEFUN (clear_ip_bgp_all_ipv4_soft_in, clear_ip_bgp_all_ipv4_soft_in_cmd, - "clear ip bgp * ipv4 (unicast|multicast) soft in", + "clear ip bgp * ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -7985,7 +7985,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, clear_ip_bgp_instance_all_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", + "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8009,7 +8009,7 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, - "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp * ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8223,7 +8223,7 @@ DEFUN (clear_bgp_all_in_prefix_filter, */ DEFUN (clear_ip_bgp_peer_soft_in, clear_ip_bgp_peer_soft_in_cmd, - "clear ip bgp (A.B.C.D|WORD) soft in", + "clear ip bgp soft in", CLEAR_STR IP_STR BGP_STR @@ -8245,7 +8245,7 @@ DEFUN (clear_ip_bgp_peer_soft_in, DEFUN (clear_ip_bgp_peer_in_prefix_filter, clear_ip_bgp_peer_in_prefix_filter_cmd, - "clear ip bgp (A.B.C.D|WORD) in prefix-filter", + "clear ip bgp in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8274,7 +8274,7 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter, */ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, clear_ip_bgp_peer_ipv4_soft_in_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", + "clear ip bgp ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8311,7 +8311,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", + "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8336,7 +8336,7 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8371,7 +8371,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, clear_ip_bgp_peer_vpnv4_soft_in_cmd, - "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", + "clear ip bgp vpnv4 unicast soft in", CLEAR_STR IP_STR BGP_STR @@ -8488,7 +8488,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft_in, */ DEFUN (clear_bgp_peer_soft_in, clear_bgp_peer_soft_in_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", + "clear bgp soft in", CLEAR_STR BGP_STR "BGP neighbor address to clear\n" @@ -8527,7 +8527,7 @@ DEFUN (clear_bgp_peer_soft_in, */ DEFUN (clear_bgp_peer_in_prefix_filter, clear_bgp_peer_in_prefix_filter_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", + "clear bgp in prefix-filter", CLEAR_STR BGP_STR "BGP neighbor address to clear\n" @@ -8624,7 +8624,7 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, clear_ip_bgp_peer_group_ipv4_soft_in_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", + "clear ip bgp peer-group WORD ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8661,7 +8661,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", + "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8686,7 +8686,7 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp peer-group WORD ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8898,7 +8898,7 @@ DEFUN (clear_ip_bgp_external_in_prefix_filter, */ DEFUN (clear_ip_bgp_external_ipv4_soft_in, clear_ip_bgp_external_ipv4_soft_in_cmd, - "clear ip bgp external ipv4 (unicast|multicast) soft in", + "clear ip bgp external ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8933,7 +8933,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, clear_ip_bgp_instance_external_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", + "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -8957,7 +8957,7 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, - "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp external ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -9158,7 +9158,7 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, */ DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", + "clear ip bgp " CMD_AS_RANGE " ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -9193,7 +9193,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, clear_ip_bgp_instance_as_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", + "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft in", CLEAR_STR IP_STR BGP_STR @@ -9217,7 +9217,7 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp " CMD_AS_RANGE " ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -9432,7 +9432,7 @@ DEFUN (clear_ip_bgp_all_soft, DEFUN (clear_ip_bgp_all_ipv4_soft, clear_ip_bgp_all_ipv4_soft_cmd, - "clear ip bgp * ipv4 (unicast|multicast) soft", + "clear ip bgp * ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9452,7 +9452,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft, DEFUN (clear_ip_bgp_instance_all_ipv4_soft, clear_ip_bgp_instance_all_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", + "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9559,7 +9559,7 @@ DEFUN (clear_bgp_all_soft, */ DEFUN (clear_ip_bgp_peer_soft, clear_ip_bgp_peer_soft_cmd, - "clear ip bgp (A.B.C.D|WORD) soft", + "clear ip bgp soft", CLEAR_STR IP_STR BGP_STR @@ -9578,7 +9578,7 @@ DEFUN (clear_ip_bgp_peer_soft, DEFUN (clear_ip_bgp_peer_ipv4_soft, clear_ip_bgp_peer_ipv4_soft_cmd, - "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", + "clear ip bgp ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9599,7 +9599,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft, DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, clear_ip_bgp_instance_peer_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", + "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9621,7 +9621,7 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, DEFUN (clear_ip_bgp_peer_vpnv4_soft, clear_ip_bgp_peer_vpnv4_soft_cmd, - "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", + "clear ip bgp vpnv4 unicast soft", CLEAR_STR IP_STR BGP_STR @@ -9683,7 +9683,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft, */ DEFUN (clear_bgp_peer_soft, clear_bgp_peer_soft_cmd, - "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", + "clear bgp soft", CLEAR_STR BGP_STR "BGP neighbor address to clear\n" @@ -9735,7 +9735,7 @@ DEFUN (clear_ip_bgp_peer_group_soft, DEFUN (clear_ip_bgp_peer_group_ipv4_soft, clear_ip_bgp_peer_group_ipv4_soft_cmd, - "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", + "clear ip bgp peer-group WORD ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9756,7 +9756,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft, DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", + "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9855,7 +9855,7 @@ DEFUN (clear_ip_bgp_external_soft, DEFUN (clear_ip_bgp_external_ipv4_soft, clear_ip_bgp_external_ipv4_soft_cmd, - "clear ip bgp external ipv4 (unicast|multicast) soft", + "clear ip bgp external ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9875,7 +9875,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft, DEFUN (clear_ip_bgp_instance_external_ipv4_soft, clear_ip_bgp_instance_external_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", + "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9969,7 +9969,7 @@ DEFUN (clear_ip_bgp_as_soft, DEFUN (clear_ip_bgp_as_ipv4_soft, clear_ip_bgp_as_ipv4_soft_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", + "clear ip bgp " CMD_AS_RANGE " ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -9989,7 +9989,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, DEFUN (clear_ip_bgp_instance_as_ipv4_soft, clear_ip_bgp_instance_as_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", + "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -10815,7 +10815,7 @@ DEFUN (show_ip_bgp_instance_all_summary, */ DEFUN (show_ip_bgp_ipv4_summary, show_ip_bgp_ipv4_summary_cmd, - "show ip bgp ipv4 (unicast|multicast) summary [json]", + "show ip bgp ipv4 summary [json]", SHOW_STR IP_STR BGP_STR @@ -10875,7 +10875,7 @@ DEFUN (show_bgp_ipv6_vpn_summary, */ DEFUN (show_ip_bgp_instance_ipv4_summary, show_ip_bgp_instance_ipv4_summary_cmd, - "show ip bgp view WORD ipv4 (unicast|multicast) summary [json]", + "show ip bgp view WORD ipv4 summary [json]", SHOW_STR IP_STR BGP_STR @@ -10998,7 +10998,7 @@ DEFUN (show_bgp_instance_all_summary, DEFUN (show_bgp_ipv6_safi_summary, show_bgp_ipv6_safi_summary_cmd, - "show bgp ipv6 (unicast|multicast) summary [json]", + "show bgp ipv6 summary [json]", SHOW_STR BGP_STR "Address family\n" @@ -11016,7 +11016,7 @@ DEFUN (show_bgp_ipv6_safi_summary, DEFUN (show_bgp_instance_ipv6_safi_summary, show_bgp_instance_ipv6_safi_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary [json]", + "show bgp " BGP_INSTANCE_CMD " ipv6 summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13013,7 +13013,7 @@ DEFUN (show_ip_bgp_neighbors, */ DEFUN (show_ip_bgp_neighbors_peer, show_ip_bgp_neighbors_peer_cmd, - "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", + "show ip bgp neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -13110,7 +13110,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, */ DEFUN (show_ip_bgp_instance_neighbors_peer, show_ip_bgp_instance_neighbors_peer_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", + "show ip bgp " BGP_INSTANCE_CMD " neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -13146,7 +13146,7 @@ DEFUN (show_ip_bgp_paths, DEFUN (show_ip_bgp_ipv4_paths, show_ip_bgp_ipv4_paths_cmd, - "show ip bgp ipv4 (unicast|multicast) paths", + "show ip bgp ipv4 paths", SHOW_STR IP_STR BGP_STR @@ -13307,7 +13307,7 @@ DEFUN (show_bgp_instance_all_ipv6_updgrps, DEFUN (show_bgp_updgrps, show_bgp_updgrps_cmd, - "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", + "show bgp update-groups", SHOW_STR BGP_STR "Address family\n" @@ -13385,7 +13385,7 @@ DEFUN (show_bgp_instance_ipv6_updgrps_s, DEFUN (show_bgp_updgrps_s, show_bgp_updgrps_s_cmd, - "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", + "show bgp update-groups SUBGROUP-ID", SHOW_STR BGP_STR "Address family\n" @@ -13466,7 +13466,7 @@ show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, DEFUN (show_ip_bgp_updgrps_adj, show_ip_bgp_updgrps_adj_cmd, - "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", + "show ip bgp update-groups ", SHOW_STR IP_STR BGP_STR @@ -13482,7 +13482,7 @@ DEFUN (show_ip_bgp_updgrps_adj, DEFUN (show_ip_bgp_instance_updgrps_adj, show_ip_bgp_instance_updgrps_adj_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", + "show ip bgp " BGP_INSTANCE_CMD " update-groups ", SHOW_STR IP_STR BGP_STR @@ -13499,7 +13499,7 @@ DEFUN (show_ip_bgp_instance_updgrps_adj, DEFUN (show_bgp_updgrps_afi_adj, show_bgp_updgrps_afi_adj_cmd, - "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", + "show bgp update-groups ", SHOW_STR BGP_STR "Address family\n" @@ -13523,7 +13523,7 @@ DEFUN (show_bgp_updgrps_afi_adj, DEFUN (show_bgp_updgrps_adj, show_bgp_updgrps_adj_cmd, - "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", + "show bgp update-groups ", SHOW_STR BGP_STR "BGP update groups\n" @@ -13537,7 +13537,7 @@ DEFUN (show_bgp_updgrps_adj, DEFUN (show_bgp_instance_updgrps_adj, show_bgp_instance_updgrps_adj_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", + "show bgp " BGP_INSTANCE_CMD " update-groups ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13552,7 +13552,7 @@ DEFUN (show_bgp_instance_updgrps_adj, DEFUN (show_ip_bgp_updgrps_adj_s, show_ip_bgp_updgrps_adj_s_cmd, - "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", + "show ip bgp update-groups SUBGROUP-ID ", SHOW_STR IP_STR BGP_STR @@ -13573,7 +13573,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, DEFUN (show_ip_bgp_instance_updgrps_adj_s, show_ip_bgp_instance_updgrps_adj_s_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", + "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID ", SHOW_STR IP_STR BGP_STR @@ -13595,7 +13595,7 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, DEFUN (show_bgp_updgrps_afi_adj_s, show_bgp_updgrps_afi_adj_s_cmd, - "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", + "show bgp update-groups SUBGROUP-ID ", SHOW_STR BGP_STR "Address family\n" @@ -13623,7 +13623,7 @@ DEFUN (show_bgp_updgrps_afi_adj_s, DEFUN (show_bgp_updgrps_adj_s, show_bgp_updgrps_adj_s_cmd, - "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", + "show bgp update-groups SUBGROUP-ID ", SHOW_STR BGP_STR "BGP update groups\n" @@ -13642,7 +13642,7 @@ DEFUN (show_bgp_updgrps_adj_s, DEFUN (show_bgp_instance_updgrps_adj_s, show_bgp_instance_updgrps_adj_s_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", + "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13914,7 +13914,7 @@ DEFUN (bgp_redistribute_ipv4_rmap, DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", + "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -13939,7 +13939,7 @@ DEFUN (bgp_redistribute_ipv4_metric, DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -13967,7 +13967,7 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric (0-4294967295) route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -13995,7 +13995,7 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, DEFUN (bgp_redistribute_ipv4_ospf, bgp_redistribute_ipv4_ospf_cmd, - "redistribute (ospf|table) <1-65535>", + "redistribute (1-65535)", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" @@ -14017,7 +14017,7 @@ DEFUN (bgp_redistribute_ipv4_ospf, DEFUN (bgp_redistribute_ipv4_ospf_rmap, bgp_redistribute_ipv4_ospf_rmap_cmd, - "redistribute (ospf|table) <1-65535> route-map WORD", + "redistribute (1-65535) route-map WORD", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" @@ -14042,7 +14042,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap, DEFUN (bgp_redistribute_ipv4_ospf_metric, bgp_redistribute_ipv4_ospf_metric_cmd, - "redistribute (ospf|table) <1-65535> metric <0-4294967295>", + "redistribute (1-65535) metric (0-4294967295)", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" @@ -14070,7 +14070,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric, DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, bgp_redistribute_ipv4_ospf_rmap_metric_cmd, - "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", + "redistribute (1-65535) route-map WORD metric (0-4294967295)", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" @@ -14101,7 +14101,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, bgp_redistribute_ipv4_ospf_metric_rmap_cmd, - "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", + "redistribute (1-65535) metric (0-4294967295) route-map WORD", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" @@ -14175,7 +14175,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, */ DEFUN (no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_cmd, - "no redistribute (ospf|table) <1-65535>", + "no redistribute (1-65535)", NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" @@ -14300,7 +14300,7 @@ DEFUN (bgp_redistribute_ipv6_rmap, DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", + "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -14325,7 +14325,7 @@ DEFUN (bgp_redistribute_ipv6_metric, DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -14353,7 +14353,7 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric (0-4294967295) route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -15962,7 +15962,7 @@ community_list_unset_vty (struct vty *vty, int argc, const char **argv, */ DEFUN (ip_community_list_standard, ip_community_list_standard_cmd, - "ip community-list <1-99> (deny|permit) .AA:NN", + "ip community-list (1-99) .AA:NN", IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" @@ -15976,7 +15976,7 @@ DEFUN (ip_community_list_standard, DEFUN (ip_community_list_expanded, ip_community_list_expanded_cmd, - "ip community-list <100-500> (deny|permit) .LINE", + "ip community-list (100-500) .LINE", IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" @@ -16000,7 +16000,7 @@ DEFUN (ip_community_list_expanded, */ DEFUN (ip_community_list_name_standard, ip_community_list_name_standard_cmd, - "ip community-list standard WORD (deny|permit) .AA:NN", + "ip community-list standard WORD .AA:NN", IP_STR COMMUNITY_LIST_STR "Add a standard community-list entry\n" @@ -16015,7 +16015,7 @@ DEFUN (ip_community_list_name_standard, DEFUN (ip_community_list_name_expanded, ip_community_list_name_expanded_cmd, - "ip community-list expanded WORD (deny|permit) .LINE", + "ip community-list expanded WORD .LINE", IP_STR COMMUNITY_LIST_STR "Add an expanded community-list entry\n" @@ -16029,7 +16029,7 @@ DEFUN (ip_community_list_name_expanded, DEFUN (no_ip_community_list_standard_all, no_ip_community_list_standard_all_cmd, - "no ip community-list <1-99>", + "no ip community-list (1-99)", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16040,7 +16040,7 @@ DEFUN (no_ip_community_list_standard_all, DEFUN (no_ip_community_list_standard_direction, no_ip_community_list_standard_direction_cmd, - "no ip community-list <1-99> (deny|permit)", + "no ip community-list (1-99) ", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16054,7 +16054,7 @@ DEFUN (no_ip_community_list_standard_direction, DEFUN (no_ip_community_list_expanded_all, no_ip_community_list_expanded_all_cmd, - "no ip community-list <100-500>", + "no ip community-list (100-500)", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16089,7 +16089,7 @@ DEFUN (no_ip_community_list_name_expanded_all, DEFUN (no_ip_community_list_standard, no_ip_community_list_standard_cmd, - "no ip community-list <1-99> (deny|permit) .AA:NN", + "no ip community-list (1-99) .AA:NN", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16103,7 +16103,7 @@ DEFUN (no_ip_community_list_standard, DEFUN (no_ip_community_list_expanded, no_ip_community_list_expanded_cmd, - "no ip community-list <100-500> (deny|permit) .LINE", + "no ip community-list (100-500) .LINE", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16117,7 +16117,7 @@ DEFUN (no_ip_community_list_expanded, DEFUN (no_ip_community_list_name_standard, no_ip_community_list_name_standard_cmd, - "no ip community-list standard WORD (deny|permit) .AA:NN", + "no ip community-list standard WORD .AA:NN", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16132,7 +16132,7 @@ DEFUN (no_ip_community_list_name_standard, DEFUN (no_ip_community_list_name_standard_brief, no_ip_community_list_name_standard_brief_cmd, - "no ip community-list standard WORD (deny|permit)", + "no ip community-list standard WORD ", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16146,7 +16146,7 @@ DEFUN (no_ip_community_list_name_standard_brief, DEFUN (no_ip_community_list_name_expanded, no_ip_community_list_name_expanded_cmd, - "no ip community-list expanded WORD (deny|permit) .LINE", + "no ip community-list expanded WORD .LINE", NO_STR IP_STR COMMUNITY_LIST_STR @@ -16216,7 +16216,7 @@ DEFUN (show_ip_community_list, DEFUN (show_ip_community_list_arg, show_ip_community_list_arg_cmd, - "show ip community-list (<1-500>|WORD)", + "show ip community-list <(1-500)|WORD>", SHOW_STR IP_STR "List community-list\n" @@ -16344,7 +16344,7 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, */ DEFUN (ip_extcommunity_list_standard, ip_extcommunity_list_standard_cmd, - "ip extcommunity-list <1-99> (deny|permit) .AA:NN", + "ip extcommunity-list (1-99) .AA:NN", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" @@ -16358,7 +16358,7 @@ DEFUN (ip_extcommunity_list_standard, DEFUN (ip_extcommunity_list_expanded, ip_extcommunity_list_expanded_cmd, - "ip extcommunity-list <100-500> (deny|permit) .LINE", + "ip extcommunity-list (100-500) .LINE", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" @@ -16382,7 +16382,7 @@ DEFUN (ip_extcommunity_list_expanded, */ DEFUN (ip_extcommunity_list_name_standard, ip_extcommunity_list_name_standard_cmd, - "ip extcommunity-list standard WORD (deny|permit) .AA:NN", + "ip extcommunity-list standard WORD .AA:NN", IP_STR EXTCOMMUNITY_LIST_STR "Specify standard extcommunity-list\n" @@ -16397,7 +16397,7 @@ DEFUN (ip_extcommunity_list_name_standard, DEFUN (ip_extcommunity_list_name_expanded, ip_extcommunity_list_name_expanded_cmd, - "ip extcommunity-list expanded WORD (deny|permit) .LINE", + "ip extcommunity-list expanded WORD .LINE", IP_STR EXTCOMMUNITY_LIST_STR "Specify expanded extcommunity-list\n" @@ -16411,7 +16411,7 @@ DEFUN (ip_extcommunity_list_name_expanded, DEFUN (no_ip_extcommunity_list_standard_all, no_ip_extcommunity_list_standard_all_cmd, - "no ip extcommunity-list <1-99>", + "no ip extcommunity-list (1-99)", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16422,7 +16422,7 @@ DEFUN (no_ip_extcommunity_list_standard_all, DEFUN (no_ip_extcommunity_list_standard_direction, no_ip_extcommunity_list_standard_direction_cmd, - "no ip extcommunity-list <1-99> (deny|permit)", + "no ip extcommunity-list (1-99) ", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16435,7 +16435,7 @@ DEFUN (no_ip_extcommunity_list_standard_direction, DEFUN (no_ip_extcommunity_list_expanded_all, no_ip_extcommunity_list_expanded_all_cmd, - "no ip extcommunity-list <100-500>", + "no ip extcommunity-list (100-500)", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16470,7 +16470,7 @@ DEFUN (no_ip_extcommunity_list_name_expanded_all, DEFUN (no_ip_extcommunity_list_standard, no_ip_extcommunity_list_standard_cmd, - "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", + "no ip extcommunity-list (1-99) .AA:NN", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16484,7 +16484,7 @@ DEFUN (no_ip_extcommunity_list_standard, DEFUN (no_ip_extcommunity_list_expanded, no_ip_extcommunity_list_expanded_cmd, - "no ip extcommunity-list <100-500> (deny|permit) .LINE", + "no ip extcommunity-list (100-500) .LINE", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16498,7 +16498,7 @@ DEFUN (no_ip_extcommunity_list_expanded, DEFUN (no_ip_extcommunity_list_name_standard, no_ip_extcommunity_list_name_standard_cmd, - "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", + "no ip extcommunity-list standard WORD .AA:NN", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16513,7 +16513,7 @@ DEFUN (no_ip_extcommunity_list_name_standard, DEFUN (no_ip_extcommunity_list_name_standard_brief, no_ip_extcommunity_list_name_standard_brief_cmd, - "no ip extcommunity-list standard WORD (deny|permit)", + "no ip extcommunity-list standard WORD ", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16527,7 +16527,7 @@ DEFUN (no_ip_extcommunity_list_name_standard_brief, DEFUN (no_ip_extcommunity_list_name_expanded, no_ip_extcommunity_list_name_expanded_cmd, - "no ip extcommunity-list expanded WORD (deny|permit) .LINE", + "no ip extcommunity-list expanded WORD .LINE", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -16597,7 +16597,7 @@ DEFUN (show_ip_extcommunity_list, DEFUN (show_ip_extcommunity_list_arg, show_ip_extcommunity_list_arg_cmd, - "show ip extcommunity-list (<1-500>|WORD)", + "show ip extcommunity-list <(1-500)|WORD>", SHOW_STR IP_STR "List extended-community list\n" diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index cf598cd5d6..62b057eabe 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -539,7 +539,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD " (level-1|level-2) {metric <0-16777215>|route-map WORD}", + "redistribute " QUAGGA_REDIST_STR_ISISD " [metric (0-16777215)|route-map WORD]", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" @@ -607,7 +607,7 @@ DEFUN (isis_redistribute, DEFUN (no_isis_redistribute, no_isis_redistribute_cmd, - "no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD " (level-1|level-2)", + "no redistribute " QUAGGA_REDIST_STR_ISISD " ", NO_STR REDIST_STR "Redistribute IPv4 routes\n" @@ -650,7 +650,7 @@ DEFUN (no_isis_redistribute, DEFUN (isis_default_originate, isis_default_originate_cmd, - "default-information originate (ipv4|ipv6) (level-1|level-2) {always|metric <0-16777215>|route-map WORD}", + "default-information originate [always|metric (0-16777215)|route-map WORD]", "Control distribution of default information\n" "Distribute a default route\n" "Distribute default route for IPv4\n" @@ -721,7 +721,7 @@ DEFUN (isis_default_originate, DEFUN (no_isis_default_originate, no_isis_default_originate_cmd, - "no default-information originate (ipv4|ipv6) (level-1|level-2)", + "no default-information originate ", NO_STR "Control distribution of default information\n" "Distribute a default route\n" diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 35781ef2ca..fd6bff848d 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -346,7 +346,7 @@ isis_route_set_delete (struct vty *vty, struct route_map_index *index, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", + "match ip address <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match address of route\n" @@ -368,7 +368,7 @@ DEFUN (match_ip_address, */ DEFUN (no_match_ip_address, no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", + "no match ip address <(1-199)|(1300-2699)|WORD>", NO_STR MATCH_STR IP_STR @@ -507,7 +507,7 @@ DEFUN (no_match_ipv6_address_prefix_list, * verify that the input is a valid isis metric */ DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", SET_STR "Metric vale for destination routing protocol\n" "Metric value\n") @@ -528,7 +528,7 @@ DEFUN (set_metric, */ DEFUN (no_set_metric, no_set_metric_val_cmd, - "no set metric <0-4294967295>", + "no set metric (0-4294967295)", NO_STR SET_STR "Metric value for destination routing protocol\n" diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 0a327c754e..b958f0a213 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1190,7 +1190,7 @@ DEFUN (isis_mpls_te_router_addr, DEFUN (isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd, - "mpls-te inter-as (level-1|level-1-2|level-2-only)", + "mpls-te inter-as ", MPLS_TE_STR "Configure MPLS-TE Inter-AS support\n" "AREA native mode self originate INTER-AS LSP with L1 only flooding scope)\n" diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index b0976177ff..a3890a5954 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -55,7 +55,7 @@ isis_circuit_lookup (struct vty *vty) DEFUN (ip_router_isis, ip_router_isis_cmd, - "(ip|ipv6) router isis WORD", + " router isis WORD", "Interface Internet Protocol config commands\n" "IP router interface commands\n" "IS-IS Routing for IP\n" @@ -108,7 +108,7 @@ DEFUN (ip_router_isis, DEFUN (no_ip_router_isis, no_ip_router_isis_cmd, - "no (ip|ipv6) router isis WORD", + "no router isis WORD", NO_STR "Interface Internet Protocol config commands\n" "IP router interface commands\n" @@ -192,7 +192,7 @@ DEFUN (no_isis_passive, DEFUN (isis_circuit_type, isis_circuit_type_cmd, - "isis circuit-type (level-1|level-1-2|level-2-only)", + "isis circuit-type ", "IS-IS commands\n" "Configure circuit type for interface\n" "Level-1 only adjacencies are formed\n" @@ -226,7 +226,7 @@ DEFUN (isis_circuit_type, DEFUN (no_isis_circuit_type, no_isis_circuit_type_cmd, - "no isis circuit-type (level-1|level-1-2|level-2-only)", + "no isis circuit-type ", NO_STR "IS-IS commands\n" "Configure circuit type for interface\n" @@ -298,7 +298,7 @@ DEFUN (no_isis_network, DEFUN (isis_passwd, isis_passwd_cmd, - "isis password (md5|clear) WORD", + "isis password WORD", "IS-IS commands\n" "Configure the authentication password for a circuit\n" "HMAC-MD5 authentication\n" @@ -353,7 +353,7 @@ DEFUN (no_isis_passwd, DEFUN (isis_priority, isis_priority_cmd, - "isis priority <0-127>", + "isis priority (0-127)", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n") @@ -406,7 +406,7 @@ DEFUN (no_isis_priority, DEFUN (isis_priority_l1, isis_priority_l1_cmd, - "isis priority <0-127> level-1", + "isis priority (0-127) level-1", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n" @@ -460,7 +460,7 @@ DEFUN (no_isis_priority_l1, DEFUN (isis_priority_l2, isis_priority_l2_cmd, - "isis priority <0-127> level-2", + "isis priority (0-127) level-2", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n" @@ -515,7 +515,7 @@ DEFUN (no_isis_priority_l2, /* Metric command */ DEFUN (isis_metric, isis_metric_cmd, - "isis metric <0-16777215>", + "isis metric (0-16777215)", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n") @@ -580,7 +580,7 @@ DEFUN (no_isis_metric, DEFUN (isis_metric_l1, isis_metric_l1_cmd, - "isis metric <0-16777215> level-1", + "isis metric (0-16777215) level-1", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n" @@ -646,7 +646,7 @@ DEFUN (no_isis_metric_l1, DEFUN (isis_metric_l2, isis_metric_l2_cmd, - "isis metric <0-16777215> level-2", + "isis metric (0-16777215) level-2", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n" @@ -713,7 +713,7 @@ DEFUN (no_isis_metric_l2, DEFUN (isis_hello_interval, isis_hello_interval_cmd, - "isis hello-interval <1-600>", + "isis hello-interval (1-600)", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" @@ -768,7 +768,7 @@ DEFUN (no_isis_hello_interval, DEFUN (isis_hello_interval_l1, isis_hello_interval_l1_cmd, - "isis hello-interval <1-600> level-1", + "isis hello-interval (1-600) level-1", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" @@ -824,7 +824,7 @@ DEFUN (no_isis_hello_interval_l1, DEFUN (isis_hello_interval_l2, isis_hello_interval_l2_cmd, - "isis hello-interval <1-600> level-2", + "isis hello-interval (1-600) level-2", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" @@ -880,7 +880,7 @@ DEFUN (no_isis_hello_interval_l2, DEFUN (isis_hello_multiplier, isis_hello_multiplier_cmd, - "isis hello-multiplier <2-100>", + "isis hello-multiplier (2-100)", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n") @@ -933,7 +933,7 @@ DEFUN (no_isis_hello_multiplier, DEFUN (isis_hello_multiplier_l1, isis_hello_multiplier_l1_cmd, - "isis hello-multiplier <2-100> level-1", + "isis hello-multiplier (2-100) level-1", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n" @@ -987,7 +987,7 @@ DEFUN (no_isis_hello_multiplier_l1, DEFUN (isis_hello_multiplier_l2, isis_hello_multiplier_l2_cmd, - "isis hello-multiplier <2-100> level-2", + "isis hello-multiplier (2-100) level-2", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n" @@ -1076,7 +1076,7 @@ DEFUN (no_isis_hello_padding, DEFUN (csnp_interval, csnp_interval_cmd, - "isis csnp-interval <1-600>", + "isis csnp-interval (1-600)", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n") @@ -1129,7 +1129,7 @@ DEFUN (no_csnp_interval, DEFUN (csnp_interval_l1, csnp_interval_l1_cmd, - "isis csnp-interval <1-600> level-1", + "isis csnp-interval (1-600) level-1", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n" @@ -1183,7 +1183,7 @@ DEFUN (no_csnp_interval_l1, DEFUN (csnp_interval_l2, csnp_interval_l2_cmd, - "isis csnp-interval <1-600> level-2", + "isis csnp-interval (1-600) level-2", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n" @@ -1237,7 +1237,7 @@ DEFUN (no_csnp_interval_l2, DEFUN (psnp_interval, psnp_interval_cmd, - "isis psnp-interval <1-120>", + "isis psnp-interval (1-120)", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n") @@ -1290,7 +1290,7 @@ DEFUN (no_psnp_interval, DEFUN (psnp_interval_l1, psnp_interval_l1_cmd, - "isis psnp-interval <1-120> level-1", + "isis psnp-interval (1-120) level-1", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n" @@ -1344,7 +1344,7 @@ DEFUN (no_psnp_interval_l1, DEFUN (psnp_interval_l2, psnp_interval_l2_cmd, - "isis psnp-interval <1-120> level-2", + "isis psnp-interval (1-120) level-2", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n" @@ -1436,7 +1436,7 @@ validate_metric_style_narrow (struct vty *vty, struct isis_area *area) DEFUN (metric_style, metric_style_cmd, - "metric-style (narrow|transition|wide)", + "metric-style ", "Use old-style (ISO 10589) or new-style packet formats\n" "Use old style of TLVs with narrow metric\n" "Send and accept both styles of TLVs during transition\n" @@ -1593,7 +1593,7 @@ static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu) DEFUN (area_lsp_mtu, area_lsp_mtu_cmd, - "lsp-mtu <128-4352>", + "lsp-mtu (128-4352)", "Configure the maximum size of generated LSPs\n" "Maximum size of generated LSPs\n") { @@ -1624,7 +1624,7 @@ DEFUN (no_area_lsp_mtu, DEFUN (is_type, is_type_cmd, - "is-type (level-1|level-1-2|level-2-only)", + "is-type ", "IS Level for this routing process (OSI only)\n" "Act as a station router only\n" "Act as both a station router and an area router\n" @@ -1655,7 +1655,7 @@ DEFUN (is_type, DEFUN (no_is_type, no_is_type_cmd, - "no is-type (level-1|level-1-2|level-2-only)", + "no is-type ", NO_STR "IS Level for this routing process (OSI only)\n" "Act as a station router only\n" @@ -1715,7 +1715,7 @@ set_lsp_gen_interval (struct vty *vty, struct isis_area *area, DEFUN (lsp_gen_interval, lsp_gen_interval_cmd, - "lsp-gen-interval <1-120>", + "lsp-gen-interval (1-120)", "Minimum interval between regenerating same LSP\n" "Minimum interval in seconds\n") { @@ -1756,7 +1756,7 @@ DEFUN (no_lsp_gen_interval, DEFUN (lsp_gen_interval_l1, lsp_gen_interval_l1_cmd, - "lsp-gen-interval level-1 <1-120>", + "lsp-gen-interval level-1 (1-120)", "Minimum interval between regenerating same LSP\n" "Set interval for level 1 only\n" "Minimum interval in seconds\n") @@ -1800,7 +1800,7 @@ DEFUN (no_lsp_gen_interval_l1, DEFUN (lsp_gen_interval_l2, lsp_gen_interval_l2_cmd, - "lsp-gen-interval level-2 <1-120>", + "lsp-gen-interval level-2 (1-120)", "Minimum interval between regenerating same LSP\n" "Set interval for level 2 only\n" "Minimum interval in seconds\n") @@ -1844,7 +1844,7 @@ DEFUN (no_lsp_gen_interval_l2, DEFUN (spf_interval, spf_interval_cmd, - "spf-interval <1-120>", + "spf-interval (1-120)", "Minimum interval between SPF calculations\n" "Minimum interval between consecutive SPFs in seconds\n") { @@ -1898,7 +1898,7 @@ DEFUN (no_spf_interval, DEFUN (spf_interval_l1, spf_interval_l1_cmd, - "spf-interval level-1 <1-120>", + "spf-interval level-1 (1-120)", "Minimum interval between SPF calculations\n" "Set interval for level 1 only\n" "Minimum interval between consecutive SPFs in seconds\n") @@ -1932,7 +1932,7 @@ DEFUN (no_spf_interval_l1, DEFUN (spf_interval_l2, spf_interval_l2_cmd, - "spf-interval level-2 <1-120>", + "spf-interval level-2 (1-120)", "Minimum interval between SPF calculations\n" "Set interval for level 2 only\n" "Minimum interval between consecutive SPFs in seconds\n") @@ -2018,7 +2018,7 @@ area_max_lsp_lifetime_set(struct vty *vty, int level, DEFUN (max_lsp_lifetime, max_lsp_lifetime_cmd, - "max-lsp-lifetime <350-65535>", + "max-lsp-lifetime (350-65535)", "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { @@ -2046,7 +2046,7 @@ DEFUN (no_max_lsp_lifetime, DEFUN (max_lsp_lifetime_l1, max_lsp_lifetime_l1_cmd, - "max-lsp-lifetime level-1 <350-65535>", + "max-lsp-lifetime level-1 (350-65535)", "Maximum LSP lifetime for Level 1 only\n" "LSP lifetime for Level 1 only in seconds\n") { @@ -2073,7 +2073,7 @@ DEFUN (no_max_lsp_lifetime_l1, DEFUN (max_lsp_lifetime_l2, max_lsp_lifetime_l2_cmd, - "max-lsp-lifetime level-2 <350-65535>", + "max-lsp-lifetime level-2 (350-65535)", "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime for Level 2 only in seconds\n") { @@ -2144,7 +2144,7 @@ area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) DEFUN (lsp_refresh_interval, lsp_refresh_interval_cmd, - "lsp-refresh-interval <1-65235>", + "lsp-refresh-interval (1-65235)", "LSP refresh interval\n" "LSP refresh interval in seconds\n") { @@ -2172,7 +2172,7 @@ DEFUN (no_lsp_refresh_interval, DEFUN (lsp_refresh_interval_l1, lsp_refresh_interval_l1_cmd, - "lsp-refresh-interval level-1 <1-65235>", + "lsp-refresh-interval level-1 (1-65235)", "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { @@ -2200,7 +2200,7 @@ DEFUN (no_lsp_refresh_interval_l1, DEFUN (lsp_refresh_interval_l2, lsp_refresh_interval_l2_cmd, - "lsp-refresh-interval level-2 <1-65235>", + "lsp-refresh-interval level-2 (1-65235)", "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { @@ -2265,7 +2265,7 @@ area_passwd_set(struct vty *vty, int level, */ DEFUN (area_passwd_md5, area_passwd_md5_cmd, - "(area-password|domain-password) md5 WORD", + " md5 WORD", "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n" "Authentication type\n" @@ -2301,7 +2301,7 @@ DEFUN (area_passwd_md5, */ DEFUN (area_passwd_clear, area_passwd_clear_cmd, - "(area-password|domain-password) clear WORD", + " clear WORD", "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n" "Authentication type\n" @@ -2324,7 +2324,7 @@ DEFUN (area_passwd_clear, DEFUN (no_area_passwd, no_area_passwd_cmd, - "no (area-password|domain-password)", + "no ", NO_STR "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") diff --git a/isisd/isisd.c b/isisd/isisd.c index bfee7a810b..263fa63a3b 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1896,7 +1896,7 @@ DEFUN (no_log_adj_changes, DEFUN (topology_generate_grid, topology_generate_grid_cmd, - "topology generate grid <1-100> <1-100> <1-65000> [param] [param] [param]", + "topology generate grid (1-100) (1-100) (1-65000) [param] [param] [param]", "Topology generation for IS-IS\n" "Topology generation\n" "Grid topology\n" diff --git a/lib/command.c b/lib/command.c index b676b0c9d3..7cc2c3b23b 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1869,7 +1869,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [" LOG_FACILITIES "] ["LOG_LEVELS"]", + "no log syslog [" LOG_FACILITIES "] [" LOG_LEVELS "]", NO_STR "Logging control\n" "Cancel logging to syslog\n" @@ -1882,7 +1882,7 @@ DEFUN (no_config_log_syslog, DEFUN (config_log_facility, config_log_facility_cmd, - "log facility "LOG_FACILITIES, + "log facility " LOG_FACILITIES, "Logging control\n" "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) @@ -1895,7 +1895,7 @@ DEFUN (config_log_facility, DEFUN (no_config_log_facility, no_config_log_facility_cmd, - "no log facility ["LOG_FACILITIES"]", + "no log facility [" LOG_FACILITIES "]", NO_STR "Logging control\n" "Reset syslog facility to default (daemon)\n" @@ -1907,7 +1907,7 @@ DEFUN (no_config_log_facility, DEFUN_DEPRECATED (config_log_trap, config_log_trap_cmd, - "log trap "LOG_LEVELS, + "log trap " LOG_LEVELS, "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC) @@ -1927,7 +1927,7 @@ DEFUN_DEPRECATED (config_log_trap, DEFUN_DEPRECATED (no_config_log_trap, no_config_log_trap_cmd, - "no log trap ["LOG_LEVELS"]", + "no log trap [" LOG_LEVELS "]", NO_STR "Logging control\n" "Permit all logging information\n" @@ -1960,7 +1960,7 @@ DEFUN (no_config_log_record_priority, DEFUN (config_log_timestamp_precision, config_log_timestamp_precision_cmd, - "log timestamp precision <0-6>", + "log timestamp precision (0-6)", "Logging control\n" "Timestamp configuration\n" "Set the timestamp precision\n" diff --git a/lib/filter.c b/lib/filter.c index dee752f220..a25c8cdc97 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -704,7 +704,7 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str, /* Standard access-list */ DEFUN (access_list_standard, access_list_standard_cmd, - "access-list (<1-99>|<1300-1999>) (deny|permit) A.B.C.D A.B.C.D", + "access-list <(1-99)|(1300-1999)> A.B.C.D A.B.C.D", "Add an access list entry\n" "IP standard access list\n" "IP standard access list (expanded range)\n" @@ -719,7 +719,7 @@ DEFUN (access_list_standard, DEFUN (access_list_standard_nomask, access_list_standard_nomask_cmd, - "access-list (<1-99>|<1300-1999>) (deny|permit) A.B.C.D", + "access-list <(1-99)|(1300-1999)> A.B.C.D", "Add an access list entry\n" "IP standard access list\n" "IP standard access list (expanded range)\n" @@ -733,7 +733,7 @@ DEFUN (access_list_standard_nomask, DEFUN (access_list_standard_host, access_list_standard_host_cmd, - "access-list (<1-99>|<1300-1999>) (deny|permit) host A.B.C.D", + "access-list <(1-99)|(1300-1999)> host A.B.C.D", "Add an access list entry\n" "IP standard access list\n" "IP standard access list (expanded range)\n" @@ -748,7 +748,7 @@ DEFUN (access_list_standard_host, DEFUN (access_list_standard_any, access_list_standard_any_cmd, - "access-list (<1-99>|<1300-1999>) (deny|permit) any", + "access-list <(1-99)|(1300-1999)> any", "Add an access list entry\n" "IP standard access list\n" "IP standard access list (expanded range)\n" @@ -762,7 +762,7 @@ DEFUN (access_list_standard_any, DEFUN (no_access_list_standard, no_access_list_standard_cmd, - "no access-list (<1-99>|<1300-1999>) (deny|permit) A.B.C.D A.B.C.D", + "no access-list <(1-99)|(1300-1999)> A.B.C.D A.B.C.D", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -778,7 +778,7 @@ DEFUN (no_access_list_standard, DEFUN (no_access_list_standard_nomask, no_access_list_standard_nomask_cmd, - "no access-list (<1-99>|<1300-1999>) (deny|permit) A.B.C.D", + "no access-list <(1-99)|(1300-1999)> A.B.C.D", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -793,7 +793,7 @@ DEFUN (no_access_list_standard_nomask, DEFUN (no_access_list_standard_host, no_access_list_standard_host_cmd, - "no access-list (<1-99>|<1300-1999>) (deny|permit) host A.B.C.D", + "no access-list <(1-99)|(1300-1999)> host A.B.C.D", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -809,7 +809,7 @@ DEFUN (no_access_list_standard_host, DEFUN (no_access_list_standard_any, no_access_list_standard_any_cmd, - "no access-list (<1-99>|<1300-1999>) (deny|permit) any", + "no access-list <(1-99)|(1300-1999)> any", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -825,7 +825,7 @@ DEFUN (no_access_list_standard_any, /* Extended access-list */ DEFUN (access_list_extended, access_list_extended_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -843,7 +843,7 @@ DEFUN (access_list_extended, DEFUN (access_list_extended_mask_any, access_list_extended_mask_any_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D any", + "access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D any", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -861,7 +861,7 @@ DEFUN (access_list_extended_mask_any, DEFUN (access_list_extended_any_mask, access_list_extended_any_mask_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip any A.B.C.D A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip any A.B.C.D A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -879,7 +879,7 @@ DEFUN (access_list_extended_any_mask, DEFUN (access_list_extended_any_any, access_list_extended_any_any_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip any any", + "access-list <(100-199)|(2000-2699)> ip any any", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -896,7 +896,7 @@ DEFUN (access_list_extended_any_any, DEFUN (access_list_extended_mask_host, access_list_extended_mask_host_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D host A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D host A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -915,7 +915,7 @@ DEFUN (access_list_extended_mask_host, DEFUN (access_list_extended_host_mask, access_list_extended_host_mask_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D A.B.C.D A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip host A.B.C.D A.B.C.D A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -934,7 +934,7 @@ DEFUN (access_list_extended_host_mask, DEFUN (access_list_extended_host_host, access_list_extended_host_host_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D host A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip host A.B.C.D host A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -953,7 +953,7 @@ DEFUN (access_list_extended_host_host, DEFUN (access_list_extended_any_host, access_list_extended_any_host_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip any host A.B.C.D", + "access-list <(100-199)|(2000-2699)> ip any host A.B.C.D", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -971,7 +971,7 @@ DEFUN (access_list_extended_any_host, DEFUN (access_list_extended_host_any, access_list_extended_host_any_cmd, - "access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D any", + "access-list <(100-199)|(2000-2699)> ip host A.B.C.D any", "Add an access list entry\n" "IP extended access list\n" "IP extended access list (expanded range)\n" @@ -989,7 +989,7 @@ DEFUN (access_list_extended_host_any, DEFUN (no_access_list_extended, no_access_list_extended_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1008,7 +1008,7 @@ DEFUN (no_access_list_extended, DEFUN (no_access_list_extended_mask_any, no_access_list_extended_mask_any_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D any", + "no access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D any", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1027,7 +1027,7 @@ DEFUN (no_access_list_extended_mask_any, DEFUN (no_access_list_extended_any_mask, no_access_list_extended_any_mask_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip any A.B.C.D A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip any A.B.C.D A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1046,7 +1046,7 @@ DEFUN (no_access_list_extended_any_mask, DEFUN (no_access_list_extended_any_any, no_access_list_extended_any_any_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip any any", + "no access-list <(100-199)|(2000-2699)> ip any any", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1064,7 +1064,7 @@ DEFUN (no_access_list_extended_any_any, DEFUN (no_access_list_extended_mask_host, no_access_list_extended_mask_host_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip A.B.C.D A.B.C.D host A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip A.B.C.D A.B.C.D host A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1084,7 +1084,7 @@ DEFUN (no_access_list_extended_mask_host, DEFUN (no_access_list_extended_host_mask, no_access_list_extended_host_mask_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D A.B.C.D A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip host A.B.C.D A.B.C.D A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1104,7 +1104,7 @@ DEFUN (no_access_list_extended_host_mask, DEFUN (no_access_list_extended_host_host, no_access_list_extended_host_host_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D host A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip host A.B.C.D host A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1124,7 +1124,7 @@ DEFUN (no_access_list_extended_host_host, DEFUN (no_access_list_extended_any_host, no_access_list_extended_any_host_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip any host A.B.C.D", + "no access-list <(100-199)|(2000-2699)> ip any host A.B.C.D", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1143,7 +1143,7 @@ DEFUN (no_access_list_extended_any_host, DEFUN (no_access_list_extended_host_any, no_access_list_extended_host_any_cmd, - "no access-list (<100-199>|<2000-2699>) (deny|permit) ip host A.B.C.D any", + "no access-list <(100-199)|(2000-2699)> ip host A.B.C.D any", NO_STR "Add an access list entry\n" "IP extended access list\n" @@ -1244,7 +1244,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, /* Zebra access-list */ DEFUN (access_list, access_list_cmd, - "access-list WORD (deny|permit) A.B.C.D/M", + "access-list WORD A.B.C.D/M", "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" @@ -1256,7 +1256,7 @@ DEFUN (access_list, DEFUN (access_list_exact, access_list_exact_cmd, - "access-list WORD (deny|permit) A.B.C.D/M exact-match", + "access-list WORD A.B.C.D/M exact-match", "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" @@ -1269,7 +1269,7 @@ DEFUN (access_list_exact, DEFUN (access_list_any, access_list_any_cmd, - "access-list WORD (deny|permit) any", + "access-list WORD any", "Add an access list entry\n" "IP zebra access-list name\n" "Specify packets to reject\n" @@ -1281,7 +1281,7 @@ DEFUN (access_list_any, DEFUN (no_access_list, no_access_list_cmd, - "no access-list WORD (deny|permit) A.B.C.D/M", + "no access-list WORD A.B.C.D/M", NO_STR "Add an access list entry\n" "IP zebra access-list name\n" @@ -1294,7 +1294,7 @@ DEFUN (no_access_list, DEFUN (no_access_list_exact, no_access_list_exact_cmd, - "no access-list WORD (deny|permit) A.B.C.D/M exact-match", + "no access-list WORD A.B.C.D/M exact-match", NO_STR "Add an access list entry\n" "IP zebra access-list name\n" @@ -1308,7 +1308,7 @@ DEFUN (no_access_list_exact, DEFUN (no_access_list_any, no_access_list_any_cmd, - "no access-list WORD (deny|permit) any", + "no access-list WORD any", NO_STR "Add an access list entry\n" "IP zebra access-list name\n" @@ -1321,7 +1321,7 @@ DEFUN (no_access_list_any, DEFUN (no_access_list_all, no_access_list_all_cmd, - "no access-list (<1-99>|<100-199>|<1300-1999>|<2000-2699>|WORD)", + "no access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD>", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -1357,7 +1357,7 @@ DEFUN (no_access_list_all, DEFUN (access_list_remark, access_list_remark_cmd, - "access-list (<1-99>|<100-199>|<1300-1999>|<2000-2699>|WORD) remark .LINE", + "access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark .LINE", "Add an access list entry\n" "IP standard access list\n" "IP extended access list\n" @@ -1397,7 +1397,7 @@ DEFUN (access_list_remark, */ DEFUN (no_access_list_remark, no_access_list_remark_cmd, - "no access-list (<1-99>|<100-199>|<1300-1999>|<2000-2699>|WORD) remark", + "no access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark", NO_STR "Add an access list entry\n" "IP standard access list\n" @@ -1414,7 +1414,7 @@ DEFUN (no_access_list_remark, #ifdef HAVE_IPV6 DEFUN (ipv6_access_list, ipv6_access_list_cmd, - "ipv6 access-list WORD (deny|permit) X:X::X:X/M", + "ipv6 access-list WORD X:X::X:X/M", IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" @@ -1427,7 +1427,7 @@ DEFUN (ipv6_access_list, DEFUN (ipv6_access_list_exact, ipv6_access_list_exact_cmd, - "ipv6 access-list WORD (deny|permit) X:X::X:X/M exact-match", + "ipv6 access-list WORD X:X::X:X/M exact-match", IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" @@ -1441,7 +1441,7 @@ DEFUN (ipv6_access_list_exact, DEFUN (ipv6_access_list_any, ipv6_access_list_any_cmd, - "ipv6 access-list WORD (deny|permit) any", + "ipv6 access-list WORD any", IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" @@ -1454,7 +1454,7 @@ DEFUN (ipv6_access_list_any, DEFUN (no_ipv6_access_list, no_ipv6_access_list_cmd, - "no ipv6 access-list WORD (deny|permit) X:X::X:X/M", + "no ipv6 access-list WORD X:X::X:X/M", NO_STR IPV6_STR "Add an access list entry\n" @@ -1468,7 +1468,7 @@ DEFUN (no_ipv6_access_list, DEFUN (no_ipv6_access_list_exact, no_ipv6_access_list_exact_cmd, - "no ipv6 access-list WORD (deny|permit) X:X::X:X/M exact-match", + "no ipv6 access-list WORD X:X::X:X/M exact-match", NO_STR IPV6_STR "Add an access list entry\n" @@ -1483,7 +1483,7 @@ DEFUN (no_ipv6_access_list_exact, DEFUN (no_ipv6_access_list_any, no_ipv6_access_list_any_cmd, - "no ipv6 access-list WORD (deny|permit) any", + "no ipv6 access-list WORD any", NO_STR IPV6_STR "Add an access list entry\n" @@ -1699,7 +1699,7 @@ DEFUN (show_ip_access_list, DEFUN (show_ip_access_list_name, show_ip_access_list_name_cmd, - "show ip access-list (<1-99>|<100-199>|<1300-1999>|<2000-2699>|WORD)", + "show ip access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD>", SHOW_STR IP_STR "List IP access lists\n" diff --git a/lib/if.c b/lib/if.c index 646f33354e..c19b8d1f86 100644 --- a/lib/if.c +++ b/lib/if.c @@ -671,7 +671,7 @@ if_dump_all (void) if_dump (p); } -DEFUN (interface_desc, +DEFUN (interface_desc, interface_desc_cmd, "description LINE...", "Interface specific description\n" @@ -690,7 +690,7 @@ DEFUN (interface_desc, return CMD_SUCCESS; } -DEFUN (no_interface_desc, +DEFUN (no_interface_desc, no_interface_desc_cmd, "no description", NO_STR diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 240a03cab4..abed32c9e3 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -221,7 +221,7 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type, */ DEFUN (if_rmap, if_rmap_cmd, - "route-map RMAP_NAME (in|out) IFNAME", + "route-map RMAP_NAME IFNAME", "Route map set\n" "Route map name\n" "Route map set for input filtering\n" @@ -259,7 +259,7 @@ DEFUN (if_rmap, */ DEFUN (no_if_rmap, no_if_rmap_cmd, - "no route-map ROUTEMAP_NAME (in|out) IFNAME", + "no route-map ROUTEMAP_NAME IFNAME", NO_STR "Route map unset\n" "Route map name\n" diff --git a/lib/keychain.c b/lib/keychain.c index 1997496d34..0796d81f1a 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -271,7 +271,7 @@ DEFUN (no_key_chain, DEFUN (key, key_cmd, - "key <0-2147483647>", + "key (0-2147483647)", "Configure a key\n" "Key identifier number\n") { @@ -291,7 +291,7 @@ DEFUN (key, DEFUN (no_key, no_key_cmd, - "no key <0-2147483647>", + "no key (0-2147483647)", NO_STR "Delete a key\n" "Key identifier number\n") @@ -541,7 +541,7 @@ key_lifetime_infinite_set (struct vty *vty, struct key_range *krange, DEFUN (accept_lifetime_day_month_day_month, accept_lifetime_day_month_day_month_cmd, - "accept-lifetime HH:MM:SS <1-31> MONTH <1993-2035> HH:MM:SS <1-31> MONTH <1993-2035>", + "accept-lifetime HH:MM:SS (1-31) MONTH (1993-2035) HH:MM:SS (1-31) MONTH (1993-2035)", "Set accept lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -562,7 +562,7 @@ DEFUN (accept_lifetime_day_month_day_month, DEFUN (accept_lifetime_day_month_month_day, accept_lifetime_day_month_month_day_cmd, - "accept-lifetime HH:MM:SS <1-31> MONTH <1993-2035> HH:MM:SS MONTH <1-31> <1993-2035>", + "accept-lifetime HH:MM:SS (1-31) MONTH (1993-2035) HH:MM:SS MONTH (1-31) (1993-2035)", "Set accept lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -583,7 +583,7 @@ DEFUN (accept_lifetime_day_month_month_day, DEFUN (accept_lifetime_month_day_day_month, accept_lifetime_month_day_day_month_cmd, - "accept-lifetime HH:MM:SS MONTH <1-31> <1993-2035> HH:MM:SS <1-31> MONTH <1993-2035>", + "accept-lifetime HH:MM:SS MONTH (1-31) (1993-2035) HH:MM:SS (1-31) MONTH (1993-2035)", "Set accept lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -604,7 +604,7 @@ DEFUN (accept_lifetime_month_day_day_month, DEFUN (accept_lifetime_month_day_month_day, accept_lifetime_month_day_month_day_cmd, - "accept-lifetime HH:MM:SS MONTH <1-31> <1993-2035> HH:MM:SS MONTH <1-31> <1993-2035>", + "accept-lifetime HH:MM:SS MONTH (1-31) (1993-2035) HH:MM:SS MONTH (1-31) (1993-2035)", "Set accept lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -625,7 +625,7 @@ DEFUN (accept_lifetime_month_day_month_day, DEFUN (accept_lifetime_infinite_day_month, accept_lifetime_infinite_day_month_cmd, - "accept-lifetime HH:MM:SS <1-31> MONTH <1993-2035> infinite", + "accept-lifetime HH:MM:SS (1-31) MONTH (1993-2035) infinite", "Set accept lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -643,7 +643,7 @@ DEFUN (accept_lifetime_infinite_day_month, DEFUN (accept_lifetime_infinite_month_day, accept_lifetime_infinite_month_day_cmd, - "accept-lifetime HH:MM:SS MONTH <1-31> <1993-2035> infinite", + "accept-lifetime HH:MM:SS MONTH (1-31) (1993-2035) infinite", "Set accept lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -661,7 +661,7 @@ DEFUN (accept_lifetime_infinite_month_day, DEFUN (accept_lifetime_duration_day_month, accept_lifetime_duration_day_month_cmd, - "accept-lifetime HH:MM:SS <1-31> MONTH <1993-2035> duration <1-2147483646>", + "accept-lifetime HH:MM:SS (1-31) MONTH (1993-2035) duration (1-2147483646)", "Set accept lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -680,7 +680,7 @@ DEFUN (accept_lifetime_duration_day_month, DEFUN (accept_lifetime_duration_month_day, accept_lifetime_duration_month_day_cmd, - "accept-lifetime HH:MM:SS MONTH <1-31> <1993-2035> duration <1-2147483646>", + "accept-lifetime HH:MM:SS MONTH (1-31) (1993-2035) duration (1-2147483646)", "Set accept lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -699,7 +699,7 @@ DEFUN (accept_lifetime_duration_month_day, DEFUN (send_lifetime_day_month_day_month, send_lifetime_day_month_day_month_cmd, - "send-lifetime HH:MM:SS <1-31> MONTH <1993-2035> HH:MM:SS <1-31> MONTH <1993-2035>", + "send-lifetime HH:MM:SS (1-31) MONTH (1993-2035) HH:MM:SS (1-31) MONTH (1993-2035)", "Set send lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -720,7 +720,7 @@ DEFUN (send_lifetime_day_month_day_month, DEFUN (send_lifetime_day_month_month_day, send_lifetime_day_month_month_day_cmd, - "send-lifetime HH:MM:SS <1-31> MONTH <1993-2035> HH:MM:SS MONTH <1-31> <1993-2035>", + "send-lifetime HH:MM:SS (1-31) MONTH (1993-2035) HH:MM:SS MONTH (1-31) (1993-2035)", "Set send lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -741,7 +741,7 @@ DEFUN (send_lifetime_day_month_month_day, DEFUN (send_lifetime_month_day_day_month, send_lifetime_month_day_day_month_cmd, - "send-lifetime HH:MM:SS MONTH <1-31> <1993-2035> HH:MM:SS <1-31> MONTH <1993-2035>", + "send-lifetime HH:MM:SS MONTH (1-31) (1993-2035) HH:MM:SS (1-31) MONTH (1993-2035)", "Set send lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -762,7 +762,7 @@ DEFUN (send_lifetime_month_day_day_month, DEFUN (send_lifetime_month_day_month_day, send_lifetime_month_day_month_day_cmd, - "send-lifetime HH:MM:SS MONTH <1-31> <1993-2035> HH:MM:SS MONTH <1-31> <1993-2035>", + "send-lifetime HH:MM:SS MONTH (1-31) (1993-2035) HH:MM:SS MONTH (1-31) (1993-2035)", "Set send lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -783,7 +783,7 @@ DEFUN (send_lifetime_month_day_month_day, DEFUN (send_lifetime_infinite_day_month, send_lifetime_infinite_day_month_cmd, - "send-lifetime HH:MM:SS <1-31> MONTH <1993-2035> infinite", + "send-lifetime HH:MM:SS (1-31) MONTH (1993-2035) infinite", "Set send lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -801,7 +801,7 @@ DEFUN (send_lifetime_infinite_day_month, DEFUN (send_lifetime_infinite_month_day, send_lifetime_infinite_month_day_cmd, - "send-lifetime HH:MM:SS MONTH <1-31> <1993-2035> infinite", + "send-lifetime HH:MM:SS MONTH (1-31) (1993-2035) infinite", "Set send lifetime of the key\n" "Time to start\n" "Month of the year to start\n" @@ -819,7 +819,7 @@ DEFUN (send_lifetime_infinite_month_day, DEFUN (send_lifetime_duration_day_month, send_lifetime_duration_day_month_cmd, - "send-lifetime HH:MM:SS <1-31> MONTH <1993-2035> duration <1-2147483646>", + "send-lifetime HH:MM:SS (1-31) MONTH (1993-2035) duration (1-2147483646)", "Set send lifetime of the key\n" "Time to start\n" "Day of th month to start\n" @@ -838,7 +838,7 @@ DEFUN (send_lifetime_duration_day_month, DEFUN (send_lifetime_duration_month_day, send_lifetime_duration_month_day_cmd, - "send-lifetime HH:MM:SS MONTH <1-31> <1993-2035> duration <1-2147483646>", + "send-lifetime HH:MM:SS MONTH (1-31) (1993-2035) duration (1-2147483646)", "Set send lifetime of the key\n" "Time to start\n" "Month of the year to start\n" diff --git a/lib/ns.c b/lib/ns.c index 58b640651d..9480546e38 100644 --- a/lib/ns.c +++ b/lib/ns.c @@ -551,7 +551,7 @@ ns_netns_pathname (struct vty *vty, const char *name) DEFUN (ns_netns, ns_netns_cmd, - "logical-router <1-65535> ns NAME", + "logical-router (1-65535) ns NAME", "Enable a logical-router\n" "Specify the logical-router indentifier\n" "The Name Space\n" @@ -589,7 +589,7 @@ DEFUN (ns_netns, DEFUN (no_ns_netns, no_ns_netns_cmd, - "no logical-router <1-65535> ns NAME", + "no logical-router (1-65535) ns NAME", NO_STR "Enable a Logical-Router\n" "Specify the Logical-Router identifier\n" diff --git a/lib/plist.c b/lib/plist.c index d874e1d024..164bc1d7e1 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1406,7 +1406,7 @@ vty_clear_prefix_list (struct vty *vty, afi_t afi, const char *name, DEFUN (ip_prefix_list, ip_prefix_list_cmd, - "ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)", + "ip prefix-list WORD ", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1421,7 +1421,7 @@ DEFUN (ip_prefix_list, DEFUN (ip_prefix_list_ge, ip_prefix_list_ge_cmd, - "ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>", + "ip prefix-list WORD A.B.C.D/M ge (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1437,7 +1437,7 @@ DEFUN (ip_prefix_list_ge, DEFUN (ip_prefix_list_ge_le, ip_prefix_list_ge_le_cmd, - "ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>", + "ip prefix-list WORD A.B.C.D/M ge (0-32) le (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1455,7 +1455,7 @@ DEFUN (ip_prefix_list_ge_le, DEFUN (ip_prefix_list_le, ip_prefix_list_le_cmd, - "ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>", + "ip prefix-list WORD A.B.C.D/M le (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1471,7 +1471,7 @@ DEFUN (ip_prefix_list_le, DEFUN (ip_prefix_list_le_ge, ip_prefix_list_le_ge_cmd, - "ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>", + "ip prefix-list WORD A.B.C.D/M le (0-32) ge (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1489,7 +1489,7 @@ DEFUN (ip_prefix_list_le_ge, DEFUN (ip_prefix_list_seq, ip_prefix_list_seq_cmd, - "ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)", + "ip prefix-list WORD seq (1-4294967295) ", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1506,7 +1506,7 @@ DEFUN (ip_prefix_list_seq, DEFUN (ip_prefix_list_seq_ge, ip_prefix_list_seq_ge_cmd, - "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>", + "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1524,7 +1524,7 @@ DEFUN (ip_prefix_list_seq_ge, DEFUN (ip_prefix_list_seq_ge_le, ip_prefix_list_seq_ge_le_cmd, - "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>", + "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32) le (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1544,7 +1544,7 @@ DEFUN (ip_prefix_list_seq_ge_le, DEFUN (ip_prefix_list_seq_le, ip_prefix_list_seq_le_cmd, - "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>", + "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1562,7 +1562,7 @@ DEFUN (ip_prefix_list_seq_le, DEFUN (ip_prefix_list_seq_le_ge, ip_prefix_list_seq_le_ge_cmd, - "ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>", + "ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32) ge (0-32)", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -1594,7 +1594,7 @@ DEFUN (no_ip_prefix_list, DEFUN (no_ip_prefix_list_prefix, no_ip_prefix_list_prefix_cmd, - "no ip prefix-list WORD (deny|permit) (A.B.C.D/M|any)", + "no ip prefix-list WORD ", NO_STR IP_STR PREFIX_LIST_STR @@ -1610,7 +1610,7 @@ DEFUN (no_ip_prefix_list_prefix, DEFUN (no_ip_prefix_list_ge, no_ip_prefix_list_ge_cmd, - "no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32>", + "no ip prefix-list WORD A.B.C.D/M ge (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1627,7 +1627,7 @@ DEFUN (no_ip_prefix_list_ge, DEFUN (no_ip_prefix_list_ge_le, no_ip_prefix_list_ge_le_cmd, - "no ip prefix-list WORD (deny|permit) A.B.C.D/M ge <0-32> le <0-32>", + "no ip prefix-list WORD A.B.C.D/M ge (0-32) le (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1646,7 +1646,7 @@ DEFUN (no_ip_prefix_list_ge_le, DEFUN (no_ip_prefix_list_le, no_ip_prefix_list_le_cmd, - "no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32>", + "no ip prefix-list WORD A.B.C.D/M le (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1663,7 +1663,7 @@ DEFUN (no_ip_prefix_list_le, DEFUN (no_ip_prefix_list_le_ge, no_ip_prefix_list_le_ge_cmd, - "no ip prefix-list WORD (deny|permit) A.B.C.D/M le <0-32> ge <0-32>", + "no ip prefix-list WORD A.B.C.D/M le (0-32) ge (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1682,7 +1682,7 @@ DEFUN (no_ip_prefix_list_le_ge, DEFUN (no_ip_prefix_list_seq, no_ip_prefix_list_seq_cmd, - "no ip prefix-list WORD seq <1-4294967295> (deny|permit) (A.B.C.D/M|any)", + "no ip prefix-list WORD seq (1-4294967295) ", NO_STR IP_STR PREFIX_LIST_STR @@ -1700,7 +1700,7 @@ DEFUN (no_ip_prefix_list_seq, DEFUN (no_ip_prefix_list_seq_ge, no_ip_prefix_list_seq_ge_cmd, - "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32>", + "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1719,7 +1719,7 @@ DEFUN (no_ip_prefix_list_seq_ge, DEFUN (no_ip_prefix_list_seq_ge_le, no_ip_prefix_list_seq_ge_le_cmd, - "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M ge <0-32> le <0-32>", + "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M ge (0-32) le (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1740,7 +1740,7 @@ DEFUN (no_ip_prefix_list_seq_ge_le, DEFUN (no_ip_prefix_list_seq_le, no_ip_prefix_list_seq_le_cmd, - "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32>", + "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1759,7 +1759,7 @@ DEFUN (no_ip_prefix_list_seq_le, DEFUN (no_ip_prefix_list_seq_le_ge, no_ip_prefix_list_seq_le_ge_cmd, - "no ip prefix-list WORD seq <1-4294967295> (deny|permit) A.B.C.D/M le <0-32> ge <0-32>", + "no ip prefix-list WORD seq (1-4294967295) A.B.C.D/M le (0-32) ge (0-32)", NO_STR IP_STR PREFIX_LIST_STR @@ -1871,7 +1871,7 @@ DEFUN (show_ip_prefix_list_name, DEFUN (show_ip_prefix_list_name_seq, show_ip_prefix_list_name_seq_cmd, - "show ip prefix-list WORD seq <1-4294967295>", + "show ip prefix-list WORD seq (1-4294967295)", SHOW_STR IP_STR PREFIX_LIST_STR @@ -2003,7 +2003,7 @@ DEFUN (clear_ip_prefix_list_name_prefix, #ifdef HAVE_IPV6 DEFUN (ipv6_prefix_list, ipv6_prefix_list_cmd, - "ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)", + "ipv6 prefix-list WORD ", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2018,7 +2018,7 @@ DEFUN (ipv6_prefix_list, DEFUN (ipv6_prefix_list_ge, ipv6_prefix_list_ge_cmd, - "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>", + "ipv6 prefix-list WORD X:X::X:X/M ge (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2034,7 +2034,7 @@ DEFUN (ipv6_prefix_list_ge, DEFUN (ipv6_prefix_list_ge_le, ipv6_prefix_list_ge_le_cmd, - "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>", + "ipv6 prefix-list WORD X:X::X:X/M ge (0-128) le (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2053,7 +2053,7 @@ DEFUN (ipv6_prefix_list_ge_le, DEFUN (ipv6_prefix_list_le, ipv6_prefix_list_le_cmd, - "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>", + "ipv6 prefix-list WORD X:X::X:X/M le (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2069,7 +2069,7 @@ DEFUN (ipv6_prefix_list_le, DEFUN (ipv6_prefix_list_le_ge, ipv6_prefix_list_le_ge_cmd, - "ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>", + "ipv6 prefix-list WORD X:X::X:X/M le (0-128) ge (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2087,7 +2087,7 @@ DEFUN (ipv6_prefix_list_le_ge, DEFUN (ipv6_prefix_list_seq, ipv6_prefix_list_seq_cmd, - "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)", + "ipv6 prefix-list WORD seq (1-4294967295) ", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2104,7 +2104,7 @@ DEFUN (ipv6_prefix_list_seq, DEFUN (ipv6_prefix_list_seq_ge, ipv6_prefix_list_seq_ge_cmd, - "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>", + "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2122,7 +2122,7 @@ DEFUN (ipv6_prefix_list_seq_ge, DEFUN (ipv6_prefix_list_seq_ge_le, ipv6_prefix_list_seq_ge_le_cmd, - "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>", + "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128) le (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2142,7 +2142,7 @@ DEFUN (ipv6_prefix_list_seq_ge_le, DEFUN (ipv6_prefix_list_seq_le, ipv6_prefix_list_seq_le_cmd, - "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>", + "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2160,7 +2160,7 @@ DEFUN (ipv6_prefix_list_seq_le, DEFUN (ipv6_prefix_list_seq_le_ge, ipv6_prefix_list_seq_le_ge_cmd, - "ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>", + "ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128) ge (0-128)", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2192,7 +2192,7 @@ DEFUN (no_ipv6_prefix_list, DEFUN (no_ipv6_prefix_list_prefix, no_ipv6_prefix_list_prefix_cmd, - "no ipv6 prefix-list WORD (deny|permit) (X:X::X:X/M|any)", + "no ipv6 prefix-list WORD ", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2208,7 +2208,7 @@ DEFUN (no_ipv6_prefix_list_prefix, DEFUN (no_ipv6_prefix_list_ge, no_ipv6_prefix_list_ge_cmd, - "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128>", + "no ipv6 prefix-list WORD X:X::X:X/M ge (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2225,7 +2225,7 @@ DEFUN (no_ipv6_prefix_list_ge, DEFUN (no_ipv6_prefix_list_ge_le, no_ipv6_prefix_list_ge_le_cmd, - "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M ge <0-128> le <0-128>", + "no ipv6 prefix-list WORD X:X::X:X/M ge (0-128) le (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2244,7 +2244,7 @@ DEFUN (no_ipv6_prefix_list_ge_le, DEFUN (no_ipv6_prefix_list_le, no_ipv6_prefix_list_le_cmd, - "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128>", + "no ipv6 prefix-list WORD X:X::X:X/M le (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2261,7 +2261,7 @@ DEFUN (no_ipv6_prefix_list_le, DEFUN (no_ipv6_prefix_list_le_ge, no_ipv6_prefix_list_le_ge_cmd, - "no ipv6 prefix-list WORD (deny|permit) X:X::X:X/M le <0-128> ge <0-128>", + "no ipv6 prefix-list WORD X:X::X:X/M le (0-128) ge (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2280,7 +2280,7 @@ DEFUN (no_ipv6_prefix_list_le_ge, DEFUN (no_ipv6_prefix_list_seq, no_ipv6_prefix_list_seq_cmd, - "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) (X:X::X:X/M|any)", + "no ipv6 prefix-list WORD seq (1-4294967295) ", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2298,7 +2298,7 @@ DEFUN (no_ipv6_prefix_list_seq, DEFUN (no_ipv6_prefix_list_seq_ge, no_ipv6_prefix_list_seq_ge_cmd, - "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128>", + "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2317,7 +2317,7 @@ DEFUN (no_ipv6_prefix_list_seq_ge, DEFUN (no_ipv6_prefix_list_seq_ge_le, no_ipv6_prefix_list_seq_ge_le_cmd, - "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M ge <0-128> le <0-128>", + "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M ge (0-128) le (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2338,7 +2338,7 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, DEFUN (no_ipv6_prefix_list_seq_le, no_ipv6_prefix_list_seq_le_cmd, - "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128>", + "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2357,7 +2357,7 @@ DEFUN (no_ipv6_prefix_list_seq_le, DEFUN (no_ipv6_prefix_list_seq_le_ge, no_ipv6_prefix_list_seq_le_ge_cmd, - "no ipv6 prefix-list WORD seq <1-4294967295> (deny|permit) X:X::X:X/M le <0-128> ge <0-128>", + "no ipv6 prefix-list WORD seq (1-4294967295) X:X::X:X/M le (0-128) ge (0-128)", NO_STR IPV6_STR PREFIX_LIST_STR @@ -2469,7 +2469,7 @@ DEFUN (show_ipv6_prefix_list_name, DEFUN (show_ipv6_prefix_list_name_seq, show_ipv6_prefix_list_name_seq_cmd, - "show ipv6 prefix-list WORD seq <1-4294967295>", + "show ipv6 prefix-list WORD seq (1-4294967295)", SHOW_STR IPV6_STR PREFIX_LIST_STR diff --git a/lib/vrf.c b/lib/vrf.c index 7d79b3dc9a..6de224f8c3 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -738,7 +738,7 @@ vrf_socket (int domain, int type, int protocol, vrf_id_t vrf_id) * Debug CLI for vrf's */ DEFUN (vrf_debug, - vrf_debug_cmd, + vrf_debug_cmd, "debug vrf", DEBUG_STR "VRF Debugging\n") @@ -749,7 +749,7 @@ DEFUN (vrf_debug, } DEFUN (no_vrf_debug, - no_vrf_debug_cmd, + no_vrf_debug_cmd, "no debug vrf", NO_STR DEBUG_STR diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 4863342ef1..1c1a524e48 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -668,7 +668,7 @@ ospf6_area_config_write (struct vty *vty) DEFUN (area_filter_list, area_filter_list_cmd, - "area A.B.C.D filter-list prefix WORD (in|out)", + "area A.B.C.D filter-list prefix WORD ", "OSPFv6 area parameters\n" "OSPFv6 area ID in IP address format\n" "Filter networks between OSPFv6 areas\n" @@ -709,7 +709,7 @@ DEFUN (area_filter_list, DEFUN (no_area_filter_list, no_area_filter_list_cmd, - "no area A.B.C.D filter-list prefix WORD (in|out)", + "no area A.B.C.D filter-list prefix WORD ", NO_STR "OSPFv6 area parameters\n" "OSPFv6 area ID in IP address format\n" @@ -996,7 +996,7 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, DEFUN (ospf6_area_stub, ospf6_area_stub_cmd, - "area (A.B.C.D|<0-4294967295>) stub", + "area stub", "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" "OSPF6 area ID as a decimal value\n" @@ -1020,7 +1020,7 @@ DEFUN (ospf6_area_stub, DEFUN (ospf6_area_stub_no_summary, ospf6_area_stub_no_summary_cmd, - "area (A.B.C.D|<0-4294967295>) stub no-summary", + "area stub no-summary", "OSPF6 stub parameters\n" "OSPF6 area ID in IP address format\n" "OSPF6 area ID as a decimal value\n" @@ -1045,7 +1045,7 @@ DEFUN (ospf6_area_stub_no_summary, DEFUN (no_ospf6_area_stub, no_ospf6_area_stub_cmd, - "no area (A.B.C.D|<0-4294967295>) stub", + "no area stub", NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" @@ -1064,7 +1064,7 @@ DEFUN (no_ospf6_area_stub, DEFUN (no_ospf6_area_stub_no_summary, no_ospf6_area_stub_no_summary_cmd, - "no area (A.B.C.D|<0-4294967295>) stub no-summary", + "no area stub no-summary", NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 696f18f030..143278b42b 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1078,7 +1078,7 @@ DEFUN (ospf6_routemap_no_match_interface, /* add "set metric-type" */ DEFUN (ospf6_routemap_set_metric_type, ospf6_routemap_set_metric_type_cmd, - "set metric-type (type-1|type-2)", + "set metric-type ", "Set value\n" "Type of metric\n" "OSPF6 external type 1 metric\n" @@ -1092,7 +1092,7 @@ DEFUN (ospf6_routemap_set_metric_type, /* delete "set metric-type" */ DEFUN (ospf6_routemap_no_set_metric_type, ospf6_routemap_no_set_metric_type_cmd, - "no set metric-type (type-1|type-2)", + "no set metric-type ", NO_STR "Set value\n" "Type of metric\n" @@ -1107,7 +1107,7 @@ DEFUN (ospf6_routemap_no_set_metric_type, /* add "set metric" */ DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", "Set value\n" "Metric value\n" "Metric value\n") diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 66cc59bc32..2b7d180a8f 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1151,7 +1151,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix, /* interface variable set command */ DEFUN (ipv6_ospf6_ifmtu, ipv6_ospf6_ifmtu_cmd, - "ipv6 ospf6 ifmtu <1-65535>", + "ipv6 ospf6 ifmtu (1-65535)", IP6_STR OSPF6_STR "Interface MTU\n" @@ -1259,7 +1259,7 @@ DEFUN (no_ipv6_ospf6_ifmtu, DEFUN (ipv6_ospf6_cost, ipv6_ospf6_cost_cmd, - "ipv6 ospf6 cost <1-65535>", + "ipv6 ospf6 cost (1-65535)", IP6_STR OSPF6_STR "Interface cost\n" @@ -1326,7 +1326,7 @@ DEFUN (no_ipv6_ospf6_cost, DEFUN (auto_cost_reference_bandwidth, auto_cost_reference_bandwidth_cmd, - "auto-cost reference-bandwidth <1-4294967>", + "auto-cost reference-bandwidth (1-4294967)", "Calculate OSPF interface cost according to bandwidth\n" "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") @@ -1391,7 +1391,7 @@ DEFUN (no_auto_cost_reference_bandwidth, DEFUN (ipv6_ospf6_hellointerval, ipv6_ospf6_hellointerval_cmd, - "ipv6 ospf6 hello-interval <1-65535>", + "ipv6 ospf6 hello-interval (1-65535)", IP6_STR OSPF6_STR "Interval time of Hello packets\n" @@ -1416,7 +1416,7 @@ DEFUN (ipv6_ospf6_hellointerval, /* interface variable set command */ DEFUN (ipv6_ospf6_deadinterval, ipv6_ospf6_deadinterval_cmd, - "ipv6 ospf6 dead-interval <1-65535>", + "ipv6 ospf6 dead-interval (1-65535)", IP6_STR OSPF6_STR "Interval time after which a neighbor is declared down\n" @@ -1441,7 +1441,7 @@ DEFUN (ipv6_ospf6_deadinterval, /* interface variable set command */ DEFUN (ipv6_ospf6_transmitdelay, ipv6_ospf6_transmitdelay_cmd, - "ipv6 ospf6 transmit-delay <1-3600>", + "ipv6 ospf6 transmit-delay (1-3600)", IP6_STR OSPF6_STR "Transmit delay of this interface\n" @@ -1466,7 +1466,7 @@ DEFUN (ipv6_ospf6_transmitdelay, /* interface variable set command */ DEFUN (ipv6_ospf6_retransmitinterval, ipv6_ospf6_retransmitinterval_cmd, - "ipv6 ospf6 retransmit-interval <1-65535>", + "ipv6 ospf6 retransmit-interval (1-65535)", IP6_STR OSPF6_STR "Time between retransmitting lost link state advertisements\n" @@ -1491,7 +1491,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, /* interface variable set command */ DEFUN (ipv6_ospf6_priority, ipv6_ospf6_priority_cmd, - "ipv6 ospf6 priority <0-255>", + "ipv6 ospf6 priority (0-255)", IP6_STR OSPF6_STR "Router priority\n" @@ -1522,7 +1522,7 @@ DEFUN (ipv6_ospf6_priority, DEFUN (ipv6_ospf6_instance, ipv6_ospf6_instance_cmd, - "ipv6 ospf6 instance-id <0-255>", + "ipv6 ospf6 instance-id (0-255)", IP6_STR OSPF6_STR "Instance ID for this interface\n" @@ -1740,7 +1740,7 @@ DEFUN (no_ipv6_ospf6_advertise_prefix_list, DEFUN (ipv6_ospf6_network, ipv6_ospf6_network_cmd, - "ipv6 ospf6 network (broadcast|point-to-point)", + "ipv6 ospf6 network ", IP6_STR OSPF6_STR "Network Type\n" diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index d58ab567b3..db34214e10 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -828,7 +828,7 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) */ DEFUN (debug_ospf6_lsa_type, debug_ospf6_lsa_hex_cmd, - "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)", + "debug ospf6 lsa ", DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" @@ -884,7 +884,7 @@ DEFUN (debug_ospf6_lsa_type, */ DEFUN (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_cmd, - "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)", + "no debug ospf6 lsa ", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index e8f4990c9d..b2dd6b6ce2 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2358,7 +2358,7 @@ ospf6_lsack_send_interface (struct thread *thread) */ DEFUN (debug_ospf6_message, debug_ospf6_message_cmd, - "debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)", + "debug ospf6 message ", DEBUG_STR OSPF6_STR "Debug OSPFv3 message\n" @@ -2435,7 +2435,7 @@ DEFUN (debug_ospf6_message, */ DEFUN (no_debug_ospf6_message, no_debug_ospf6_message_cmd, - "no debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all)", + "no debug ospf6 message ", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index d5267354ae..8cf8196953 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1563,7 +1563,7 @@ ospf6_brouter_show (struct vty *vty, struct ospf6_route *route) DEFUN (debug_ospf6_route, debug_ospf6_route_cmd, - "debug ospf6 route (table|intra-area|inter-area|memory)", + "debug ospf6 route ", DEBUG_STR OSPF6_STR "Debug route table calculation\n" @@ -1589,7 +1589,7 @@ DEFUN (debug_ospf6_route, DEFUN (no_debug_ospf6_route, no_debug_ospf6_route_cmd, - "no debug ospf6 route (table|intra-area|inter-area|memory)", + "no debug ospf6 route ", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 6511d0b363..80fb904162 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -877,7 +877,7 @@ ospf6_timers_spf_set (struct vty *vty, unsigned int delay, DEFUN (ospf6_timers_throttle_spf, ospf6_timers_throttle_spf_cmd, - "timers throttle spf <0-600000> <0-600000> <0-600000>", + "timers throttle spf (0-600000) (0-600000) (0-600000)", "Adjust routing timers\n" "Throttling adaptive timer\n" "OSPF6 SPF timers\n" diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 8ddc6cfc8f..9c51b4ee7b 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -398,7 +398,7 @@ DEFUN (no_ospf6_log_adjacency_changes_detail, DEFUN (ospf6_timers_lsa, ospf6_timers_lsa_cmd, - "timers lsa min-arrival <0-600000>", + "timers lsa min-arrival (0-600000)", "Adjust routing timers\n" "OSPF6 LSA timers\n" "Minimum delay in receiving new version of a LSA\n" @@ -640,7 +640,7 @@ DEFUN (no_ospf6_stub_router_admin, DEFUN (ospf6_stub_router_startup, ospf6_stub_router_startup_cmd, - "stub-router on-startup <5-86400>", + "stub-router on-startup (5-86400)", "Make router a stub router\n" "Advertise inability to be a transit router\n" "Automatically advertise as stub-router on startup of OSPF6\n" @@ -663,7 +663,7 @@ DEFUN (no_ospf6_stub_router_startup, DEFUN (ospf6_stub_router_shutdown, ospf6_stub_router_shutdown_cmd, - "stub-router on-shutdown <5-86400>", + "stub-router on-shutdown (5-86400)", "Make router a stub router\n" "Advertise inability to be a transit router\n" "Automatically advertise as stub-router before shutdown\n" @@ -868,7 +868,7 @@ DEFUN (show_ipv6_ospf6_route_match_detail, DEFUN (show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd, - "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail", + "show ipv6 ospf6 route detail", SHOW_STR IP6_STR OSPF6_STR diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index f172b50f05..10b6b27a8b 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -718,7 +718,7 @@ ospf6_zebra_init (struct thread_master *master) */ DEFUN (debug_ospf6_zebra_sendrecv, debug_ospf6_zebra_sendrecv_cmd, - "debug ospf6 zebra (send|recv)", + "debug ospf6 zebra ", DEBUG_STR OSPF6_STR "Debug connection between zebra\n" @@ -756,7 +756,7 @@ DEFUN (debug_ospf6_zebra_sendrecv, */ DEFUN (no_debug_ospf6_zebra_sendrecv, no_debug_ospf6_zebra_sendrecv_cmd, - "no debug ospf6 zebra (send|recv)", + "no debug ospf6 zebra ", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 74ca444d40..907cd118a5 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -248,7 +248,7 @@ DEFUN (show_ipv6_ospf6_database, */ DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix)", + "show ipv6 ospf6 database ", SHOW_STR IPV6_STR OSPF6_STR @@ -579,7 +579,7 @@ DEFUN (show_ipv6_ospf6_database_router, */ DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D", + "show ipv6 ospf6 database A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -733,7 +733,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, */ DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) * A.B.C.D", + "show ipv6 ospf6 database * A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1013,7 +1013,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, */ DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D", + "show ipv6 ospf6 database A.B.C.D A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1135,7 +1135,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, */ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D", + "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1316,7 +1316,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, */ DEFUN (show_ipv6_ospf6_database_type_self_originated, show_ipv6_ospf6_database_type_self_originated_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated", + "show ipv6 ospf6 database self-originated", SHOW_STR IPV6_STR OSPF6_STR @@ -1417,7 +1417,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, */ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D", + "show ipv6 ospf6 database self-originated linkstate-id A.B.C.D", SHOW_STR IPV6_STR OSPF6_STR @@ -1531,7 +1531,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, */ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, - "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated", + "show ipv6 ospf6 database A.B.C.D self-originated", SHOW_STR IPV6_STR OSPF6_STR diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 60356e774a..5c5e5ceb5a 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -847,7 +847,7 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, */ DEFUN (debug_ospf_packet, debug_ospf_packet_all_cmd, - "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)", + "debug ospf packet ", DEBUG_STR OSPF_STR "OSPF packets\n" @@ -898,7 +898,7 @@ DEFUN (debug_ospf_packet, */ DEFUN (debug_ospf_instance_packet, debug_ospf_instance_packet_all_cmd, - "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all)", + "debug ospf (1-65535) packet ", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1019,7 +1019,7 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, */ DEFUN (no_debug_ospf_packet, no_debug_ospf_packet_all_cmd, - "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)", + "no debug ospf packet ", NO_STR DEBUG_STR OSPF_STR @@ -1073,7 +1073,7 @@ DEFUN (no_debug_ospf_packet, */ DEFUN (no_debug_ospf_instance_packet, no_debug_ospf_instance_packet_all_cmd, - "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all)", + "no debug ospf (1-65535) packet ", NO_STR DEBUG_STR OSPF_STR @@ -1170,7 +1170,7 @@ DEFUN (debug_ospf_ism, */ DEFUN (debug_ospf_instance_ism, debug_ospf_instance_ism_cmd, - "debug ospf <1-65535> ism", + "debug ospf (1-65535) ism", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1261,7 +1261,7 @@ DEFUN (no_debug_ospf_ism, */ DEFUN (no_debug_ospf_instance_ism, no_debug_ospf_instance_ism_cmd, - "no debug ospf <1-65535> ism", + "no debug ospf (1-65535) ism", NO_STR DEBUG_STR OSPF_STR @@ -1350,7 +1350,7 @@ DEFUN (debug_ospf_nsm, */ DEFUN (debug_ospf_instance_nsm, debug_ospf_instance_nsm_cmd, - "debug ospf <1-65535> nsm", + "debug ospf (1-65535) nsm", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1441,7 +1441,7 @@ DEFUN (no_debug_ospf_nsm, */ DEFUN (no_debug_ospf_instance_nsm, no_debug_ospf_instance_nsm_cmd, - "no debug ospf <1-65535> nsm", + "no debug ospf (1-65535) nsm", NO_STR DEBUG_STR OSPF_STR @@ -1537,7 +1537,7 @@ DEFUN (debug_ospf_lsa, */ DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, - "debug ospf <1-65535> lsa", + "debug ospf (1-65535) lsa", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1634,7 +1634,7 @@ DEFUN (no_debug_ospf_lsa, */ DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, - "no debug ospf <1-65535> lsa", + "no debug ospf (1-65535) lsa", NO_STR DEBUG_STR OSPF_STR @@ -1718,7 +1718,7 @@ DEFUN (debug_ospf_zebra, */ DEFUN (debug_ospf_instance_zebra, debug_ospf_instance_zebra_cmd, - "debug ospf <1-65535> zebra", + "debug ospf (1-65535) zebra", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1804,7 +1804,7 @@ DEFUN (no_debug_ospf_zebra, */ DEFUN (no_debug_ospf_instance_zebra, no_debug_ospf_instance_zebra_cmd, - "no debug ospf <1-65535> zebra", + "no debug ospf (1-65535) zebra", NO_STR DEBUG_STR OSPF_STR @@ -1851,7 +1851,7 @@ DEFUN (no_debug_ospf_event, DEFUN (debug_ospf_instance_event, debug_ospf_instance_event_cmd, - "debug ospf <1-65535> event", + "debug ospf (1-65535) event", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1871,7 +1871,7 @@ DEFUN (debug_ospf_instance_event, DEFUN (no_debug_ospf_instance_event, no_debug_ospf_instance_event_cmd, - "no debug ospf <1-65535> event", + "no debug ospf (1-65535) event", NO_STR DEBUG_STR OSPF_STR @@ -1919,7 +1919,7 @@ DEFUN (no_debug_ospf_nssa, DEFUN (debug_ospf_instance_nssa, debug_ospf_instance_nssa_cmd, - "debug ospf <1-65535> nssa", + "debug ospf (1-65535) nssa", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1939,7 +1939,7 @@ DEFUN (debug_ospf_instance_nssa, DEFUN (no_debug_ospf_instance_nssa, no_debug_ospf_instance_nssa_cmd, - "no debug ospf <1-65535> nssa", + "no debug ospf (1-65535) nssa", NO_STR DEBUG_STR OSPF_STR @@ -2160,7 +2160,7 @@ DEFUN (show_debugging_ospf, DEFUN (show_debugging_ospf_instance, show_debugging_ospf_instance_cmd, - "show debugging ospf <1-65535>", + "show debugging ospf (1-65535)", SHOW_STR DEBUG_STR OSPF_STR diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 04601b994d..b70433b87e 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1363,7 +1363,7 @@ DEFUN (no_pce_path_scope, DEFUN (pce_domain, pce_domain_cmd, - "pce domain as <0-65535>", + "pce domain as (0-65535)", PCE_STR "Configure PCE domain AS number\n" "AS number where the PCE as visibilities for path computation\n" @@ -1401,7 +1401,7 @@ out:return CMD_SUCCESS; DEFUN (no_pce_domain, no_pce_domain_cmd, - "no pce domain as <0-65535>", + "no pce domain as (0-65535)", NO_STR PCE_STR "Disable PCE domain AS number\n" @@ -1431,7 +1431,7 @@ DEFUN (no_pce_domain, DEFUN (pce_neigbhor, pce_neighbor_cmd, - "pce neighbor as <0-65535>", + "pce neighbor as (0-65535)", PCE_STR "Configure PCE neighbor domain AS number\n" "AS number of PCE neighbors\n" @@ -1469,7 +1469,7 @@ out:return CMD_SUCCESS; DEFUN (no_pce_neighbor, no_pce_neighbor_cmd, - "no pce neighbor as <0-65535>", + "no pce neighbor as (0-65535)", NO_STR PCE_STR "Disable PCE neighbor AS number\n" diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index f38e45e426..f1fc484e36 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -692,7 +692,7 @@ struct route_map_rule_cmd route_set_tag_cmd = DEFUN (match_ip_nexthop, match_ip_nexthop_cmd, - "match ip next-hop (<1-199>|<1300-2699>|WORD)", + "match ip next-hop <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -767,7 +767,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", + "match ip address <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match address of route\n" @@ -872,7 +872,7 @@ DEFUN (no_match_interface, DEFUN (match_tag, match_tag_cmd, - "match tag <1-65535>", + "match tag (1-65535)", MATCH_STR "Match tag of route\n" "Tag value\n") @@ -902,7 +902,7 @@ DEFUN (no_match_tag, DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", SET_STR "Metric value for destination routing protocol\n" "Metric value\n") @@ -932,7 +932,7 @@ DEFUN (no_set_metric, DEFUN (set_metric_type, set_metric_type_cmd, - "set metric-type (type-1|type-2)", + "set metric-type ", SET_STR "Type of metric for destination routing protocol\n" "OSPF[6] external type 1 metric\n" @@ -969,7 +969,7 @@ DEFUN (no_set_metric_type, DEFUN (set_tag, set_tag_cmd, - "set tag <1-65535>", + "set tag (1-65535)", SET_STR "Tag value for routing protocol\n" "Tag value\n") diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 4505fb3c47..c90a5b2c45 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2475,7 +2475,7 @@ DEFUN (ospf_mpls_te_inter_as_as, DEFUN (ospf_mpls_te_inter_as_area, ospf_mpls_te_inter_as_area_cmd, - "mpls-te inter-as area (A.B.C.D|<0-4294967295>)", + "mpls-te inter-as area ", MPLS_TE_STR "Configure MPLS-TE Inter-AS support\n" "AREA native mode self originate INTER_AS LSA with Type 10 (area flooding scope)\n" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index e34c0bbeb3..8d0fb1d5d9 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -529,7 +529,7 @@ DEFUN (no_ospf_passive_interface, DEFUN (ospf_network_area, ospf_network_area_cmd, - "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", + "network A.B.C.D/M area ", "Enable routing on an IP network\n" "OSPF network prefix\n" "Set the OSPF area ID\n" @@ -574,7 +574,7 @@ DEFUN (ospf_network_area, DEFUN (no_ospf_network_area, no_ospf_network_area_cmd, - "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", + "no network A.B.C.D/M area ", NO_STR "Enable routing on an IP network\n" "OSPF network prefix\n" @@ -645,7 +645,7 @@ DEFUN (no_ospf_network_area, */ DEFUN (ospf_area_range, ospf_area_range_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", + "area range A.B.C.D/M", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -679,7 +679,7 @@ DEFUN (ospf_area_range, DEFUN (ospf_area_range_not_advertise, ospf_area_range_not_advertise_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", + "area range A.B.C.D/M not-advertise", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -739,7 +739,7 @@ DEFUN (ospf_area_range_not_advertise, */ DEFUN (no_ospf_area_range, no_ospf_area_range_cmd, - "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", + "no area range A.B.C.D/M", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -768,7 +768,7 @@ DEFUN (no_ospf_area_range, DEFUN (ospf_area_range_substitute, ospf_area_range_substitute_cmd, - "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", + "area range A.B.C.D/M substitute A.B.C.D/M", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -796,7 +796,7 @@ DEFUN (ospf_area_range_substitute, DEFUN (no_ospf_area_range_substitute, no_ospf_area_range_substitute_cmd, - "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", + "no area range A.B.C.D/M substitute A.B.C.D/M", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1162,7 +1162,7 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) */ DEFUN (ospf_area_vlink, ospf_area_vlink_cmd, - "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", + "area virtual-link A.B.C.D", VLINK_HELPSTR_IPADDR) { struct ospf *ospf = vty->index; @@ -1394,7 +1394,7 @@ DEFUN (ospf_area_vlink, */ DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, - "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", + "no area virtual-link A.B.C.D", NO_STR VLINK_HELPSTR_IPADDR) { @@ -1538,7 +1538,7 @@ DEFUN (no_ospf_area_vlink, DEFUN (ospf_area_shortcut, ospf_area_shortcut_cmd, - "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", + "area shortcut ", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1581,7 +1581,7 @@ DEFUN (ospf_area_shortcut, DEFUN (no_ospf_area_shortcut, no_ospf_area_shortcut_cmd, - "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", + "no area shortcut ", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1612,7 +1612,7 @@ DEFUN (no_ospf_area_shortcut, DEFUN (ospf_area_stub, ospf_area_stub_cmd, - "area (A.B.C.D|<0-4294967295>) stub", + "area stub", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1642,7 +1642,7 @@ DEFUN (ospf_area_stub, DEFUN (ospf_area_stub_no_summary, ospf_area_stub_no_summary_cmd, - "area (A.B.C.D|<0-4294967295>) stub no-summary", + "area stub no-summary", "OSPF stub parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1673,7 +1673,7 @@ DEFUN (ospf_area_stub_no_summary, DEFUN (no_ospf_area_stub, no_ospf_area_stub_cmd, - "no area (A.B.C.D|<0-4294967295>) stub", + "no area stub", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1697,7 +1697,7 @@ DEFUN (no_ospf_area_stub, DEFUN (no_ospf_area_stub_no_summary, no_ospf_area_stub_no_summary_cmd, - "no area (A.B.C.D|<0-4294967295>) stub no-summary", + "no area stub no-summary", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1769,7 +1769,7 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], DEFUN (ospf_area_nssa_translate_no_summary, ospf_area_nssa_translate_no_summary_cmd, - "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary", + "area nssa no-summary", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1784,7 +1784,7 @@ DEFUN (ospf_area_nssa_translate_no_summary, DEFUN (ospf_area_nssa_translate, ospf_area_nssa_translate_cmd, - "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", + "area nssa ", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1798,7 +1798,7 @@ DEFUN (ospf_area_nssa_translate, DEFUN (ospf_area_nssa, ospf_area_nssa_cmd, - "area (A.B.C.D|<0-4294967295>) nssa", + "area nssa", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1809,7 +1809,7 @@ DEFUN (ospf_area_nssa, DEFUN (ospf_area_nssa_no_summary, ospf_area_nssa_no_summary_cmd, - "area (A.B.C.D|<0-4294967295>) nssa no-summary", + "area nssa no-summary", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1835,7 +1835,7 @@ DEFUN (ospf_area_nssa_no_summary, */ DEFUN (no_ospf_area_nssa, no_ospf_area_nssa_cmd, - "no area (A.B.C.D|<0-4294967295>) nssa", + "no area nssa", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1862,7 +1862,7 @@ DEFUN (no_ospf_area_nssa, DEFUN (ospf_area_default_cost, ospf_area_default_cost_cmd, - "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", + "area default-cost (0-16777215)", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1906,7 +1906,7 @@ DEFUN (ospf_area_default_cost, DEFUN (no_ospf_area_default_cost, no_ospf_area_default_cost_cmd, - "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", + "no area default-cost (0-16777215)", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -1955,7 +1955,7 @@ DEFUN (no_ospf_area_default_cost, DEFUN (ospf_area_export_list, ospf_area_export_list_cmd, - "area (A.B.C.D|<0-4294967295>) export-list NAME", + "area export-list NAME", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -1980,7 +1980,7 @@ DEFUN (ospf_area_export_list, DEFUN (no_ospf_area_export_list, no_ospf_area_export_list_cmd, - "no area (A.B.C.D|<0-4294967295>) export-list NAME", + "no area export-list NAME", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -2010,7 +2010,7 @@ DEFUN (no_ospf_area_export_list, DEFUN (ospf_area_import_list, ospf_area_import_list_cmd, - "area (A.B.C.D|<0-4294967295>) import-list NAME", + "area import-list NAME", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -2035,7 +2035,7 @@ DEFUN (ospf_area_import_list, DEFUN (no_ospf_area_import_list, no_ospf_area_import_list_cmd, - "no area (A.B.C.D|<0-4294967295>) import-list NAME", + "no area import-list NAME", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -2064,7 +2064,7 @@ DEFUN (no_ospf_area_import_list, DEFUN (ospf_area_filter_list, ospf_area_filter_list_cmd, - "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", + "area filter-list prefix WORD ", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -2111,7 +2111,7 @@ DEFUN (ospf_area_filter_list, DEFUN (no_ospf_area_filter_list, no_ospf_area_filter_list_cmd, - "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", + "no area filter-list prefix WORD ", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -2170,7 +2170,7 @@ DEFUN (no_ospf_area_filter_list, DEFUN (ospf_area_authentication_message_digest, ospf_area_authentication_message_digest_cmd, - "area (A.B.C.D|<0-4294967295>) authentication message-digest", + "area authentication message-digest", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -2195,7 +2195,7 @@ DEFUN (ospf_area_authentication_message_digest, DEFUN (ospf_area_authentication, ospf_area_authentication_cmd, - "area (A.B.C.D|<0-4294967295>) authentication", + "area authentication", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" @@ -2219,7 +2219,7 @@ DEFUN (ospf_area_authentication, DEFUN (no_ospf_area_authentication, no_ospf_area_authentication_cmd, - "no area (A.B.C.D|<0-4294967295>) authentication", + "no area authentication", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" @@ -2250,7 +2250,7 @@ DEFUN (no_ospf_area_authentication, DEFUN (ospf_abr_type, ospf_abr_type_cmd, - "ospf abr-type (cisco|ibm|shortcut|standard)", + "ospf abr-type ", "OSPF specific commands\n" "Set OSPF ABR type\n" "Alternative ABR, cisco implementation\n" @@ -2287,7 +2287,7 @@ DEFUN (ospf_abr_type, DEFUN (no_ospf_abr_type, no_ospf_abr_type_cmd, - "no ospf abr-type (cisco|ibm|shortcut|standard)", + "no ospf abr-type ", NO_STR "OSPF specific commands\n" "Set OSPF ABR type\n" @@ -2461,7 +2461,7 @@ ospf_timers_spf_set (struct vty *vty, unsigned int delay, DEFUN (ospf_timers_min_ls_interval, ospf_timers_min_ls_interval_cmd, - "timers throttle lsa all <0-5000>", + "timers throttle lsa all (0-5000)", "Adjust routing timers\n" "Throttling adaptive timer\n" "LSA delay between transmissions\n" @@ -2516,7 +2516,7 @@ DEFUN (no_ospf_timers_min_ls_interval, DEFUN (ospf_timers_min_ls_arrival, ospf_timers_min_ls_arrival_cmd, - "timers lsa arrival <0-1000>", + "timers lsa arrival (0-1000)", "Adjust routing timers\n" "Throttling link state advertisement delays\n" "OSPF minimum arrival interval delay\n" @@ -2572,7 +2572,7 @@ DEFUN (no_ospf_timers_min_ls_arrival, DEFUN (ospf_timers_throttle_spf, ospf_timers_throttle_spf_cmd, - "timers throttle spf <0-600000> <0-600000> <0-600000>", + "timers throttle spf (0-600000) (0-600000) (0-600000)", "Adjust routing timers\n" "Throttling adaptive timer\n" "OSPF SPF timers\n" @@ -2624,7 +2624,7 @@ DEFUN (no_ospf_timers_throttle_spf, DEFUN (ospf_timers_lsa, ospf_timers_lsa_cmd, - "timers lsa min-arrival <0-600000>", + "timers lsa min-arrival (0-600000)", "Adjust routing timers\n" "OSPF LSA timers\n" "Minimum delay in receiving new version of a LSA\n" @@ -2752,7 +2752,7 @@ DEFUN (ospf_neighbor, */ DEFUN (ospf_neighbor_poll_interval, ospf_neighbor_poll_interval_cmd, - "neighbor A.B.C.D poll-interval <1-65535>", + "neighbor A.B.C.D poll-interval (1-65535)", NEIGHBOR_STR "Neighbor IP address\n" "Dead Neighbor Polling interval\n" @@ -2845,7 +2845,7 @@ DEFUN (no_ospf_neighbor, DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, - "refresh timer <10-1800>", + "refresh timer (10-1800)", "Adjust refresh parameters\n" "Set refresh timer\n" "Timer value in seconds\n") @@ -2873,7 +2873,7 @@ DEFUN (ospf_refresh_timer, */ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, - "no refresh timer <10-1800>", + "no refresh timer (10-1800)", "Adjust refresh parameters\n" "Unset refresh timer\n" "Timer value in seconds\n") @@ -2901,7 +2901,7 @@ DEFUN (no_ospf_refresh_timer, DEFUN (ospf_auto_cost_reference_bandwidth, ospf_auto_cost_reference_bandwidth_cmd, - "auto-cost reference-bandwidth <1-4294967>", + "auto-cost reference-bandwidth (1-4294967)", "Calculate OSPF interface cost according to bandwidth\n" "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") @@ -2978,7 +2978,7 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth, */ DEFUN (ospf_write_multiplier, ospf_write_multiplier_cmd, - "ospf write-multiplier <1-100>", + "ospf write-multiplier (1-100)", "OSPF specific commands\n" "Write multiplier\n" "Maximum number of interface serviced per write\n") @@ -3015,7 +3015,7 @@ DEFUN (ospf_write_multiplier, */ DEFUN (no_ospf_write_multiplier, no_ospf_write_multiplier_cmd, - "no ospf write-multiplier <1-100>", + "no ospf write-multiplier (1-100)", NO_STR "OSPF specific commands\n" "Write multiplier\n" @@ -3618,7 +3618,7 @@ DEFUN (show_ip_ospf, DEFUN (show_ip_ospf_instance, show_ip_ospf_instance_cmd, - "show ip ospf <1-65535> [json]", + "show ip ospf (1-65535) [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4028,7 +4028,7 @@ DEFUN (show_ip_ospf_interface, DEFUN (show_ip_ospf_instance_interface, show_ip_ospf_instance_interface_cmd, - "show ip ospf <1-65535> interface [INTERFACE] [json]", + "show ip ospf (1-65535) interface [INTERFACE] [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4185,7 +4185,7 @@ DEFUN (show_ip_ospf_neighbor, DEFUN (show_ip_ospf_instance_neighbor, show_ip_ospf_instance_neighbor_cmd, - "show ip ospf <1-65535> neighbor [json]", + "show ip ospf (1-65535) neighbor [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4296,7 +4296,7 @@ DEFUN (show_ip_ospf_neighbor_all, DEFUN (show_ip_ospf_instance_neighbor_all, show_ip_ospf_instance_neighbor_all_cmd, - "show ip ospf <1-65535> neighbor all [json]", + "show ip ospf (1-65535) neighbor all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4390,7 +4390,7 @@ DEFUN (show_ip_ospf_neighbor_int, DEFUN (show_ip_ospf_instance_neighbor_int, show_ip_ospf_instance_neighbor_int_cmd, - "show ip ospf <1-65535> neighbor IFNAME [json]", + "show ip ospf (1-65535) neighbor IFNAME [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4756,7 +4756,7 @@ DEFUN (show_ip_ospf_neighbor_id, DEFUN (show_ip_ospf_instance_neighbor_id, show_ip_ospf_instance_neighbor_id_cmd, - "show ip ospf <1-65535> neighbor A.B.C.D [json]", + "show ip ospf (1-65535) neighbor A.B.C.D [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4847,7 +4847,7 @@ DEFUN (show_ip_ospf_neighbor_detail, DEFUN (show_ip_ospf_instance_neighbor_detail, show_ip_ospf_instance_neighbor_detail_cmd, - "show ip ospf <1-65535> neighbor detail [json]", + "show ip ospf (1-65535) neighbor detail [json]", SHOW_STR IP_STR "OSPF information\n" @@ -4945,7 +4945,7 @@ DEFUN (show_ip_ospf_neighbor_detail_all, DEFUN (show_ip_ospf_instance_neighbor_detail_all, show_ip_ospf_instance_neighbor_detail_all_cmd, - "show ip ospf <1-65535> neighbor detail all [json]", + "show ip ospf (1-65535) neighbor detail all [json]", SHOW_STR IP_STR "OSPF information\n" @@ -5047,7 +5047,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, DEFUN (show_ip_ospf_instance_neighbor_int_detail, show_ip_ospf_instance_neighbor_int_detail_cmd, - "show ip ospf <1-65535> neighbor IFNAME detail [json]", + "show ip ospf (1-65535) neighbor IFNAME detail [json]", SHOW_STR IP_STR "OSPF information\n" @@ -5889,7 +5889,7 @@ DEFUN (show_ip_ospf_database, */ DEFUN (show_ip_ospf_instance_database, show_ip_ospf_instance_database_cmd, - "show ip ospf <1-65535> database", + "show ip ospf (1-65535) database", SHOW_STR IP_STR "OSPF information\n" @@ -5979,7 +5979,7 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf */ DEFUN (show_ip_ospf_database_type_adv_router, show_ip_ospf_database_type_adv_router_cmd, - "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", + "show ip ospf database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D", SHOW_STR IP_STR "OSPF information\n" @@ -6011,7 +6011,7 @@ DEFUN (show_ip_ospf_database_type_adv_router, */ DEFUN (show_ip_ospf_instance_database_type_adv_router, show_ip_ospf_instance_database_type_adv_router_cmd, - "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", + "show ip ospf (1-65535) database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D", SHOW_STR IP_STR "OSPF information\n" @@ -6045,7 +6045,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, */ DEFUN (ip_ospf_authentication_args, ip_ospf_authentication_args_addr_cmd, - "ip ospf authentication (null|message-digest) A.B.C.D", + "ip ospf authentication A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Enable authentication on this interface\n" @@ -6154,7 +6154,7 @@ DEFUN (ip_ospf_authentication, */ DEFUN (no_ip_ospf_authentication_args, no_ip_ospf_authentication_args_addr_cmd, - "no ip ospf authentication (null|message-digest) A.B.C.D", + "no ip ospf authentication A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6488,7 +6488,7 @@ DEFUN (no_ip_ospf_authentication_key, */ DEFUN (ip_ospf_message_digest_key, ip_ospf_message_digest_key_addr_cmd, - "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", + "ip ospf message-digest-key (1-255) md5 KEY A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Message digest authentication password (key)\n" @@ -6563,7 +6563,7 @@ ALIAS_HIDDEN (ip_ospf_message_digest_key, */ DEFUN (no_ip_ospf_message_digest_key_md5, no_ip_ospf_message_digest_key_md5_addr_cmd, - "no ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", + "no ip ospf message-digest-key (1-255) md5 KEY A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6636,7 +6636,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, */ DEFUN (no_ip_ospf_message_digest_key, no_ip_ospf_message_digest_key_addr_cmd, - "no ip ospf message-digest-key <1-255> A.B.C.D", + "no ip ospf message-digest-key (1-255) A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6701,7 +6701,7 @@ DEFUN (no_ip_ospf_message_digest_key, */ DEFUN (ip_ospf_cost, ip_ospf_cost_u32_inet4_cmd, - "ip ospf cost <1-65535> A.B.C.D", + "ip ospf cost (1-65535) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Interface cost\n" @@ -6857,7 +6857,7 @@ DEFUN (no_ip_ospf_cost, */ DEFUN (no_ip_ospf_cost2, no_ip_ospf_cost_u32_cmd, - "no ip ospf cost <1-65535>", + "no ip ospf cost (1-65535)", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7023,7 +7023,7 @@ ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, */ DEFUN (ip_ospf_dead_interval, ip_ospf_dead_interval_addr_cmd, - "ip ospf dead-interval <1-65535> A.B.C.D", + "ip ospf dead-interval (1-65535) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" @@ -7057,7 +7057,7 @@ ALIAS_HIDDEN (ip_ospf_dead_interval, */ DEFUN (ip_ospf_dead_interval_minimal, ip_ospf_dead_interval_minimal_addr_cmd, - "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", + "ip ospf dead-interval minimal hello-multiplier (1-10) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" @@ -7115,7 +7115,7 @@ DEFUN (ip_ospf_dead_interval_minimal, */ DEFUN (no_ip_ospf_dead_interval, no_ip_ospf_dead_interval_addr_cmd, - "no ip ospf dead-interval <1-65535> A.B.C.D", + "no ip ospf dead-interval (1-65535) A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7198,7 +7198,7 @@ DEFUN (no_ip_ospf_dead_interval, */ DEFUN (ip_ospf_hello_interval, ip_ospf_hello_interval_addr_cmd, - "ip ospf hello-interval <1-65535> A.B.C.D", + "ip ospf hello-interval (1-65535) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Time between HELLO packets\n" @@ -7274,7 +7274,7 @@ ALIAS_HIDDEN (ip_ospf_hello_interval, */ DEFUN (no_ip_ospf_hello_interval, no_ip_ospf_hello_interval_addr_cmd, - "no ip ospf hello-interval <1-65535> A.B.C.D", + "no ip ospf hello-interval (1-65535) A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7322,7 +7322,7 @@ DEFUN (no_ip_ospf_hello_interval, DEFUN (ip_ospf_network, ip_ospf_network_cmd, - "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", + "ip ospf network ", "IP Information\n" "OSPF interface commands\n" "Network type\n" @@ -7461,7 +7461,7 @@ DEFUN (no_ip_ospf_network, */ DEFUN (ip_ospf_priority, ip_ospf_priority_addr_cmd, - "ip ospf priority <0-255> A.B.C.D", + "ip ospf priority (0-255) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Router priority\n" @@ -7553,7 +7553,7 @@ ALIAS_HIDDEN (ip_ospf_priority, */ DEFUN (no_ip_ospf_priority, no_ip_ospf_priority_addr_cmd, - "no ip ospf priority <0-255> A.B.C.D", + "no ip ospf priority (0-255) A.B.C.D", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7627,7 +7627,7 @@ DEFUN (no_ip_ospf_priority, */ DEFUN (ip_ospf_retransmit_interval, ip_ospf_retransmit_interval_addr_cmd, - "ip ospf retransmit-interval <3-65535> A.B.C.D", + "ip ospf retransmit-interval (3-65535) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" @@ -7756,7 +7756,7 @@ DEFUN (no_ip_ospf_retransmit_interval, DEFUN (no_ip_ospf_retransmit_interval_sec, no_ip_ospf_retransmit_interval_sec_cmd, - "no ip ospf retransmit-interval <3-65535>", + "no ip ospf retransmit-interval (3-65535)", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7787,7 +7787,7 @@ DEFUN (no_ip_ospf_retransmit_interval_sec, */ DEFUN (ip_ospf_transmit_delay, ip_ospf_transmit_delay_addr_cmd, - "ip ospf transmit-delay <1-65535> A.B.C.D", + "ip ospf transmit-delay (1-65535) A.B.C.D", "IP Information\n" "OSPF interface commands\n" "Link state transmit delay\n" @@ -7915,7 +7915,7 @@ DEFUN (no_ip_ospf_transmit_delay, DEFUN (no_ip_ospf_transmit_delay_sec, no_ip_ospf_transmit_delay_sec_cmd, - "no ip ospf transmit-delay <1-65535>", + "no ip ospf transmit-delay (1-65535)", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7948,7 +7948,7 @@ DEFUN (no_ip_ospf_transmit_delay_sec, */ DEFUN (ip_ospf_area, ip_ospf_area_cmd, - "ip ospf area (A.B.C.D|<0-4294967295>)", + "ip ospf area ", "IP Information\n" "OSPF interface commands\n" "Enable OSPF on this interface\n" @@ -8072,7 +8072,7 @@ DEFUN (no_ip_ospf_area, */ DEFUN (no_ip_ospf_instance_area, no_ip_ospf_instance_area_cmd, - "no ip ospf <1-65535> area", + "no ip ospf (1-65535) area", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -8104,7 +8104,7 @@ DEFUN (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8157,7 +8157,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPFD " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8189,7 +8189,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "redistribute (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -8257,7 +8257,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute (ospf|table) <1-65535> {metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no redistribute (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]", NO_STR REDIST_STR "Open Shortest Path First\n" @@ -8355,7 +8355,7 @@ DEFUN (no_ospf_distribute_list_out, /* Default information originate. */ DEFUN (ospf_default_information_originate, ospf_default_information_originate_cmd, - "default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]", "Control distribution of default information\n" "Distribute a default route\n" "Always advertise default route\n" @@ -8406,7 +8406,7 @@ DEFUN (ospf_default_information_originate, DEFUN (no_ospf_default_information_originate, no_ospf_default_information_originate_cmd, - "no default-information originate {always|metric <0-16777214>|metric-type (1|2)|route-map WORD}", + "no default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]", NO_STR "Control distribution of default information\n" "Distribute a default route\n" @@ -8449,7 +8449,7 @@ DEFUN (no_ospf_default_information_originate, DEFUN (ospf_default_metric, ospf_default_metric_cmd, - "default-metric <0-16777214>", + "default-metric (0-16777214)", "Set metric of redistributed routes\n" "Default metric\n") { @@ -8494,7 +8494,7 @@ DEFUN (no_ospf_default_metric, DEFUN (ospf_distance, ospf_distance_cmd, - "distance <1-255>", + "distance (1-255)", "Define an administrative distance\n" "OSPF Administrative distance\n") { @@ -8510,7 +8510,7 @@ DEFUN (ospf_distance, DEFUN (no_ospf_distance, no_ospf_distance_cmd, - "no distance <1-255>", + "no distance (1-255)", NO_STR "Define an administrative distance\n" "OSPF Administrative distance\n") @@ -8527,7 +8527,7 @@ DEFUN (no_ospf_distance, DEFUN (no_ospf_distance_ospf, no_ospf_distance_ospf_cmd, - "no distance ospf {intra-area <1-255>|inter-area <1-255>|external <1-255>}", + "no distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]", NO_STR "Define an administrative distance\n" "OSPF Administrative distance\n" @@ -8571,7 +8571,7 @@ DEFUN (no_ospf_distance_ospf, DEFUN (ospf_distance_ospf, ospf_distance_ospf_cmd, - "distance ospf {intra-area <1-255>|inter-area <1-255>|external <1-255>}", + "distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]", "Define an administrative distance\n" "OSPF Administrative distance\n" "Intra-area routes\n" @@ -8610,7 +8610,7 @@ DEFUN (ospf_distance_ospf, DEFUN (ospf_distance_source, ospf_distance_source_cmd, - "distance <1-255> A.B.C.D/M", + "distance (1-255) A.B.C.D/M", "Administrative distance\n" "Distance value\n" "IP source prefix\n") @@ -8627,7 +8627,7 @@ DEFUN (ospf_distance_source, DEFUN (no_ospf_distance_source, no_ospf_distance_source_cmd, - "no distance <1-255> A.B.C.D/M", + "no distance (1-255) A.B.C.D/M", NO_STR "Administrative distance\n" "Distance value\n" @@ -8645,7 +8645,7 @@ DEFUN (no_ospf_distance_source, DEFUN (ospf_distance_source_access_list, ospf_distance_source_access_list_cmd, - "distance <1-255> A.B.C.D/M WORD", + "distance (1-255) A.B.C.D/M WORD", "Administrative distance\n" "Distance value\n" "IP source prefix\n" @@ -8663,7 +8663,7 @@ DEFUN (ospf_distance_source_access_list, DEFUN (no_ospf_distance_source_access_list, no_ospf_distance_source_access_list_cmd, - "no distance <1-255> A.B.C.D/M WORD", + "no distance (1-255) A.B.C.D/M WORD", NO_STR "Administrative distance\n" "Distance value\n" @@ -8844,7 +8844,7 @@ DEFUN (no_ospf_max_metric_router_lsa_admin, DEFUN (ospf_max_metric_router_lsa_startup, ospf_max_metric_router_lsa_startup_cmd, - "max-metric router-lsa on-startup <5-86400>", + "max-metric router-lsa on-startup (5-86400)", "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" "Automatically advertise stub Router-LSA on startup of OSPF\n" @@ -8880,7 +8880,7 @@ DEFUN (ospf_max_metric_router_lsa_startup, */ DEFUN (no_ospf_max_metric_router_lsa_startup, no_ospf_max_metric_router_lsa_startup_cmd, - "no max-metric router-lsa on-startup <5-86400>", + "no max-metric router-lsa on-startup (5-86400)", NO_STR "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" @@ -8914,7 +8914,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup, DEFUN (ospf_max_metric_router_lsa_shutdown, ospf_max_metric_router_lsa_shutdown_cmd, - "max-metric router-lsa on-shutdown <5-100>", + "max-metric router-lsa on-shutdown (5-100)", "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" "Advertise stub-router prior to full shutdown of OSPF\n" @@ -8953,7 +8953,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, */ DEFUN (no_ospf_max_metric_router_lsa_shutdown, no_ospf_max_metric_router_lsa_shutdown_cmd, - "no max-metric router-lsa on-shutdown <5-100>", + "no max-metric router-lsa on-shutdown (5-100)", NO_STR "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" @@ -9187,7 +9187,7 @@ DEFUN (show_ip_ospf_border_routers, DEFUN (show_ip_ospf_instance_border_routers, show_ip_ospf_instance_border_routers_cmd, - "show ip ospf <1-65535> border-routers", + "show ip ospf (1-65535) border-routers", SHOW_STR IP_STR "OSPF information\n" @@ -9249,7 +9249,7 @@ DEFUN (show_ip_ospf_route, DEFUN (show_ip_ospf_instance_route, show_ip_ospf_instance_route_cmd, - "show ip ospf <1-65535> route", + "show ip ospf (1-65535) route", SHOW_STR IP_STR "OSPF information\n" diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index 0567f4f205..3566d28ffa 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -90,7 +90,7 @@ DEFUN (debug_rip_packet, DEFUN (debug_rip_packet_direct, debug_rip_packet_direct_cmd, - "debug rip packet (recv|send)", + "debug rip packet ", DEBUG_STR RIP_STR "RIP packet\n" @@ -142,7 +142,7 @@ DEFUN (no_debug_rip_packet, DEFUN (no_debug_rip_packet_direct, no_debug_rip_packet_direct_cmd, - "no debug rip packet (recv|send)", + "no debug rip packet ", NO_STR DEBUG_STR RIP_STR diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 122a53eba0..4ad750304e 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1220,7 +1220,7 @@ rip_passive_nondefault_clean (void) /* RIP enable network or interface configuration. */ DEFUN (rip_network, rip_network_cmd, - "network (A.B.C.D/M|WORD)", + "network ", "Enable routing on an IP network\n" "IP prefix /, e.g., 35.0.0.0/8\n" "Interface name\n") @@ -1248,7 +1248,7 @@ DEFUN (rip_network, /* RIP enable network or interface configuration. */ DEFUN (no_rip_network, no_rip_network_cmd, - "no network (A.B.C.D/M|WORD)", + "no network ", NO_STR "Enable routing on an IP network\n" "IP prefix /, e.g., 35.0.0.0/8\n" @@ -1323,7 +1323,7 @@ DEFUN (no_rip_neighbor, DEFUN (ip_rip_receive_version, ip_rip_receive_version_cmd, - "ip rip receive version (1|2)", + "ip rip receive version <1|2>", IP_STR "Routing Information Protocol\n" "Advertisement reception\n" @@ -1427,7 +1427,7 @@ DEFUN (no_ip_rip_receive_version, DEFUN (ip_rip_send_version, ip_rip_send_version_cmd, - "ip rip send version (1|2)", + "ip rip send version <1|2>", IP_STR "Routing Information Protocol\n" "Advertisement transmission\n" @@ -1545,7 +1545,7 @@ DEFUN (no_ip_rip_send_version, */ DEFUN (ip_rip_authentication_mode, ip_rip_authentication_mode_cmd, - "ip rip authentication mode (md5|text)", + "ip rip authentication mode ", IP_STR "Routing Information Protocol\n" "Authentication control\n" @@ -1873,7 +1873,7 @@ DEFUN (no_ip_rip_split_horizon_poisoned_reverse, DEFUN (rip_passive_interface, rip_passive_interface_cmd, - "passive-interface (IFNAME|default)", + "passive-interface ", "Suppress routing updates on an interface\n" "Interface name\n" "default for all interfaces\n") @@ -1893,7 +1893,7 @@ DEFUN (rip_passive_interface, DEFUN (no_rip_passive_interface, no_rip_passive_interface_cmd, - "no passive-interface (IFNAME|default)", + "no passive-interface ", NO_STR "Suppress routing updates on an interface\n" "Interface name\n" diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index be734c66dd..f57c6684e4 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -282,7 +282,7 @@ rip_offset_list_apply_out (struct prefix_ipv4 *p, struct interface *ifp, DEFUN (rip_offset_list, rip_offset_list_cmd, - "offset-list WORD (in|out) <0-16>", + "offset-list WORD (0-16)", "Modify RIP metric\n" "Access-list name\n" "For incoming updates\n" @@ -294,7 +294,7 @@ DEFUN (rip_offset_list, DEFUN (rip_offset_list_ifname, rip_offset_list_ifname_cmd, - "offset-list WORD (in|out) <0-16> IFNAME", + "offset-list WORD (0-16) IFNAME", "Modify RIP metric\n" "Access-list name\n" "For incoming updates\n" @@ -307,7 +307,7 @@ DEFUN (rip_offset_list_ifname, DEFUN (no_rip_offset_list, no_rip_offset_list_cmd, - "no offset-list WORD (in|out) <0-16>", + "no offset-list WORD (0-16)", NO_STR "Modify RIP metric\n" "Access-list name\n" @@ -320,7 +320,7 @@ DEFUN (no_rip_offset_list, DEFUN (no_rip_offset_list_ifname, no_rip_offset_list_ifname_cmd, - "no offset-list WORD (in|out) <0-16> IFNAME", + "no offset-list WORD (0-16) IFNAME", NO_STR "Modify RIP metric\n" "Access-list name\n" diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 4bb5958e9d..35e869172c 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -737,7 +737,7 @@ static struct route_map_rule_cmd route_set_tag_cmd = DEFUN (match_metric, match_metric_cmd, - "match metric <0-4294967295>", + "match metric (0-4294967295)", MATCH_STR "Match metric of route\n" "Metric value\n") @@ -797,7 +797,7 @@ DEFUN (no_match_interface, DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, - "match ip next-hop (<1-199>|<1300-2699>|WORD)", + "match ip next-hop <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -870,7 +870,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", + "match ip address <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match address of route\n" @@ -944,7 +944,7 @@ DEFUN (no_match_ip_address_prefix_list, DEFUN (match_tag, match_tag_cmd, - "match tag <1-65535>", + "match tag (1-65535)", MATCH_STR "Match tag of route\n" "Metric value\n") @@ -984,7 +984,7 @@ DEFUN (no_match_tag, */ DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", SET_STR "Metric value for destination routing protocol\n" "Metric value\n") @@ -1072,7 +1072,7 @@ DEFUN (no_set_ip_nexthop, DEFUN (set_tag, set_tag_cmd, - "set tag <1-65535>", + "set tag (1-65535)", SET_STR "Tag value for routing protocol\n" "Tag value\n") diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 4ede048f9c..56f4623f3f 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -467,7 +467,7 @@ DEFUN (no_rip_redistribute_type_routemap, DEFUN (rip_redistribute_type_metric, rip_redistribute_type_metric_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16>", + "redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16)", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD "Metric\n" @@ -497,7 +497,7 @@ DEFUN (rip_redistribute_type_metric, DEFUN (no_rip_redistribute_type_metric, no_rip_redistribute_type_metric_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16>", + "no redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16)", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD @@ -526,7 +526,7 @@ DEFUN (no_rip_redistribute_type_metric, DEFUN (rip_redistribute_type_metric_routemap, rip_redistribute_type_metric_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16> route-map WORD", + "redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16) route-map WORD", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD "Metric\n" @@ -560,7 +560,7 @@ DEFUN (rip_redistribute_type_metric_routemap, DEFUN (no_rip_redistribute_type_metric_routemap, no_rip_redistribute_type_metric_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD " metric <0-16> route-map WORD", + "no redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16) route-map WORD", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD diff --git a/ripd/ripd.c b/ripd/ripd.c index d483d1ef31..9fa11ef9ab 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2943,7 +2943,7 @@ DEFUN (no_router_rip, DEFUN (rip_version, rip_version_cmd, - "version <1-2>", + "version (1-2)", "Set routing protocol version\n" "version\n") { @@ -3075,7 +3075,7 @@ rip_update_default_metric (void) DEFUN (rip_default_metric, rip_default_metric_cmd, - "default-metric <1-16>", + "default-metric (1-16)", "Set a metric of redistribute routes\n" "Default metric\n") { @@ -3113,7 +3113,7 @@ DEFUN (no_rip_default_metric, DEFUN (rip_timers, rip_timers_cmd, - "timers basic <5-2147483647> <5-2147483647> <5-2147483647>", + "timers basic (5-2147483647) (5-2147483647) (5-2147483647)", "Adjust routing timers\n" "Basic routing protocol update timers\n" "Routing table update timer value in second. Default is 30.\n" @@ -3388,7 +3388,7 @@ rip_distance_show (struct vty *vty) DEFUN (rip_distance, rip_distance_cmd, - "distance <1-255>", + "distance (1-255)", "Administrative distance\n" "Distance value\n") { @@ -3398,7 +3398,7 @@ DEFUN (rip_distance, DEFUN (no_rip_distance, no_rip_distance_cmd, - "no distance <1-255>", + "no distance (1-255)", NO_STR "Administrative distance\n" "Distance value\n") @@ -3409,7 +3409,7 @@ DEFUN (no_rip_distance, DEFUN (rip_distance_source, rip_distance_source_cmd, - "distance <1-255> A.B.C.D/M", + "distance (1-255) A.B.C.D/M", "Administrative distance\n" "Distance value\n" "IP source prefix\n") @@ -3420,7 +3420,7 @@ DEFUN (rip_distance_source, DEFUN (no_rip_distance_source, no_rip_distance_source_cmd, - "no distance <1-255> A.B.C.D/M", + "no distance (1-255) A.B.C.D/M", NO_STR "Administrative distance\n" "Distance value\n" @@ -3432,7 +3432,7 @@ DEFUN (no_rip_distance_source, DEFUN (rip_distance_source_access_list, rip_distance_source_access_list_cmd, - "distance <1-255> A.B.C.D/M WORD", + "distance (1-255) A.B.C.D/M WORD", "Administrative distance\n" "Distance value\n" "IP source prefix\n" @@ -3444,7 +3444,7 @@ DEFUN (rip_distance_source_access_list, DEFUN (no_rip_distance_source_access_list, no_rip_distance_source_access_list_cmd, - "no distance <1-255> A.B.C.D/M WORD", + "no distance (1-255) A.B.C.D/M WORD", NO_STR "Administrative distance\n" "Distance value\n" diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index 73bfcb4d6c..ecbba5b308 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -91,7 +91,7 @@ DEFUN (debug_ripng_packet, DEFUN (debug_ripng_packet_direct, debug_ripng_packet_direct_cmd, - "debug ripng packet (recv|send)", + "debug ripng packet ", DEBUG_STR "RIPng configuration\n" "Debug option set for ripng packet\n" @@ -144,7 +144,7 @@ DEFUN (no_debug_ripng_packet, DEFUN (no_debug_ripng_packet_direct, no_debug_ripng_packet_direct_cmd, - "no debug ripng packet (recv|send)", + "no debug ripng packet ", NO_STR DEBUG_STR "RIPng configuration\n" diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 2fbfb33e3c..46ca818c46 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -290,7 +290,7 @@ ripng_offset_list_apply_out (struct prefix_ipv6 *p, struct interface *ifp, DEFUN (ripng_offset_list, ripng_offset_list_cmd, - "offset-list WORD (in|out) <0-16>", + "offset-list WORD (0-16)", "Modify RIPng metric\n" "Access-list name\n" "For incoming updates\n" @@ -302,7 +302,7 @@ DEFUN (ripng_offset_list, DEFUN (ripng_offset_list_ifname, ripng_offset_list_ifname_cmd, - "offset-list WORD (in|out) <0-16> IFNAME", + "offset-list WORD (0-16) IFNAME", "Modify RIPng metric\n" "Access-list name\n" "For incoming updates\n" @@ -315,7 +315,7 @@ DEFUN (ripng_offset_list_ifname, DEFUN (no_ripng_offset_list, no_ripng_offset_list_cmd, - "no offset-list WORD (in|out) <0-16>", + "no offset-list WORD (0-16)", NO_STR "Modify RIPng metric\n" "Access-list name\n" @@ -328,7 +328,7 @@ DEFUN (no_ripng_offset_list, DEFUN (no_ripng_offset_list_ifname, no_ripng_offset_list_ifname_cmd, - "no offset-list WORD (in|out) <0-16> IFNAME", + "no offset-list WORD (0-16) IFNAME", NO_STR "Modify RIPng metric\n" "Access-list name\n" diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 9c25d60033..0910f94a77 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -502,7 +502,7 @@ static struct route_map_rule_cmd route_set_tag_cmd = DEFUN (match_metric, match_metric_cmd, - "match metric <0-4294967295>", + "match metric (0-4294967295)", MATCH_STR "Match metric of route\n" "Metric value\n") @@ -562,7 +562,7 @@ DEFUN (no_match_interface, DEFUN (match_tag, match_tag_cmd, - "match tag <1-65535>", + "match tag (1-65535)", MATCH_STR "Match tag of route\n" "Metric value\n") @@ -594,7 +594,7 @@ DEFUN (no_match_tag, DEFUN (set_metric, set_metric_cmd, - "set metric <0-4294967295>", + "set metric (0-4294967295)", "Set value\n" "Metric value for destination routing protocol\n" "Metric value\n") @@ -676,7 +676,7 @@ DEFUN (no_set_ipv6_nexthop_local, DEFUN (set_tag, set_tag_cmd, - "set tag <1-65535>", + "set tag (1-65535)", SET_STR "Tag value for routing protocol\n" "Tag value\n") diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 055a074cc7..e455211954 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -394,7 +394,7 @@ DEFUN (no_ripng_redistribute_type, DEFUN (ripng_redistribute_type_metric, ripng_redistribute_type_metric_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", + "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric (0-16)", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" @@ -446,7 +446,7 @@ DEFUN (ripng_redistribute_type_routemap, DEFUN (ripng_redistribute_type_metric_routemap, ripng_redistribute_type_metric_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", + "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric (0-16) route-map WORD", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index dd8f1fc39a..5e53d44b69 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2389,7 +2389,7 @@ DEFUN (no_ripng_aggregate_address, DEFUN (ripng_default_metric, ripng_default_metric_cmd, - "default-metric <1-16>", + "default-metric (1-16)", "Set a metric of redistribute routes\n" "Default metric\n") { @@ -2528,7 +2528,7 @@ DEFUN (no_ripng_garbage_timer, DEFUN (ripng_timers, ripng_timers_cmd, - "timers basic <0-65535> <0-65535> <0-65535>", + "timers basic (0-65535) (0-65535) (0-65535)", "RIPng timers setup\n" "Basic timer\n" "Routing table update timer value in second. Default is 30.\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 08a680066c..1c8f0c7e56 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -21,6 +21,10 @@ def token_is_variable(line_number, token): assert token.endswith(']'), "%d: token %s should end with ]" % (line_number, token) return True + if token.startswith('<'): + assert token.endswith('>'), "%d: token %s should end with >" % (line_number, token) + return True + if token.startswith('{'): # I don't really care about checking for this I just put # these asserts in here to bug sharpd @@ -246,7 +250,7 @@ DEFUN (no_bgp_maxmed_onstartup, while re_argv: index = int(re_argv.group(1)) if index not in variable_indexes and index <= max_index: - raise Exception("%d: index %s is not a variable in the command string" % (self.line_number, index)) + print "%d: index %s is not a variable in the command string" % (self.line_number, index) tmp_line = re_argv.group(2) re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line) @@ -341,6 +345,7 @@ def update_argvs(filename): line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '(kernel|connected|static|ospf|isis|bgp|pim|table)') line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '(kernel|connected|static|ripng|isis|bgp|table)') line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '(kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)') + line = line.replace('" LOG_FACILITIES "', '(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)') # endswith line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') @@ -371,6 +376,7 @@ def update_argvs(filename): line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' (kernel|connected|static|ripng|isis|bgp|table)",') line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' (kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)",') + line = line.replace('" LOG_FACILITIES,', ' (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index f767c64d35..dd4131b701 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1772,7 +1772,7 @@ DEFUN (vtysh_show_work_queues, DEFUN (vtysh_show_work_queues_daemon, vtysh_show_work_queues_daemon_cmd, - "show work-queues (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd)", + "show work-queues ", SHOW_STR "Work Queue information\n" "For the zebra daemon\n" @@ -2224,7 +2224,7 @@ DEFUN (vtysh_write_terminal, DEFUN (vtysh_write_terminal_daemon, vtysh_write_terminal_daemon_cmd, - "write terminal (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd)", + "write terminal ", "Write running configuration to memory, network, or terminal\n" "Write to terminal\n" "For the zebra daemon\n" @@ -2435,7 +2435,7 @@ ALIAS (vtysh_write_terminal, DEFUN (vtysh_terminal_length, vtysh_terminal_length_cmd, - "terminal length <0-512>", + "terminal length (0-512)", "Set terminal line parameters\n" "Set number of lines on a screen\n" "Number of lines on screen (0 for no pausing)\n") diff --git a/zebra/debug.c b/zebra/debug.c index fb3887c678..cbdcdf27f6 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -123,7 +123,7 @@ DEFUN (debug_zebra_packet, DEFUN (debug_zebra_packet_direct, debug_zebra_packet_direct_cmd, - "debug zebra packet (recv|send|detail)", + "debug zebra packet ", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra packet\n" @@ -142,7 +142,7 @@ DEFUN (debug_zebra_packet_direct, DEFUN (debug_zebra_packet_detail, debug_zebra_packet_detail_cmd, - "debug zebra packet (recv|send) detail", + "debug zebra packet detail", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra packet\n" @@ -172,7 +172,7 @@ DEFUN (debug_zebra_kernel, DEFUN (debug_zebra_kernel_msgdump, debug_zebra_kernel_msgdump_cmd, - "debug zebra kernel msgdump {recv|send}", + "debug zebra kernel msgdump [recv|send]", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" @@ -259,7 +259,7 @@ DEFUN (no_debug_zebra_packet, DEFUN (no_debug_zebra_packet_direct, no_debug_zebra_packet_direct_cmd, - "no debug zebra packet (recv|send)", + "no debug zebra packet ", NO_STR DEBUG_STR "Zebra configuration\n" @@ -288,7 +288,7 @@ DEFUN (no_debug_zebra_kernel, DEFUN (no_debug_zebra_kernel_msgdump, no_debug_zebra_kernel_msgdump_cmd, - "no debug zebra kernel msgdump {recv|send}", + "no debug zebra kernel msgdump [recv|send]", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" diff --git a/zebra/interface.c b/zebra/interface.c index 5e2f64b544..1f1146e247 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1367,7 +1367,7 @@ DEFUN (show_interface_name_vrf, interface_update_stats (); if (argc > 1) - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[4]->arg); /* Specified interface print. */ ifp = if_lookup_by_name_vrf (argv[2]->arg, vrf_id); @@ -1674,7 +1674,7 @@ DEFUN (no_shutdown_if, DEFUN (bandwidth_if, bandwidth_if_cmd, - "bandwidth <1-100000>", + "bandwidth (1-100000)", "Set bandwidth informational parameter\n" "Bandwidth in megabits\n") { @@ -1840,7 +1840,7 @@ DEFUN (no_link_params_enable, /* STANDARD TE metrics */ DEFUN (link_params_metric, link_params_metric_cmd, - "metric <0-4294967295>", + "metric (0-4294967295)", "Link metric for MPLS-TE purpose\n" "Metric value in decimal\n") { @@ -1948,7 +1948,7 @@ DEFUN (link_params_max_rsv_bw, DEFUN (link_params_unrsv_bw, link_params_unrsv_bw_cmd, - "unrsv-bw <0-7> BANDWIDTH", + "unrsv-bw (0-7) BANDWIDTH", "Unreserved bandwidth at each priority level\n" "Priority\n" "Bytes/second (IEEE floating point format)\n") @@ -2028,7 +2028,7 @@ DEFUN (no_link_params_admin_grp, /* RFC5392 & RFC5316: INTER-AS */ DEFUN (link_params_inter_as, link_params_inter_as_cmd, - "neighbor A.B.C.D as <1-4294967295>", + "neighbor A.B.C.D as (1-4294967295)", "Configure remote ASBR information (Neighbor IP address and AS number)\n" "Remote IP address in dot decimal A.B.C.D\n" "Remote AS number\n" @@ -2101,7 +2101,7 @@ DEFUN (no_link_params_inter_as, */ DEFUN (link_params_delay, link_params_delay_cmd, - "delay <0-16777215>", + "delay (0-16777215)", "Unidirectional Average Link Delay\n" "Average delay in micro-second as decimal (0...16777215)\n") { @@ -2208,7 +2208,7 @@ DEFUN (no_link_params_delay, DEFUN (link_params_delay_var, link_params_delay_var_cmd, - "delay-variation <0-16777215>", + "delay-variation (0-16777215)", "Unidirectional Link Delay Variation\n" "delay variation in micro-second as decimal (0...16777215)\n") { diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index d41373369e..424f02788a 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -463,7 +463,7 @@ DEFUN (no_ip_irdp_shutdown, DEFUN (ip_irdp_holdtime, ip_irdp_holdtime_cmd, - "ip irdp holdtime <0-9000>", + "ip irdp holdtime (0-9000)", IP_STR "ICMP Router discovery on this interface\n" "Set holdtime value\n" @@ -486,7 +486,7 @@ DEFUN (ip_irdp_holdtime, DEFUN (ip_irdp_minadvertinterval, ip_irdp_minadvertinterval_cmd, - "ip irdp minadvertinterval <3-1800>", + "ip irdp minadvertinterval (3-1800)", IP_STR "ICMP Router discovery on this interface\n" "Set minimum time between advertisement\n" @@ -519,7 +519,7 @@ DEFUN (ip_irdp_minadvertinterval, DEFUN (ip_irdp_maxadvertinterval, ip_irdp_maxadvertinterval_cmd, - "ip irdp maxadvertinterval <4-1800>", + "ip irdp maxadvertinterval (4-1800)", IP_STR "ICMP Router discovery on this interface\n" "Set maximum time between advertisement\n" @@ -558,7 +558,7 @@ DEFUN (ip_irdp_maxadvertinterval, DEFUN (ip_irdp_preference, ip_irdp_preference_cmd, - "ip irdp preference <0-2147483647>", + "ip irdp preference (0-2147483647)", IP_STR "ICMP Router discovery on this interface\n" "Set default preference level for this interface\n" @@ -581,7 +581,7 @@ DEFUN (ip_irdp_preference, DEFUN (ip_irdp_address_preference, ip_irdp_address_preference_cmd, - "ip irdp address A.B.C.D preference <0-2147483647>", + "ip irdp address A.B.C.D preference (0-2147483647)", IP_STR "Alter ICMP Router discovery preference this interface\n" "Specify IRDP non-default preference to advertise\n" @@ -625,7 +625,7 @@ DEFUN (ip_irdp_address_preference, DEFUN (no_ip_irdp_address_preference, no_ip_irdp_address_preference_cmd, - "no ip irdp address A.B.C.D preference <0-2147483647>", + "no ip irdp address A.B.C.D preference (0-2147483647)", NO_STR IP_STR "Alter ICMP Router discovery preference this interface\n" diff --git a/zebra/rtadv.c b/zebra/rtadv.c index d372c985f9..c13d85a4d1 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -917,7 +917,7 @@ DEFUN (no_ipv6_nd_suppress_ra, DEFUN (ipv6_nd_ra_interval_msec, ipv6_nd_ra_interval_msec_cmd, - "ipv6 nd ra-interval msec <70-1800000>", + "ipv6 nd ra-interval msec (70-1800000)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Router Advertisement interval\n" @@ -952,7 +952,7 @@ DEFUN (ipv6_nd_ra_interval_msec, DEFUN (ipv6_nd_ra_interval, ipv6_nd_ra_interval_cmd, - "ipv6 nd ra-interval <1-1800>", + "ipv6 nd ra-interval (1-1800)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Router Advertisement interval\n" @@ -1033,7 +1033,7 @@ DEFUN (no_ipv6_nd_ra_interval, DEFUN (ipv6_nd_ra_lifetime, ipv6_nd_ra_lifetime_cmd, - "ipv6 nd ra-lifetime <0-9000>", + "ipv6 nd ra-lifetime (0-9000)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Router lifetime\n" @@ -1095,7 +1095,7 @@ DEFUN (no_ipv6_nd_ra_lifetime, DEFUN (ipv6_nd_reachable_time, ipv6_nd_reachable_time_cmd, - "ipv6 nd reachable-time <1-3600000>", + "ipv6 nd reachable-time (1-3600000)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Reachable time\n" @@ -1139,7 +1139,7 @@ DEFUN (no_ipv6_nd_reachable_time, DEFUN (ipv6_nd_homeagent_preference, ipv6_nd_homeagent_preference_cmd, - "ipv6 nd home-agent-preference <0-65535>", + "ipv6 nd home-agent-preference (0-65535)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Home Agent preference\n" @@ -1183,7 +1183,7 @@ DEFUN (no_ipv6_nd_homeagent_preference, DEFUN (ipv6_nd_homeagent_lifetime, ipv6_nd_homeagent_lifetime_cmd, - "ipv6 nd home-agent-lifetime <0-65520>", + "ipv6 nd home-agent-lifetime (0-65520)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Home Agent lifetime\n" @@ -1508,7 +1508,7 @@ DEFUN (no_ipv6_nd_other_config_flag, */ DEFUN (ipv6_nd_prefix, ipv6_nd_prefix_cmd, - "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", + "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> ", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Prefix information\n" @@ -1782,7 +1782,7 @@ DEFUN (no_ipv6_nd_prefix, DEFUN (ipv6_nd_router_preference, ipv6_nd_router_preference_cmd, - "ipv6 nd router-preference (high|medium|low)", + "ipv6 nd router-preference ", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Default router preference\n" @@ -1844,7 +1844,7 @@ DEFUN (no_ipv6_nd_router_preference, DEFUN (ipv6_nd_mtu, ipv6_nd_mtu_cmd, - "ipv6 nd mtu <1-65535>", + "ipv6 nd mtu (1-65535)", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Advertised MTU\n" diff --git a/zebra/test_main.c b/zebra/test_main.c index 722151288b..2908ddd949 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -119,7 +119,7 @@ static ifindex_t test_ifindex = 0; /* testrib commands */ DEFUN (test_interface_state, test_interface_state_cmd, - "state (up|down)", + "state ", "configure interface\n" "up\n" "down\n") diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 88cc7977fa..6dcc7624e7 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -330,7 +330,7 @@ DEFUN (no_match_interface, DEFUN (match_tag, match_tag_cmd, - "match tag <1-65535>", + "match tag (1-65535)", MATCH_STR "Match tag of route\n" "Tag value\n") @@ -365,7 +365,7 @@ DEFUN (no_match_tag, DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, - "match ip next-hop (<1-199>|<1300-2699>|WORD)", + "match ip next-hop <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match next-hop address of route\n" @@ -451,7 +451,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, DEFUN (match_ip_address, match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", + "match ip address <(1-199)|(1300-2699)|WORD>", MATCH_STR IP_STR "Match address of route\n" @@ -623,7 +623,7 @@ DEFUN (no_match_ip_nexthop_prefix_len, DEFUN (match_source_protocol, match_source_protocol_cmd, - "match source-protocol (bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static)", + "match source-protocol ", MATCH_STR "Match protocol via which the route was learnt\n") { @@ -642,7 +642,7 @@ DEFUN (match_source_protocol, DEFUN (no_match_source_protocol, no_match_source_protocol_cmd, - "no match source-protocol (bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static)", + "no match source-protocol ", NO_STR MATCH_STR "No match protocol via which the route was learnt\n") @@ -668,7 +668,7 @@ DEFUN (no_match_source_protocol, DEFUN (set_src, set_src_cmd, - "set src (A.B.C.D|X:X::X:X)", + "set src ", SET_STR "src address for route\n" "src address\n") @@ -727,7 +727,7 @@ DEFUN (set_src, DEFUN (no_set_src, no_set_src_cmd, - "no set src {A.B.C.D|X:X::X:X}", + "no set src [A.B.C.D|X:X::X:X]", NO_STR SET_STR "Source address for route\n") @@ -740,7 +740,7 @@ DEFUN (no_set_src, DEFUN (zebra_route_map_timer, zebra_route_map_timer_cmd, - "zebra route-map delay-timer <0-600>", + "zebra route-map delay-timer (0-600)", "Time to wait before route-map updates are processed\n" "0 means event-driven updates are disabled\n") { diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index f4a663ab3a..d395c11a11 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -193,7 +193,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd, */ DEFUN (ip_mroute_dist, ip_mroute_dist_cmd, - "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", + "ip mroute A.B.C.D/M (1-255)", IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -218,7 +218,7 @@ DEFUN (ip_mroute_dist, */ DEFUN (no_ip_mroute_dist, no_ip_mroute_dist_cmd, - "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>", + "no ip mroute A.B.C.D/M (1-255)", IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -232,7 +232,7 @@ DEFUN (no_ip_mroute_dist, DEFUN (ip_multicast_mode, ip_multicast_mode_cmd, - "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", + "ip multicast rpf-lookup-mode ", IP_STR "Multicast options\n" "RPF lookup behavior\n" @@ -273,7 +273,7 @@ DEFUN (ip_multicast_mode, */ DEFUN (no_ip_multicast_mode, no_ip_multicast_mode_cmd, - "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)", + "no ip multicast rpf-lookup-mode ", NO_STR IP_STR "Multicast options\n" @@ -332,7 +332,7 @@ DEFUN (show_ip_rpf_addr, /* Static route configuration. */ DEFUN (ip_route, ip_route_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", + "ip route A.B.C.D/M ", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -346,7 +346,7 @@ DEFUN (ip_route, DEFUN (ip_route_tag, ip_route_tag_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>", + "ip route A.B.C.D/M tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -362,7 +362,7 @@ DEFUN (ip_route_tag, DEFUN (ip_route_flags, ip_route_flags_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", + "ip route A.B.C.D/M ", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -377,7 +377,7 @@ DEFUN (ip_route_flags, DEFUN (ip_route_flags_tag, ip_route_flags_tag_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", + "ip route A.B.C.D/M tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -395,7 +395,7 @@ DEFUN (ip_route_flags_tag, DEFUN (ip_route_flags2, ip_route_flags2_cmd, - "ip route A.B.C.D/M (reject|blackhole)", + "ip route A.B.C.D/M ", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -408,7 +408,7 @@ DEFUN (ip_route_flags2, DEFUN (ip_route_flags2_tag, ip_route_flags2_tag_cmd, - "ip route A.B.C.D/M (reject|blackhole) tag <1-65535>", + "ip route A.B.C.D/M tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -425,7 +425,7 @@ DEFUN (ip_route_flags2_tag, /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask, ip_route_mask_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)", + "ip route A.B.C.D A.B.C.D ", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -440,7 +440,7 @@ DEFUN (ip_route_mask, DEFUN (ip_route_mask_tag, ip_route_mask_tag_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>", + "ip route A.B.C.D A.B.C.D tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -458,7 +458,7 @@ DEFUN (ip_route_mask_tag, DEFUN (ip_route_mask_flags, ip_route_mask_flags_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", + "ip route A.B.C.D A.B.C.D ", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -474,7 +474,7 @@ DEFUN (ip_route_mask_flags, DEFUN (ip_route_mask_flags_tag, ip_route_mask_flags_tag_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", + "ip route A.B.C.D A.B.C.D tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -493,7 +493,7 @@ DEFUN (ip_route_mask_flags_tag, DEFUN (ip_route_mask_flags2, ip_route_mask_flags2_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole)", + "ip route A.B.C.D A.B.C.D ", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -507,7 +507,7 @@ DEFUN (ip_route_mask_flags2, DEFUN (ip_route_mask_flags2_tag, ip_route_mask_flags2_tag_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>", + "ip route A.B.C.D A.B.C.D tag (1-65535)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -524,7 +524,7 @@ DEFUN (ip_route_mask_flags2_tag, /* Distance option value. */ DEFUN (ip_route_distance, ip_route_distance_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>", + "ip route A.B.C.D/M (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -539,7 +539,7 @@ DEFUN (ip_route_distance, DEFUN (ip_route_tag_distance, ip_route_tag_distance_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", + "ip route A.B.C.D/M tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -557,7 +557,7 @@ DEFUN (ip_route_tag_distance, DEFUN (ip_route_flags_distance, ip_route_flags_distance_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", + "ip route A.B.C.D/M (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -573,7 +573,7 @@ DEFUN (ip_route_flags_distance, DEFUN (ip_route_flags_tag_distance, ip_route_flags_tag_distance_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "ip route A.B.C.D/M tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -591,7 +591,7 @@ DEFUN (ip_route_flags_tag_distance, DEFUN (ip_route_flags_distance2, ip_route_flags_distance2_cmd, - "ip route A.B.C.D/M (reject|blackhole) <1-255>", + "ip route A.B.C.D/M (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -605,7 +605,7 @@ DEFUN (ip_route_flags_distance2, DEFUN (ip_route_flags_tag_distance2, ip_route_flags_tag_distance2_cmd, - "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>", + "ip route A.B.C.D/M tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -621,7 +621,7 @@ DEFUN (ip_route_flags_tag_distance2, DEFUN (ip_route_mask_distance, ip_route_mask_distance_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", + "ip route A.B.C.D A.B.C.D (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -637,7 +637,7 @@ DEFUN (ip_route_mask_distance, DEFUN (ip_route_mask_tag_distance, ip_route_mask_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -655,7 +655,7 @@ DEFUN (ip_route_mask_tag_distance, DEFUN (ip_route_mask_flags_tag_distance, ip_route_mask_flags_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -675,7 +675,7 @@ DEFUN (ip_route_mask_flags_tag_distance, DEFUN (ip_route_mask_flags_distance, ip_route_mask_flags_distance_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", + "ip route A.B.C.D A.B.C.D (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -692,7 +692,7 @@ DEFUN (ip_route_mask_flags_distance, DEFUN (ip_route_mask_flags_distance2, ip_route_mask_flags_distance2_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", + "ip route A.B.C.D A.B.C.D (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -707,7 +707,7 @@ DEFUN (ip_route_mask_flags_distance2, DEFUN (ip_route_mask_flags_tag_distance2, ip_route_mask_flags_tag_distance2_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>", + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -737,7 +737,7 @@ DEFUN (ip_route_mask_flags_tag_distance2, */ DEFUN (no_ip_route, no_ip_route_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)", + "no ip route A.B.C.D/M ", NO_STR IP_STR "Establish static routes\n" @@ -767,7 +767,7 @@ DEFUN (no_ip_route, */ DEFUN (no_ip_route_tag, no_ip_route_tag_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>", + "no ip route A.B.C.D/M tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -786,7 +786,7 @@ DEFUN (no_ip_route_tag, DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, - "no ip route A.B.C.D/M (reject|blackhole)", + "no ip route A.B.C.D/M ", NO_STR IP_STR "Establish static routes\n" @@ -800,7 +800,7 @@ DEFUN (no_ip_route_flags2, DEFUN (no_ip_route_flags2_tag, no_ip_route_flags2_tag_cmd, - "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535>", + "no ip route A.B.C.D/M tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -830,7 +830,7 @@ DEFUN (no_ip_route_flags2_tag, */ DEFUN (no_ip_route_mask, no_ip_route_mask_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)", + "no ip route A.B.C.D A.B.C.D ", NO_STR IP_STR "Establish static routes\n" @@ -862,7 +862,7 @@ DEFUN (no_ip_route_mask, */ DEFUN (no_ip_route_mask_tag, no_ip_route_mask_tag_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>", + "no ip route A.B.C.D A.B.C.D tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -882,7 +882,7 @@ DEFUN (no_ip_route_mask_tag, DEFUN (no_ip_route_mask_flags2, no_ip_route_mask_flags2_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole)", + "no ip route A.B.C.D A.B.C.D ", NO_STR IP_STR "Establish static routes\n" @@ -897,7 +897,7 @@ DEFUN (no_ip_route_mask_flags2, DEFUN (no_ip_route_mask_flags2_tag, no_ip_route_mask_flags2_tag_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535>", + "no ip route A.B.C.D A.B.C.D tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -914,7 +914,7 @@ DEFUN (no_ip_route_mask_flags2_tag, DEFUN (no_ip_route_distance, no_ip_route_distance_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>", + "no ip route A.B.C.D/M (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -930,7 +930,7 @@ DEFUN (no_ip_route_distance, DEFUN (no_ip_route_tag_distance, no_ip_route_tag_distance_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", + "no ip route A.B.C.D/M tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -948,7 +948,7 @@ DEFUN (no_ip_route_tag_distance, DEFUN (no_ip_route_flags_distance, no_ip_route_flags_distance_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", + "no ip route A.B.C.D/M (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -965,7 +965,7 @@ DEFUN (no_ip_route_flags_distance, DEFUN (no_ip_route_flags_tag_distance, no_ip_route_flags_tag_distance_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "no ip route A.B.C.D/M tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -984,7 +984,7 @@ DEFUN (no_ip_route_flags_tag_distance, DEFUN (no_ip_route_flags_distance2, no_ip_route_flags_distance2_cmd, - "no ip route A.B.C.D/M (reject|blackhole) <1-255>", + "no ip route A.B.C.D/M (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -999,7 +999,7 @@ DEFUN (no_ip_route_flags_distance2, DEFUN (no_ip_route_flags_tag_distance2, no_ip_route_flags_tag_distance2_cmd, - "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>", + "no ip route A.B.C.D/M tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1016,7 +1016,7 @@ DEFUN (no_ip_route_flags_tag_distance2, DEFUN (no_ip_route_mask_distance, no_ip_route_mask_distance_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>", + "no ip route A.B.C.D A.B.C.D (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1033,7 +1033,7 @@ DEFUN (no_ip_route_mask_distance, DEFUN (no_ip_route_mask_tag_distance, no_ip_route_mask_tag_distance_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1052,7 +1052,7 @@ DEFUN (no_ip_route_mask_tag_distance, DEFUN (no_ip_route_mask_flags_distance, no_ip_route_mask_flags_distance_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>", + "no ip route A.B.C.D A.B.C.D (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1070,7 +1070,7 @@ DEFUN (no_ip_route_mask_flags_distance, DEFUN (no_ip_route_mask_flags_tag_distance, no_ip_route_mask_flags_tag_distance_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1090,7 +1090,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance, DEFUN (no_ip_route_mask_flags_distance2, no_ip_route_mask_flags_distance2_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>", + "no ip route A.B.C.D A.B.C.D (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1106,7 +1106,7 @@ DEFUN (no_ip_route_mask_flags_distance2, DEFUN (no_ip_route_mask_flags_tag_distance2, no_ip_route_mask_flags_tag_distance2_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255>", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -1125,7 +1125,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, /* Static route configuration. */ DEFUN (ip_route_vrf, ip_route_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, + "ip route A.B.C.D/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1139,7 +1139,7 @@ DEFUN (ip_route_vrf, DEFUN (ip_route_tag_vrf, ip_route_tag_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1155,7 +1155,7 @@ DEFUN (ip_route_tag_vrf, DEFUN (ip_route_flags_vrf, ip_route_flags_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "ip route A.B.C.D/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1170,7 +1170,7 @@ DEFUN (ip_route_flags_vrf, DEFUN (ip_route_flags_tag_vrf, ip_route_flags_tag_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1188,7 +1188,7 @@ DEFUN (ip_route_flags_tag_vrf, DEFUN (ip_route_flags2_vrf, ip_route_flags2_vrf_cmd, - "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, + "ip route A.B.C.D/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1201,7 +1201,7 @@ DEFUN (ip_route_flags2_vrf, DEFUN (ip_route_flags2_tag_vrf, ip_route_flags2_tag_vrf_cmd, - "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1218,7 +1218,7 @@ DEFUN (ip_route_flags2_tag_vrf, /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask_vrf, ip_route_mask_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1233,7 +1233,7 @@ DEFUN (ip_route_mask_vrf, DEFUN (ip_route_mask_tag_vrf, ip_route_mask_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1251,7 +1251,7 @@ DEFUN (ip_route_mask_tag_vrf, DEFUN (ip_route_mask_flags_vrf, ip_route_mask_flags_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1267,7 +1267,7 @@ DEFUN (ip_route_mask_flags_vrf, DEFUN (ip_route_mask_flags_tag_vrf, ip_route_mask_flags_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1286,7 +1286,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, DEFUN (ip_route_mask_flags2_vrf, ip_route_mask_flags2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1300,7 +1300,7 @@ DEFUN (ip_route_mask_flags2_vrf, DEFUN (ip_route_mask_flags2_tag_vrf, ip_route_mask_flags2_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1317,7 +1317,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, /* Distance option value. */ DEFUN (ip_route_distance_vrf, ip_route_distance_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1332,7 +1332,7 @@ DEFUN (ip_route_distance_vrf, DEFUN (ip_route_tag_distance_vrf, ip_route_tag_distance_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1350,7 +1350,7 @@ DEFUN (ip_route_tag_distance_vrf, DEFUN (ip_route_flags_distance_vrf, ip_route_flags_distance_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1366,7 +1366,7 @@ DEFUN (ip_route_flags_distance_vrf, DEFUN (ip_route_flags_tag_distance_vrf, ip_route_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1384,7 +1384,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, DEFUN (ip_route_flags_distance2_vrf, ip_route_flags_distance2_vrf_cmd, - "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1398,7 +1398,7 @@ DEFUN (ip_route_flags_distance2_vrf, DEFUN (ip_route_flags_tag_distance2_vrf, ip_route_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1414,7 +1414,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, DEFUN (ip_route_mask_distance_vrf, ip_route_mask_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1430,7 +1430,7 @@ DEFUN (ip_route_mask_distance_vrf, DEFUN (ip_route_mask_tag_distance_vrf, ip_route_mask_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, DEFUN (ip_route_mask_flags_tag_distance_vrf, ip_route_mask_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1462,13 +1462,13 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (ip_route_mask_flags_distance_vrf, ip_route_mask_flags_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1485,7 +1485,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, DEFUN (ip_route_mask_flags_distance2_vrf, ip_route_mask_flags_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1500,7 +1500,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, DEFUN (ip_route_mask_flags_tag_distance2_vrf, ip_route_mask_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1517,7 +1517,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, DEFUN (no_ip_route_vrf, no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1532,7 +1532,7 @@ DEFUN (no_ip_route_vrf, DEFUN (no_ip_route_flags_vrf, no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1548,7 +1548,7 @@ DEFUN (no_ip_route_flags_vrf, DEFUN (no_ip_route_tag_vrf, no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1565,7 +1565,7 @@ DEFUN (no_ip_route_tag_vrf, DEFUN (no_ip_route_flags_tag_vrf, no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1583,7 +1583,7 @@ DEFUN (no_ip_route_flags_tag_vrf, DEFUN (no_ip_route_flags2_vrf, no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR, + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1597,7 +1597,7 @@ DEFUN (no_ip_route_flags2_vrf, DEFUN (no_ip_route_flags2_tag_vrf, no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1613,7 +1613,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, DEFUN (no_ip_route_mask_vrf, no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1629,7 +1629,7 @@ DEFUN (no_ip_route_mask_vrf, DEFUN (no_ip_route_mask_flags_vrf, no_ip_route_mask_flags_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1646,7 +1646,7 @@ DEFUN (no_ip_route_mask_flags_vrf, DEFUN (no_ip_route_mask_tag_vrf, no_ip_route_mask_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1664,7 +1664,7 @@ DEFUN (no_ip_route_mask_tag_vrf, DEFUN (no_ip_route_mask_flags_tag_vrf, no_ip_route_mask_flags_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1683,7 +1683,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, DEFUN (no_ip_route_mask_flags2_vrf, no_ip_route_mask_flags2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1698,7 +1698,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, DEFUN (no_ip_route_mask_flags2_tag_vrf, no_ip_route_mask_flags2_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1716,7 +1716,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, DEFUN (no_ip_route_distance_vrf, no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1732,7 +1732,7 @@ DEFUN (no_ip_route_distance_vrf, DEFUN (no_ip_route_tag_distance_vrf, no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1750,7 +1750,7 @@ DEFUN (no_ip_route_tag_distance_vrf, DEFUN (no_ip_route_flags_distance_vrf, no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1767,7 +1767,7 @@ DEFUN (no_ip_route_flags_distance_vrf, DEFUN (no_ip_route_flags_tag_distance_vrf, no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1786,7 +1786,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, DEFUN (no_ip_route_flags_distance2_vrf, no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1801,7 +1801,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, DEFUN (no_ip_route_flags_tag_distance2_vrf, no_ip_route_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1818,7 +1818,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, DEFUN (no_ip_route_mask_distance_vrf, no_ip_route_mask_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1835,7 +1835,7 @@ DEFUN (no_ip_route_mask_distance_vrf, DEFUN (no_ip_route_mask_tag_distance_vrf, no_ip_route_mask_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1854,7 +1854,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance_vrf, no_ip_route_mask_flags_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1872,7 +1872,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, DEFUN (no_ip_route_mask_flags_tag_distance_vrf, no_ip_route_mask_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1892,7 +1892,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance2_vrf, no_ip_route_mask_flags_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1908,7 +1908,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, no_ip_route_mask_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2619,7 +2619,7 @@ DEFUN (no_ipv6_nht_default_route, */ DEFUN (show_ip_route_tag, show_ip_route_tag_cmd, - "show ip route tag <1-65535>", + "show ip route tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -2840,7 +2840,7 @@ DEFUN (show_ip_route_protocol, DEFUN (show_ip_route_ospf_instance, show_ip_route_ospf_instance_cmd, - "show ip route ospf <1-65535>", + "show ip route ospf (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -3256,7 +3256,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route " VRF_ALL_CMD_STR " tag <1-65535>", + "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -3782,7 +3782,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, DEFUN (ipv6_route, ipv6_route_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", + "ipv6 route X:X::X:X/M ", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3794,7 +3794,7 @@ DEFUN (ipv6_route, DEFUN (ipv6_route_tag, ipv6_route_tag_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>", + "ipv6 route X:X::X:X/M tag (1-65535)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3808,7 +3808,7 @@ DEFUN (ipv6_route_tag, DEFUN (ipv6_route_flags, ipv6_route_flags_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", + "ipv6 route X:X::X:X/M ", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3822,7 +3822,7 @@ DEFUN (ipv6_route_flags, DEFUN (ipv6_route_flags_tag, ipv6_route_flags_tag_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>", + "ipv6 route X:X::X:X/M tag (1-65535)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3849,7 +3849,7 @@ DEFUN (ipv6_route_ifname, } DEFUN (ipv6_route_ifname_tag, ipv6_route_ifname_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3863,7 +3863,7 @@ DEFUN (ipv6_route_ifname_tag, DEFUN (ipv6_route_ifname_flags, ipv6_route_ifname_flags_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE ", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3877,7 +3877,7 @@ DEFUN (ipv6_route_ifname_flags, DEFUN (ipv6_route_ifname_flags_tag, ipv6_route_ifname_flags_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3893,7 +3893,7 @@ DEFUN (ipv6_route_ifname_flags_tag, DEFUN (ipv6_route_pref, ipv6_route_pref_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", + "ipv6 route X:X::X:X/M (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3906,7 +3906,7 @@ DEFUN (ipv6_route_pref, DEFUN (ipv6_route_pref_tag, ipv6_route_pref_tag_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3921,7 +3921,7 @@ DEFUN (ipv6_route_pref_tag, DEFUN (ipv6_route_flags_pref, ipv6_route_flags_pref_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", + "ipv6 route X:X::X:X/M (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3936,7 +3936,7 @@ DEFUN (ipv6_route_flags_pref, DEFUN (ipv6_route_flags_pref_tag, ipv6_route_flags_pref_tag_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3953,7 +3953,7 @@ DEFUN (ipv6_route_flags_pref_tag, DEFUN (ipv6_route_ifname_pref, ipv6_route_ifname_pref_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3966,7 +3966,7 @@ DEFUN (ipv6_route_ifname_pref, DEFUN (ipv6_route_ifname_pref_tag, ipv6_route_ifname_pref_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3981,7 +3981,7 @@ DEFUN (ipv6_route_ifname_pref_tag, DEFUN (ipv6_route_ifname_flags_pref, ipv6_route_ifname_flags_pref_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -3996,7 +3996,7 @@ DEFUN (ipv6_route_ifname_flags_pref, DEFUN (ipv6_route_ifname_flags_pref_tag, ipv6_route_ifname_flags_pref_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4013,7 +4013,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag, DEFUN (no_ipv6_route, no_ipv6_route_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)", + "no ipv6 route X:X::X:X/M ", NO_STR IP_STR "Establish static routes\n" @@ -4026,7 +4026,7 @@ DEFUN (no_ipv6_route, DEFUN (no_ipv6_route_tag, no_ipv6_route_tag_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>", + "no ipv6 route X:X::X:X/M tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -4041,7 +4041,7 @@ DEFUN (no_ipv6_route_tag, DEFUN (no_ipv6_route_flags, no_ipv6_route_flags_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)", + "no ipv6 route X:X::X:X/M ", NO_STR IP_STR "Establish static routes\n" @@ -4056,7 +4056,7 @@ DEFUN (no_ipv6_route_flags, DEFUN (no_ipv6_route_flags_tag, no_ipv6_route_flags_tag_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535>", + "no ipv6 route X:X::X:X/M tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -4086,7 +4086,7 @@ DEFUN (no_ipv6_route_ifname, DEFUN (no_ipv6_route_ifname_tag, no_ipv6_route_ifname_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -4101,7 +4101,7 @@ DEFUN (no_ipv6_route_ifname_tag, DEFUN (no_ipv6_route_ifname_flags, no_ipv6_route_ifname_flags_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE ", NO_STR IP_STR "Establish static routes\n" @@ -4116,7 +4116,7 @@ DEFUN (no_ipv6_route_ifname_flags, DEFUN (no_ipv6_route_ifname_flags_tag, no_ipv6_route_ifname_flags_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", NO_STR IP_STR "Establish static routes\n" @@ -4133,7 +4133,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag, DEFUN (no_ipv6_route_pref, no_ipv6_route_pref_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>", + "no ipv6 route X:X::X:X/M (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4147,7 +4147,7 @@ DEFUN (no_ipv6_route_pref, DEFUN (no_ipv6_route_pref_tag, no_ipv6_route_pref_tag_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4163,7 +4163,7 @@ DEFUN (no_ipv6_route_pref_tag, DEFUN (no_ipv6_route_flags_pref, no_ipv6_route_flags_pref_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>", + "no ipv6 route X:X::X:X/M (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4180,7 +4180,7 @@ DEFUN (no_ipv6_route_flags_pref, DEFUN (no_ipv6_route_flags_pref_tag, no_ipv6_route_flags_pref_tag_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255>", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4199,7 +4199,7 @@ DEFUN (no_ipv6_route_flags_pref_tag, DEFUN (no_ipv6_route_ifname_pref, no_ipv6_route_ifname_pref_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4213,7 +4213,7 @@ DEFUN (no_ipv6_route_ifname_pref, DEFUN (no_ipv6_route_ifname_pref_tag, no_ipv6_route_ifname_pref_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4229,7 +4229,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag, DEFUN (no_ipv6_route_ifname_flags_pref, no_ipv6_route_ifname_flags_pref_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4245,7 +4245,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref, DEFUN (no_ipv6_route_ifname_flags_pref_tag, no_ipv6_route_ifname_flags_pref_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255>", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", NO_STR IP_STR "Establish static routes\n" @@ -4263,7 +4263,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, DEFUN (ipv6_route_vrf, ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4276,7 +4276,7 @@ DEFUN (ipv6_route_vrf, DEFUN (ipv6_route_tag_vrf, ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4291,7 +4291,7 @@ DEFUN (ipv6_route_tag_vrf, DEFUN (ipv6_route_flags_vrf, ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4306,7 +4306,7 @@ DEFUN (ipv6_route_flags_vrf, DEFUN (ipv6_route_flags_tag_vrf, ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4335,7 +4335,7 @@ DEFUN (ipv6_route_ifname_vrf, } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4350,7 +4350,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, DEFUN (ipv6_route_ifname_flags_vrf, ipv6_route_ifname_flags_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4365,7 +4365,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, DEFUN (ipv6_route_ifname_flags_tag_vrf, ipv6_route_ifname_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4382,7 +4382,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, DEFUN (ipv6_route_pref_vrf, ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4396,7 +4396,7 @@ DEFUN (ipv6_route_pref_vrf, DEFUN (ipv6_route_pref_tag_vrf, ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4412,7 +4412,7 @@ DEFUN (ipv6_route_pref_tag_vrf, DEFUN (ipv6_route_flags_pref_vrf, ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4428,7 +4428,7 @@ DEFUN (ipv6_route_flags_pref_vrf, DEFUN (ipv6_route_flags_pref_tag_vrf, ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4446,7 +4446,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, DEFUN (ipv6_route_ifname_pref_vrf, ipv6_route_ifname_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4460,7 +4460,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, DEFUN (ipv6_route_ifname_pref_tag_vrf, ipv6_route_ifname_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4476,7 +4476,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, DEFUN (ipv6_route_ifname_flags_pref_vrf, ipv6_route_ifname_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4492,7 +4492,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4510,7 +4510,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4524,7 +4524,7 @@ DEFUN (no_ipv6_route_vrf, DEFUN (no_ipv6_route_tag_vrf, no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4540,7 +4540,7 @@ DEFUN (no_ipv6_route_tag_vrf, DEFUN (no_ipv6_route_flags_vrf, no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4556,7 +4556,7 @@ DEFUN (no_ipv6_route_flags_vrf, DEFUN (no_ipv6_route_flags_tag_vrf, no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4588,7 +4588,7 @@ DEFUN (no_ipv6_route_ifname_vrf, DEFUN (no_ipv6_route_ifname_tag_vrf, no_ipv6_route_ifname_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4604,7 +4604,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_vrf, no_ipv6_route_ifname_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4620,7 +4620,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, DEFUN (no_ipv6_route_ifname_flags_tag_vrf, no_ipv6_route_ifname_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4638,7 +4638,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, DEFUN (no_ipv6_route_pref_vrf, no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4653,7 +4653,7 @@ DEFUN (no_ipv6_route_pref_vrf, DEFUN (no_ipv6_route_pref_tag_vrf, no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4670,7 +4670,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, DEFUN (no_ipv6_route_flags_pref_vrf, no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4688,7 +4688,7 @@ DEFUN (no_ipv6_route_flags_pref_vrf, DEFUN (no_ipv6_route_flags_pref_tag_vrf, no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4708,7 +4708,7 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_pref_vrf, no_ipv6_route_ifname_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4723,7 +4723,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, DEFUN (no_ipv6_route_ifname_pref_tag_vrf, no_ipv6_route_ifname_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4740,7 +4740,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_vrf, no_ipv6_route_ifname_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4757,7 +4757,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, no_ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-65535> <1-255> " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -4891,7 +4891,7 @@ DEFUN (show_ipv6_route, */ DEFUN (show_ipv6_route_tag, show_ipv6_route_tag_cmd, - "show ipv6 route tag <1-65535>", + "show ipv6 route tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5338,7 +5338,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " tag <1-65535>", + "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5800,7 +5800,7 @@ zebra_ip_config (struct vty *vty) */ DEFUN (ip_zebra_import_table_distance, ip_zebra_import_table_distance_cmd, - "ip import-table <1-252> distance <1-255>", + "ip import-table (1-252) distance (1-255)", IP_STR "import routes from non-main kernel table\n" "kernel routing table id\n" @@ -5846,7 +5846,7 @@ DEFUN (ip_zebra_import_table_distance, */ DEFUN (ip_zebra_import_table_distance_routemap, ip_zebra_import_table_distance_routemap_cmd, - "ip import-table <1-252> distance <1-255> route-map WORD", + "ip import-table (1-252) distance (1-255) route-map WORD", IP_STR "import routes from non-main kernel table\n" "kernel routing table id\n" @@ -5899,7 +5899,7 @@ DEFUN (ip_zebra_import_table_distance_routemap, */ DEFUN (no_ip_zebra_import_table, no_ip_zebra_import_table_cmd, - "no ip import-table <1-252> {route-map NAME}", + "no ip import-table (1-252) [route-map NAME]", NO_STR IP_STR "import routes from non-main kernel table\n" diff --git a/zebra/zserv.c b/zebra/zserv.c index 3402bf1dfb..fc7b41954d 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2257,7 +2257,7 @@ DEFUN (show_table, return CMD_SUCCESS; } -DEFUN (config_table, +DEFUN (config_table, config_table_cmd, "table TABLENO", "Configure target kernel routing table\n" From 833e546811842c36cd17b182a474df82b2870633 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 14:02:28 +0000 Subject: [PATCH 119/280] bgpd: fix hosed CMD_RANGE_STR Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 3d2ddacbbb..1c015eb66f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1495,7 +1495,7 @@ DEFUN (no_bgp_coalesce_time, /* Maximum-paths configuration */ DEFUN (bgp_maxpaths, bgp_maxpaths_cmd, - "maximum-paths " CMD_RANGE_STR<1, MULTIPATH_NUM>, + "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), "Forward packets over multiple paths\n" "Number of paths\n") { @@ -1504,7 +1504,7 @@ DEFUN (bgp_maxpaths, DEFUN (bgp_maxpaths_ibgp, bgp_maxpaths_ibgp_cmd, - "maximum-paths ibgp " CMD_RANGE_STR<1, MULTIPATH_NUM>, + "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n") @@ -1514,7 +1514,7 @@ DEFUN (bgp_maxpaths_ibgp, DEFUN (bgp_maxpaths_ibgp_cluster, bgp_maxpaths_ibgp_cluster_cmd, - "maximum-paths ibgp " CMD_RANGE_STR<1, MULTIPATH_NUM> " equal-cluster-length", + "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n" @@ -4598,7 +4598,7 @@ DEFUN (neighbor_ebgp_multihop, DEFUN (neighbor_ebgp_multihop_ttl, neighbor_ebgp_multihop_ttl_cmd, - NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR<1, MAXTTL>, + NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n" From 0c515adf432ee0d02d38edc34de7666faaf323ba Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 14:02:55 +0000 Subject: [PATCH 120/280] zebra: compress multiple whitespaces in command string Signed-off-by: Daniel Walton --- tools/argv_translator.py | 8 ++++++++ zebra/zebra_vty.c | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 1c8f0c7e56..4ee0831ed9 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -267,6 +267,11 @@ DEFUN (no_bgp_maxmed_onstartup, line = line.replace('}', ']') re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) + # A one off to handle "CMD_RANGE_STR(1, MULTIPATH_NUM)" + if 'CMD_RANGE_STR<' in line: + line = line.replace('CMD_RANGE_STR<', 'CMD_RANGE_STR(') + line = line.replace('>', ')') + while re_range: line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3)) re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) @@ -274,6 +279,9 @@ DEFUN (no_bgp_maxmed_onstartup, if not line.endswith('\n'): line += '\n' + # compress duplicate whitespaces + re_space = re.search('^(\s*).*(\s*)$', line) + line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) return line def dump(self): diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index d395c11a11..3188799f26 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -655,7 +655,7 @@ DEFUN (ip_route_mask_tag_distance, DEFUN (ip_route_mask_flags_tag_distance, ip_route_mask_flags_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, DEFUN (ip_route_mask_flags_tag_distance_vrf, ip_route_mask_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -2436,7 +2436,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route " VRF_CMD_STR " [json]", + "show ip route " VRF_CMD_STR " [json]", SHOW_STR IP_STR "IP routing table\n" @@ -3420,7 +3420,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -3475,7 +3475,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D", SHOW_STR IP_STR "IP routing table\n" From 0a3e73dd2723912e14a22b077718e602cbad27c8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 17:22:42 +0000 Subject: [PATCH 121/280] zebra: fix vrf argv index numbers Signed-off-by: Daniel Walton --- zebra/zebra_vty.c | 170 +++++++++++++++++++++++----------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 3188799f26..505da4923c 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -668,8 +668,8 @@ DEFUN (ip_route_mask_flags_tag_distance, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[8]->arg, - argv[9]->arg, NULL); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, + argv[8]->arg, NULL); } @@ -1134,7 +1134,7 @@ DEFUN (ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, NULL, argv[6]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, NULL, argv[5]->arg); } DEFUN (ip_route_tag_vrf, @@ -1150,7 +1150,7 @@ DEFUN (ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, NULL, argv[7]->arg); } DEFUN (ip_route_flags_vrf, @@ -1165,7 +1165,7 @@ DEFUN (ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg); } DEFUN (ip_route_flags_tag_vrf, @@ -1183,7 +1183,7 @@ DEFUN (ip_route_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ip_route_flags2_vrf, @@ -1196,7 +1196,7 @@ DEFUN (ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, NULL, argv[6]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, NULL, argv[5]->arg); } DEFUN (ip_route_flags2_tag_vrf, @@ -1212,7 +1212,7 @@ DEFUN (ip_route_flags2_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, NULL, argv[7]->arg); } /* Mask as A.B.C.D format. */ @@ -1228,7 +1228,7 @@ DEFUN (ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); } DEFUN (ip_route_mask_tag_vrf, @@ -1246,7 +1246,7 @@ DEFUN (ip_route_mask_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ip_route_mask_flags_vrf, @@ -1262,7 +1262,7 @@ DEFUN (ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); } DEFUN (ip_route_mask_flags_tag_vrf, @@ -1281,7 +1281,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (ip_route_mask_flags2_vrf, @@ -1295,7 +1295,7 @@ DEFUN (ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); } DEFUN (ip_route_mask_flags2_tag_vrf, @@ -1311,7 +1311,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); } /* Distance option value. */ @@ -1327,7 +1327,7 @@ DEFUN (ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg); } DEFUN (ip_route_tag_distance_vrf, @@ -1345,7 +1345,7 @@ DEFUN (ip_route_tag_distance_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (ip_route_flags_distance_vrf, @@ -1361,7 +1361,7 @@ DEFUN (ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (ip_route_flags_tag_distance_vrf, @@ -1379,7 +1379,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[7]->arg,argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (ip_route_flags_distance2_vrf, @@ -1393,7 +1393,7 @@ DEFUN (ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, argv[4]->arg, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg); } DEFUN (ip_route_flags_tag_distance2_vrf, @@ -1409,7 +1409,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (ip_route_mask_distance_vrf, @@ -1425,7 +1425,7 @@ DEFUN (ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (ip_route_mask_tag_distance_vrf, @@ -1443,7 +1443,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (ip_route_mask_flags_tag_distance_vrf, @@ -1480,7 +1480,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (ip_route_mask_flags_distance2_vrf, @@ -1495,7 +1495,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (ip_route_mask_flags_tag_distance2_vrf, @@ -1512,7 +1512,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (no_ip_route_vrf, @@ -1527,7 +1527,7 @@ DEFUN (no_ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); } DEFUN (no_ip_route_flags_vrf, @@ -1543,7 +1543,7 @@ DEFUN (no_ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); } DEFUN (no_ip_route_tag_vrf, @@ -1560,7 +1560,7 @@ DEFUN (no_ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (no_ip_route_flags_tag_vrf, @@ -1578,7 +1578,7 @@ DEFUN (no_ip_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ip_route_flags2_vrf, @@ -1592,7 +1592,7 @@ DEFUN (no_ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); } DEFUN (no_ip_route_flags2_tag_vrf, @@ -1608,7 +1608,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (no_ip_route_mask_vrf, @@ -1624,7 +1624,7 @@ DEFUN (no_ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[7]->arg); } DEFUN (no_ip_route_mask_flags_vrf, @@ -1641,7 +1641,7 @@ DEFUN (no_ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[8]->arg); } DEFUN (no_ip_route_mask_tag_vrf, @@ -1659,7 +1659,7 @@ DEFUN (no_ip_route_mask_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ip_route_mask_flags_tag_vrf, @@ -1678,7 +1678,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[11]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[10]->arg); } DEFUN (no_ip_route_mask_flags2_vrf, @@ -1693,7 +1693,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[7]->arg); } DEFUN (no_ip_route_mask_flags2_tag_vrf, @@ -1710,7 +1710,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); } @@ -1727,7 +1727,7 @@ DEFUN (no_ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (no_ip_route_tag_distance_vrf, @@ -1745,7 +1745,7 @@ DEFUN (no_ip_route_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (no_ip_route_flags_distance_vrf, @@ -1762,7 +1762,7 @@ DEFUN (no_ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (no_ip_route_flags_tag_distance_vrf, @@ -1781,7 +1781,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg,argv[11]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg,argv[10]->arg); } DEFUN (no_ip_route_flags_distance2_vrf, @@ -1796,7 +1796,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (no_ip_route_flags_tag_distance2_vrf, @@ -1813,7 +1813,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg , argv[7]->arg, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg , argv[7]->arg, argv[9]->arg); } DEFUN (no_ip_route_mask_distance_vrf, @@ -1830,7 +1830,7 @@ DEFUN (no_ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (no_ip_route_mask_tag_distance_vrf, @@ -1849,7 +1849,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[11]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (no_ip_route_mask_flags_distance_vrf, @@ -1867,7 +1867,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[10]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[9]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance_vrf, @@ -1887,7 +1887,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[11]->arg); } DEFUN (no_ip_route_mask_flags_distance2_vrf, @@ -1903,7 +1903,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, @@ -1921,7 +1921,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); } /* New RIB. Detailed information for IPv4 route. */ @@ -3436,7 +3436,7 @@ DEFUN (show_ip_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP, argv[7]->arg); + type = proto_redistnum (AFI_IP, argv[6]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); @@ -3489,7 +3489,7 @@ DEFUN (show_ip_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[6]->arg, &p); + ret = str2prefix_ipv4 (argv[5]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -4271,7 +4271,7 @@ DEFUN (ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, argv[6]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, argv[5]->arg); } DEFUN (ipv6_route_tag_vrf, @@ -4286,7 +4286,7 @@ DEFUN (ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, argv[8]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, argv[7]->arg); } DEFUN (ipv6_route_flags_vrf, @@ -4301,7 +4301,7 @@ DEFUN (ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[7]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); } DEFUN (ipv6_route_flags_tag_vrf, @@ -4318,7 +4318,7 @@ DEFUN (ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[9]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ipv6_route_ifname_vrf, @@ -4331,7 +4331,7 @@ DEFUN (ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[7]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, @@ -4345,7 +4345,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[9]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (ipv6_route_ifname_flags_vrf, @@ -4360,7 +4360,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[8]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); } DEFUN (ipv6_route_ifname_flags_tag_vrf, @@ -4377,7 +4377,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (ipv6_route_pref_vrf, @@ -4391,7 +4391,7 @@ DEFUN (ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, argv[7]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, argv[6]->arg); } DEFUN (ipv6_route_pref_tag_vrf, @@ -4407,7 +4407,7 @@ DEFUN (ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, argv[9]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, argv[8]->arg); } DEFUN (ipv6_route_flags_pref_vrf, @@ -4423,7 +4423,7 @@ DEFUN (ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[8]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (ipv6_route_flags_pref_tag_vrf, @@ -4441,7 +4441,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (ipv6_route_ifname_pref_vrf, @@ -4455,7 +4455,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[8]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (ipv6_route_ifname_pref_tag_vrf, @@ -4471,7 +4471,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (ipv6_route_ifname_flags_pref_vrf, @@ -4487,7 +4487,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, @@ -4505,7 +4505,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); + return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (no_ipv6_route_vrf, @@ -4519,7 +4519,7 @@ DEFUN (no_ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, argv[7]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, argv[6]->arg); } DEFUN (no_ipv6_route_tag_vrf, @@ -4535,7 +4535,7 @@ DEFUN (no_ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, argv[9]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, argv[8]->arg); } DEFUN (no_ipv6_route_flags_vrf, @@ -4551,7 +4551,7 @@ DEFUN (no_ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[8]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[7]->arg); } DEFUN (no_ipv6_route_flags_tag_vrf, @@ -4569,7 +4569,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[10]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ipv6_route_ifname_vrf, @@ -4583,7 +4583,7 @@ DEFUN (no_ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[8]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[7]->arg); } DEFUN (no_ipv6_route_ifname_tag_vrf, @@ -4599,7 +4599,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[10]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[9]->arg); } DEFUN (no_ipv6_route_ifname_flags_vrf, @@ -4615,7 +4615,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[9]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[8]->arg); } DEFUN (no_ipv6_route_ifname_flags_tag_vrf, @@ -4633,7 +4633,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[11]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[10]->arg); } DEFUN (no_ipv6_route_pref_vrf, @@ -4648,7 +4648,7 @@ DEFUN (no_ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, argv[8]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, argv[7]->arg); } DEFUN (no_ipv6_route_pref_tag_vrf, @@ -4665,7 +4665,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, argv[10]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); } DEFUN (no_ipv6_route_flags_pref_vrf, @@ -4683,7 +4683,7 @@ DEFUN (no_ipv6_route_flags_pref_vrf, VRF_CMD_HELP_STR) { /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[9]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (no_ipv6_route_flags_pref_tag_vrf, @@ -4703,7 +4703,7 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, VRF_CMD_HELP_STR) { /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[11]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (no_ipv6_route_ifname_pref_vrf, @@ -4718,7 +4718,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[9]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[8]->arg); } DEFUN (no_ipv6_route_ifname_pref_tag_vrf, @@ -4735,7 +4735,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[11]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[10]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_vrf, @@ -4752,7 +4752,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[10]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[9]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, @@ -4771,7 +4771,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[12]->arg); + return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[11]->arg); } /* @@ -5025,7 +5025,7 @@ DEFUN (show_ipv6_route_protocol, if ( argc >1 ) { VRF_GET_ID (vrf_id, argv[4]->arg); - type = proto_redistnum (AFI_IP6, argv[1]); + type = proto_redistnum (AFI_IP6, argv[3]->arg); } else type = proto_redistnum (AFI_IP6, argv[4]->arg); @@ -5465,7 +5465,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[6]->arg); + type = proto_redistnum (AFI_IP6, argv[4]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); From 7c022376c83e8eb72ee02ff22916e925ef68430c Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 19:26:31 +0000 Subject: [PATCH 122/280] zebra: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- tools/argv_translator.py | 365 +++++++++--- zebra/debug.c | 27 +- zebra/interface.c | 78 ++- zebra/irdp_interface.c | 25 +- zebra/router-id.c | 3 +- zebra/rtadv.c | 43 +- zebra/test_main.c | 3 +- zebra/zebra_routemap.c | 77 ++- zebra/zebra_vty.c | 1182 ++++++++++++++++++++++++++++++-------- 9 files changed, 1395 insertions(+), 408 deletions(-) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 4ee0831ed9..eff05a4125 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -4,6 +4,7 @@ import re import sys import os import subprocess +from collections import OrderedDict from copy import deepcopy from pprint import pformat, pprint @@ -156,7 +157,7 @@ def get_argv_translator(line_number, line): return table ''' -def get_argv_variable_indexes(line_number, line): +def get_command_string_variable_indexes(line_number, line): indexes = {} line = line.strip() @@ -177,6 +178,230 @@ def get_argv_variable_indexes(line_number, line): return (max_index, indexes) +def get_token_index_variable_name(line_number, token): + + re_range = re.search('\(\d+-\d+\)', token) + + if token.startswith('['): + assert token.endswith(']'), "Token %s should end with ]" % token + token = token[1:-1] + + if token.startswith('<'): + assert token.endswith('>'), "Token %s should end with >" % token + token = token[1:-1] + + if token == 'A.B.C.D': + return 'idx_ipv4' + + elif token == 'A.B.C.D/M': + return 'idx_ipv4_prefixlen' + + elif token == 'X:X::X:X': + return 'idx_ipv6' + + elif token == 'X:X::X:X/M': + return 'idx_ipv6_prefixlen' + + elif token == 'ASN:nn_or_IP-address:nn': + return 'idx_ext_community' + + elif token == '.AA:NN': + return 'idx_community' + + elif token == 'WORD': + return 'idx_word' + + elif token == 'json': + return 'idx_json' + + elif token == '.LINE': + return 'idx_regex' + + elif token == 'A.B.C.D|INTERFACE': + return 'idx_ipv4_ifname' + + elif token == 'A.B.C.D|INTERFACE|null0': + return 'idx_ipv4_ifname_null' + + elif token == 'X:X::X:X|INTERFACE': + return 'idx_ipv6_ifname' + + elif token == 'reject|blackhole': + return 'idx_reject_blackhole' + + elif token == 'route-map NAME': + return 'idx_route_map' + + elif token == 'recv|send|detail': + return 'idx_recv_send' + + elif token == 'recv|send': + return 'idx_recv_send' + + elif token == 'up|down': + return 'idx_up_down' + + elif token == 'off-link': + return 'idx_off_link' + + elif token == 'no-autoconfig': + return 'idx_no_autoconfig' + + elif token == 'router-address': + return 'idx_router_address' + + elif token == 'high|medium|low': + return 'idx_high_medium_low' + + elif token == '(0-4294967295)|infinite': + return 'idx_number_infinite' + + elif token == '(1-199)|(1300-2699)|WORD': + return 'idx_acl' + + elif token == 'A.B.C.D|X:X::X:X': + return 'idx_ip' + + elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': + return 'idx_rpf_lookup_mode' + + elif token in ('kernel|connected|static|rip|ospf|isis|pim|table', + 'kernel|connected|static|ripng|ospf6|isis|table', + 'kernel|connected|static|rip|isis|bgp|pim|table', + 'kernel|connected|static|rip|ospf|isis|bgp|pim|table', + 'kernel|connected|static|rip|ospf|isis|bgp|pim|table', + 'kernel|connected|static|rip|ospf|isis|bgp|pim|table|any', + 'kernel|connected|static|ripng|ospf6|isis|bgp|table|any', + 'kernel|connected|static|ripng|ospf6|isis|bgp|table', + 'kernel|connected|static|ospf6|isis|bgp|table', + 'kernel|connected|static|ospf|isis|bgp|pim|table', + 'kernel|connected|static|ripng|isis|bgp|table', + # '', + 'bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static', + 'kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table'): + return 'idx_protocol' + + elif '|' in token: + raise Exception("%d: what variable name for %s" % (line_number, token)) + + elif re_range: + return 'idx_number' + + elif token.upper() == token: + return 'idx_%s' % token.lower() + + else: + raise Exception("%d: what variable name for %s" % (line_number, token)) + + +def get_command_string_index_variable_table(line_number, line): + """ + Return a table that maps an index position to a variable name such as 'idx_ipv4' + """ + indexes = OrderedDict() + + line = line.strip() + assert line.startswith('"'), "line does not start with \"\n%s" % (line) + assert line.endswith('",'), "line does not end with \",\n%s" % (line) + line = line[1:-2] + max_index = 0 + + for (token_index, token) in enumerate(line_to_tokens(line_number, line)): + if not token: + raise Exception("%d: empty token" % line_number) + + if token_is_variable(line_number, token): + # print "%s is a token" % token + idx_variable_name = get_token_index_variable_name(line_number, token) + count = 0 + for tmp in indexes.itervalues(): + if tmp == idx_variable_name: + count += 1 + elif re.search('^%s_\d+' % idx_variable_name, tmp): + count += 1 + if count: + idx_variable_name = "%s_%d" % (idx_variable_name, count + 1) + indexes[token_index] = idx_variable_name + + return indexes + +def expand_command_string(line): + + # in the middle + line = line.replace('" CMD_AS_RANGE "', '(1-4294967295)') + line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '(1-5000)') + line = line.replace('" BGP_INSTANCE_CMD "', ' WORD') + line = line.replace('" BGP_INSTANCE_ALL_CMD "', ' all') + line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '(1-255)') + line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '') + line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '') + line = line.replace('" VRF_CMD_STR "', 'vrf NAME') + line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all') + line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '') + line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '') + line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '') + line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '') + line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '') + line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '') + line = line.replace('" LOG_FACILITIES "', '') + + # endswith + line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",') + line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' (1-5000)",') + line = line.replace('" BGP_INSTANCE_CMD,', ' WORD",') + line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' all",') + line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '(1-255)",') + line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '(1-255)",') + line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '(2-255) (50-60000) (50-60000)",') + line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', + ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') + line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' ",') + line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' [A.B.C.D|X:X::X:X|WORD]",') + line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' ",') + line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' ",') + line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' ",') + line = line.replace('" VRF_CMD_STR,', ' vrf NAME",') + line = line.replace('" VRF_ALL_CMD_STR,', ' vrf all",') + line = line.replace('" QUAGGA_IP_REDIST_STR_ZEBRA,', ' ",') + line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' ",') + line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' ",') + line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' ",') + line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' ",') + line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' ",') + line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') + line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' ",') + line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' ",') + line = line.replace('" LOG_FACILITIES,', ' ",') + + # startswith + line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range ') + line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor ') + line = line.replace('NEIGHBOR_CMD2 "', '"neighbor ') + line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor ') + line = line.replace('NEIGHBOR_CMD "', '"neighbor ') + line = line.replace('PIM_CMD_NO "', '"no ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') + + # solo + line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor ",') + line = line.replace('NEIGHBOR_CMD2,', '"neighbor ",') + line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor ",') + line = line.replace('NEIGHBOR_CMD,', '"neighbor ",') + line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",') + + if line.rstrip().endswith('" ,'): + line = line.replace('" ,', '",') + + return line + + class DEFUN(object): def __init__(self, line_number, command_string_expanded, lines): @@ -216,14 +441,14 @@ DEFUN (no_bgp_maxmed_onstartup, elif state == 'HELP': if line.strip() == '{': - self.guts.append(line) + # self.guts.append(line) state = 'BODY' else: self.help_strings.append(line) elif state == 'BODY': if line.rstrip() == '}': - self.guts.append(line) + # self.guts.append(line) state = None else: self.guts.append(line) @@ -239,7 +464,7 @@ DEFUN (no_bgp_maxmed_onstartup, return self.name def sanity_check(self): - (max_index, variable_indexes) = get_argv_variable_indexes(self.line_number, self.command_string_expanded) + (max_index, variable_indexes) = get_command_string_variable_indexes(self.line_number, self.command_string_expanded) # sanity check that each argv index matches a variable in the command string for line in self.guts: @@ -256,7 +481,6 @@ DEFUN (no_bgp_maxmed_onstartup, def get_new_command_string(self): line = self.command_string - # dwalton # Change <1-255> to (1-255) # Change (foo|bar) to # Change {wazzup} to [wazzup]....there shouldn't be many of these @@ -284,18 +508,68 @@ DEFUN (no_bgp_maxmed_onstartup, line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) return line + def get_used_idx_variables(self, idx_table): + used = {} + + # sanity check that each argv index matches a variable in the command string + for line in self.guts: + if 'argv[' in line and '->arg' in line: + tmp_line = deepcopy(line) + re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line) + + while re_argv: + index = re_argv.group(1) + + if index.isdigit(): + index = int(index) + if index in idx_table: + used[index] = idx_table[index] + else: + print "%d: could not find idx variable for %d" % (self.line_number, index) + else: + for (key, value) in idx_table.iteritems(): + if value == index: + used[key] = value + break + + tmp_line = re_argv.group(2) + re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line) + + return used + def dump(self): + new_command_string = self.get_new_command_string() + new_command_string_expanded = expand_command_string(new_command_string) lines = [] lines.append("DEFUN (%s,\n" % self.name) lines.append(" %s,\n" % self.name_cmd) - lines.append(self.get_new_command_string()) + lines.append(new_command_string) lines.extend(self.help_strings) - lines.extend(self.guts) + lines.append('{\n') + + # only print the variables that will be used else we get a compile error + idx_table = get_command_string_index_variable_table(self.line_number, new_command_string_expanded) + idx_table_used = self.get_used_idx_variables(idx_table) + + for index in sorted(idx_table_used.keys()): + idx_variable = idx_table_used[index] + lines.append(" int %s = %d;\n" % (idx_variable, index)) + + # sanity check that each argv index matches a variable in the command string + for line in self.guts: + if line.startswith(' int idx_'): + pass + elif 'argv[' in line and '->arg' in line: + for (index, idx_variable) in idx_table.iteritems(): + line = line.replace("argv[%d]->arg" % index, "argv[%s]->arg" % idx_variable) + lines.append(line) + else: + lines.append(line) + + lines.append('}\n') return ''.join(lines) - - def update_argvs(filename): lines = [] @@ -334,78 +608,7 @@ def update_argvs(filename): state = 'DEFUN_BODY' elif line_number == defun_line_number + 2: - - # in the middle - line = line.replace('" CMD_AS_RANGE "', '<1-4294967295>') - line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '<1-5000>') - line = line.replace('" BGP_INSTANCE_CMD "', '(view|vrf) WORD') - line = line.replace('" BGP_INSTANCE_ALL_CMD "', '(view|vrf) all') - line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '<1-255>') - line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '(kernel|connected|static|rip|ospf|isis|pim|table)') - line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '(kernel|connected|static|ripng|ospf6|isis|table)') - line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') - line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '(kernel|connected|static|rip|isis|bgp|pim|table)') - line = line.replace('" VRF_CMD_STR "', 'vrf NAME') - line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all') - line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)') - line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)') - line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)') - line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '(kernel|connected|static|ospf|isis|bgp|pim|table)') - line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '(kernel|connected|static|ripng|isis|bgp|table)') - line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '(kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)') - line = line.replace('" LOG_FACILITIES "', '(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)') - - # endswith - line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",') - line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' <1-5000>",') - line = line.replace('" BGP_INSTANCE_CMD,', ' (view|vrf) WORD",') - line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' (view|vrf) all",') - line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",') - line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",') - line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '<2-255> <50-60000> <50-60000>",') - line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', - ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') - line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",') - line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",') - line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",') - line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' (kernel|connected|static|ripng|ospf6|isis|table)",') - line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' (kernel|connected|static|rip|isis|bgp|pim|table)",') - line = line.replace('" VRF_CMD_STR,', ' vrf NAME",') - line = line.replace('" VRF_ALL_CMD_STR,', ' vrf all",') - line = line.replace('" QUAGGA_IP_REDIST_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table)",') - line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table)",') - line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)",') - line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') - line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",') - line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' (kernel|connected|static|ospf|isis|bgp|pim|table)",') - line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') - line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' (kernel|connected|static|ripng|isis|bgp|table)",') - line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' (kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table)",') - line = line.replace('" LOG_FACILITIES,', ' (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)",') - - # startswith - line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') - line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('NEIGHBOR_CMD "', '"neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('PIM_CMD_NO "', '"no ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') - - # solo - line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor (A.B.C.D|X:X::X:X|WORD)",') - line = line.replace('NEIGHBOR_CMD2,', '"neighbor (A.B.C.D|X:X::X:X|WORD)",') - line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor (A.B.C.D|X:X::X:X)",') - line = line.replace('NEIGHBOR_CMD,', '"neighbor (A.B.C.D|X:X::X:X)",') - line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",') - - if line.rstrip().endswith('" ,'): - line = line.replace('" ,', '",') + line = expand_command_string(line) command_string = line ''' diff --git a/zebra/debug.c b/zebra/debug.c index cbdcdf27f6..3714ffe3f6 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -130,12 +130,13 @@ DEFUN (debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { + int idx_recv_send = 3; zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - if (strncmp ("detail", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("detail", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; } @@ -150,10 +151,11 @@ DEFUN (debug_zebra_packet_detail, "Debug option set for send packet\n" "Debug option set detailed information\n") { + int idx_recv_send = 3; zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); return CMD_SUCCESS; @@ -180,9 +182,10 @@ DEFUN (debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (argv[4]->arg && strncmp(argv[4]->arg, "recv", strlen(argv[4]->arg)) == 0) + int idx_recv_send = 4; + if (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "recv", strlen(argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[4]->arg || strncmp(argv[4]->arg, "send", strlen(argv[4]->arg)) == 0) + if (!argv[idx_recv_send]->arg || strncmp(argv[idx_recv_send]->arg, "send", strlen(argv[idx_recv_send]->arg)) == 0) SET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } @@ -267,9 +270,10 @@ DEFUN (no_debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) + int idx_recv_send = 4; + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) + if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); return CMD_SUCCESS; } @@ -296,9 +300,10 @@ DEFUN (no_debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - if (!argv[1] || (argv[5]->arg && strncmp(argv[5]->arg, "recv", strlen(argv[5]->arg)) == 0)) + int idx_recv_send = 5; + if (!argv[1] || (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "recv", strlen(argv[idx_recv_send]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[5]->arg || (argv[5]->arg && strncmp(argv[5]->arg, "send", strlen(argv[5]->arg)) == 0)) + if (!argv[idx_recv_send]->arg || (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "send", strlen(argv[idx_recv_send]->arg)) == 0)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); return CMD_SUCCESS; } diff --git a/zebra/interface.c b/zebra/interface.c index 1f1146e247..26315bd6c7 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1361,19 +1361,21 @@ DEFUN (show_interface_name_vrf, "Interface name\n" VRF_CMD_HELP_STR) { + int idx_ifname = 2; + int idx_name = 4; struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; interface_update_stats (); if (argc > 1) - VRF_GET_ID (vrf_id, argv[4]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[2]->arg, vrf_id); + ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_id); if (ifp == NULL) { - vty_out (vty, "%% Can't find interface %s%s", argv[2]->arg, + vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1399,6 +1401,7 @@ DEFUN (show_interface_name_vrf_all, "Interface name\n" VRF_ALL_CMD_HELP_STR) { + int idx_ifname = 2; struct interface *ifp; vrf_iter_t iter; int found = 0; @@ -1409,7 +1412,7 @@ DEFUN (show_interface_name_vrf_all, for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { /* Specified interface print. */ - ifp = if_lookup_by_name_vrf (argv[2]->arg, vrf_iter2id (iter)); + ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_iter2id (iter)); if (ifp) { if_dump_vty (vty, ifp); @@ -1419,7 +1422,7 @@ DEFUN (show_interface_name_vrf_all, if (!found) { - vty_out (vty, "%% Can't find interface %s%s", argv[2]->arg, VTY_NEWLINE); + vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1678,11 +1681,12 @@ DEFUN (bandwidth_if, "Set bandwidth informational parameter\n" "Bandwidth in megabits\n") { + int idx_number = 1; struct interface *ifp; unsigned int bandwidth; ifp = (struct interface *) vty->index; - bandwidth = strtol(argv[1]->arg, NULL, 10); + bandwidth = strtol(argv[idx_number]->arg, NULL, 10); /* bandwidth range is <1-100000> */ if (bandwidth < 1 || bandwidth > 100000) @@ -1844,11 +1848,12 @@ DEFUN (link_params_metric, "Link metric for MPLS-TE purpose\n" "Metric value in decimal\n") { + int idx_number = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t metric; - VTY_GET_ULONG("metric", metric, argv[1]->arg); + VTY_GET_ULONG("metric", metric, argv[idx_number]->arg); /* Update TE metric if needed */ link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE, metric); @@ -1876,12 +1881,13 @@ DEFUN (link_params_maxbw, "Maximum bandwidth that can be used\n" "Bytes/second (IEEE floating point format)\n") { + int idx_bandwidth = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1920,11 +1926,12 @@ DEFUN (link_params_max_rsv_bw, "Maximum bandwidth that may be reserved\n" "Bytes/second (IEEE floating point format)\n") { + int idx_bandwidth = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1953,20 +1960,22 @@ DEFUN (link_params_unrsv_bw, "Priority\n" "Bytes/second (IEEE floating point format)\n") { + int idx_number = 1; + int idx_bandwidth = 2; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); int priority; float bw; /* We don't have to consider about range check here. */ - if (sscanf (argv[1]->arg, "%d", &priority) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &priority) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); return CMD_WARNING; } - if (sscanf (argv[2]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1994,11 +2003,12 @@ DEFUN (link_params_admin_grp, "Administrative group membership\n" "32-bit Hexadecimal value (e.g. 0xa1)\n") { + int idx_bitpattern = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); unsigned long value; - if (sscanf (argv[1]->arg, "0x%lx", &value) != 1) + if (sscanf (argv[idx_bitpattern]->arg, "0x%lx", &value) != 1) { vty_out (vty, "link_params_admin_grp: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2034,19 +2044,21 @@ DEFUN (link_params_inter_as, "Remote AS number\n" "AS number in the range <1-4294967295>\n") { + int idx_ipv4 = 1; + int idx_number = 3; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); struct in_addr addr; u_int32_t as; - if (!inet_aton (argv[1]->arg, &addr)) + if (!inet_aton (argv[idx_ipv4]->arg, &addr)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_ULONG("AS number", as, argv[3]->arg); + VTY_GET_ULONG("AS number", as, argv[idx_number]->arg); /* Update Remote IP and Remote AS fields if needed */ if (IS_PARAM_UNSET(iflp, LP_RMT_AS) @@ -2105,6 +2117,7 @@ DEFUN (link_params_delay, "Unidirectional Average Link Delay\n" "Average delay in micro-second as decimal (0...16777215)\n") { + int idx_number = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); @@ -2112,7 +2125,7 @@ DEFUN (link_params_delay, u_int8_t update = 0; /* Get and Check new delay values */ - VTY_GET_ULONG("delay", delay, argv[1]->arg); + VTY_GET_ULONG("delay", delay, argv[idx_number]->arg); switch (argc) { case 1: @@ -2212,11 +2225,12 @@ DEFUN (link_params_delay_var, "Unidirectional Link Delay Variation\n" "delay variation in micro-second as decimal (0...16777215)\n") { + int idx_number = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); u_int32_t value; - VTY_GET_ULONG("delay variation", value, argv[1]->arg); + VTY_GET_ULONG("delay variation", value, argv[idx_number]->arg); /* Update Delay Variation if needed */ link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value); @@ -2244,11 +2258,12 @@ DEFUN (link_params_pkt_loss, "Unidirectional Link Packet Loss\n" "percentage of total traffic by 0.000003% step and less than 50.331642%\n") { + int idx_percentage = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float fval; - if (sscanf (argv[1]->arg, "%g", &fval) != 1) + if (sscanf (argv[idx_percentage]->arg, "%g", &fval) != 1) { vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2284,11 +2299,12 @@ DEFUN (link_params_res_bw, "Unidirectional Residual Bandwidth\n" "Bytes/second (IEEE floating point format)\n") { + int idx_bandwidth = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2330,11 +2346,12 @@ DEFUN (link_params_ava_bw, "Unidirectional Available Bandwidth\n" "Bytes/second (IEEE floating point format)\n") { + int idx_bandwidth = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2376,11 +2393,12 @@ DEFUN (link_params_use_bw, "Unidirectional Utilised Bandwidth\n" "Bytes/second (IEEE floating point format)\n") { + int idx_bandwidth = 1; struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); float bw; - if (sscanf (argv[1]->arg, "%g", &bw) != 1) + if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1) { vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -2564,7 +2582,8 @@ DEFUN (ip_address, "Set the IP address of an interface\n" "IP address (e.g. 10.0.0.1/8)\n") { - return ip_address_install (vty, vty->index, argv[2]->arg, NULL, NULL); + int idx_ipv4_prefixlen = 2; + return ip_address_install (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, NULL, NULL); } DEFUN (no_ip_address, @@ -2575,7 +2594,8 @@ DEFUN (no_ip_address, "Set the IP address of an interface\n" "IP Address (e.g. 10.0.0.1/8)") { - return ip_address_uninstall (vty, vty->index, argv[3]->arg, NULL, NULL); + int idx_ipv4_prefixlen = 3; + return ip_address_uninstall (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, NULL, NULL); } @@ -2589,7 +2609,9 @@ DEFUN (ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_install (vty, vty->index, argv[2]->arg, NULL, argv[4]->arg); + int idx_ipv4_prefixlen = 2; + int idx_line = 4; + return ip_address_install (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_line]->arg); } DEFUN (no_ip_address_label, @@ -2602,7 +2624,9 @@ DEFUN (no_ip_address_label, "Label of this address\n" "Label\n") { - return ip_address_uninstall (vty, vty->index, argv[3]->arg, NULL, argv[5]->arg); + int idx_ipv4_prefixlen = 3; + int idx_line = 5; + return ip_address_uninstall (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_line]->arg); } #endif /* HAVE_NETLINK */ @@ -2765,7 +2789,8 @@ DEFUN (ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_install (vty, vty->index, argv[2]->arg, NULL, NULL, 0); + int idx_ipv6_prefixlen = 2; + return ipv6_address_install (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, NULL, NULL, 0); } DEFUN (no_ipv6_address, @@ -2776,7 +2801,8 @@ DEFUN (no_ipv6_address, "Set the IP address of an interface\n" "IPv6 address (e.g. 3ffe:506::1/48)\n") { - return ipv6_address_uninstall (vty, vty->index, argv[3]->arg, NULL, NULL, 0); + int idx_ipv6_prefixlen = 3; + return ipv6_address_uninstall (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, NULL, NULL, 0); } #endif /* HAVE_IPV6 */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 424f02788a..2f741380f5 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -469,6 +469,7 @@ DEFUN (ip_irdp_holdtime, "Set holdtime value\n" "Holdtime value in seconds. Default is 1800 seconds\n") { + int idx_number = 3; struct interface *ifp; struct zebra_if *zi; struct irdp_interface *irdp; @@ -480,7 +481,7 @@ DEFUN (ip_irdp_holdtime, zi=ifp->info; irdp=&zi->irdp; - irdp->Lifetime = atoi(argv[3]->arg); + irdp->Lifetime = atoi(argv[idx_number]->arg); return CMD_SUCCESS; } @@ -492,6 +493,7 @@ DEFUN (ip_irdp_minadvertinterval, "Set minimum time between advertisement\n" "Minimum advertisement interval in seconds\n") { + int idx_number = 3; struct interface *ifp; struct zebra_if *zi; struct irdp_interface *irdp; @@ -503,8 +505,8 @@ DEFUN (ip_irdp_minadvertinterval, zi=ifp->info; irdp=&zi->irdp; - if( (unsigned) atoi(argv[3]->arg) <= irdp->MaxAdvertInterval) { - irdp->MinAdvertInterval = atoi(argv[3]->arg); + if( (unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) { + irdp->MinAdvertInterval = atoi(argv[idx_number]->arg); return CMD_SUCCESS; } @@ -525,6 +527,7 @@ DEFUN (ip_irdp_maxadvertinterval, "Set maximum time between advertisement\n" "Maximum advertisement interval in seconds\n") { + int idx_number = 3; struct interface *ifp; struct zebra_if *zi; struct irdp_interface *irdp; @@ -537,8 +540,8 @@ DEFUN (ip_irdp_maxadvertinterval, irdp=&zi->irdp; - if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[3]->arg) ) { - irdp->MaxAdvertInterval = atoi(argv[3]->arg); + if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) { + irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg); return CMD_SUCCESS; } @@ -564,6 +567,7 @@ DEFUN (ip_irdp_preference, "Set default preference level for this interface\n" "Preference level\n") { + int idx_number = 3; struct interface *ifp; struct zebra_if *zi; struct irdp_interface *irdp; @@ -575,7 +579,7 @@ DEFUN (ip_irdp_preference, zi=ifp->info; irdp=&zi->irdp; - irdp->Preference = atoi(argv[3]->arg); + irdp->Preference = atoi(argv[idx_number]->arg); return CMD_SUCCESS; } @@ -588,6 +592,8 @@ DEFUN (ip_irdp_address_preference, "Set IRDP address for advertise\n" "Preference level\n") { + int idx_ipv4 = 3; + int idx_number = 5; struct listnode *node; struct in_addr ip; int pref; @@ -605,10 +611,10 @@ DEFUN (ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[3]->arg, &ip); + ret = inet_aton(argv[idx_ipv4]->arg, &ip); if(!ret) return CMD_WARNING; - pref = atoi(argv[5]->arg); + pref = atoi(argv[idx_number]->arg); for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv)) if(adv->ip.s_addr == ip.s_addr) @@ -633,6 +639,7 @@ DEFUN (no_ip_irdp_address_preference, "Select IRDP address\n" "Old preference level\n") { + int idx_ipv4 = 4; struct listnode *node, *nnode; struct in_addr ip; int ret; @@ -649,7 +656,7 @@ DEFUN (no_ip_irdp_address_preference, zi=ifp->info; irdp=&zi->irdp; - ret = inet_aton(argv[4]->arg, &ip); + ret = inet_aton(argv[idx_ipv4]->arg, &ip); if (!ret) return CMD_WARNING; diff --git a/zebra/router-id.c b/zebra/router-id.c index 05eee8ad33..6e1d434ec4 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -228,10 +228,11 @@ DEFUN (router_id, "Manually set the router-id\n" "IP address to use for router-id\n") { + int idx_ipv4 = 1; struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; - rid.u.prefix4.s_addr = inet_addr (argv[1]->arg); + rid.u.prefix4.s_addr = inet_addr (argv[idx_ipv4]->arg); if (!rid.u.prefix4.s_addr) return CMD_WARNING; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index c13d85a4d1..ec4736463c 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -923,6 +923,7 @@ DEFUN (ipv6_nd_ra_interval_msec, "Router Advertisement interval\n" "Router Advertisement interval in milliseconds\n") { + int idx_number = 4; unsigned interval; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; @@ -930,7 +931,7 @@ DEFUN (ipv6_nd_ra_interval_msec, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[4]->arg, 70, 1800000); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 70, 1800000); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -958,6 +959,7 @@ DEFUN (ipv6_nd_ra_interval, "Router Advertisement interval\n" "Router Advertisement interval in seconds\n") { + int idx_number = 3; unsigned interval; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; @@ -965,7 +967,7 @@ DEFUN (ipv6_nd_ra_interval, struct zebra_ns *zns; zns = zvrf->zns; - VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[3]->arg, 1, 1800); + VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 1, 1800); if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime)) { vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE); @@ -1039,6 +1041,7 @@ DEFUN (ipv6_nd_ra_lifetime, "Router lifetime\n" "Router lifetime in seconds (0 stands for a non-default gw)\n") { + int idx_number = 3; int lifetime; struct interface *ifp; struct zebra_if *zif; @@ -1046,7 +1049,7 @@ DEFUN (ipv6_nd_ra_lifetime, ifp = (struct interface *) vty->index; zif = ifp->info; - VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[3]->arg, 0, 9000); + VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[idx_number]->arg, 0, 9000); /* The value to be placed in the Router Lifetime field * of Router Advertisements sent from the interface, @@ -1101,9 +1104,10 @@ DEFUN (ipv6_nd_reachable_time, "Reachable time\n" "Reachable time in milliseconds\n") { + int idx_number = 3; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[3]->arg, 1, RTADV_MAX_REACHABLE_TIME); + VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[idx_number]->arg, 1, RTADV_MAX_REACHABLE_TIME); return CMD_SUCCESS; } @@ -1145,9 +1149,10 @@ DEFUN (ipv6_nd_homeagent_preference, "Home Agent preference\n" "preference value (default is 0, least preferred)\n") { + int idx_number = 3; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[3]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[idx_number]->arg, 0, 65535); return CMD_SUCCESS; } @@ -1189,9 +1194,10 @@ DEFUN (ipv6_nd_homeagent_lifetime, "Home Agent lifetime\n" "Home Agent lifetime in seconds (0 to track ra-lifetime)\n") { + int idx_number = 3; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[3]->arg, 0, RTADV_MAX_HALIFETIME); + VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[idx_number]->arg, 0, RTADV_MAX_HALIFETIME); return CMD_SUCCESS; } @@ -1508,7 +1514,7 @@ DEFUN (no_ipv6_nd_other_config_flag, */ DEFUN (ipv6_nd_prefix, ipv6_nd_prefix_cmd, - "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> ", + "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> ", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Prefix information\n" @@ -1521,6 +1527,9 @@ DEFUN (ipv6_nd_prefix, "Do not use prefix for autoconfiguration\n" "Set Router Address flag\n") { + int idx_ipv6_prefixlen = 3; + int idx_number_infinite = 4; + int idx_number_infinite_2 = 5; int i; int ret; int cursor = 1; @@ -1531,7 +1540,7 @@ DEFUN (ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[3]->arg, &rp.prefix); + ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1546,19 +1555,19 @@ DEFUN (ipv6_nd_prefix, if (argc > 1) { - if ((isdigit((unsigned char)argv[4]->arg[0])) - || strncmp (argv[4]->arg, "i", 1) == 0) + if ((isdigit((unsigned char)argv[idx_number_infinite]->arg[0])) + || strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0) { - if ( strncmp (argv[4]->arg, "i", 1) == 0) + if ( strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0) rp.AdvValidLifetime = UINT32_MAX; else - rp.AdvValidLifetime = (u_int32_t) strtoll (argv[4]->arg, + rp.AdvValidLifetime = (u_int32_t) strtoll (argv[idx_number_infinite]->arg, (char **)NULL, 10); - if ( strncmp (argv[5]->arg, "i", 1) == 0) + if ( strncmp (argv[idx_number_infinite_2]->arg, "i", 1) == 0) rp.AdvPreferredLifetime = UINT32_MAX; else - rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[5]->arg, + rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[idx_number_infinite_2]->arg, (char **)NULL, 10); if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) @@ -1790,6 +1799,7 @@ DEFUN (ipv6_nd_router_preference, "Low default router preference\n" "Medium default router preference (default)\n") { + int idx_high_medium_low = 3; struct interface *ifp; struct zebra_if *zif; int i = 0; @@ -1799,7 +1809,7 @@ DEFUN (ipv6_nd_router_preference, while (0 != rtadv_pref_strs[i]) { - if (strncmp (argv[3]->arg, rtadv_pref_strs[i], 1) == 0) + if (strncmp (argv[idx_high_medium_low]->arg, rtadv_pref_strs[i], 1) == 0) { zif->rtadv.DefaultPreference = i; return CMD_SUCCESS; @@ -1850,9 +1860,10 @@ DEFUN (ipv6_nd_mtu, "Advertised MTU\n" "MTU in bytes\n") { + int idx_number = 3; struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; - VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[3]->arg, 1, 65535); + VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[idx_number]->arg, 1, 65535); return CMD_SUCCESS; } diff --git a/zebra/test_main.c b/zebra/test_main.c index 2908ddd949..4dd3e897f2 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -124,6 +124,7 @@ DEFUN (test_interface_state, "up\n" "down\n") { + int idx_up_down = 1; struct interface *ifp; if (argc < 1) return CMD_WARNING; @@ -136,7 +137,7 @@ DEFUN (test_interface_state, ifp->flags = IFF_BROADCAST|IFF_MULTICAST; } - switch (argv[1]->arg[0]) + switch (argv[idx_up_down]->arg[0]) { case 'u': SET_FLAG (ifp->flags, IFF_UP); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 6dcc7624e7..9ca4cd9473 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -301,7 +301,8 @@ DEFUN (match_interface, "match first hop interface of route\n" "Interface name\n") { - return zebra_route_match_add (vty, vty->index, "interface", argv[2]->arg, + int idx_word = 2; + return zebra_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -335,7 +336,8 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return zebra_route_match_add (vty, vty->index, "tag", argv[2]->arg, + int idx_number = 2; + return zebra_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -373,7 +375,8 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg, RMAP_EVENT_FILTER_ADDED); + int idx_acl = 3; + return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } /* @@ -414,8 +417,9 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } /* @@ -460,7 +464,8 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return zebra_route_match_add (vty, vty->index, "ip address", argv[3]->arg, + int idx_acl = 3; + return zebra_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -502,8 +507,9 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return zebra_route_match_add (vty, vty->index, "ip address prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } /* @@ -627,17 +633,18 @@ DEFUN (match_source_protocol, MATCH_STR "Match protocol via which the route was learnt\n") { + int idx_protocol = 2; int i; - i = proto_name2num(argv[2]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } return zebra_route_match_add (vty, vty->index, "source-protocol", - argv[2]->arg, RMAP_EVENT_MATCH_ADDED); + argv[idx_protocol]->arg, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_source_protocol, @@ -647,20 +654,21 @@ DEFUN (no_match_source_protocol, MATCH_STR "No match protocol via which the route was learnt\n") { + int idx_protocol = 3; int i; if (argc >= 1) { - i = proto_name2num(argv[3]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[3]->arg ? argv[3]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } } return zebra_route_match_delete (vty, vty->index, - "source-protocol", argv[3]->arg ? argv[3]->arg : NULL, + "source-protocol", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : NULL, RMAP_EVENT_MATCH_DELETED); } @@ -673,15 +681,16 @@ DEFUN (set_src, "src address for route\n" "src address\n") { + int idx_ip = 2; union g_addr src; struct interface *pif = NULL; int family; struct prefix p; vrf_iter_t iter; - if (inet_pton(AF_INET, argv[2]->arg, &src.ipv4) != 1) + if (inet_pton(AF_INET, argv[idx_ip]->arg, &src.ipv4) != 1) { - if (inet_pton(AF_INET6, argv[2]->arg, &src.ipv6) != 1) + if (inet_pton(AF_INET6, argv[idx_ip]->arg, &src.ipv6) != 1) { vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE); return CMD_WARNING; @@ -722,7 +731,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[2]->arg); + return zebra_route_set_add (vty, vty->index, "src", argv[idx_ip]->arg); } DEFUN (no_set_src, @@ -732,10 +741,11 @@ DEFUN (no_set_src, SET_STR "Source address for route\n") { + int idx_ip = 3; if (argc == 0) return zebra_route_set_delete (vty, vty->index, "src", NULL); - return zebra_route_set_delete (vty, vty->index, "src", argv[3]->arg); + return zebra_route_set_delete (vty, vty->index, "src", argv[idx_ip]->arg); } DEFUN (zebra_route_map_timer, @@ -744,9 +754,10 @@ DEFUN (zebra_route_map_timer, "Time to wait before route-map updates are processed\n" "0 means event-driven updates are disabled\n") { + int idx_number = 3; u_int32_t rmap_delay_timer; - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[3]->arg, 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[idx_number]->arg, 0, 600); zebra_route_map_set_delay_timer(rmap_delay_timer); return (CMD_SUCCESS); @@ -782,15 +793,16 @@ DEFUN (ip_protocol, QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA "Route map name\n") { + int idx_protocol = 2; int i; - if (strcasecmp(argv[2]->arg, "any") == 0) + if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[2]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -805,7 +817,7 @@ DEFUN (ip_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[2]->arg); + VRF_DEFAULT, argv[idx_protocol]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -897,15 +909,16 @@ DEFUN (ipv6_protocol, QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA "Route map name\n") { + int idx_protocol = 2; int i; - if (strcasecmp(argv[2]->arg, "any") == 0) + if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[2]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -920,7 +933,7 @@ DEFUN (ipv6_protocol, if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[2]->arg); + VRF_DEFAULT, argv[idx_protocol]->arg); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; @@ -1013,15 +1026,16 @@ DEFUN (ip_protocol_nht_rmap, QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA "Route map name\n") { + int idx_protocol = 2; int i; - if (strcasecmp(argv[2]->arg, "any") == 0) + if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[2]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } @@ -1119,15 +1133,16 @@ DEFUN (ipv6_protocol_nht_rmap, QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA "Route map name\n") { + int idx_protocol = 2; int i; - if (strcasecmp(argv[2]->arg, "any") == 0) + if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[2]->arg); + i = proto_name2num(argv[idx_protocol]->arg); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[2]->arg ? argv[2]->arg : "", + vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", VTY_NEWLINE); return CMD_WARNING; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 505da4923c..99d7bd6fdb 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -201,7 +201,10 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argc > 2 ? argv[4]->arg : NULL, NULL); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_number = 4; + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, NULL, NULL, argc > 2 ? argv[idx_number]->arg : NULL, NULL); } @@ -226,7 +229,10 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argc > 2 ? argv[5]->arg : NULL, NULL); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, NULL, NULL, argc > 2 ? argv[idx_number]->arg : NULL, NULL); } @@ -242,16 +248,17 @@ DEFUN (ip_multicast_mode, "Lookup both, use entry with lower distance\n" "Lookup both, use entry with longer prefix\n") { + int idx_rpf_lookup_mode = 3; - if (!strncmp (argv[3]->arg, "u", 1)) + if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "u", 1)) multicast_mode_ipv4_set (MCAST_URIB_ONLY); - else if (!strncmp (argv[3]->arg, "mrib-o", 6)) + else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "mrib-o", 6)) multicast_mode_ipv4_set (MCAST_MRIB_ONLY); - else if (!strncmp (argv[3]->arg, "mrib-t", 6)) + else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "mrib-t", 6)) multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); - else if (!strncmp (argv[3]->arg, "low", 3)) + else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "low", 3)) multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); - else if (!strncmp (argv[3]->arg, "lon", 3)) + else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "lon", 3)) multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); else { @@ -307,12 +314,13 @@ DEFUN (show_ip_rpf_addr, "Display RPF information for multicast source\n" "IP multicast source address (e.g. 10.0.0.0)\n") { + int idx_ipv4 = 3; struct in_addr addr; struct route_node *rn; struct rib *rib; int ret; - ret = inet_aton (argv[3]->arg, &addr); + ret = inet_aton (argv[idx_ipv4]->arg, &addr); if (ret == 0) { vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); @@ -340,7 +348,9 @@ DEFUN (ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, NULL); } @@ -356,7 +366,10 @@ DEFUN (ip_route_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } @@ -371,7 +384,10 @@ DEFUN (ip_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } @@ -389,7 +405,11 @@ DEFUN (ip_route_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } @@ -402,7 +422,9 @@ DEFUN (ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } @@ -418,7 +440,10 @@ DEFUN (ip_route_flags2_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } @@ -434,7 +459,10 @@ DEFUN (ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, NULL); } @@ -452,7 +480,11 @@ DEFUN (ip_route_mask_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } @@ -468,7 +500,11 @@ DEFUN (ip_route_mask_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } @@ -487,7 +523,12 @@ DEFUN (ip_route_mask_flags_tag, "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } @@ -501,7 +542,10 @@ DEFUN (ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } @@ -517,7 +561,11 @@ DEFUN (ip_route_mask_flags2_tag, "Set tag for this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } @@ -533,8 +581,11 @@ DEFUN (ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, - argv[4]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_tag_distance, @@ -551,8 +602,12 @@ DEFUN (ip_route_tag_distance, "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, - argv[6]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 5; + int idx_number_2 = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (ip_route_flags_distance, @@ -567,8 +622,12 @@ DEFUN (ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, - argv[5]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_flags_tag_distance, @@ -585,8 +644,13 @@ DEFUN (ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, - argv[7]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (ip_route_flags_distance2, @@ -599,8 +663,11 @@ DEFUN (ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, - argv[4]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_flags_tag_distance2, @@ -615,8 +682,12 @@ DEFUN (ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, - argv[6]->arg, NULL); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 5; + int idx_number_2 = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (ip_route_mask_distance, @@ -631,8 +702,12 @@ DEFUN (ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, - argv[5]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_mask_tag_distance, @@ -649,8 +724,13 @@ DEFUN (ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, - argv[7]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_number_2 = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance, @@ -668,8 +748,14 @@ DEFUN (ip_route_mask_flags_tag_distance, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, - argv[8]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } @@ -686,8 +772,13 @@ DEFUN (ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, - argv[6]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_mask_flags_distance2, @@ -701,8 +792,12 @@ DEFUN (ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, - argv[5]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (ip_route_mask_flags_tag_distance2, @@ -718,8 +813,13 @@ DEFUN (ip_route_mask_flags_tag_distance2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, - argv[7]->arg, NULL); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } /* @@ -746,7 +846,9 @@ DEFUN (no_ip_route, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, NULL); } @@ -778,7 +880,10 @@ DEFUN (no_ip_route_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } @@ -794,7 +899,8 @@ DEFUN (no_ip_route_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, NULL, NULL, + int idx_ipv4_prefixlen = 3; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, NULL, NULL, NULL, NULL); } @@ -810,7 +916,9 @@ DEFUN (no_ip_route_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL); } @@ -840,7 +948,10 @@ DEFUN (no_ip_route_mask, "IP gateway interface name\n" "Null interface\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, NULL); } @@ -874,7 +985,11 @@ DEFUN (no_ip_route_mask_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } @@ -891,7 +1006,9 @@ DEFUN (no_ip_route_mask_flags2, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -908,7 +1025,10 @@ DEFUN (no_ip_route_mask_flags2_tag, "Tag of this route\n" "Tag value\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL); } @@ -924,8 +1044,11 @@ DEFUN (no_ip_route_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, - argv[5]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_tag_distance, @@ -942,8 +1065,12 @@ DEFUN (no_ip_route_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, - argv[7]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_number_2 = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_route_flags_distance, @@ -959,8 +1086,12 @@ DEFUN (no_ip_route_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, - argv[6]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance, @@ -978,8 +1109,13 @@ DEFUN (no_ip_route_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, - argv[8]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_route_flags_distance2, @@ -993,8 +1129,11 @@ DEFUN (no_ip_route_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, - argv[5]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_flags_tag_distance2, @@ -1010,8 +1149,12 @@ DEFUN (no_ip_route_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, - argv[7]->arg, NULL); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_route_mask_distance, @@ -1027,8 +1170,12 @@ DEFUN (no_ip_route_mask_distance, "Null interface\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, - argv[6]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_mask_tag_distance, @@ -1046,8 +1193,13 @@ DEFUN (no_ip_route_mask_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, - argv[8]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 7; + int idx_number_2 = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance, @@ -1064,8 +1216,13 @@ DEFUN (no_ip_route_mask_flags_distance, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, - argv[7]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_number = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance, @@ -1084,8 +1241,14 @@ DEFUN (no_ip_route_mask_flags_tag_distance, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, - argv[9]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_number_2 = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_route_mask_flags_distance2, @@ -1100,8 +1263,12 @@ DEFUN (no_ip_route_mask_flags_distance2, "Silently discard pkts when matched\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, - argv[6]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, + argv[idx_number]->arg, NULL); } DEFUN (no_ip_route_mask_flags_tag_distance2, @@ -1118,8 +1285,13 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, "Tag value\n" "Distance value for this route\n") { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, - argv[8]->arg, NULL); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, + argv[idx_number_2]->arg, NULL); } /* Static route configuration. */ @@ -1134,7 +1306,10 @@ DEFUN (ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, NULL, argv[5]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_name = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_tag_vrf, @@ -1150,7 +1325,11 @@ DEFUN (ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, NULL, argv[7]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ip_route_flags_vrf, @@ -1165,7 +1344,11 @@ DEFUN (ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_flags_tag_vrf, @@ -1183,7 +1366,12 @@ DEFUN (ip_route_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ip_route_flags2_vrf, @@ -1196,7 +1384,10 @@ DEFUN (ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, NULL, argv[5]->arg); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_name = 5; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_flags2_tag_vrf, @@ -1212,7 +1403,11 @@ DEFUN (ip_route_flags2_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, NULL, argv[7]->arg); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } /* Mask as A.B.C.D format. */ @@ -1228,7 +1423,11 @@ DEFUN (ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_mask_tag_vrf, @@ -1246,7 +1445,12 @@ DEFUN (ip_route_mask_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags_vrf, @@ -1262,7 +1466,12 @@ DEFUN (ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags_tag_vrf, @@ -1281,7 +1490,13 @@ DEFUN (ip_route_mask_flags_tag_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags2_vrf, @@ -1295,7 +1510,11 @@ DEFUN (ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags2_tag_vrf, @@ -1311,7 +1530,12 @@ DEFUN (ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } /* Distance option value. */ @@ -1327,7 +1551,11 @@ DEFUN (ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_tag_distance_vrf, @@ -1345,7 +1573,12 @@ DEFUN (ip_route_tag_distance_vrf, VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, NULL, argv[5]->arg, argv[6]->arg, argv[8]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname_null = 3; + int idx_number = 5; + int idx_number_2 = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ip_route_flags_distance_vrf, @@ -1361,7 +1594,12 @@ DEFUN (ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_flags_tag_distance_vrf, @@ -1379,7 +1617,13 @@ DEFUN (ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, argv[3]->arg, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ipv4_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ip_route_flags_distance2_vrf, @@ -1393,7 +1637,11 @@ DEFUN (ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_flags_tag_distance2_vrf, @@ -1409,7 +1657,12 @@ DEFUN (ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, NULL, NULL, argv[3]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg); + int idx_ipv4_prefixlen = 2; + int idx_reject_blackhole = 3; + int idx_number = 5; + int idx_number_2 = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ip_route_mask_distance_vrf, @@ -1425,7 +1678,12 @@ DEFUN (ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_mask_tag_distance_vrf, @@ -1443,7 +1701,13 @@ DEFUN (ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags_tag_distance_vrf, @@ -1462,7 +1726,14 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } @@ -1480,7 +1751,13 @@ DEFUN (ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags_distance2_vrf, @@ -1495,7 +1772,12 @@ DEFUN (ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ip_route_mask_flags_tag_distance2_vrf, @@ -1512,7 +1794,13 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_vrf, @@ -1527,7 +1815,10 @@ DEFUN (no_ip_route_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_flags_vrf, @@ -1543,7 +1834,11 @@ DEFUN (no_ip_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_tag_vrf, @@ -1560,7 +1855,11 @@ DEFUN (no_ip_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_flags_tag_vrf, @@ -1578,7 +1877,12 @@ DEFUN (no_ip_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_flags2_vrf, @@ -1592,7 +1896,10 @@ DEFUN (no_ip_route_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_name = 6; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_flags2_tag_vrf, @@ -1608,7 +1915,11 @@ DEFUN (no_ip_route_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_vrf, @@ -1624,7 +1935,11 @@ DEFUN (no_ip_route_mask_vrf, "Null interface\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[7]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_vrf, @@ -1641,7 +1956,12 @@ DEFUN (no_ip_route_mask_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[8]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_tag_vrf, @@ -1659,7 +1979,12 @@ DEFUN (no_ip_route_mask_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_tag_vrf, @@ -1678,7 +2003,13 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[10]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_name = 10; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags2_vrf, @@ -1693,7 +2024,11 @@ DEFUN (no_ip_route_mask_flags2_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[7]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags2_tag_vrf, @@ -1710,7 +2045,12 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } @@ -1727,7 +2067,11 @@ DEFUN (no_ip_route_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_tag_distance_vrf, @@ -1745,7 +2089,12 @@ DEFUN (no_ip_route_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname_null = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_flags_distance_vrf, @@ -1762,7 +2111,12 @@ DEFUN (no_ip_route_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_flags_tag_distance_vrf, @@ -1781,7 +2135,13 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg,argv[10]->arg); + int idx_ipv4_prefixlen = 3; + int idx_ipv4_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg,argv[idx_name]->arg); } DEFUN (no_ip_route_flags_distance2_vrf, @@ -1796,7 +2156,11 @@ DEFUN (no_ip_route_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + int idx_name = 7; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_flags_tag_distance2_vrf, @@ -1813,7 +2177,12 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, NULL, NULL, argv[4]->arg, argv[6]->arg , argv[7]->arg, argv[9]->arg); + int idx_ipv4_prefixlen = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg , argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_distance_vrf, @@ -1830,7 +2199,12 @@ DEFUN (no_ip_route_mask_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_tag_distance_vrf, @@ -1849,7 +2223,13 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname_null = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_distance_vrf, @@ -1867,7 +2247,13 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[9]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_number = 7; + int idx_name = 9; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance_vrf, @@ -1887,7 +2273,14 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[11]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_ipv4_ifname = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_number_2 = 9; + int idx_name = 11; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_distance2_vrf, @@ -1903,7 +2296,12 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + int idx_name = 8; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, @@ -1921,7 +2319,13 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, "Distance value for this route\n" VRF_CMD_HELP_STR) { - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } /* New RIB. Detailed information for IPv4 route. */ @@ -2442,12 +2846,13 @@ DEFUN (show_ip_route_vrf, "IP routing table\n" VRF_CMD_HELP_STR) { + int idx_json = 5; u_char uj = use_json(argc, argv); if (argc == 1 && uj) return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj); else - return do_show_ip_route (vty, argv[5]->arg, SAFI_UNICAST, uj); + return do_show_ip_route (vty, argv[idx_json]->arg, SAFI_UNICAST, uj); } /* @@ -2626,6 +3031,7 @@ DEFUN (show_ip_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_number = 4; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2636,10 +3042,10 @@ DEFUN (show_ip_route_tag, if (argc > 1) { tag = atoi(argv[1]); - VRF_GET_ID (vrf_id, argv[4]->arg); + VRF_GET_ID (vrf_id, argv[idx_number]->arg); } else - tag = atoi(argv[4]->arg); + tag = atoi(argv[idx_number]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -2683,6 +3089,7 @@ DEFUN (show_ip_route_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Show route matching the specified Network/Mask pair only\n") { + int idx_ipv4_prefixlen = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2694,10 +3101,10 @@ DEFUN (show_ip_route_prefix_longer, if (argc > 1) { ret = str2prefix (argv[1], &p); - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv4_prefixlen]->arg); } else - ret = str2prefix (argv[3]->arg, &p); + ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p); if (! ret) { @@ -2847,13 +3254,14 @@ DEFUN (show_ip_route_ospf_instance, "Open Shortest Path First (OSPFv2)\n" "Instance ID\n") { + int idx_number = 4; struct route_table *table; struct route_node *rn; struct rib *rib; int first = 1; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[4]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); if (! table) @@ -2892,6 +3300,7 @@ DEFUN (show_ip_route_addr, "IP routing table\n" "Network in the IP routing table to display\n") { + int idx_ipv4 = 3; int ret; struct prefix_ipv4 p; struct route_table *table; @@ -2900,11 +3309,11 @@ DEFUN (show_ip_route_addr, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv4]->arg); ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[3]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p); if (ret <= 0) { @@ -2949,6 +3358,7 @@ DEFUN (show_ip_route_prefix, "IP routing table\n" "IP prefix /, e.g., 35.0.0.0/8\n") { + int idx_ipv4_prefixlen = 3; int ret; struct prefix_ipv4 p; struct route_table *table; @@ -2957,11 +3367,11 @@ DEFUN (show_ip_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv4_prefixlen]->arg); ret = str2prefix_ipv4 (argv[1], &p); } else - ret = str2prefix_ipv4 (argv[3]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p); if (ret <= 0) { @@ -3264,6 +3674,7 @@ DEFUN (show_ip_route_vrf_all_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_number = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -3273,8 +3684,8 @@ DEFUN (show_ip_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[6]->arg) - tag = atoi(argv[6]->arg); + if (argv[idx_number]->arg) + tag = atoi(argv[idx_number]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -3317,6 +3728,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Show route matching the specified Network/Mask pair only\n") { + int idx_ipv4_prefixlen = 5; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -3327,7 +3739,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[5]->arg, &p); + ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -3482,6 +3894,7 @@ DEFUN (show_ip_route_vrf_all_addr, VRF_ALL_CMD_HELP_STR "Network in the IP routing table to display\n") { + int idx_ipv4 = 5; int ret; struct prefix_ipv4 p; struct route_table *table; @@ -3489,7 +3902,7 @@ DEFUN (show_ip_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[5]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3523,6 +3936,7 @@ DEFUN (show_ip_route_vrf_all_prefix, VRF_ALL_CMD_HELP_STR "IP prefix /, e.g., 35.0.0.0/8\n") { + int idx_ipv4_prefixlen = 5; int ret; struct prefix_ipv4 p; struct route_table *table; @@ -3530,7 +3944,7 @@ DEFUN (show_ip_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv4 (argv[5]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p); if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE); @@ -3789,7 +4203,9 @@ DEFUN (ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_tag, @@ -3803,7 +4219,10 @@ DEFUN (ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 5; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); } DEFUN (ipv6_route_flags, @@ -3817,7 +4236,10 @@ DEFUN (ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_flags_tag, @@ -3833,7 +4255,11 @@ DEFUN (ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname, @@ -3845,7 +4271,10 @@ DEFUN (ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_tag, ipv6_route_ifname_tag_cmd, @@ -3858,7 +4287,11 @@ DEFUN (ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } DEFUN (ipv6_route_ifname_flags, @@ -3872,7 +4305,11 @@ DEFUN (ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } DEFUN (ipv6_route_ifname_flags_tag, @@ -3888,7 +4325,12 @@ DEFUN (ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } DEFUN (ipv6_route_pref, @@ -3901,7 +4343,10 @@ DEFUN (ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 4; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); } DEFUN (ipv6_route_pref_tag, @@ -3916,7 +4361,11 @@ DEFUN (ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 5; + int idx_number_2 = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_route_flags_pref, @@ -3931,7 +4380,11 @@ DEFUN (ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); } DEFUN (ipv6_route_flags_pref_tag, @@ -3948,7 +4401,12 @@ DEFUN (ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_route_ifname_pref, @@ -3961,7 +4419,11 @@ DEFUN (ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 5; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, NULL); } DEFUN (ipv6_route_ifname_pref_tag, @@ -3976,7 +4438,12 @@ DEFUN (ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 6; + int idx_number_2 = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref, @@ -3991,7 +4458,12 @@ DEFUN (ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); } DEFUN (ipv6_route_ifname_flags_pref_tag, @@ -4008,7 +4480,13 @@ DEFUN (ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, NULL); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_route, @@ -4021,7 +4499,9 @@ DEFUN (no_ipv6_route, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_tag, @@ -4036,7 +4516,10 @@ DEFUN (no_ipv6_route_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 6; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); } DEFUN (no_ipv6_route_flags, @@ -4051,7 +4534,10 @@ DEFUN (no_ipv6_route_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_flags_tag, @@ -4068,7 +4554,11 @@ DEFUN (no_ipv6_route_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname, @@ -4081,7 +4571,10 @@ DEFUN (no_ipv6_route_ifname, "IPv6 gateway address\n" "IPv6 gateway interface name\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_tag, @@ -4096,7 +4589,11 @@ DEFUN (no_ipv6_route_ifname_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags, @@ -4111,7 +4608,11 @@ DEFUN (no_ipv6_route_ifname_flags, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); } DEFUN (no_ipv6_route_ifname_flags_tag, @@ -4128,7 +4629,12 @@ DEFUN (no_ipv6_route_ifname_flags_tag, "Set tag for this route\n" "Tag value\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); } DEFUN (no_ipv6_route_pref, @@ -4142,7 +4648,10 @@ DEFUN (no_ipv6_route_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 5; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_route_pref_tag, @@ -4158,7 +4667,11 @@ DEFUN (no_ipv6_route_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 6; + int idx_number_2 = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref, @@ -4174,8 +4687,12 @@ DEFUN (no_ipv6_route_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + /* We do not care about argv[idx_reject_blackhole]->arg */ + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_route_flags_pref_tag, @@ -4193,8 +4710,13 @@ DEFUN (no_ipv6_route_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + /* We do not care about argv[idx_reject_blackhole]->arg */ + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref, @@ -4208,7 +4730,11 @@ DEFUN (no_ipv6_route_ifname_pref, "IPv6 gateway interface name\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 6; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_route_ifname_pref_tag, @@ -4224,7 +4750,12 @@ DEFUN (no_ipv6_route_ifname_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 7; + int idx_number_2 = 8; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref, @@ -4240,7 +4771,12 @@ DEFUN (no_ipv6_route_ifname_flags_pref, "Silently discard pkts when matched\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_route_ifname_flags_pref_tag, @@ -4258,7 +4794,13 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, "Tag value\n" "Distance value for this prefix\n") { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, NULL); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_number_2 = 9; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_route_vrf, @@ -4271,7 +4813,10 @@ DEFUN (ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, NULL, argv[5]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_name = 5; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_tag_vrf, @@ -4286,7 +4831,11 @@ DEFUN (ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, NULL, argv[7]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 5; + int idx_name = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_flags_vrf, @@ -4301,7 +4850,11 @@ DEFUN (ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, NULL, argv[6]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_name = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_flags_tag_vrf, @@ -4318,7 +4871,12 @@ DEFUN (ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_name = 8; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_vrf, @@ -4331,7 +4889,11 @@ DEFUN (ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[6]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_name = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, @@ -4345,7 +4907,12 @@ DEFUN (ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 6; + int idx_name = 8; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_flags_vrf, @@ -4360,7 +4927,12 @@ DEFUN (ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[7]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_name = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_flags_tag_vrf, @@ -4377,7 +4949,13 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_name = 9; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (ipv6_route_pref_vrf, @@ -4391,7 +4969,11 @@ DEFUN (ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, NULL, argv[4]->arg, argv[6]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 4; + int idx_name = 6; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_pref_tag_vrf, @@ -4407,7 +4989,12 @@ DEFUN (ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, NULL, argv[5]->arg, argv[6]->arg, argv[8]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_number = 5; + int idx_number_2 = 6; + int idx_name = 8; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_flags_pref_vrf, @@ -4423,7 +5010,12 @@ DEFUN (ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 5; + int idx_name = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_flags_pref_tag_vrf, @@ -4441,7 +5033,13 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, NULL, argv[4]->arg, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6_ifname = 3; + int idx_reject_blackhole = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_pref_vrf, @@ -4455,7 +5053,12 @@ DEFUN (ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 5; + int idx_name = 7; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_pref_tag_vrf, @@ -4471,7 +5074,13 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_flags_pref_vrf, @@ -4487,7 +5096,13 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + int idx_name = 8; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, @@ -4505,7 +5120,14 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 1, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv6_prefixlen = 2; + int idx_ipv6 = 3; + int idx_interface = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_vrf, @@ -4519,7 +5141,10 @@ DEFUN (no_ipv6_route_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, NULL, argv[6]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_name = 6; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_tag_vrf, @@ -4535,7 +5160,11 @@ DEFUN (no_ipv6_route_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, NULL, argv[8]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 6; + int idx_name = 8; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_flags_vrf, @@ -4551,7 +5180,11 @@ DEFUN (no_ipv6_route_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, NULL, argv[7]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_name = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_flags_tag_vrf, @@ -4569,7 +5202,12 @@ DEFUN (no_ipv6_route_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_name = 9; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_vrf, @@ -4583,7 +5221,11 @@ DEFUN (no_ipv6_route_ifname_vrf, "IPv6 gateway interface name\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, NULL, argv[7]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_name = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_tag_vrf, @@ -4599,7 +5241,12 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, NULL, argv[9]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 7; + int idx_name = 9; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_flags_vrf, @@ -4615,7 +5262,12 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, "Silently discard pkts when matched\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, NULL, argv[8]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_name = 8; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_flags_tag_vrf, @@ -4633,7 +5285,13 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, "Tag value\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, NULL, argv[10]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_name = 10; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); } DEFUN (no_ipv6_route_pref_vrf, @@ -4648,7 +5306,11 @@ DEFUN (no_ipv6_route_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, NULL, argv[5]->arg, argv[7]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 5; + int idx_name = 7; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_pref_tag_vrf, @@ -4665,7 +5327,12 @@ DEFUN (no_ipv6_route_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, NULL, argv[6]->arg, argv[7]->arg, argv[9]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_number = 6; + int idx_number_2 = 7; + int idx_name = 9; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_flags_pref_vrf, @@ -4682,8 +5349,13 @@ DEFUN (no_ipv6_route_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 6; + int idx_name = 8; + /* We do not care about argv[idx_reject_blackhole]->arg */ + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_flags_pref_tag_vrf, @@ -4702,8 +5374,14 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* We do not care about argv[5]->arg */ - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, NULL, argv[5]->arg, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6_ifname = 4; + int idx_reject_blackhole = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + /* We do not care about argv[idx_reject_blackhole]->arg */ + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_pref_vrf, @@ -4718,7 +5396,12 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, NULL, argv[6]->arg, argv[8]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 6; + int idx_name = 8; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_pref_tag_vrf, @@ -4735,7 +5418,13 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, NULL, argv[7]->arg, argv[8]->arg, argv[10]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_number = 7; + int idx_number_2 = 8; + int idx_name = 10; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_vrf, @@ -4752,7 +5441,13 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, NULL, argv[7]->arg, argv[9]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 7; + int idx_name = 9; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); } DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, @@ -4771,7 +5466,14 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - return static_ipv6_func (vty, 0, argv[3]->arg, argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[8]->arg, argv[9]->arg, argv[11]->arg); + int idx_ipv6_prefixlen = 3; + int idx_ipv6 = 4; + int idx_interface = 5; + int idx_reject_blackhole = 6; + int idx_number = 8; + int idx_number_2 = 9; + int idx_name = 11; + return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); } /* @@ -4790,6 +5492,7 @@ DEFUN (show_ipv6_route, IP_STR "IPv6 routing table\n") { + int idx_json = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -4801,14 +5504,14 @@ DEFUN (show_ipv6_route, json_object *json_prefix = NULL; u_char uj = use_json(argc, argv); - if (argc > 0 && argv[3]->arg && strcmp(argv[3]->arg, "json") != 0) + if (argc > 0 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0) { - if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[3]->arg))) + if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[idx_json]->arg))) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s not defined%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "vrf %s not defined%s", argv[idx_json]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -4817,7 +5520,7 @@ DEFUN (show_ipv6_route, if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "vrf %s inactive%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "vrf %s inactive%s", argv[idx_json]->arg, VTY_NEWLINE); return CMD_SUCCESS; } else @@ -4898,6 +5601,7 @@ DEFUN (show_ipv6_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_number = 4; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -4907,11 +5611,11 @@ DEFUN (show_ipv6_route_tag, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[4]->arg); + VRF_GET_ID (vrf_id, argv[idx_number]->arg); tag = atoi(argv[1]); } else - tag = atoi(argv[4]->arg); + tag = atoi(argv[idx_number]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -4955,6 +5659,7 @@ DEFUN (show_ipv6_route_prefix_longer, "IPv6 prefix\n" "Show route matching the specified Network/Mask pair only\n") { + int idx_ipv6_prefixlen = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -4965,11 +5670,11 @@ DEFUN (show_ipv6_route_prefix_longer, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv6_prefixlen]->arg); ret = str2prefix (argv[1], &p); } else - ret = str2prefix (argv[3]->arg, &p); + ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p); if (! ret) { @@ -5015,6 +5720,7 @@ DEFUN (show_ipv6_route_protocol, "IP routing table\n" QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { + int idx_protocol = 3; int type; struct route_table *table; struct route_node *rn; @@ -5025,7 +5731,7 @@ DEFUN (show_ipv6_route_protocol, if ( argc >1 ) { VRF_GET_ID (vrf_id, argv[4]->arg); - type = proto_redistnum (AFI_IP6, argv[3]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); } else type = proto_redistnum (AFI_IP6, argv[4]->arg); @@ -5074,6 +5780,7 @@ DEFUN (show_ipv6_route_addr, "IPv6 routing table\n" "IPv6 Address\n") { + int idx_ipv6 = 3; int ret; struct prefix_ipv6 p; struct route_table *table; @@ -5082,11 +5789,11 @@ DEFUN (show_ipv6_route_addr, if (argc > 1 ) { - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv6]->arg); ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[3]->arg, &p); + ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p); if (ret <= 0) { @@ -5131,6 +5838,7 @@ DEFUN (show_ipv6_route_prefix, "IPv6 routing table\n" "IPv6 prefix\n") { + int idx_ipv6_prefixlen = 3; int ret; struct prefix_ipv6 p; struct route_table *table; @@ -5139,11 +5847,11 @@ DEFUN (show_ipv6_route_prefix, if (argc > 1) { - VRF_GET_ID (vrf_id, argv[3]->arg); + VRF_GET_ID (vrf_id, argv[idx_ipv6_prefixlen]->arg); ret = str2prefix_ipv6 (argv[1], &p); } else - ret = str2prefix_ipv6 (argv[3]->arg, &p); + ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p); if (ret <= 0) { @@ -5346,6 +6054,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_number = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -5355,8 +6064,8 @@ DEFUN (show_ipv6_route_vrf_all_tag, int vrf_header = 1; u_short tag = 0; - if (argv[6]->arg) - tag = atoi(argv[6]->arg); + if (argv[idx_number]->arg) + tag = atoi(argv[idx_number]->arg); for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) { @@ -5400,6 +6109,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, "IPv6 prefix\n" "Show route matching the specified Network/Mask pair only\n") { + int idx_ipv6_prefixlen = 5; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -5410,7 +6120,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, int first = 1; int vrf_header = 1; - ret = str2prefix (argv[5]->arg, &p); + ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p); if (! ret) { vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); @@ -5511,6 +6221,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, VRF_ALL_CMD_HELP_STR "IPv6 Address\n") { + int idx_ipv6 = 5; int ret; struct prefix_ipv6 p; struct route_table *table; @@ -5518,7 +6229,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[5]->arg, &p); + ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE); @@ -5552,6 +6263,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, VRF_ALL_CMD_HELP_STR "IPv6 prefix\n") { + int idx_ipv6_prefixlen = 5; int ret; struct prefix_ipv6 p; struct route_table *table; @@ -5559,7 +6271,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, struct zebra_vrf *zvrf; vrf_iter_t iter; - ret = str2prefix_ipv6 (argv[5]->arg, &p); + ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p); if (ret <= 0) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -5807,11 +6519,13 @@ DEFUN (ip_zebra_import_table_distance, "Distance for imported routes\n" "Default distance value\n") { + int idx_number = 2; + int idx_number_2 = 4; u_int32_t table_id = 0; int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; if (argc) - VTY_GET_INTEGER("table", table_id, argv[2]->arg); + VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5828,7 +6542,7 @@ DEFUN (ip_zebra_import_table_distance, } if (argc > 1) - VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255); + VTY_GET_INTEGER_RANGE("distance", distance, argv[idx_number_2]->arg, 1, 255); return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1)); } @@ -5855,12 +6569,15 @@ DEFUN (ip_zebra_import_table_distance_routemap, "route-map for filtering\n" "route-map name\n") { + int idx_number = 2; + int idx_number_2 = 4; + int idx_word = 6; u_int32_t table_id = 0; int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; const char *rmap_name; if (argc) - VTY_GET_INTEGER("table", table_id, argv[2]->arg); + VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -5878,11 +6595,11 @@ DEFUN (ip_zebra_import_table_distance_routemap, if (argc > 2) { - VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255); - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[6]->arg); + VTY_GET_INTEGER_RANGE("distance", distance, argv[idx_number_2]->arg, 1, 255); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[idx_word]->arg); } else - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[4]->arg); + rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[idx_number_2]->arg); return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); } @@ -5905,10 +6622,11 @@ DEFUN (no_ip_zebra_import_table, "import routes from non-main kernel table\n" "kernel routing table id\n") { + int idx_number = 3; u_int32_t table_id = 0; if (argc) - VTY_GET_INTEGER("table", table_id, argv[3]->arg); + VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); if (!is_zebra_valid_kernel_table(table_id)) { From c500ae4060d155ee9808d99e63450c6bac0f7dbd Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 19:45:50 +0000 Subject: [PATCH 123/280] bgpd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- bgpd/bgp_debug.c | 80 ++- bgpd/bgp_dump.c | 12 +- bgpd/bgp_filter.c | 32 +- bgpd/bgp_mplsvpn.c | 54 +- bgpd/bgp_nexthop.c | 6 +- bgpd/bgp_route.c | 873 +++++++++++++++--------- bgpd/bgp_routemap.c | 130 ++-- bgpd/bgp_vty.c | 1362 +++++++++++++++++++++++++------------- tools/argv_translator.py | 72 ++ 9 files changed, 1738 insertions(+), 883 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 89b970d97c..817a8e00a4 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -630,7 +630,8 @@ DEFUN (debug_bgp_neighbor_events_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[3]->arg; + int idx_peer = 3; + const char *host = argv[idx_peer]->arg; if (!bgp_debug_neighbor_events_peers) bgp_debug_neighbor_events_peers = list_new (); @@ -684,8 +685,9 @@ DEFUN (no_debug_bgp_neighbor_events_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { + int idx_peer = 4; int found_peer = 0; - const char *host = argv[4]->arg; + const char *host = argv[idx_peer]->arg; if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers)) { @@ -774,7 +776,8 @@ DEFUN (debug_bgp_keepalive_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[3]->arg; + int idx_peer = 3; + const char *host = argv[idx_peer]->arg; if (!bgp_debug_keepalive_peers) bgp_debug_keepalive_peers = list_new (); @@ -828,8 +831,9 @@ DEFUN (no_debug_bgp_keepalive_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { + int idx_peer = 4; int found_peer = 0; - const char *host = argv[4]->arg; + const char *host = argv[idx_peer]->arg; if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers)) { @@ -863,11 +867,12 @@ DEFUN (debug_bgp_bestpath_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 3; struct prefix *argv_p; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[3]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -881,7 +886,7 @@ DEFUN (debug_bgp_bestpath_prefix, if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -894,7 +899,7 @@ DEFUN (debug_bgp_bestpath_prefix, else { TERM_DEBUG_ON (bestpath, BESTPATH); - vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -911,12 +916,13 @@ DEFUN (no_debug_bgp_bestpath_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 4; struct prefix *argv_p; int found_prefix = 0; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[4]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -943,9 +949,9 @@ DEFUN (no_debug_bgp_bestpath_prefix, } if (found_prefix) - vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1005,22 +1011,23 @@ DEFUN (debug_bgp_update_direct, "Inbound updates\n" "Outbound updates\n") { + int idx_in_out = 3; - if (strncmp ("i", argv[3]->arg, 1) == 0) + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) bgp_debug_list_free(bgp_debug_update_in_peers); else bgp_debug_list_free(bgp_debug_update_out_peers); if (vty->node == CONFIG_NODE) { - if (strncmp ("i", argv[3]->arg, 1) == 0) + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) DEBUG_ON (update, UPDATE_IN); else DEBUG_ON (update, UPDATE_OUT); } else { - if (strncmp ("i", argv[3]->arg, 1) == 0) + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) { TERM_DEBUG_ON (update, UPDATE_IN); vty_out (vty, "BGP updates debugging is on (inbound)%s", VTY_NEWLINE); @@ -1046,7 +1053,9 @@ DEFUN (debug_bgp_update_direct_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { - const char *host = argv[4]->arg; + int idx_in_out = 3; + int idx_peer = 4; + const char *host = argv[idx_peer]->arg; int inbound; if (!bgp_debug_update_in_peers) @@ -1055,7 +1064,7 @@ DEFUN (debug_bgp_update_direct_peer, if (!bgp_debug_update_out_peers) bgp_debug_update_out_peers = list_new (); - if (strncmp ("i", argv[3]->arg, 1) == 0) + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) inbound = 1; else inbound = 0; @@ -1117,12 +1126,12 @@ DEFUN (debug_bgp_update_direct_peer, if (inbound) { TERM_DEBUG_ON (update, UPDATE_IN); - vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE); } else { TERM_DEBUG_ON (update, UPDATE_OUT); - vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE); } } return CMD_SUCCESS; @@ -1138,7 +1147,8 @@ DEFUN (no_debug_bgp_update_direct, "Inbound updates\n" "Outbound updates\n") { - if (strncmp ("i", argv[4]->arg, 1) == 0) + int idx_in_out = 4; + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) { bgp_debug_list_free(bgp_debug_update_in_peers); @@ -1183,11 +1193,13 @@ DEFUN (no_debug_bgp_update_direct_peer, "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { + int idx_in_out = 4; + int idx_peer = 5; int inbound; int found_peer = 0; - const char *host = argv[5]->arg; + const char *host = argv[idx_peer]->arg; - if (strncmp ("i", argv[4]->arg, 1) == 0) + if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) inbound = 1; else inbound = 0; @@ -1271,11 +1283,12 @@ DEFUN (debug_bgp_update_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 4; struct prefix *argv_p; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[4]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1289,7 +1302,7 @@ DEFUN (debug_bgp_update_prefix, if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1302,7 +1315,7 @@ DEFUN (debug_bgp_update_prefix, else { TERM_DEBUG_ON (update, UPDATE_PREFIX); - vty_out (vty, "BGP updates debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -1320,12 +1333,13 @@ DEFUN (no_debug_bgp_update_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 5; struct prefix *argv_p; int found_prefix = 0; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[5]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1352,9 +1366,9 @@ DEFUN (no_debug_bgp_update_prefix, } if (found_prefix) - vty_out (vty, "BGP updates debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1418,11 +1432,12 @@ DEFUN (debug_bgp_zebra_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 4; struct prefix *argv_p; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[4]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1435,7 +1450,7 @@ DEFUN (debug_bgp_zebra_prefix, if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p)) { - vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1446,7 +1461,7 @@ DEFUN (debug_bgp_zebra_prefix, else { TERM_DEBUG_ON (zebra, ZEBRA); - vty_out (vty, "BGP zebra debugging is on for %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); } return CMD_SUCCESS; @@ -1484,12 +1499,13 @@ DEFUN (no_debug_bgp_zebra_prefix, "IPv6 prefix /\n") { + int idx_ipv4_ipv6_prefixlen = 5; struct prefix *argv_p; int found_prefix = 0; int ret; argv_p = prefix_new(); - ret = str2prefix (argv[5]->arg, argv_p); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p); if (!ret) { prefix_free(argv_p); @@ -1514,9 +1530,9 @@ DEFUN (no_debug_bgp_zebra_prefix, } if (found_prefix) - vty_out (vty, "BGP zebra debugging is off for %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); else - vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE); return CMD_SUCCESS; } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index c5fc052009..48c43b7f6e 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -736,13 +736,16 @@ DEFUN (dump_bgp_all, "Output filename\n" "Interval of output\n") { + int idx_dump_routes = 2; + int idx_path = 3; + int idx_interval = 4; int bgp_dump_type = 0; const char *interval = NULL; struct bgp_dump *bgp_dump_struct = NULL; const struct bgp_dump_type_map *map = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[2]->arg, map->str) == 0) + if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0) bgp_dump_type = map->type; switch (bgp_dump_type) @@ -763,10 +766,10 @@ DEFUN (dump_bgp_all, /* When an interval is given */ if (argc == 3) - interval = argv[4]->arg; + interval = argv[idx_interval]->arg; return bgp_dump_set (vty, bgp_dump_struct, bgp_dump_type, - argv[3]->arg, interval); + argv[idx_path]->arg, interval); } DEFUN (no_dump_bgp_all, @@ -781,12 +784,13 @@ DEFUN (no_dump_bgp_all, "Stop dump process updates-et\n" "Stop dump process route-mrt\n") { + int idx_dump_routes = 3; int bgp_dump_type = 0; const struct bgp_dump_type_map *map = NULL; struct bgp_dump *bgp_dump_struct = NULL; for (map = bgp_dump_type_map; map->str; map++) - if (strcmp(argv[3]->arg, map->str) == 0) + if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0) bgp_dump_type = map->type; switch (bgp_dump_type) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 6a39d02174..05d5eafae6 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -437,6 +437,8 @@ DEFUN (ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { + int idx_word = 3; + int idx_permit_deny = 4; enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; @@ -444,9 +446,9 @@ DEFUN (ip_as_path, char *regstr; /* Check the filter type. */ - if (strncmp (argv[4]->arg, "p", 1) == 0) + if (strncmp (argv[idx_permit_deny]->arg, "p", 1) == 0) type = AS_FILTER_PERMIT; - else if (strncmp (argv[4]->arg, "d", 1) == 0) + else if (strncmp (argv[idx_permit_deny]->arg, "d", 1) == 0) type = AS_FILTER_DENY; else { @@ -461,7 +463,7 @@ DEFUN (ip_as_path, if (!regex) { XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[3]->arg, + vty_out (vty, "can't compile regexp %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -471,7 +473,7 @@ DEFUN (ip_as_path, XFREE (MTYPE_TMP, regstr); /* Install new filter to the access_list. */ - aslist = as_list_get (argv[3]->arg); + aslist = as_list_get (argv[idx_word]->arg); /* Duplicate insertion check. */; if (as_list_dup_check (aslist, asfilter)) @@ -494,6 +496,8 @@ DEFUN (no_ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { + int idx_word = 4; + int idx_permit_deny = 5; enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; @@ -501,18 +505,18 @@ DEFUN (no_ip_as_path, regex_t *regex; /* Lookup AS list from AS path list. */ - aslist = as_list_lookup (argv[4]->arg); + aslist = as_list_lookup (argv[idx_word]->arg); if (aslist == NULL) { - vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg, + vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } /* Check the filter type. */ - if (strncmp (argv[5]->arg, "p", 1) == 0) + if (strncmp (argv[idx_permit_deny]->arg, "p", 1) == 0) type = AS_FILTER_PERMIT; - else if (strncmp (argv[5]->arg, "d", 1) == 0) + else if (strncmp (argv[idx_permit_deny]->arg, "d", 1) == 0) type = AS_FILTER_DENY; else { @@ -527,7 +531,7 @@ DEFUN (no_ip_as_path, if (!regex) { XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[4]->arg, + vty_out (vty, "can't compile regexp %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -558,12 +562,13 @@ DEFUN (no_ip_as_path_all, "Specify an access list name\n" "Regular expression access list name\n") { + int idx_word = 4; struct as_list *aslist; - aslist = as_list_lookup (argv[4]->arg); + aslist = as_list_lookup (argv[idx_word]->arg); if (aslist == NULL) { - vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[4]->arg, + vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -572,7 +577,7 @@ DEFUN (no_ip_as_path_all, /* Run hook function. */ if (as_list_master.delete_hook) - (*as_list_master.delete_hook) (argv[4]->arg); + (*as_list_master.delete_hook) (argv[idx_word]->arg); return CMD_SUCCESS; } @@ -628,9 +633,10 @@ DEFUN (show_ip_as_path_access_list, "List AS path access lists\n" "AS path access list name\n") { + int idx_word = 3; struct as_list *aslist; - aslist = as_list_lookup (argv[3]->arg); + aslist = as_list_lookup (argv[idx_word]->arg); if (aslist) as_list_show (vty, aslist); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 629cfffb30..48baedcea5 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -360,7 +360,10 @@ DEFUN (vpnv4_network, "BGP tag\n" "tag value\n") { - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, NULL); + int idx_ipv4_prefixlen = 1; + int idx_ext_community = 3; + int idx_word = 5; + return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL); } DEFUN (vpnv4_network_route_map, @@ -375,7 +378,11 @@ DEFUN (vpnv4_network_route_map, "route map\n" "route map name\n") { - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[1]->arg, argv[3]->arg, argv[5]->arg, argv[7]->arg); + int idx_ipv4_prefixlen = 1; + int idx_ext_community = 3; + int idx_word = 5; + int idx_word_2 = 7; + return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg); } /* For testing purpose, static route of MPLS-VPN. */ @@ -390,7 +397,10 @@ DEFUN (no_vpnv4_network, "BGP tag\n" "tag value\n") { - return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[2]->arg, argv[4]->arg, argv[6]->arg); + int idx_ipv4_prefixlen = 2; + int idx_ext_community = 4; + int idx_word = 6; + return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg); } static int @@ -791,10 +801,11 @@ DEFUN (show_bgp_ipv4_vpn_rd, "VPN Route Distinguisher\n" JSON_STR) { + int idx_ext_community = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -814,10 +825,11 @@ DEFUN (show_bgp_ipv6_vpn_rd, "VPN Route Distinguisher\n" JSON_STR) { + int idx_ext_community = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (!ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -849,10 +861,11 @@ DEFUN (show_ip_bgp_vpnv4_rd, "Display information for a route distinguisher\n" "VPN Route Distinguisher\n") { + int idx_ext_community = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -885,10 +898,11 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, "VPN Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_ext_community = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -910,12 +924,13 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_ipv4 = 6; union sockunion su; struct peer *peer; int ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[6]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) @@ -927,7 +942,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -964,13 +979,15 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_ext_community = 5; + int idx_ipv4 = 7; int ret; union sockunion su; struct peer *peer; struct prefix_rd prd; u_char uj = use_json(argc, argv); - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { if (uj) @@ -986,7 +1003,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, return CMD_WARNING; } - ret = str2sockunion (argv[7]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) @@ -998,7 +1015,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1034,12 +1051,13 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_ipv4 = 6; int ret; struct peer *peer; union sockunion su; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[6]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) @@ -1051,7 +1069,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[6]->arg, VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -1087,13 +1105,15 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_ext_community = 5; + int idx_ipv4 = 7; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[7]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { if (uj) @@ -1105,7 +1125,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, json_object_free(json_no); } else - vty_out (vty, "Malformed address: %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -1124,7 +1144,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { if (uj) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index caecd80e6e..e648af91e7 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -520,7 +520,8 @@ DEFUN (show_ip_bgp_instance_nexthop, BGP_INSTANCE_HELP_STR "BGP nexthop table\n") { - return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 0); + int idx_word = 4; + return show_ip_bgp_nexthop_table (vty, argv[idx_word]->arg, 0); } DEFUN (show_ip_bgp_instance_all_nexthop, @@ -545,7 +546,8 @@ DEFUN (show_ip_bgp_instance_nexthop_detail, BGP_INSTANCE_HELP_STR "BGP nexthop table\n") { - return show_ip_bgp_nexthop_table (vty, argv[4]->arg, 1); + int idx_word = 4; + return show_ip_bgp_nexthop_table (vty, argv[idx_word]->arg, 1); } void diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d0eff6e206..6238f28dda 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4264,8 +4264,9 @@ DEFUN (bgp_table_map, "BGP table to RIB route download filter\n" "Name of the route map\n") { + int idx_word = 1; return bgp_table_map_set (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[1]->arg); + bgp_node_afi (vty), bgp_node_safi (vty), argv[idx_word]->arg); } DEFUN (no_bgp_table_map, no_bgp_table_map_cmd, @@ -4273,8 +4274,9 @@ DEFUN (no_bgp_table_map, "BGP table to RIB route download filter\n" "Name of the route map\n") { + int idx_word = 2; return bgp_table_map_unset (vty, vty->index, - bgp_node_afi (vty), bgp_node_safi (vty), argv[2]->arg); + bgp_node_afi (vty), bgp_node_safi (vty), argv[idx_word]->arg); } DEFUN (bgp_network, @@ -4283,7 +4285,8 @@ DEFUN (bgp_network, "Specify a network to announce via BGP\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_static_set (vty, vty->index, argv[1]->arg, + int idx_ipv4_prefixlen = 1; + return bgp_static_set (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), NULL, 0); } @@ -4295,8 +4298,10 @@ DEFUN (bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[1]->arg, - AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); + int idx_ipv4_prefixlen = 1; + int idx_word = 3; + return bgp_static_set (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, + AFI_IP, bgp_node_safi (vty), argv[idx_word]->arg, 0); } DEFUN (bgp_network_backdoor, @@ -4306,7 +4311,8 @@ DEFUN (bgp_network_backdoor, "IP prefix /, e.g., 35.0.0.0/8\n" "Specify a BGP backdoor route\n") { - return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP, SAFI_UNICAST, + int idx_ipv4_prefixlen = 1; + return bgp_static_set (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -4318,10 +4324,12 @@ DEFUN (bgp_network_mask, "Network mask\n" "Network mask\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 3; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4342,10 +4350,13 @@ DEFUN (bgp_network_mask_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 3; + int idx_word = 5; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4353,7 +4364,7 @@ DEFUN (bgp_network_mask_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[5]->arg, 0); + AFI_IP, bgp_node_safi (vty), argv[idx_word]->arg, 0); } DEFUN (bgp_network_mask_backdoor, @@ -4365,10 +4376,12 @@ DEFUN (bgp_network_mask_backdoor, "Network mask\n" "Specify a BGP backdoor route\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 3; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[3]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4385,10 +4398,11 @@ DEFUN (bgp_network_mask_natural, "Specify a network to announce via BGP\n" "Network number\n") { + int idx_ipv4 = 1; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4407,10 +4421,12 @@ DEFUN (bgp_network_mask_natural_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { + int idx_ipv4 = 1; + int idx_word = 3; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4418,7 +4434,7 @@ DEFUN (bgp_network_mask_natural_route_map, } return bgp_static_set (vty, vty->index, prefix_str, - AFI_IP, bgp_node_safi (vty), argv[3]->arg, 0); + AFI_IP, bgp_node_safi (vty), argv[idx_word]->arg, 0); } DEFUN (bgp_network_mask_natural_backdoor, @@ -4428,10 +4444,11 @@ DEFUN (bgp_network_mask_natural_backdoor, "Network number\n" "Specify a BGP backdoor route\n") { + int idx_ipv4 = 1; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, NULL, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4465,7 +4482,8 @@ DEFUN (no_bgp_network, "Specify a network to announce via BGP\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP, + int idx_ipv4_prefixlen = 2; + return bgp_static_unset (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty)); } @@ -4500,10 +4518,12 @@ DEFUN (no_bgp_network_mask, "Network mask\n" "Network mask\n") { + int idx_ipv4 = 2; + int idx_ipv4_2 = 4; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[2]->arg, argv[4]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4539,10 +4559,11 @@ DEFUN (no_bgp_network_mask_natural, "Specify a network to announce via BGP\n" "Network number\n") { + int idx_ipv4 = 2; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[2]->arg, NULL, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); @@ -4571,7 +4592,8 @@ DEFUN (ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix /\n") { - return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, bgp_node_safi(vty), + int idx_ipv6_prefixlen = 1; + return bgp_static_set (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, bgp_node_safi(vty), NULL, 0); } @@ -4583,8 +4605,10 @@ DEFUN (ipv6_bgp_network_route_map, "Route-map to modify the attributes\n" "Name of the route map\n") { - return bgp_static_set (vty, vty->index, argv[1]->arg, AFI_IP6, - bgp_node_safi (vty), argv[3]->arg, 0); + int idx_ipv6_prefixlen = 1; + int idx_word = 3; + return bgp_static_set (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, + bgp_node_safi (vty), argv[idx_word]->arg, 0); } /* @@ -4611,7 +4635,8 @@ DEFUN (no_ipv6_bgp_network, "Specify a network to announce via BGP\n" "IPv6 prefix /\n") { - return bgp_static_unset (vty, vty->index, argv[2]->arg, AFI_IP6, bgp_node_safi(vty)); + int idx_ipv6_prefixlen = 2; + return bgp_static_unset (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, bgp_node_safi(vty)); } @@ -5225,7 +5250,8 @@ DEFUN (aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), 0, 0); + int idx_ipv4_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), 0, 0); } DEFUN (aggregate_address_mask, @@ -5235,10 +5261,12 @@ DEFUN (aggregate_address_mask, "Aggregate address\n" "Aggregate mask\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 2; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { @@ -5257,7 +5285,8 @@ DEFUN (aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), + int idx_ipv4_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, 0); } @@ -5269,10 +5298,12 @@ DEFUN (aggregate_address_mask_summary_only, "Aggregate mask\n" "Filter more specific routes from updates\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 2; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { @@ -5291,7 +5322,8 @@ DEFUN (aggregate_address_as_set, "Aggregate prefix\n" "Generate AS set path information\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), + int idx_ipv4_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), 0, AGGREGATE_AS_SET); } @@ -5303,10 +5335,12 @@ DEFUN (aggregate_address_mask_as_set, "Aggregate mask\n" "Generate AS set path information\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 2; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { @@ -5336,7 +5370,8 @@ DEFUN (aggregate_address_as_set_summary, "Generate AS set path information\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP, bgp_node_safi (vty), + int idx_ipv4_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } @@ -5360,10 +5395,12 @@ DEFUN (aggregate_address_mask_as_set_summary, "Generate AS set path information\n" "Filter more specific routes from updates\n") { + int idx_ipv4 = 1; + int idx_ipv4_2 = 2; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[1]->arg, argv[2]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { @@ -5412,7 +5449,8 @@ DEFUN (no_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP, bgp_node_safi (vty)); + int idx_ipv4_prefixlen = 2; + return bgp_aggregate_unset (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty)); } @@ -5460,10 +5498,12 @@ DEFUN (no_aggregate_address_mask, "Aggregate address\n" "Aggregate mask\n") { + int idx_ipv4 = 2; + int idx_ipv4_2 = 3; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[2]->arg, argv[3]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { @@ -5494,7 +5534,8 @@ DEFUN (ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); + int idx_ipv6_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); } /* @@ -5514,7 +5555,8 @@ DEFUN (ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_set (vty, argv[1]->arg, AFI_IP6, SAFI_UNICAST, + int idx_ipv6_prefixlen = 1; + return bgp_aggregate_set (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, AGGREGATE_SUMMARY_ONLY, 0); } @@ -5535,7 +5577,8 @@ DEFUN (no_ipv6_aggregate_address, "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); + int idx_ipv6_prefixlen = 2; + return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); } /* @@ -5557,7 +5600,8 @@ DEFUN (no_ipv6_aggregate_address_summary_only, "Aggregate prefix\n" "Filter more specific routes from updates\n") { - return bgp_aggregate_unset (vty, argv[2]->arg, AFI_IP6, SAFI_UNICAST); + int idx_ipv6_prefixlen = 2; + return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); } @@ -7972,9 +8016,10 @@ DEFUN (show_ip_bgp_ipv4, "Address Family modifier\n" "JavaScript Object Notation\n") { + int idx_safi = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -7991,7 +8036,8 @@ DEFUN (show_ip_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv4 = 3; + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_route_pathtype, @@ -8005,12 +8051,14 @@ DEFUN (show_ip_bgp_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_ipv4 = 3; + int idx_bestpath = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_safi_route_pathtype, @@ -8026,18 +8074,21 @@ DEFUN (show_bgp_ipv4_safi_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_safi = 3; + int idx_ipv4 = 4; + int idx_bestpath = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_bgp_ipv4_prefix, @@ -8049,7 +8100,8 @@ DEFUN (show_bgp_ipv4_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); + int idx_ipv4_prefixlen = 3; + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_route, @@ -8061,7 +8113,8 @@ DEFUN (show_bgp_ipv6_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + int idx_ipv6 = 3; + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_prefix, @@ -8073,7 +8126,8 @@ DEFUN (show_bgp_ipv6_prefix, "IPv6 prefix /\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); + int idx_ipv6_prefixlen = 3; + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); } /* @@ -8100,12 +8154,14 @@ DEFUN (show_ip_bgp_ipv4_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_ipv4 = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } @@ -8120,7 +8176,8 @@ DEFUN (show_ip_bgp_vpnv4_all_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv4 = 5; + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv4_vpn_route, @@ -8133,7 +8190,8 @@ DEFUN (show_bgp_ipv4_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + int idx_ipv4 = 4; + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_route, @@ -8146,7 +8204,8 @@ DEFUN (show_bgp_ipv6_vpn_route, "Network in the BGP routing table to display\n" JSON_STR) { - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); + int idx_ipv6 = 4; + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv4_vpn_rd_route, @@ -8161,16 +8220,18 @@ DEFUN (show_bgp_ipv4_vpn_rd_route, "Network in the BGP routing table to display\n" JSON_STR) { + int idx_ext_community = 5; + int idx_ipv4 = 6; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn_rd_route, @@ -8185,16 +8246,18 @@ DEFUN (show_bgp_ipv6_vpn_rd_route, "Network in the BGP routing table to display\n" JSON_STR) { + int idx_ext_community = 5; + int idx_ipv6 = 6; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_route, @@ -8209,17 +8272,19 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { + int idx_ext_community = 5; + int idx_ipv4 = 6; int ret; struct prefix_rd prd; u_char uj= use_json(argc, argv); - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); } DEFUN (show_ip_bgp_prefix, @@ -8231,7 +8296,8 @@ DEFUN (show_ip_bgp_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv4_prefixlen = 3; + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_prefix_pathtype, @@ -8245,11 +8311,13 @@ DEFUN (show_ip_bgp_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_ipv4_prefixlen = 3; + int idx_bestpath = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } /* @@ -8276,12 +8344,14 @@ DEFUN (show_ip_bgp_ipv4_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_ipv4_prefixlen = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } @@ -8313,18 +8383,21 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_ipv4_prefixlen = 5; + int idx_bestpath = 6; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "m", 1) == 0) - if (strncmp (argv[6]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[6]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } @@ -8339,7 +8412,8 @@ DEFUN (show_ip_bgp_vpnv4_all_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv4_prefixlen = 5; + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_vpnv4_rd_prefix, @@ -8354,16 +8428,18 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { + int idx_ext_community = 5; + int idx_ipv4_prefixlen = 6; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - return bgp_show_route (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_view, @@ -8375,13 +8451,14 @@ DEFUN (show_ip_bgp_view, BGP_INSTANCE_HELP_STR "JavaScript Object Notation\n") { + int idx_word = 4; struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[4]->arg); + bgp = bgp_lookup_by_name (argv[idx_word]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8413,7 +8490,9 @@ DEFUN (show_ip_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + int idx_word = 4; + int idx_ipv4 = 5; + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_route_pathtype, @@ -8428,12 +8507,15 @@ DEFUN (show_ip_bgp_instance_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_ipv4 = 5; + int idx_bestpath = 6; u_char uj = use_json(argc, argv); - if (strncmp (argv[6]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } DEFUN (show_ip_bgp_instance_prefix, @@ -8446,7 +8528,9 @@ DEFUN (show_ip_bgp_instance_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + int idx_word = 4; + int idx_ipv4_prefixlen = 5; + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_ip_bgp_instance_prefix_pathtype, @@ -8461,11 +8545,14 @@ DEFUN (show_ip_bgp_instance_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_ipv4_prefixlen = 5; + int idx_bestpath = 6; u_char uj = use_json(argc, argv); - if (strncmp (argv[6]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } #ifdef HAVE_IPV6 @@ -8500,8 +8587,9 @@ DEFUN (show_bgp_ipv6_safi, "Address Family modifier\n" "JavaScript Object Notation\n") { + int idx_safi = 3; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, NULL, uj); @@ -8538,7 +8626,8 @@ DEFUN (show_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv6 = 2; + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_route, @@ -8552,11 +8641,13 @@ DEFUN (show_bgp_ipv6_safi_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { + int idx_safi = 3; + int idx_ipv6 = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); } /* @@ -8581,11 +8672,13 @@ DEFUN (show_bgp_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_ipv6 = 2; + int idx_bestpath = 3; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } @@ -8602,17 +8695,20 @@ DEFUN (show_bgp_ipv6_safi_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_safi = 3; + int idx_ipv6 = 4; + int idx_bestpath = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8625,8 +8721,9 @@ DEFUN (show_ipv6_bgp_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { + int idx_ipv6 = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_prefix, @@ -8637,7 +8734,8 @@ DEFUN (show_bgp_prefix, "IPv6 prefix /\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + int idx_ipv6_prefixlen = 2; + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } DEFUN (show_bgp_ipv6_safi_prefix, @@ -8651,11 +8749,13 @@ DEFUN (show_bgp_ipv6_safi_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "JavaScript Object Notation\n") { + int idx_safi = 3; + int idx_ipv6_prefixlen = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); } /* @@ -8680,11 +8780,13 @@ DEFUN (show_bgp_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_ipv6_prefixlen = 2; + int idx_bestpath = 3; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } @@ -8701,17 +8803,20 @@ DEFUN (show_bgp_ipv6_safi_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_safi = 3; + int idx_ipv6_prefixlen = 4; + int idx_bestpath = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); else - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } /* old command */ @@ -8724,8 +8829,9 @@ DEFUN (show_ipv6_bgp_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "JavaScript Object Notation\n") { + int idx_ipv6_prefixlen = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } /* @@ -8746,13 +8852,14 @@ DEFUN (show_bgp_view, BGP_INSTANCE_HELP_STR "JavaScript Object Notation\n") { + int idx_word = 3; struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[3]->arg); + bgp = bgp_lookup_by_name (argv[idx_word]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -8794,7 +8901,9 @@ DEFUN (show_bgp_instance_route, "Network in the BGP routing table to display\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + int idx_word = 3; + int idx_ipv6 = 4; + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } @@ -8822,11 +8931,14 @@ DEFUN (show_bgp_instance_route_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_ipv6 = 4; + int idx_bestpath = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); } @@ -8850,7 +8962,9 @@ DEFUN (show_bgp_instance_prefix, "IPv6 prefix /\n" "JavaScript Object Notation\n") { - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } @@ -8878,11 +8992,14 @@ DEFUN (show_bgp_instance_prefix_pathtype, "Display only multipaths\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + int idx_bestpath = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[5]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); + if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); else - return bgp_show_route (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); + return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); } @@ -8906,7 +9023,9 @@ DEFUN (show_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + int idx_word_2 = 5; + return bgp_show_prefix_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -8931,7 +9050,9 @@ DEFUN (show_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + int idx_word_2 = 5; + return bgp_show_filter_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -8956,7 +9077,9 @@ DEFUN (show_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[3]->arg, argv[5]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + int idx_word_2 = 5; + return bgp_show_route_map (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -8983,7 +9106,9 @@ DEFUN (show_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[3]->arg, argv[5]->arg, 0, AFI_IP6, SAFI_UNICAST); + int idx_word = 3; + int idx_comm_list = 5; + return bgp_show_community_list (vty, argv[idx_word]->arg, argv[idx_comm_list]->arg, 0, AFI_IP6, SAFI_UNICAST); } @@ -9007,7 +9132,9 @@ DEFUN (show_bgp_instance_prefix_longer, "IPv6 prefix /\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return bgp_show_prefix_longer (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -9036,8 +9163,9 @@ DEFUN (show_ipv6_mbgp_route, "Network in the MBGP routing table to display\n" "JavaScript Object Notation\n") { + int idx_ipv6 = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } /* old command */ @@ -9050,8 +9178,9 @@ DEFUN (show_ipv6_mbgp_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "JavaScript Object Notation\n") { + int idx_ipv6_prefixlen = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); + return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); } #endif @@ -9153,7 +9282,8 @@ DEFUN (show_ip_bgp_ipv4_regexp, "Display routes matching the AS path regular expression\n" "A regular-expression to match the BGP AS paths\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_MULTICAST, bgp_show_type_regexp); @@ -9250,7 +9380,8 @@ DEFUN (show_ip_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9264,7 +9395,9 @@ DEFUN (show_ip_bgp_instance_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + int idx_word_2 = 6; + return bgp_show_prefix_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9290,7 +9423,8 @@ DEFUN (show_ip_bgp_flap_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 5; + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_list); } @@ -9307,11 +9441,13 @@ DEFUN (show_ip_bgp_ipv4_prefix_list, "Display routes conforming to the prefix-list\n" "IP prefix-list name\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, + int idx_safi = 4; + int idx_word = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_list); - return bgp_show_prefix_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9334,7 +9470,8 @@ DEFUN (show_bgp_prefix_list, "Display routes conforming to the prefix-list\n" "IPv6 prefix-list name\n") { - return bgp_show_prefix_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9349,8 +9486,9 @@ DEFUN (show_ipv6_bgp_prefix_list, "Display routes matching the prefix-list\n" "IPv6 prefix-list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_list); } @@ -9364,8 +9502,9 @@ DEFUN (show_ipv6_mbgp_prefix_list, "Display routes matching the prefix-list\n" "IPv6 prefix-list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_list); } #endif /* HAVE_IPV6 */ @@ -9403,7 +9542,8 @@ DEFUN (show_ip_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9417,7 +9557,9 @@ DEFUN (show_ip_bgp_instance_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + int idx_word_2 = 6; + return bgp_show_filter_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9443,7 +9585,8 @@ DEFUN (show_ip_bgp_flap_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 5; + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_filter_list); } @@ -9460,11 +9603,13 @@ DEFUN (show_ip_bgp_ipv4_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, + int idx_safi = 4; + int idx_word = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_filter_list); - return bgp_show_filter_list (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9487,7 +9632,8 @@ DEFUN (show_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { - return bgp_show_filter_list (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9502,8 +9648,9 @@ DEFUN (show_ipv6_bgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_UNICAST, + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_filter_list); } @@ -9517,8 +9664,9 @@ DEFUN (show_ipv6_mbgp_filter_list, "Display routes conforming to the filter-list\n" "Regular expression access list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[4]->arg, AFI_IP6, SAFI_MULTICAST, + return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_filter_list); } #endif /* HAVE_IPV6 */ @@ -9548,7 +9696,8 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, "Display detailed information about dampening\n" "Display detail of configured dampening parameters\n") { - if (strncmp(argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp(argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_MULTICAST); return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST); @@ -9567,7 +9716,8 @@ DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, "Display detailed information about dampening\n" "Display flap statistics of routes\n") { - if (strncmp(argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp(argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_flap_statistics, NULL, 0); @@ -9587,7 +9737,8 @@ DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, "Display detailed information about dampening\n" "Display paths suppressed due to dampening\n") { - if (strncmp(argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp(argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_dampend_paths, NULL, 0); @@ -9629,7 +9780,8 @@ DEFUN (show_ip_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9643,7 +9795,9 @@ DEFUN (show_ip_bgp_instance_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, argv[4]->arg, argv[6]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + int idx_word_2 = 6; + return bgp_show_route_map (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9669,7 +9823,8 @@ DEFUN (show_ip_bgp_flap_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 5; + return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_route_map); } @@ -9686,11 +9841,13 @@ DEFUN (show_ip_bgp_ipv4_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_MULTICAST, + int idx_safi = 4; + int idx_word = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_route_map); - return bgp_show_route_map (vty, NULL, argv[6]->arg, AFI_IP, SAFI_UNICAST, + return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9712,7 +9869,8 @@ DEFUN (show_bgp_route_map, "Display routes matching the route-map\n" "A route-map to match on\n") { - return bgp_show_route_map (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, + int idx_word = 3; + return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_route_map); } @@ -9765,7 +9923,8 @@ DEFUN (show_ip_bgp_ipv4_cidr_only, "Address Family modifier\n" "Display only routes with non-natural netmasks\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_cidr_only, NULL, 0); @@ -9796,7 +9955,8 @@ DEFUN (show_ip_bgp_ipv4_community_all, "Address Family modifier\n" "Display routes matching the communities\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_community_all, NULL, 0); @@ -10074,7 +10234,8 @@ DEFUN (show_ip_bgp_ipv4_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); @@ -10095,20 +10256,23 @@ DEFUN (show_bgp_instance_afi_safi_community_all, "Address Family modifier\n" "Display routes matching the communities\n") { + int idx_word = 3; + int idx_afi = 4; + int idx_safi = 5; int afi; int safi; struct bgp *bgp; /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[3]->arg); + bgp = bgp_lookup_by_name (argv[idx_word]->arg); if (bgp == NULL) { - vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } - afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0); } @@ -10197,12 +10361,15 @@ DEFUN (show_bgp_instance_afi_safi_community, "Do not advertise to any peer (well-known community)\n" "Do not export to next AS (well-known community)\n") { + int idx_word = 3; + int idx_afi = 4; + int idx_safi = 5; int afi; int safi; - afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_community (vty, argv[3]->arg, argc, argv, 0, afi, safi); + afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + return bgp_show_community (vty, argv[idx_word]->arg, argc, argv, 0, afi, safi); } @@ -10372,7 +10539,8 @@ DEFUN (show_ip_bgp_ipv4_community_exact, "Do not export to next AS (well-known community)\n" "Exact match of the communities") { - if (strncmp (argv[4]->arg, "m", 1) == 0) + int idx_safi = 4; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_MULTICAST); return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); @@ -11034,7 +11202,8 @@ DEFUN (show_ip_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP, SAFI_UNICAST); + int idx_comm_list = 4; + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_instance_community_list, @@ -11048,7 +11217,9 @@ DEFUN (show_ip_bgp_instance_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, argv[4]->arg, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); + int idx_word = 4; + int idx_comm_list = 6; + return bgp_show_community_list (vty, argv[idx_word]->arg, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list, @@ -11064,10 +11235,12 @@ DEFUN (show_ip_bgp_ipv4_community_list, "community-list number\n" "community-list name\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_MULTICAST); + int idx_safi = 4; + int idx_comm_list = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[6]->arg, 0, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_community_list_exact, @@ -11081,7 +11254,8 @@ DEFUN (show_ip_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP, SAFI_UNICAST); + int idx_comm_list = 4; + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_UNICAST); } DEFUN (show_ip_bgp_ipv4_community_list_exact, @@ -11098,10 +11272,12 @@ DEFUN (show_ip_bgp_ipv4_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_MULTICAST); + int idx_safi = 4; + int idx_comm_list = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_MULTICAST); - return bgp_show_community_list (vty, NULL, argv[6]->arg, 1, AFI_IP, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_UNICAST); } #ifdef HAVE_IPV6 @@ -11125,7 +11301,8 @@ DEFUN (show_bgp_community_list, "community-list number\n" "community-list name\n") { - return bgp_show_community_list (vty, NULL, argv[3]->arg, 0, AFI_IP6, SAFI_UNICAST); + int idx_comm_list = 3; + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP6, SAFI_UNICAST); } @@ -11139,8 +11316,9 @@ DEFUN (show_ipv6_bgp_community_list, "Display routes matching the community-list\n" "community-list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 0, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11153,8 +11331,9 @@ DEFUN (show_ipv6_mbgp_community_list, "Display routes matching the community-list\n" "community-list name\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[4]->arg, 0, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 0, AFI_IP6, SAFI_MULTICAST); } /* @@ -11179,7 +11358,8 @@ DEFUN (show_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { - return bgp_show_community_list (vty, NULL, argv[3]->arg, 1, AFI_IP6, SAFI_UNICAST); + int idx_comm_list = 3; + return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP6, SAFI_UNICAST); } @@ -11194,8 +11374,9 @@ DEFUN (show_ipv6_bgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_UNICAST); + return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 1, AFI_IP6, SAFI_UNICAST); } /* old command */ @@ -11209,8 +11390,9 @@ DEFUN (show_ipv6_mbgp_community_list_exact, "community-list name\n" "Exact match of the communities\n") { + int idx_word = 4; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[4]->arg, 1, AFI_IP6, SAFI_MULTICAST); + return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 1, AFI_IP6, SAFI_MULTICAST); } #endif /* HAVE_IPV6 */ @@ -11252,7 +11434,8 @@ DEFUN (show_ip_bgp_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP, SAFI_UNICAST, + int idx_ipv4_prefixlen = 3; + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11266,7 +11449,9 @@ DEFUN (show_ip_bgp_instance_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, argv[4]->arg, argv[5]->arg, AFI_IP, SAFI_UNICAST, + int idx_word = 4; + int idx_ipv4_prefixlen = 5; + return bgp_show_prefix_longer (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11292,7 +11477,8 @@ DEFUN (show_ip_bgp_flap_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_ipv4_prefixlen = 4; + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix_longer); } @@ -11309,11 +11495,13 @@ DEFUN (show_ip_bgp_ipv4_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Display route and more specific routes\n") { - if (strncmp (argv[4]->arg, "m", 1) == 0) - return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_MULTICAST, + int idx_safi = 4; + int idx_ipv4_prefixlen = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, bgp_show_type_prefix_longer); - return bgp_show_prefix_longer (vty, NULL, argv[5]->arg, AFI_IP, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11337,7 +11525,8 @@ DEFUN (show_ip_bgp_flap_address, "Display flap statistics of routes\n" "Network in the BGP routing table to display\n") { - return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_ipv4 = 4; + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_address); } @@ -11362,7 +11551,8 @@ DEFUN (show_ip_bgp_flap_prefix, "Display flap statistics of routes\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_show_prefix_longer (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, + int idx_ipv4_prefixlen = 4; + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, bgp_show_type_flap_prefix); } @@ -11386,7 +11576,8 @@ DEFUN (show_bgp_prefix_longer, "IPv6 prefix /\n" "Display route and more specific routes\n") { - return bgp_show_prefix_longer (vty, NULL, argv[2]->arg, AFI_IP6, SAFI_UNICAST, + int idx_ipv6_prefixlen = 2; + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11401,8 +11592,9 @@ DEFUN (show_ipv6_bgp_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Display route and more specific routes\n") { + int idx_ipv6_prefixlen = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_UNICAST, + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, bgp_show_type_prefix_longer); } @@ -11416,8 +11608,9 @@ DEFUN (show_ipv6_mbgp_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Display route and more specific routes\n") { + int idx_ipv6_prefixlen = 3; bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, + return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, bgp_show_type_prefix_longer); } #endif /* HAVE_IPV6 */ @@ -11832,7 +12025,9 @@ DEFUN (show_bgp_statistics, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[2]->arg, argv[3]->arg); + int idx_afi = 2; + int idx_safi = 3; + return bgp_table_stats_vty (vty, NULL, argv[idx_afi]->arg, argv[idx_safi]->arg); } DEFUN (show_bgp_statistics_view, @@ -11849,7 +12044,9 @@ DEFUN (show_bgp_statistics_view, "Address Family modifier\n" "BGP RIB advertisement statistics\n") { - return bgp_table_stats_vty (vty, NULL, argv[3]->arg, argv[4]->arg); + int idx_word = 3; + int idx_afi = 4; + return bgp_table_stats_vty (vty, NULL, argv[idx_word]->arg, argv[idx_afi]->arg); } enum bgp_pcounts @@ -12056,10 +12253,11 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12080,10 +12278,12 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12103,10 +12303,11 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12127,10 +12328,12 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12153,14 +12356,16 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MULTICAST, uj); return bgp_peer_counts (vty, peer, AFI_IP, SAFI_UNICAST, uj); @@ -12182,10 +12387,11 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12460,13 +12666,15 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); + if (argc == 4 || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); if (! peer) return CMD_WARNING; @@ -12502,18 +12710,20 @@ DEFUN (show_ip_bgp_neighbor_advertised_route, "JavaScript Object Notation\n") { + int idx_peer = 4; + int idx_json = 6; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0) + if ((argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0) || (argc == 3)) - rmap_name = argv[6]->arg; + rmap_name = argv[idx_json]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12553,18 +12763,21 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_peer = 6; + int idx_json = 8; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if ((argc == 4) || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) - rmap_name = argv[8]->arg; + if ((argc == 4) || (argc == 3 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) + rmap_name = argv[idx_json]->arg; - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); @@ -12600,13 +12813,15 @@ DEFUN (show_bgp_instance_neighbor_advertised_route, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; struct peer *peer; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); + if (argc == 4 || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); if (! peer) return CMD_WARNING; @@ -12653,17 +12868,19 @@ DEFUN (show_bgp_neighbor_advertised_route, "JavaScript Object Notation\n") { + int idx_peer = 3; + int idx_json = 5; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (!peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) - rmap_name = argv[5]->arg; + if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) + rmap_name = argv[idx_json]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, rmap_name, uj); } @@ -12686,10 +12903,11 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12726,10 +12944,12 @@ DEFUN (show_bgp_instance_neighbor_received_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12765,10 +12985,12 @@ DEFUN (show_ip_bgp_instance_neighbor_received_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -12804,17 +13026,19 @@ DEFUN (show_ip_bgp_neighbor_received_routes, "JavaScript Object Notation\n") { + int idx_peer = 4; + int idx_json = 6; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[6]->arg && strcmp(argv[6]->arg, "json") != 0)) - rmap_name = argv[6]->arg; + if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) + rmap_name = argv[idx_json]->arg; return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); } @@ -12854,18 +13078,21 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_peer = 6; + int idx_json = 8; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 4 || (argc == 3 && argv[8]->arg && strcmp(argv[8]->arg, "json") != 0)) - rmap_name = argv[8]->arg; + if (argc == 4 || (argc == 3 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) + rmap_name = argv[idx_json]->arg; - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, rmap_name, uj); else return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); @@ -12890,20 +13117,25 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_afi = 4; + int idx_safi = 5; + int idx_peer = 7; + int idx_adv_rcvd_routes = 8; int afi; int safi; int in; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[7]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - afi = (strncmp (argv[4]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[5]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - in = (strncmp (argv[8]->arg, "r", 1) == 0) ? 1 : 0; + afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + in = (strncmp (argv[idx_adv_rcvd_routes]->arg, "r", 1) == 0) ? 1 : 0; return peer_adj_routes (vty, peer, afi, safi, in, NULL, uj); } @@ -12922,16 +13154,17 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { + int idx_peer = 4; char name[BUFSIZ]; union sockunion su; struct peer *peer; int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[4]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[4]->arg); + peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); if (! peer) { if (uj) @@ -12941,13 +13174,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[4]->arg); + json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[4]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13012,16 +13245,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_peer = 6; char name[BUFSIZ]; union sockunion su; struct peer *peer; int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[6]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[6]->arg); + peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); if (! peer) { if (uj) @@ -13031,13 +13266,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[6]->arg); + json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[6]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13060,7 +13295,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, } } - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) { sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_MULTICAST); count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); @@ -13149,17 +13384,19 @@ DEFUN (show_bgp_neighbor_received_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 3; + int idx_json = 5; struct peer *peer; const char *rmap_name = NULL; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if (argc == 3 || (argc == 2 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) - rmap_name = argv[5]->arg; + if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) + rmap_name = argv[idx_json]->arg; return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, rmap_name, uj); } @@ -13193,16 +13430,17 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { + int idx_peer = 3; char name[BUFSIZ]; union sockunion su; struct peer *peer; int count, ret; u_char uj = use_json(argc, argv); - ret = str2sockunion (argv[3]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[3]->arg); + peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); if (! peer) { if (uj) @@ -13212,13 +13450,13 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[3]->arg); + json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13283,10 +13521,11 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, "Display the received routes from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13324,6 +13563,8 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; char name[BUFSIZ]; union sockunion su; struct peer *peer; @@ -13332,7 +13573,7 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, u_char uj = use_json(argc, argv); /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[3]->arg); + bgp = bgp_lookup_by_name (argv[idx_word]->arg); if (bgp == NULL) { if (uj) @@ -13344,14 +13585,14 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_object_free(json_no); } else - vty_out (vty, "Can't find BGP instance %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } - ret = str2sockunion (argv[5]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[5]->arg); + peer = peer_lookup_by_conf_if (bgp, argv[idx_peer]->arg); if (! peer) { if (uj) @@ -13361,13 +13602,13 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, json_no = json_object_new_object(); json_sub = json_object_new_object(); json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[5]->arg); + json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); json_object_object_add(json_no, "detail", json_sub); vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); json_object_free(json_no); } else - vty_out (vty, "%% Malformed address or name: %s%s", argv[5]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -13439,10 +13680,11 @@ DEFUN (show_ip_bgp_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13464,10 +13706,12 @@ DEFUN (show_ip_bgp_instance_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[4]->arg, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13488,10 +13732,11 @@ DEFUN (show_ip_bgp_neighbor_flap, "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13512,10 +13757,11 @@ DEFUN (show_ip_bgp_neighbor_damp, "Display the dampened routes received from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13539,14 +13785,16 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_safi = 4; + int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[6]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_MULTICAST, bgp_show_type_neighbor, uj); @@ -13583,10 +13831,12 @@ DEFUN (show_bgp_instance_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13644,14 +13894,17 @@ DEFUN (show_bgp_instance_neighbor_damp, "Display the dampened routes received from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; + int idx_json = 7; struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) - || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); + if ((argc == 4 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") == 0) + || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); if (! peer) return CMD_WARNING; @@ -13710,14 +13963,17 @@ DEFUN (show_bgp_instance_neighbor_flap, "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_peer = 5; + int idx_json = 7; struct peer *peer; u_char uj = use_json(argc, argv); - if ((argc == 4 && argv[7]->arg && strcmp(argv[7]->arg, "json") == 0) - || (argc == 3 && argv[5]->arg && strcmp(argv[5]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[3]->arg, argv[5]->arg, uj); + if ((argc == 4 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") == 0) + || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) + peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); else - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); if (! peer) return CMD_WARNING; @@ -13764,10 +14020,11 @@ DEFUN (show_bgp_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 3; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[3]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -13793,10 +14050,11 @@ DEFUN (ipv6_mbgp_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[4]->arg, uj); + peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); if (! peer) return CMD_WARNING; @@ -14008,13 +14266,16 @@ DEFUN (bgp_distance, "Distance for routes internal to the AS\n" "Distance for local routes\n") { + int idx_number = 2; + int idx_number_2 = 3; + int idx_number_3 = 4; struct bgp *bgp; bgp = vty->index; - bgp->distance_ebgp = atoi (argv[2]->arg); - bgp->distance_ibgp = atoi (argv[3]->arg); - bgp->distance_local = atoi (argv[4]->arg); + bgp->distance_ebgp = atoi (argv[idx_number]->arg); + bgp->distance_ibgp = atoi (argv[idx_number_2]->arg); + bgp->distance_local = atoi (argv[idx_number_3]->arg); return CMD_SUCCESS; } @@ -14054,7 +14315,9 @@ DEFUN (bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, NULL); + int idx_number = 1; + int idx_ipv4_prefixlen = 2; + bgp_distance_set (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -14066,7 +14329,9 @@ DEFUN (no_bgp_distance_source, "Administrative distance\n" "IP source prefix\n") { - bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, NULL); + int idx_number = 2; + int idx_ipv4_prefixlen = 3; + bgp_distance_unset (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -14078,7 +14343,10 @@ DEFUN (bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg); + int idx_number = 1; + int idx_ipv4_prefixlen = 2; + int idx_word = 3; + bgp_distance_set (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -14091,7 +14359,10 @@ DEFUN (no_bgp_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - bgp_distance_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg); + int idx_number = 2; + int idx_ipv4_prefixlen = 3; + int idx_word = 4; + bgp_distance_unset (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -14117,6 +14388,10 @@ DEFUN (bgp_damp_set, "Value to start suppressing a route\n" "Maximum duration to suppress a stable route\n") { + int idx_number = 2; + int idx_number_2 = 3; + int idx_number_3 = 4; + int idx_number_4 = 5; struct bgp *bgp; int half = DEFAULT_HALF_LIFE * 60; int reuse = DEFAULT_REUSE; @@ -14125,14 +14400,14 @@ DEFUN (bgp_damp_set, if (argc == 4) { - half = atoi (argv[2]->arg) * 60; - reuse = atoi (argv[3]->arg); - suppress = atoi (argv[4]->arg); - max = atoi (argv[5]->arg) * 60; + half = atoi (argv[idx_number]->arg) * 60; + reuse = atoi (argv[idx_number_2]->arg); + suppress = atoi (argv[idx_number_3]->arg); + max = atoi (argv[idx_number_4]->arg) * 60; } else if (argc == 1) { - half = atoi (argv[2]->arg) * 60; + half = atoi (argv[idx_number]->arg) * 60; max = 4 * half; } @@ -14353,7 +14628,8 @@ DEFUN (clear_ip_bgp_dampening_prefix, "Clear route flap dampening information\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, + int idx_ipv4_prefixlen = 4; + return bgp_clear_damp_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1); } @@ -14366,7 +14642,8 @@ DEFUN (clear_ip_bgp_dampening_address, "Clear route flap dampening information\n" "Network to clear damping information\n") { - return bgp_clear_damp_route (vty, NULL, argv[4]->arg, AFI_IP, + int idx_ipv4 = 4; + return bgp_clear_damp_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0); } @@ -14380,10 +14657,12 @@ DEFUN (clear_ip_bgp_dampening_address_mask, "Network to clear damping information\n" "Network mask\n") { + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; int ret; char prefix_str[BUFSIZ]; - ret = netmask_str2prefix_str (argv[4]->arg, argv[5]->arg, prefix_str); + ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); if (! ret) { vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index dc342b110f..0b43b14e68 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3000,7 +3000,8 @@ DEFUN (match_peer, "IP address of peer\n" "IPv6 address of peer\n") { - return bgp_route_match_add (vty, vty->index, "peer", argv[2]->arg, + int idx_ip = 2; + return bgp_route_match_add (vty, vty->index, "peer", argv[idx_ip]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3054,7 +3055,8 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip address", argv[3]->arg, + int idx_acl = 3; + return bgp_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3093,7 +3095,8 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg, + int idx_acl = 3; + return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3131,7 +3134,8 @@ DEFUN (match_probability, "Match portion of routes defined by percentage value\n" "Percentage of routes\n") { - return bgp_route_match_add (vty, vty->index, "probability", argv[2]->arg, + int idx_number = 2; + return bgp_route_match_add (vty, vty->index, "probability", argv[idx_number]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3168,7 +3172,8 @@ DEFUN (match_ip_route_source, "IP access-list number (expanded range)\n" "IP standard access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ip route-source", argv[3]->arg, + int idx_acl = 3; + return bgp_route_match_add (vty, vty->index, "ip route-source", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -3206,8 +3211,9 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return bgp_route_match_add (vty, vty->index, "ip address prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } /* @@ -3244,8 +3250,9 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } /* @@ -3282,8 +3289,9 @@ DEFUN (match_ip_route_source_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return bgp_route_match_add (vty, vty->index, "ip route-source prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } /* @@ -3318,7 +3326,8 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return bgp_route_match_add (vty, vty->index, "metric", argv[2]->arg, + int idx_number = 2; + return bgp_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3351,7 +3360,8 @@ DEFUN (match_local_pref, "Match local-preference of route\n" "Metric value\n") { - return bgp_route_match_add (vty, vty->index, "local-preference", argv[2]->arg, + int idx_number = 2; + return bgp_route_match_add (vty, vty->index, "local-preference", argv[idx_number]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3386,7 +3396,8 @@ DEFUN (match_community, "Community-list number (expanded)\n" "Community-list name\n") { - return bgp_route_match_add (vty, vty->index, "community", argv[2]->arg, + int idx_comm_list = 2; + return bgp_route_match_add (vty, vty->index, "community", argv[idx_comm_list]->arg, RMAP_EVENT_CLIST_ADDED); } @@ -3400,13 +3411,14 @@ DEFUN (match_community_exact, "Community-list name\n" "Do exact matching of communities\n") { + int idx_comm_list = 2; int ret; char *argstr; argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[2]->arg) + strlen ("exact-match") + 2); + strlen (argv[idx_comm_list]->arg) + strlen ("exact-match") + 2); - sprintf (argstr, "%s exact-match", argv[2]->arg); + sprintf (argstr, "%s exact-match", argv[idx_comm_list]->arg); ret = bgp_route_match_add (vty, vty->index, "community", argstr, RMAP_EVENT_CLIST_ADDED); @@ -3458,7 +3470,8 @@ DEFUN (match_ecommunity, "Extended community-list number (expanded)\n" "Extended community-list name\n") { - return bgp_route_match_add (vty, vty->index, "extcommunity", argv[2]->arg, + int idx_comm_list = 2; + return bgp_route_match_add (vty, vty->index, "extcommunity", argv[idx_comm_list]->arg, RMAP_EVENT_ECLIST_ADDED); } @@ -3492,7 +3505,8 @@ DEFUN (match_aspath, "Match BGP AS path list\n" "AS path access-list name\n") { - return bgp_route_match_add (vty, vty->index, "as-path", argv[2]->arg, + int idx_word = 2; + return bgp_route_match_add (vty, vty->index, "as-path", argv[idx_word]->arg, RMAP_EVENT_ASLIST_ADDED); } @@ -3526,13 +3540,14 @@ DEFUN (match_origin, "local IGP\n" "unknown heritage\n") { - if (strncmp (argv[2]->arg, "igp", 2) == 0) + int idx_origin = 2; + if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0) return bgp_route_match_add (vty, vty->index, "origin", "igp", RMAP_EVENT_MATCH_ADDED); - if (strncmp (argv[2]->arg, "egp", 1) == 0) + if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0) return bgp_route_match_add (vty, vty->index, "origin", "egp", RMAP_EVENT_MATCH_ADDED); - if (strncmp (argv[2]->arg, "incomplete", 2) == 0) + if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0) return bgp_route_match_add (vty, vty->index, "origin", "incomplete", RMAP_EVENT_MATCH_ADDED); @@ -3569,7 +3584,8 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return bgp_route_match_add (vty, vty->index, "interface", argv[2]->arg, + int idx_word = 2; + return bgp_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3601,7 +3617,8 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return bgp_route_match_add (vty, vty->index, "tag", argv[2]->arg, + int idx_number = 2; + return bgp_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -3635,10 +3652,11 @@ DEFUN (set_ip_nexthop, "Next hop address\n" "IP address of next hop\n") { + int idx_ipv4 = 3; union sockunion su; int ret; - ret = str2sockunion (argv[3]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -3652,7 +3670,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg); + return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); } DEFUN (set_ip_nexthop_peer, @@ -3728,7 +3746,8 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return bgp_route_set_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return bgp_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } @@ -3760,7 +3779,8 @@ DEFUN (set_local_pref, "BGP local preference path attribute\n" "Preference value\n") { - return bgp_route_set_add (vty, vty->index, "local-preference", argv[2]->arg); + int idx_number = 2; + return bgp_route_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg); } /* @@ -3790,7 +3810,8 @@ DEFUN (set_weight, "BGP weight for routing table\n" "Weight value\n") { - return bgp_route_set_add (vty, vty->index, "weight", argv[2]->arg); + int idx_number = 2; + return bgp_route_set_add (vty, vty->index, "weight", argv[idx_number]->arg); } /* @@ -4055,11 +4076,12 @@ DEFUN (set_community_delete, "Community-list name\n" "Delete matching communities\n") { + int idx_comm_list = 2; char *str; - str = XCALLOC (MTYPE_TMP, strlen (argv[2]->arg) + strlen (" delete") + 1); - strcpy (str, argv[2]->arg); - strcpy (str + strlen (argv[2]->arg), " delete"); + str = XCALLOC (MTYPE_TMP, strlen (argv[idx_comm_list]->arg) + strlen (" delete") + 1); + strcpy (str, argv[idx_comm_list]->arg); + strcpy (str + strlen (argv[idx_comm_list]->arg), " delete"); bgp_route_set_add (vty, vty->index, "comm-list", str); @@ -4178,11 +4200,12 @@ DEFUN (set_origin, "local IGP\n" "unknown heritage\n") { - if (strncmp (argv[2]->arg, "igp", 2) == 0) + int idx_origin = 2; + if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0) return bgp_route_set_add (vty, vty->index, "origin", "igp"); - if (strncmp (argv[2]->arg, "egp", 1) == 0) + if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0) return bgp_route_set_add (vty, vty->index, "origin", "egp"); - if (strncmp (argv[2]->arg, "incomplete", 2) == 0) + if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0) return bgp_route_set_add (vty, vty->index, "origin", "incomplete"); return CMD_WARNING; @@ -4238,11 +4261,13 @@ DEFUN (set_aggregator_as, "AS number\n" "IP address of aggregator\n") { + int idx_number = 3; + int idx_ipv4 = 4; int ret; struct in_addr address; char *argstr; - ret = inet_aton (argv[4]->arg, &address); + ret = inet_aton (argv[idx_ipv4]->arg, &address); if (ret == 0) { vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE); @@ -4250,9 +4275,9 @@ DEFUN (set_aggregator_as, } argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[3]->arg) + strlen (argv[4]->arg) + 2); + strlen (argv[idx_number]->arg) + strlen (argv[idx_ipv4]->arg) + 2); - sprintf (argstr, "%s %s", argv[3]->arg, argv[4]->arg); + sprintf (argstr, "%s %s", argv[idx_number]->arg, argv[idx_ipv4]->arg); ret = bgp_route_set_add (vty, vty->index, "aggregator as", argstr); @@ -4314,7 +4339,8 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return bgp_route_set_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return bgp_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* @@ -4347,7 +4373,8 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[3]->arg, + int idx_word = 3; + return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[idx_word]->arg, RMAP_EVENT_FILTER_ADDED); } @@ -4360,7 +4387,8 @@ DEFUN (no_match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[4]->arg, + int idx_word = 4; + return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[idx_word]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -4372,7 +4400,8 @@ DEFUN (match_ipv6_next_hop, "Match IPv6 next-hop address of route\n" "IPv6 address of next hop\n") { - return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[3]->arg, + int idx_ipv6 = 3; + return bgp_route_match_add (vty, vty->index, "ipv6 next-hop", argv[idx_ipv6]->arg, RMAP_EVENT_MATCH_ADDED); } @@ -4385,7 +4414,8 @@ DEFUN (no_match_ipv6_next_hop, "Match IPv6 next-hop address of route\n" "IPv6 address of next hop\n") { - return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[4]->arg, + int idx_ipv6 = 4; + return bgp_route_match_delete (vty, vty->index, "ipv6 next-hop", argv[idx_ipv6]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -4398,8 +4428,9 @@ DEFUN (match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list", - argv[4]->arg, RMAP_EVENT_PLIST_ADDED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } DEFUN (no_match_ipv6_address_prefix_list, @@ -4412,8 +4443,9 @@ DEFUN (no_match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 5; return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list", - argv[5]->arg, RMAP_EVENT_PLIST_DELETED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); } DEFUN (set_ipv6_nexthop_peer, @@ -4471,10 +4503,11 @@ DEFUN (set_ipv6_nexthop_global, "IPv6 global address\n" "IPv6 address of next hop\n") { + int idx_ipv6 = 4; struct in6_addr addr; int ret; - ret = inet_pton (AF_INET6, argv[4]->arg, &addr); + ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr); if (!ret) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -4489,7 +4522,7 @@ DEFUN (set_ipv6_nexthop_global, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[4]->arg); + return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); } /* @@ -4525,10 +4558,11 @@ DEFUN (set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { + int idx_ipv6 = 4; struct in6_addr addr; int ret; - ret = inet_pton (AF_INET6, argv[4]->arg, &addr); + ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr); if (!ret) { vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); @@ -4540,7 +4574,7 @@ DEFUN (set_ipv6_nexthop_local, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); + return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); } /* @@ -4576,7 +4610,8 @@ DEFUN (set_vpnv4_nexthop, "VPNv4 next-hop address\n" "IP address of next hop\n") { - return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[3]->arg); + int idx_ipv4 = 3; + return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); } /* @@ -4608,7 +4643,8 @@ DEFUN (set_originator_id, "BGP originator ID attribute\n" "IP address of originator\n") { - return bgp_route_set_add (vty, vty->index, "originator-id", argv[2]->arg); + int idx_ipv4 = 2; + return bgp_route_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg); } /* diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1c015eb66f..8f1db7624d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -614,7 +614,8 @@ DEFUN (bgp_config_type, "cisco\n" "zebra\n") { - if (strncmp (argv[2]->arg, "c", 1) == 0) + int idx_vendor = 2; + if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0) bgp_option_set (BGP_OPT_CONFIG_CISCO); else bgp_option_unset (BGP_OPT_CONFIG_CISCO); @@ -684,6 +685,7 @@ DEFUN (router_bgp, BGP_STR AS_STR) { + int idx_number = 2; int ret; as_t as; struct bgp *bgp; @@ -712,7 +714,7 @@ DEFUN (router_bgp, // "router bgp X" else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[2]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); inst_type = BGP_INSTANCE_TYPE_DEFAULT; if (argc == 3) @@ -777,6 +779,7 @@ DEFUN (no_router_bgp, BGP_STR AS_STR) { + int idx_number = 3; as_t as; struct bgp *bgp; const char *name = NULL; @@ -802,7 +805,7 @@ DEFUN (no_router_bgp, } else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); if (argc == 3) name = argv[5]->arg; @@ -832,13 +835,14 @@ DEFUN (bgp_router_id, "Override configured router identifier\n" "Manually configured router identifier\n") { + int idx_ipv4 = 2; int ret; struct in_addr id; struct bgp *bgp; bgp = vty->index; - ret = inet_aton (argv[2]->arg, &id); + ret = inet_aton (argv[idx_ipv4]->arg, &id); if (! ret) { vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); @@ -912,13 +916,14 @@ DEFUN (bgp_cluster_id, "Configure Route-Reflector Cluster-id\n" "Route-Reflector Cluster-id in IP address format\n") { + int idx_ipv4 = 2; int ret; struct bgp *bgp; struct in_addr cluster; bgp = vty->index; - ret = inet_aton (argv[2]->arg, &cluster); + ret = inet_aton (argv[idx_ipv4]->arg, &cluster); if (! ret) { vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); @@ -986,12 +991,13 @@ DEFUN (bgp_confederation_identifier, "AS number\n" "Set routing domain confederation AS\n") { + int idx_number = 3; struct bgp *bgp; as_t as; bgp = vty->index; - VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); bgp_confederation_id_set (bgp, as); @@ -1151,12 +1157,13 @@ DEFUN (bgp_maxmed_admin_medv, "Administratively applied, for an indefinite period\n" "Max MED value to be used\n") { + int idx_number = 3; struct bgp *bgp; bgp = vty->index; bgp->v_maxmed_admin = 1; - VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[3]->arg); + VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[idx_number]->arg); bgp_maxmed_update(bgp); @@ -1203,6 +1210,7 @@ DEFUN (bgp_maxmed_onstartup, "Effective on a startup\n" "Time (seconds) period for max-med\n") { + int idx_number = 3; struct bgp *bgp; bgp = vty->index; @@ -1213,7 +1221,7 @@ DEFUN (bgp_maxmed_onstartup, return CMD_WARNING; } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); + VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; bgp_maxmed_update(bgp); @@ -1230,6 +1238,8 @@ DEFUN (bgp_maxmed_onstartup_medv, "Time (seconds) period for max-med\n" "Max MED value to be used\n") { + int idx_number = 3; + int idx_number_2 = 4; struct bgp *bgp; bgp = vty->index; @@ -1240,8 +1250,8 @@ DEFUN (bgp_maxmed_onstartup_medv, return CMD_WARNING; } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); - VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[4]->arg); + VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); + VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[idx_number_2]->arg); bgp_maxmed_update(bgp); @@ -1366,7 +1376,8 @@ DEFUN (bgp_update_delay, "Force initial delay for best-path and updates\n" "Seconds\n") { - return bgp_update_delay_config_vty(vty, argv[1]->arg, NULL); + int idx_number = 1; + return bgp_update_delay_config_vty(vty, argv[idx_number]->arg, NULL); } DEFUN (bgp_update_delay_establish_wait, @@ -1377,7 +1388,9 @@ DEFUN (bgp_update_delay_establish_wait, "Wait for peers to be established\n" "Seconds\n") { - return bgp_update_delay_config_vty(vty, argv[1]->arg, argv[2]->arg); + int idx_number = 1; + int idx_number_2 = 2; + return bgp_update_delay_config_vty(vty, argv[idx_number]->arg, argv[idx_number_2]->arg); } /* Update-delay deconfiguration */ @@ -1434,7 +1447,8 @@ DEFUN (bgp_wpkt_quanta, "How many packets to write to peer socket per run\n" "Number of packets\n") { - return bgp_wpkt_quanta_config_vty(vty, argv[1]->arg, 1); + int idx_number = 1; + return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 1); } /* Update-delay deconfiguration */ @@ -1444,7 +1458,8 @@ DEFUN (no_bgp_wpkt_quanta, "How many packets to write to peer socket per run\n" "Number of packets\n") { - return bgp_wpkt_quanta_config_vty(vty, argv[2]->arg, 0); + int idx_number = 2; + return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 0); } static int @@ -1480,7 +1495,8 @@ DEFUN (bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - return bgp_coalesce_config_vty(vty, argv[1]->arg, 1); + int idx_number = 1; + return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 1); } DEFUN (no_bgp_coalesce_time, @@ -1489,7 +1505,8 @@ DEFUN (no_bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - return bgp_coalesce_config_vty(vty, argv[2]->arg, 0); + int idx_number = 2; + return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 0); } /* Maximum-paths configuration */ @@ -1499,7 +1516,8 @@ DEFUN (bgp_maxpaths, "Forward packets over multiple paths\n" "Number of paths\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[1]->arg, 0, 1); + int idx_number = 1; + return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[idx_number]->arg, 0, 1); } DEFUN (bgp_maxpaths_ibgp, @@ -1509,7 +1527,8 @@ DEFUN (bgp_maxpaths_ibgp, "iBGP-multipath\n" "Number of paths\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, 0, 1); + int idx_number = 2; + return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[idx_number]->arg, 0, 1); } DEFUN (bgp_maxpaths_ibgp_cluster, @@ -1520,7 +1539,8 @@ DEFUN (bgp_maxpaths_ibgp_cluster, "Number of paths\n" "Match the cluster length\n") { - return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, + int idx_number = 2; + return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[idx_number]->arg, BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); } @@ -1607,14 +1627,16 @@ DEFUN (bgp_timers, "Keepalive interval\n" "Holdtime\n") { + int idx_number = 2; + int idx_number_2 = 3; struct bgp *bgp; unsigned long keepalive = 0; unsigned long holdtime = 0; bgp = vty->index; - VTY_GET_INTEGER ("keepalive", keepalive, argv[2]->arg); - VTY_GET_INTEGER ("holdtime", holdtime, argv[3]->arg); + VTY_GET_INTEGER ("keepalive", keepalive, argv[idx_number]->arg); + VTY_GET_INTEGER ("holdtime", holdtime, argv[idx_number_2]->arg); /* Holdtime value check. */ if (holdtime < 3 && holdtime != 0) @@ -1826,6 +1848,7 @@ DEFUN (bgp_graceful_restart_stalepath_time, "Set the max time to hold onto restarting peer's stale paths\n" "Delay value (seconds)\n") { + int idx_number = 3; struct bgp *bgp; u_int32_t stalepath; @@ -1833,7 +1856,7 @@ DEFUN (bgp_graceful_restart_stalepath_time, if (! bgp) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[3]->arg, 1, 3600); + VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[idx_number]->arg, 1, 3600); bgp->stalepath_time = stalepath; return CMD_SUCCESS; } @@ -1846,6 +1869,7 @@ DEFUN (bgp_graceful_restart_restart_time, "Set the time to wait to delete stale routes before a BGP open message is received\n" "Delay value (seconds)\n") { + int idx_number = 3; struct bgp *bgp; u_int32_t restart; @@ -1853,7 +1877,7 @@ DEFUN (bgp_graceful_restart_restart_time, if (! bgp) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[3]->arg, 1, 3600); + VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[idx_number]->arg, 1, 3600); bgp->restart_time = restart; return CMD_SUCCESS; } @@ -2093,6 +2117,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, "Generate an AS_SET\n" "Do not generate an AS_SET\n") { + int idx_as_set = 4; struct bgp *bgp; bgp = vty->index; @@ -2100,7 +2125,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, /* no-as-set is now the default behavior so we can silently * ignore it */ - if (argv[4]->arg != NULL && strncmp (argv[4]->arg, "a", 1) == 0) + if (argv[idx_as_set]->arg != NULL && strncmp (argv[idx_as_set]->arg, "a", 1) == 0) bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); else bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; @@ -2169,11 +2194,12 @@ DEFUN (bgp_bestpath_med, "Compare MED among confederation paths\n" "Treat missing MED as the least preferred one\n") { + int idx_med_knob = 3; struct bgp *bgp; bgp = vty->index; - if (strncmp (argv[3]->arg, "confed", 1) == 0) + if (strncmp (argv[idx_med_knob]->arg, "confed", 1) == 0) bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); else bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); @@ -2223,11 +2249,12 @@ DEFUN (no_bgp_bestpath_med, "Compare MED among confederation paths\n" "Treat missing MED as the least preferred one\n") { + int idx_med_knob = 4; struct bgp *bgp; bgp = vty->index; - if (strncmp (argv[4]->arg, "confed", 1) == 0) + if (strncmp (argv[idx_med_knob]->arg, "confed", 1) == 0) bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); else bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); @@ -2385,12 +2412,13 @@ DEFUN (bgp_default_local_preference, "local preference (higher=more preferred)\n" "Configure default local preference value\n") { + int idx_number = 3; struct bgp *bgp; u_int32_t local_pref; bgp = vty->index; - VTY_GET_INTEGER ("local preference", local_pref, argv[3]->arg); + VTY_GET_INTEGER ("local preference", local_pref, argv[idx_number]->arg); bgp_default_local_preference_set (bgp, local_pref); bgp_clear_star_soft_in (vty, bgp->name); @@ -2434,12 +2462,13 @@ DEFUN (bgp_default_subgroup_pkt_queue_max, "subgroup-pkt-queue-max\n" "Configure subgroup packet queue max\n") { + int idx_number = 3; struct bgp *bgp; u_int32_t max_size; bgp = vty->index; - VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[3]->arg); + VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[idx_number]->arg); bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); @@ -2523,12 +2552,13 @@ DEFUN (bgp_listen_limit, "maximum number of BGP Dynamic Neighbors that can be created\n" "Configure Dynamic Neighbors listen limit value\n") { + int idx_number = 3; struct bgp *bgp; int listen_limit; bgp = vty->index; - VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[3]->arg, + VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[idx_number]->arg, BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); @@ -2603,6 +2633,8 @@ DEFUN (bgp_listen_range, "add a listening range for Dynamic Neighbors\n" LISTEN_RANGE_ADDR_STR) { + int idx_ipv4_ipv6_prefixlen = 3; + int idx_word = 5; struct bgp *bgp; struct prefix range; struct peer_group *group, *existing_group; @@ -2611,10 +2643,10 @@ DEFUN (bgp_listen_range, bgp = vty->index; - //VTY_GET_IPV4_PREFIX ("listen range", range, argv[3]->arg); + //VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_ipv6_prefixlen]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[3]->arg, &range); + ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2638,7 +2670,7 @@ DEFUN (bgp_listen_range, existing_group = listen_range_exists (bgp, &range, 1); if (existing_group) { - if (strcmp (existing_group->name, argv[5]->arg) == 0) + if (strcmp (existing_group->name, argv[idx_word]->arg) == 0) return CMD_SUCCESS; else { @@ -2656,7 +2688,7 @@ DEFUN (bgp_listen_range, return CMD_WARNING; } - group = peer_group_lookup (bgp, argv[5]->arg); + group = peer_group_lookup (bgp, argv[idx_word]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -2675,6 +2707,8 @@ DEFUN (no_bgp_listen_range, "delete a listening range for Dynamic Neighbors\n" "Remove Dynamic Neighbors listening range\n") { + int idx_ipv4_prefixlen = 4; + int idx_word = 6; struct bgp *bgp; struct prefix range; struct peer_group *group; @@ -2683,10 +2717,10 @@ DEFUN (no_bgp_listen_range, bgp = vty->index; - // VTY_GET_IPV4_PREFIX ("listen range", range, argv[4]->arg); + // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[4]->arg, &range); + ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2707,7 +2741,7 @@ DEFUN (no_bgp_listen_range, apply_mask (&range); - group = peer_group_lookup (bgp, argv[6]->arg); + group = peer_group_lookup (bgp, argv[idx_word]->arg); if (! group) { vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); @@ -2858,7 +2892,9 @@ DEFUN (neighbor_remote_as, "Specify a BGP neighbor\n" AS_STR) { - return peer_remote_as_vty (vty, argv[1]->arg, argv[3]->arg, AFI_IP, SAFI_UNICAST); + int idx_peer = 1; + int idx_remote_as = 3; + return peer_remote_as_vty (vty, argv[idx_peer]->arg, argv[idx_remote_as]->arg, AFI_IP, SAFI_UNICAST); } static int @@ -2980,11 +3016,12 @@ DEFUN (neighbor_interface_config, "Interface name or neighbor tag\n" "Enable BGP on interface\n") { + int idx_word = 1; if (argc == 2) - return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, argv[3]->arg, NULL); else - return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, NULL, NULL); } @@ -3008,7 +3045,8 @@ DEFUN (neighbor_interface_config_v6only, "Enable BGP on interface\n" "Enable BGP with v6 link-local only\n") { - return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, + int idx_word = 1; + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, argv[5]->arg, NULL); } @@ -3021,8 +3059,10 @@ DEFUN (neighbor_interface_config_remote_as, "Enable BGP on interface\n" AS_STR) { - return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, - NULL, argv[4]->arg); + int idx_word = 1; + int idx_remote_as = 4; + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, + NULL, argv[idx_remote_as]->arg); } DEFUN (neighbor_interface_v6only_config_remote_as, @@ -3033,8 +3073,10 @@ DEFUN (neighbor_interface_v6only_config_remote_as, "Enable BGP on interface\n" AS_STR) { - return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, - NULL, argv[5]->arg); + int idx_word = 1; + int idx_remote_as = 5; + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, + NULL, argv[idx_remote_as]->arg); } DEFUN (neighbor_peer_group, @@ -3044,19 +3086,20 @@ DEFUN (neighbor_peer_group, "Interface name or neighbor tag\n" "Configure peer-group\n") { + int idx_word = 1; struct bgp *bgp; struct peer *peer; struct peer_group *group; bgp = vty->index; - peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); + peer = peer_lookup_by_conf_if (bgp, argv[idx_word]->arg); if (peer) { vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); return CMD_WARNING; } - group = peer_group_get (bgp, argv[1]->arg); + group = peer_group_get (bgp, argv[idx_word]->arg); if (! group) return CMD_WARNING; @@ -3080,17 +3123,18 @@ DEFUN (no_neighbor, NEIGHBOR_STR NEIGHBOR_ADDR_STR2) { + int idx_peer = 2; int ret; union sockunion su; struct peer_group *group; struct peer *peer; struct peer *other; - ret = str2sockunion (argv[2]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); + peer = peer_lookup_by_conf_if (vty->index, argv[idx_peer]->arg); if (peer) { /* Request zebra to terminate IPv6 RAs on this interface. */ @@ -3100,7 +3144,7 @@ DEFUN (no_neighbor, return CMD_SUCCESS; } - group = peer_group_lookup (vty->index, argv[2]->arg); + group = peer_group_lookup (vty->index, argv[idx_peer]->arg); if (group) peer_group_delete (group); else @@ -3182,10 +3226,11 @@ DEFUN (no_neighbor_interface_config, "Interface name\n" "Configure BGP on interface\n") { + int idx_word = 2; struct peer *peer; /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); + peer = peer_lookup_by_conf_if (vty->index, argv[idx_word]->arg); if (peer) { /* Request zebra to terminate IPv6 RAs on this interface. */ @@ -3214,9 +3259,10 @@ DEFUN (no_neighbor_peer_group, "Neighbor tag\n" "Configure peer-group\n") { + int idx_word = 2; struct peer_group *group; - group = peer_group_lookup (vty->index, argv[2]->arg); + group = peer_group_lookup (vty->index, argv[idx_word]->arg); if (group) peer_group_delete (group); else @@ -3236,18 +3282,19 @@ DEFUN (no_neighbor_interface_peer_group_remote_as, "Specify a BGP neighbor\n" AS_STR) { + int idx_word = 2; struct peer_group *group; struct peer *peer; /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); + peer = peer_lookup_by_conf_if (vty->index, argv[idx_word]->arg); if (peer) { peer_as_change (peer, 0, AS_SPECIFIED); return CMD_SUCCESS; } - group = peer_group_lookup (vty->index, argv[2]->arg); + group = peer_group_lookup (vty->index, argv[idx_word]->arg); if (group) peer_group_remote_as_delete (group); else @@ -3266,14 +3313,16 @@ DEFUN (neighbor_local_as, "Specify a local-as number\n" "AS number used as local AS\n") { + int idx_peer = 1; + int idx_number = 3; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[3]->arg), 0, 0); + ret = peer_local_as_set (peer, atoi (argv[idx_number]->arg), 0, 0); return bgp_vty_return (vty, ret); } @@ -3286,14 +3335,16 @@ DEFUN (neighbor_local_as_no_prepend, "AS number used as local AS\n" "Do not prepend local-as to updates from ebgp peers\n") { + int idx_peer = 1; + int idx_number = 3; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 0); + ret = peer_local_as_set (peer, atoi (argv[idx_number]->arg), 1, 0); return bgp_vty_return (vty, ret); } @@ -3307,14 +3358,16 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, "Do not prepend local-as to updates from ebgp peers\n" "Do not prepend local-as to updates from ibgp peers\n") { + int idx_peer = 1; + int idx_number = 3; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 1); + ret = peer_local_as_set (peer, atoi (argv[idx_number]->arg), 1, 1); return bgp_vty_return (vty, ret); } @@ -3354,10 +3407,11 @@ DEFUN (no_neighbor_local_as, NEIGHBOR_ADDR_STR2 "Specify a local-as number\n") { + int idx_peer = 2; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3375,10 +3429,11 @@ DEFUN (neighbor_solo, NEIGHBOR_ADDR_STR2 "Solo peer - part of its own update group\n") { + int idx_peer = 1; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3394,10 +3449,11 @@ DEFUN (no_neighbor_solo, NEIGHBOR_ADDR_STR2 "Solo peer - part of its own update group\n") { + int idx_peer = 2; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3413,14 +3469,16 @@ DEFUN (neighbor_password, "Set a password\n" "The password\n") { + int idx_peer = 1; + int idx_line = 3; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - ret = peer_password_set (peer, argv[3]->arg); + ret = peer_password_set (peer, argv[idx_line]->arg); return bgp_vty_return (vty, ret); } @@ -3442,10 +3500,11 @@ DEFUN (no_neighbor_password, NEIGHBOR_ADDR_STR2 "Set a password\n") { + int idx_peer = 2; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3461,10 +3520,11 @@ DEFUN (neighbor_activate, NEIGHBOR_ADDR_STR2 "Enable the Address Family for this Neighbor\n") { + int idx_peer = 1; int ret; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3483,11 +3543,12 @@ DEFUN (no_neighbor_activate, NEIGHBOR_ADDR_STR2 "Enable the Address Family for this Neighbor\n") { + int idx_peer = 2; int ret; struct peer *peer; /* Lookup peer. */ - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -3506,6 +3567,8 @@ DEFUN (neighbor_set_peer_group, "Member of the peer-group\n" "peer-group name\n") { + int idx_peer = 1; + int idx_word = 3; int ret; as_t as; union sockunion su; @@ -3516,13 +3579,13 @@ DEFUN (neighbor_set_peer_group, bgp = vty->index; peer = NULL; - ret = str2sockunion (argv[1]->arg, &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); + peer = peer_lookup_by_conf_if (bgp, argv[idx_peer]->arg); if (!peer) { - vty_out (vty, "%% Malformed address or name: %s%s", argv[1]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -3545,7 +3608,7 @@ DEFUN (neighbor_set_peer_group, } } - group = peer_group_lookup (bgp, argv[3]->arg); + group = peer_group_lookup (bgp, argv[idx_word]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -3572,6 +3635,8 @@ DEFUN (no_neighbor_set_peer_group, "Member of the peer-group\n" "peer-group name\n") { + int idx_peer = 2; + int idx_word = 4; int ret; struct bgp *bgp; struct peer *peer; @@ -3579,11 +3644,11 @@ DEFUN (no_neighbor_set_peer_group, bgp = vty->index; - peer = peer_lookup_vty (vty, argv[2]->arg); + peer = peer_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - group = peer_group_lookup (bgp, argv[4]->arg); + group = peer_group_lookup (bgp, argv[idx_word]->arg); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -3644,7 +3709,8 @@ DEFUN (neighbor_passive, NEIGHBOR_ADDR_STR2 "Don't send open messages to this neighbor\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_PASSIVE); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_PASSIVE); } DEFUN (no_neighbor_passive, @@ -3655,7 +3721,8 @@ DEFUN (no_neighbor_passive, NEIGHBOR_ADDR_STR2 "Don't send open messages to this neighbor\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_PASSIVE); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_PASSIVE); } /* neighbor shutdown. */ @@ -3666,7 +3733,8 @@ DEFUN (neighbor_shutdown, NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_SHUTDOWN); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_SHUTDOWN); } DEFUN (no_neighbor_shutdown, @@ -3677,7 +3745,8 @@ DEFUN (no_neighbor_shutdown, NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_SHUTDOWN); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_SHUTDOWN); } /* neighbor capability dynamic. */ @@ -3689,7 +3758,8 @@ DEFUN (neighbor_capability_dynamic, "Advertise capability to the peer\n" "Advertise dynamic capability to this neighbor\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); } DEFUN (no_neighbor_capability_dynamic, @@ -3701,7 +3771,8 @@ DEFUN (no_neighbor_capability_dynamic, "Advertise capability to the peer\n" "Advertise dynamic capability to this neighbor\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); } /* neighbor dont-capability-negotiate */ @@ -3712,7 +3783,8 @@ DEFUN (neighbor_dont_capability_negotiate, NEIGHBOR_ADDR_STR2 "Do not perform capability negotiation\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DONT_CAPABILITY); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DONT_CAPABILITY); } DEFUN (no_neighbor_dont_capability_negotiate, @@ -3723,7 +3795,8 @@ DEFUN (no_neighbor_dont_capability_negotiate, NEIGHBOR_ADDR_STR2 "Do not perform capability negotiation\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DONT_CAPABILITY); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DONT_CAPABILITY); } /* neighbor capability extended next hop encoding */ @@ -3735,7 +3808,8 @@ DEFUN (neighbor_capability_enhe, "Advertise capability to the peer\n" "Advertise extended next-hop capability to the peer\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_CAPABILITY_ENHE); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_CAPABILITY_ENHE); } DEFUN (no_neighbor_capability_enhe, @@ -3747,7 +3821,8 @@ DEFUN (no_neighbor_capability_enhe, "Advertise capability to the peer\n" "Advertise extended next-hop capability to the peer\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_CAPABILITY_ENHE); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_CAPABILITY_ENHE); } static int @@ -3796,18 +3871,20 @@ DEFUN (neighbor_capability_orf_prefix, "Capability to RECEIVE the ORF from this neighbor\n" "Capability to SEND the ORF to this neighbor\n") { + int idx_peer = 1; + int idx_send_recv = 5; u_int16_t flag = 0; - if (strncmp (argv[5]->arg, "s", 1) == 0) + if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[5]->arg, "r", 1) == 0) + else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[5]->arg, "b", 1) == 0) + else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flag); } @@ -3824,18 +3901,20 @@ DEFUN (no_neighbor_capability_orf_prefix, "Capability to RECEIVE the ORF from this neighbor\n" "Capability to SEND the ORF to this neighbor\n") { + int idx_peer = 2; + int idx_send_recv = 6; u_int16_t flag = 0; - if (strncmp (argv[6]->arg, "s", 1) == 0) + if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM; - else if (strncmp (argv[6]->arg, "r", 1) == 0) + else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_RM; - else if (strncmp (argv[6]->arg, "b", 1) == 0) + else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0) flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; else return CMD_WARNING; - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flag); } @@ -3847,7 +3926,8 @@ DEFUN (neighbor_nexthop_self, NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); } @@ -3860,7 +3940,8 @@ DEFUN (neighbor_nexthop_self_force, "Disable the next hop calculation for this neighbor\n" "Set the next hop to self for reflected routes\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_FORCE_NEXTHOP_SELF); } @@ -3873,7 +3954,8 @@ DEFUN (no_neighbor_nexthop_self, NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); } @@ -3887,7 +3969,8 @@ DEFUN (no_neighbor_nexthop_self_force, "Disable the next hop calculation for this neighbor\n" "Set the next hop to self for reflected routes\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_FORCE_NEXTHOP_SELF); } @@ -3900,7 +3983,8 @@ DEFUN (neighbor_as_override, NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_AS_OVERRIDE); } @@ -3913,7 +3997,8 @@ DEFUN (no_neighbor_as_override, NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_AS_OVERRIDE); } @@ -3926,7 +4011,8 @@ DEFUN (neighbor_remove_private_as, NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS); } @@ -3939,7 +4025,8 @@ DEFUN (neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL); } @@ -3952,7 +4039,8 @@ DEFUN (neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); } @@ -3966,7 +4054,8 @@ DEFUN (neighbor_remove_private_as_all_replace_as, "Apply to all AS numbers" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); } @@ -3979,7 +4068,8 @@ DEFUN (no_neighbor_remove_private_as, NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS); } @@ -3993,7 +4083,8 @@ DEFUN (no_neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL); } @@ -4007,7 +4098,8 @@ DEFUN (no_neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); } @@ -4022,7 +4114,8 @@ DEFUN (no_neighbor_remove_private_as_all_replace_as, "Apply to all AS numbers" "Replace private ASNs with our ASN in outbound updates\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); } @@ -4036,7 +4129,8 @@ DEFUN (neighbor_send_community, NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); } @@ -4049,7 +4143,8 @@ DEFUN (no_neighbor_send_community, NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); } @@ -4065,16 +4160,18 @@ DEFUN (neighbor_send_community_type, "Send Extended Community attributes\n" "Send Standard Community attributes\n") { - if (strncmp (argv[3]->arg, "s", 1) == 0) - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + int idx_type = 3; + if (strncmp (argv[idx_type]->arg, "s", 1) == 0) + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[3]->arg, "e", 1) == 0) - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + if (strncmp (argv[idx_type]->arg, "e", 1) == 0) + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_EXT_COMMUNITY); - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_SEND_COMMUNITY| PEER_FLAG_SEND_EXT_COMMUNITY)); @@ -4091,16 +4188,18 @@ DEFUN (no_neighbor_send_community_type, "Send Extended Community attributes\n" "Send Standard Community attributes\n") { - if (strncmp (argv[4]->arg, "s", 1) == 0) - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + int idx_type = 4; + if (strncmp (argv[idx_type]->arg, "s", 1) == 0) + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[4]->arg, "e", 1) == 0) - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + if (strncmp (argv[idx_type]->arg, "e", 1) == 0) + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SEND_EXT_COMMUNITY); - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_SEND_COMMUNITY | PEER_FLAG_SEND_EXT_COMMUNITY)); @@ -4115,7 +4214,8 @@ DEFUN (neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SOFT_RECONFIG); } @@ -4129,7 +4229,8 @@ DEFUN (no_neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_SOFT_RECONFIG); } @@ -4141,14 +4242,15 @@ DEFUN (neighbor_route_reflector_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") { + int idx_peer = 1; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REFLECTOR_CLIENT); } @@ -4161,7 +4263,8 @@ DEFUN (no_neighbor_route_reflector_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REFLECTOR_CLIENT); } @@ -4174,12 +4277,13 @@ DEFUN (neighbor_route_server_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { + int idx_peer = 1; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_RSERVER_CLIENT); } @@ -4192,7 +4296,8 @@ DEFUN (no_neighbor_route_server_client, NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_RSERVER_CLIENT); } @@ -4205,7 +4310,8 @@ DEFUN (neighbor_nexthop_local_unchanged, "Configure treatment of outgoing link-local nexthop attribute\n" "Leave link-local nexthop unchanged for this peer\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } @@ -4219,7 +4325,8 @@ DEFUN (no_neighbor_nexthop_local_unchanged, "Configure treatment of outgoing link-local-nexthop attribute\n" "Leave link-local nexthop unchanged for this peer\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } @@ -4282,7 +4389,8 @@ DEFUN (neighbor_attr_unchanged, NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n") { - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_AS_PATH_UNCHANGED | PEER_FLAG_NEXTHOP_UNCHANGED | @@ -4299,16 +4407,18 @@ DEFUN (neighbor_attr_unchanged1, "Nexthop attribute\n" "Med attribute\n") { + int idx_peer = 1; + int idx_attribute = 3; u_int16_t flags = 0; - if (strncmp (argv[3]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[3]->arg, "next-hop", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[3]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4322,14 +4432,16 @@ DEFUN (neighbor_attr_unchanged2, "Nexthop attribute\n" "Med attribute\n") { + int idx_peer = 1; + int idx_attribute = 4; u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - if (strncmp (argv[4]->arg, "next-hop", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[4]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4344,14 +4456,16 @@ DEFUN (neighbor_attr_unchanged3, "As-path attribute\n" "Med attribute\n") { + int idx_peer = 1; + int idx_attribute = 4; u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - if (strncmp (argv[4]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[4]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4365,14 +4479,16 @@ DEFUN (neighbor_attr_unchanged4, "As-path attribute\n" "Nexthop attribute\n") { + int idx_peer = 1; + int idx_attribute = 4; u_int16_t flags = PEER_FLAG_MED_UNCHANGED; - if (strncmp (argv[4]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4447,7 +4563,8 @@ DEFUN (no_neighbor_attr_unchanged, NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), (PEER_FLAG_AS_PATH_UNCHANGED | PEER_FLAG_NEXTHOP_UNCHANGED | @@ -4465,16 +4582,18 @@ DEFUN (no_neighbor_attr_unchanged1, "Nexthop attribute\n" "Med attribute\n") { + int idx_peer = 2; + int idx_attribute = 4; u_int16_t flags = 0; - if (strncmp (argv[4]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[4]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4489,14 +4608,16 @@ DEFUN (no_neighbor_attr_unchanged2, "Nexthop attribute\n" "Med attribute\n") { + int idx_peer = 2; + int idx_attribute = 5; u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - if (strncmp (argv[5]->arg, "next-hop", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[5]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4511,14 +4632,16 @@ DEFUN (no_neighbor_attr_unchanged3, "As-path attribute\n" "Med attribute\n") { + int idx_peer = 2; + int idx_attribute = 5; u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - if (strncmp (argv[5]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[5]->arg, "med", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4533,14 +4656,16 @@ DEFUN (no_neighbor_attr_unchanged4, "As-path attribute\n" "Nexthop attribute\n") { + int idx_peer = 2; + int idx_attribute = 5; u_int16_t flags = PEER_FLAG_MED_UNCHANGED; - if (strncmp (argv[5]->arg, "as-path", 1) == 0) + if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[5]->arg, "next-hop", 1) == 0) + else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), flags); } @@ -4593,7 +4718,8 @@ DEFUN (neighbor_ebgp_multihop, NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n") { - return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, NULL); + int idx_peer = 1; + return peer_ebgp_multihop_set_vty (vty, argv[idx_peer]->arg, NULL); } DEFUN (neighbor_ebgp_multihop_ttl, @@ -4604,7 +4730,9 @@ DEFUN (neighbor_ebgp_multihop_ttl, "Allow EBGP neighbors not on directly connected networks\n" "maximum hop count\n") { - return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, argv[3]->arg); + int idx_peer = 1; + int idx_number = 3; + return peer_ebgp_multihop_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } /* @@ -4625,7 +4753,8 @@ DEFUN (no_neighbor_ebgp_multihop, NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n") { - return peer_ebgp_multihop_unset_vty (vty, argv[2]->arg); + int idx_peer = 2; + return peer_ebgp_multihop_unset_vty (vty, argv[idx_peer]->arg); } @@ -4645,7 +4774,8 @@ DEFUN (neighbor_disable_connected_check, NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } /* @@ -4665,7 +4795,8 @@ DEFUN (no_neighbor_disable_connected_check, NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } /* Enforce multihop. */ @@ -4680,10 +4811,11 @@ DEFUN (neighbor_description, "Neighbor specific description\n" "Up to 80 characters describing this neighbor\n") { + int idx_peer = 1; struct peer *peer; char *str; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -4717,9 +4849,10 @@ DEFUN (no_neighbor_description, NEIGHBOR_ADDR_STR2 "Neighbor specific description\n") { + int idx_peer = 2; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -4775,7 +4908,9 @@ DEFUN (neighbor_update_source, "Source of routing updates\n" BGP_UPDATE_SOURCE_HELP_STR) { - return peer_update_source_vty (vty, argv[1]->arg, argv[3]->arg); + int idx_peer = 1; + int idx_peer_2 = 3; + return peer_update_source_vty (vty, argv[idx_peer]->arg, argv[idx_peer_2]->arg); } DEFUN (no_neighbor_update_source, @@ -4787,7 +4922,8 @@ DEFUN (no_neighbor_update_source, "Source of routing updates\n" BGP_UPDATE_SOURCE_HELP_STR) { - return peer_update_source_vty (vty, argv[2]->arg, NULL); + int idx_peer = 2; + return peer_update_source_vty (vty, argv[idx_peer]->arg, NULL); } static int @@ -4818,7 +4954,8 @@ DEFUN (neighbor_default_originate, NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n") { - return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + int idx_peer = 1; + return peer_default_originate_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), NULL, 1); } @@ -4831,8 +4968,10 @@ DEFUN (neighbor_default_originate_rmap, "Route-map to specify criteria to originate default\n" "route-map name\n") { - return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[4]->arg, 1); + int idx_peer = 1; + int idx_word = 4; + return peer_default_originate_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_word]->arg, 1); } /* @@ -4854,7 +4993,8 @@ DEFUN (no_neighbor_default_originate, NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n") { - return peer_default_originate_set_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_default_originate_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), NULL, 0); } @@ -4896,7 +5036,9 @@ DEFUN (neighbor_port, "Neighbor's BGP port\n" "TCP port number\n") { - return peer_port_vty (vty, argv[1]->arg, AFI_IP, argv[3]->arg); + int idx_ip = 1; + int idx_number = 3; + return peer_port_vty (vty, argv[idx_ip]->arg, AFI_IP, argv[idx_number]->arg); } /* @@ -4917,7 +5059,8 @@ DEFUN (no_neighbor_port, NEIGHBOR_ADDR_STR "Neighbor's BGP port\n") { - return peer_port_vty (vty, argv[2]->arg, AFI_IP, NULL); + int idx_ip = 2; + return peer_port_vty (vty, argv[idx_ip]->arg, AFI_IP, NULL); } @@ -4962,7 +5105,9 @@ DEFUN (neighbor_weight, "Set default weight for routes from this neighbor\n" "default weight\n") { - return peer_weight_set_vty (vty, argv[1]->arg, argv[3]->arg); + int idx_peer = 1; + int idx_number = 3; + return peer_weight_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } /* @@ -4983,7 +5128,8 @@ DEFUN (no_neighbor_weight, NEIGHBOR_ADDR_STR2 "Set default weight for routes from this neighbor\n") { - return peer_weight_unset_vty (vty, argv[2]->arg); + int idx_peer = 2; + return peer_weight_unset_vty (vty, argv[idx_peer]->arg); } @@ -4995,7 +5141,8 @@ DEFUN (neighbor_override_capability, NEIGHBOR_ADDR_STR2 "Override capability negotiation result\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); + int idx_peer = 1; + return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); } DEFUN (no_neighbor_override_capability, @@ -5006,7 +5153,8 @@ DEFUN (no_neighbor_override_capability, NEIGHBOR_ADDR_STR2 "Override capability negotiation result\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); + int idx_peer = 2; + return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); } DEFUN (neighbor_strict_capability, @@ -5016,7 +5164,8 @@ DEFUN (neighbor_strict_capability, NEIGHBOR_ADDR_STR "Strict capability negotiation match\n") { - return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_STRICT_CAP_MATCH); + int idx_ip = 1; + return peer_flag_set_vty (vty, argv[idx_ip]->arg, PEER_FLAG_STRICT_CAP_MATCH); } DEFUN (no_neighbor_strict_capability, @@ -5027,7 +5176,8 @@ DEFUN (no_neighbor_strict_capability, NEIGHBOR_ADDR_STR "Strict capability negotiation match\n") { - return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_STRICT_CAP_MATCH); + int idx_ip = 2; + return peer_flag_unset_vty (vty, argv[idx_ip]->arg, PEER_FLAG_STRICT_CAP_MATCH); } static int @@ -5075,7 +5225,10 @@ DEFUN (neighbor_timers, "Keepalive interval\n" "Holdtime\n") { - return peer_timers_set_vty (vty, argv[1]->arg, argv[3]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_number = 3; + int idx_number_2 = 4; + return peer_timers_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } /* @@ -5097,7 +5250,8 @@ DEFUN (no_neighbor_timers, NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n") { - return peer_timers_unset_vty (vty, argv[2]->arg); + int idx_peer = 2; + return peer_timers_unset_vty (vty, argv[idx_peer]->arg); } @@ -5144,7 +5298,9 @@ DEFUN (neighbor_timers_connect, "BGP connect timer\n" "Connect timer\n") { - return peer_timers_connect_set_vty (vty, argv[1]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_number = 4; + return peer_timers_connect_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } /* @@ -5167,7 +5323,8 @@ DEFUN (no_neighbor_timers_connect, "BGP per neighbor timers\n" "BGP connect timer\n") { - return peer_timers_connect_unset_vty (vty, argv[2]->arg); + int idx_peer = 2; + return peer_timers_connect_unset_vty (vty, argv[idx_peer]->arg); } @@ -5202,7 +5359,9 @@ DEFUN (neighbor_advertise_interval, "Minimum interval between sending BGP routing updates\n" "time in seconds\n") { - return peer_advertise_interval_vty (vty, argv[1]->arg, argv[3]->arg, 1); + int idx_peer = 1; + int idx_number = 3; + return peer_advertise_interval_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg, 1); } /* @@ -5223,7 +5382,8 @@ DEFUN (no_neighbor_advertise_interval, NEIGHBOR_ADDR_STR2 "Minimum interval between sending BGP routing updates\n") { - return peer_advertise_interval_vty (vty, argv[2]->arg, NULL, 0); + int idx_peer = 2; + return peer_advertise_interval_vty (vty, argv[idx_peer]->arg, NULL, 0); } @@ -5236,11 +5396,12 @@ DEFUN (bgp_set_route_map_delay_timer, "Time in secs to wait before processing route-map changes\n" "0 disables the timer, no route updates happen when route-maps change\n") { + int idx_number = 3; u_int32_t rmap_delay_timer; - if (argv[3]->arg) + if (argv[idx_number]->arg) { - VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[3]->arg, 0, 600); + VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[idx_number]->arg, 0, 600); bm->rmap_update_timer = rmap_delay_timer; /* if the dynamic update handling is being disabled, and a timer is @@ -5306,10 +5467,12 @@ DEFUN (neighbor_interface, "Interface\n" "Interface name\n") { + int idx_ip = 1; + int idx_word = 3; if (argc == 3) - return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); + return peer_interface_vty (vty, argv[idx_ip]->arg, argv[idx_word]->arg); else - return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); + return peer_interface_vty (vty, argv[idx_ip]->arg, argv[idx_word]->arg); } DEFUN (no_neighbor_interface, @@ -5321,7 +5484,8 @@ DEFUN (no_neighbor_interface, "Interface\n" "Interface name\n") { - return peer_interface_vty (vty, argv[2]->arg, NULL); + int idx_peer = 2; + return peer_interface_vty (vty, argv[idx_peer]->arg, NULL); } /* Set distribute list to the peer. */ @@ -5384,8 +5548,11 @@ DEFUN (neighbor_distribute_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_distribute_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_acl = 3; + int idx_in_out = 4; + return peer_distribute_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_acl]->arg, argv[idx_in_out]->arg); } DEFUN (no_neighbor_distribute_list, @@ -5401,8 +5568,10 @@ DEFUN (no_neighbor_distribute_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_distribute_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[5]->arg); + int idx_peer = 2; + int idx_in_out = 5; + return peer_distribute_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_in_out]->arg); } /* Set prefix list to the peer. */ @@ -5463,8 +5632,11 @@ DEFUN (neighbor_prefix_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_prefix_list_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_word = 3; + int idx_in_out = 4; + return peer_prefix_list_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_word]->arg, argv[idx_in_out]->arg); } DEFUN (no_neighbor_prefix_list, @@ -5478,8 +5650,10 @@ DEFUN (no_neighbor_prefix_list, "Filter incoming updates\n" "Filter outgoing updates\n") { - return peer_prefix_list_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[5]->arg); + int idx_peer = 2; + int idx_in_out = 5; + return peer_prefix_list_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_in_out]->arg); } static int @@ -5540,8 +5714,11 @@ DEFUN (neighbor_filter_list, "Filter incoming routes\n" "Filter outgoing routes\n") { - return peer_aslist_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_word = 3; + int idx_in_out = 4; + return peer_aslist_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_word]->arg, argv[idx_in_out]->arg); } DEFUN (no_neighbor_filter_list, @@ -5555,8 +5732,10 @@ DEFUN (no_neighbor_filter_list, "Filter incoming routes\n" "Filter outgoing routes\n") { - return peer_aslist_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[5]->arg); + int idx_peer = 2; + int idx_in_out = 5; + return peer_aslist_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_in_out]->arg); } /* Set route-map to the peer. */ @@ -5617,8 +5796,11 @@ DEFUN (neighbor_route_map, "Apply map to incoming routes\n" "Apply map to outbound routes\n") { - return peer_route_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); + int idx_peer = 1; + int idx_word = 3; + int idx_in_out = 4; + return peer_route_map_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_word]->arg, argv[idx_in_out]->arg); } DEFUN (no_neighbor_route_map, @@ -5632,8 +5814,10 @@ DEFUN (no_neighbor_route_map, "Apply map to incoming routes\n" "Apply map to outbound routes\n") { - return peer_route_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[5]->arg); + int idx_peer = 2; + int idx_in_out = 5; + return peer_route_map_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_in_out]->arg); } /* Set unsuppress-map to the peer. */ @@ -5678,8 +5862,10 @@ DEFUN (neighbor_unsuppress_map, "Route-map to selectively unsuppress suppressed routes\n" "Name of route map\n") { - return peer_unsuppress_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg); + int idx_peer = 1; + int idx_word = 3; + return peer_unsuppress_map_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_word]->arg); } DEFUN (no_neighbor_unsuppress_map, @@ -5691,7 +5877,8 @@ DEFUN (no_neighbor_unsuppress_map, "Route-map to selectively unsuppress suppressed routes\n" "Name of route map\n") { - return peer_unsuppress_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_unsuppress_map_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty)); } @@ -5754,8 +5941,10 @@ DEFUN (neighbor_maximum_prefix, "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, NULL, 0, + int idx_peer = 1; + int idx_number = 3; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, NULL, 0, NULL); } @@ -5768,8 +5957,11 @@ DEFUN (neighbor_maximum_prefix_threshold, "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, + int idx_peer = 1; + int idx_number = 3; + int idx_number_2 = 4; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 0, NULL); } @@ -5782,8 +5974,10 @@ DEFUN (neighbor_maximum_prefix_warning, "maximum no. of prefix limit\n" "Only give warning message when limit is exceeded\n") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, NULL, 1, + int idx_peer = 1; + int idx_number = 3; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, NULL, 1, NULL); } @@ -5797,8 +5991,11 @@ DEFUN (neighbor_maximum_prefix_threshold_warning, "Threshold value (%) at which to generate a warning msg\n" "Only give warning message when limit is exceeded\n") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 1, NULL); + int idx_peer = 1; + int idx_number = 3; + int idx_number_2 = 4; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 1, NULL); } DEFUN (neighbor_maximum_prefix_restart, @@ -5811,8 +6008,11 @@ DEFUN (neighbor_maximum_prefix_restart, "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, NULL, 0, argv[5]->arg); + int idx_peer = 1; + int idx_number = 3; + int idx_number_2 = 5; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, NULL, 0, argv[idx_number_2]->arg); } DEFUN (neighbor_maximum_prefix_threshold_restart, @@ -5826,8 +6026,12 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes") { - return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, argv[6]->arg); + int idx_peer = 1; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; + return peer_maximum_prefix_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), + bgp_node_safi (vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 0, argv[idx_number_3]->arg); } /* @@ -5892,7 +6096,8 @@ DEFUN (no_neighbor_maximum_prefix, NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n") { - return peer_maximum_prefix_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_maximum_prefix_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty)); } @@ -5919,11 +6124,12 @@ DEFUN (neighbor_allowas_in, NEIGHBOR_ADDR_STR2 "Accept as-path with my AS present in it\n") { + int idx_peer = 1; int ret; struct peer *peer; unsigned int allow_num; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -5957,10 +6163,11 @@ DEFUN (no_neighbor_allowas_in, NEIGHBOR_ADDR_STR2 "allow local ASN appears in aspath attribute\n") { + int idx_peer = 2; int ret; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -5977,14 +6184,16 @@ DEFUN (neighbor_ttl_security, NEIGHBOR_ADDR_STR2 "Specify the maximum number of hops to the BGP peer\n") { + int idx_peer = 1; + int idx_number = 4; struct peer *peer; int gtsm_hops; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[4]->arg, 1, 254); + VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[idx_number]->arg, 1, 254); /* * If 'neighbor swpX', then this is for directly connected peers, @@ -5992,7 +6201,7 @@ DEFUN (neighbor_ttl_security, */ if (peer->conf_if && (gtsm_hops > 1)) { vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", - argv[1]->arg, VTY_NEWLINE); + argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -6007,9 +6216,10 @@ DEFUN (no_neighbor_ttl_security, NEIGHBOR_ADDR_STR2 "Specify the maximum number of hops to the BGP peer\n") { + int idx_peer = 2; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[2]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -6023,13 +6233,14 @@ DEFUN (neighbor_addpath_tx_all_paths, NEIGHBOR_ADDR_STR2 "Use addpath to advertise all paths to a neighbor\n") { + int idx_peer = 1; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_ALL_PATHS); } @@ -6042,7 +6253,8 @@ DEFUN (no_neighbor_addpath_tx_all_paths, NEIGHBOR_ADDR_STR2 "Use addpath to advertise all paths to a neighbor\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_ALL_PATHS); } @@ -6054,13 +6266,14 @@ DEFUN (neighbor_addpath_tx_bestpath_per_as, NEIGHBOR_ADDR_STR2 "Use addpath to advertise the bestpath per each neighboring AS\n") { + int idx_peer = 1; struct peer *peer; - peer = peer_and_group_lookup_vty (vty, argv[1]->arg); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; - return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), + return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); } @@ -6073,7 +6286,8 @@ DEFUN (no_neighbor_addpath_tx_bestpath_per_as, NEIGHBOR_ADDR_STR2 "Use addpath to advertise the bestpath per each neighboring AS\n") { - return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), + int idx_peer = 2; + return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); } @@ -6098,7 +6312,8 @@ DEFUN (address_family_ipv4_safi, "Address Family modifier\n" "Address Family modifier\n") { - if (strncmp (argv[2]->arg, "m", 1) == 0) + int idx_safi = 2; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) vty->node = BGP_IPV4M_NODE; else vty->node = BGP_IPV4_NODE; @@ -6124,7 +6339,8 @@ DEFUN (address_family_ipv6_safi, "Address Family modifier\n" "Address Family modifier\n") { - if (strncmp (argv[2]->arg, "m", 1) == 0) + int idx_safi = 2; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) vty->node = BGP_IPV6M_NODE; else vty->node = BGP_IPV6_NODE; @@ -6400,10 +6616,11 @@ DEFUN (clear_ip_bgp_peer, "BGP IPv6 neighbor to clear\n" "BGP neighbor on interface to clear\n") { + int idx_peer = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[3]->arg); + return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); } @@ -6459,10 +6676,11 @@ DEFUN (clear_ip_bgp_peer_group, "Clear all members of peer-group\n" "BGP peer-group name\n") { + int idx_word = 4; if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[4]->arg); + return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[idx_word]->arg); } @@ -6556,10 +6774,11 @@ DEFUN (clear_ip_bgp_prefix, "Clear bestpath and re-advertise\n" "IP prefix /, e.g., 35.0.0.0/8\n") { + int idx_ipv4_prefixlen = 4; if (argc == 3) return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); - return bgp_clear_prefix (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); } @@ -6607,11 +6826,12 @@ DEFUN (clear_ip_bgp_as, BGP_STR "Clear peers with the AS number\n") { + int idx_number = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); - return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[3]->arg); -} + return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); +} @@ -6693,7 +6913,8 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); @@ -6728,11 +6949,14 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, "Address Family modifier\n" BGP_SOFT_OUT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, + int idx_view_vrf = 3; + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); - return bgp_clear_vty (vty, argv[3]->arg, AFI_IP, SAFI_UNICAST, clear_all, + return bgp_clear_vty (vty, argv[idx_view_vrf]->arg, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); } @@ -6886,10 +7110,12 @@ DEFUN (clear_bgp_ipv6_safi_prefix, "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - if (strncmp (argv[3]->arg, "m", 1) == 0) - return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_MULTICAST, NULL); + int idx_safi = 3; + int idx_ipv6_prefixlen = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_prefix (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL); else - return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL); } DEFUN (clear_bgp_instance_ipv6_safi_prefix, @@ -6903,10 +7129,13 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - if (strncmp (argv[5]->arg, "m", 1) == 0) - return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_MULTICAST, NULL); + int idx_word = 3; + int idx_safi = 5; + int idx_ipv6_prefixlen = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL); else - return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL); } /* @@ -6950,12 +7179,13 @@ DEFUN (clear_ip_bgp_peer_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_ipv4_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } @@ -6989,12 +7219,14 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_ipv4_word = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } /* @@ -7027,12 +7259,15 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[5]->arg); + int idx_word = 4; + int idx_ipv4_word = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } @@ -7064,8 +7299,9 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_ipv4_word = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } @@ -7093,8 +7329,9 @@ DEFUN (clear_ip_bgp_peer_encap_soft_out, "Soft reconfig\n" "Soft reconfig outbound update\n") { + int idx_ipv4 = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_ipv4]->arg); } @@ -7179,12 +7416,13 @@ DEFUN (clear_bgp_peer_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_peer = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[2]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_peer]->arg); } @@ -7235,12 +7473,13 @@ DEFUN (clear_ip_bgp_peer_group_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_word = 4; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[4]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } @@ -7274,12 +7513,14 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[6]->arg, "m", 1) == 0) + int idx_word = 4; + int idx_safi = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[4]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[4]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } /* @@ -7312,12 +7553,15 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[8]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[6]->arg); + int idx_word = 4; + int idx_word_2 = 6; + int idx_safi = 8; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_OUT, argv[idx_word_2]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[6]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_OUT, argv[idx_word_2]->arg); } @@ -7395,12 +7639,13 @@ DEFUN (clear_bgp_peer_group_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } @@ -7484,7 +7729,8 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); @@ -7520,11 +7766,13 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); } @@ -7647,12 +7895,13 @@ DEFUN (clear_ip_bgp_as_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_number = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } @@ -7684,12 +7933,14 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_number = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } /* @@ -7720,12 +7971,15 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[5]->arg); + int idx_word = 4; + int idx_number = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } @@ -7754,8 +8008,9 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } @@ -7783,8 +8038,9 @@ DEFUN (clear_ip_bgp_as_encap_soft_out, "Soft reconfig\n" "Soft reconfig outbound update\n") { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_OUT, argv[3]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } @@ -7853,12 +8109,13 @@ DEFUN (clear_bgp_as_soft_out, BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_number = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_OUT, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[2]->arg); + BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } @@ -7961,7 +8218,8 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); @@ -7997,11 +8255,13 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_all, + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); } @@ -8020,7 +8280,8 @@ DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); @@ -8232,12 +8493,13 @@ DEFUN (clear_ip_bgp_peer_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_ipv4_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } @@ -8254,8 +8516,9 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter, BGP_SOFT_IN_STR "Push out the existing ORF prefix-list\n") { + int idx_ipv4_word = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); } /* @@ -8286,12 +8549,14 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_ipv4_word = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } /* @@ -8324,12 +8589,15 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[5]->arg); + int idx_word = 4; + int idx_ipv4_word = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } @@ -8348,12 +8616,14 @@ DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out the existing ORF prefix-list\n") { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_ipv4_word = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); } /* @@ -8382,8 +8652,9 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_ipv4_word = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } @@ -8411,8 +8682,9 @@ DEFUN (clear_ip_bgp_peer_encap_soft_in, "Soft reconfig\n" "Soft reconfig inbound update\n") { + int idx_ipv4 = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_ipv4]->arg); } @@ -8497,12 +8769,13 @@ DEFUN (clear_bgp_peer_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_peer = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[2]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_peer]->arg); } @@ -8536,8 +8809,9 @@ DEFUN (clear_bgp_peer_in_prefix_filter, BGP_SOFT_IN_STR "Push out the existing ORF prefix-list\n") { + int idx_peer = 2; return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_peer]->arg); } @@ -8582,12 +8856,13 @@ DEFUN (clear_ip_bgp_peer_group_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_word = 4; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[4]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); } @@ -8604,8 +8879,9 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { + int idx_word = 4; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); } /* @@ -8636,12 +8912,14 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[6]->arg, "m", 1) == 0) + int idx_word = 4; + int idx_safi = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[4]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[4]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); } /* @@ -8674,12 +8952,15 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[8]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[6]->arg); + int idx_word = 4; + int idx_word_2 = 6; + int idx_safi = 8; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_IN, argv[idx_word_2]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[6]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_IN, argv[idx_word_2]->arg); } @@ -8698,12 +8979,14 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[6]->arg, "m", 1) == 0) + int idx_word = 4; + int idx_safi = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); } /* @@ -8779,12 +9062,13 @@ DEFUN (clear_bgp_peer_group_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); } @@ -8816,8 +9100,9 @@ DEFUN (clear_bgp_peer_group_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { + int idx_word = 3; return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); } @@ -8909,7 +9194,8 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); @@ -8945,11 +9231,13 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); } @@ -8968,7 +9256,8 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); @@ -9118,12 +9407,13 @@ DEFUN (clear_ip_bgp_as_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_number = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } @@ -9139,8 +9429,9 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); } /* @@ -9169,12 +9460,14 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_number = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } /* @@ -9205,12 +9498,15 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[5]->arg); + int idx_word = 4; + int idx_number = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } @@ -9228,12 +9524,14 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_number = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); } /* @@ -9260,8 +9558,9 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } @@ -9289,8 +9588,9 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, "Soft reconfig\n" "Soft reconfig inbound update\n") { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_IN, argv[3]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } @@ -9359,12 +9659,13 @@ DEFUN (clear_bgp_as_soft_in, BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_number = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_IN, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[2]->arg); + BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } @@ -9394,8 +9695,9 @@ DEFUN (clear_bgp_as_in_prefix_filter, BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { + int idx_number = 2; return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); + BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); } @@ -9442,7 +9744,8 @@ DEFUN (clear_ip_bgp_all_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); @@ -9463,8 +9766,10 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, @@ -9567,12 +9872,13 @@ DEFUN (clear_ip_bgp_peer_soft, "BGP neighbor on interface to clear\n" BGP_SOFT_STR) { + int idx_ipv4_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); } @@ -9589,12 +9895,14 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_ipv4_word = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); } DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, @@ -9611,12 +9919,15 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[5]->arg); + int idx_word = 4; + int idx_ipv4_word = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); } DEFUN (clear_ip_bgp_peer_vpnv4_soft, @@ -9631,8 +9942,9 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { + int idx_ipv4_word = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); } DEFUN (clear_ip_bgp_peer_encap_soft, @@ -9646,8 +9958,9 @@ DEFUN (clear_ip_bgp_peer_encap_soft, "Address Family Modifier\n" "Soft reconfig\n") { + int idx_ipv4 = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4]->arg); } /* @@ -9691,12 +10004,13 @@ DEFUN (clear_bgp_peer_soft, "BGP neighbor on interface to clear\n" BGP_SOFT_STR) { + int idx_peer = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[2]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_peer]->arg); } @@ -9724,12 +10038,13 @@ DEFUN (clear_ip_bgp_peer_group_soft, "BGP peer-group name\n" BGP_SOFT_STR) { + int idx_word = 4; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[4]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); } @@ -9746,12 +10061,14 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[6]->arg, "m", 1) == 0) + int idx_word = 4; + int idx_safi = 6; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[4]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[4]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); } DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, @@ -9768,12 +10085,15 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[8]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[6]->arg); + int idx_word = 4; + int idx_word_2 = 6; + int idx_safi = 8; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, + BGP_CLEAR_SOFT_BOTH, argv[idx_word_2]->arg); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[6]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, + BGP_CLEAR_SOFT_BOTH, argv[idx_word_2]->arg); } /* @@ -9813,12 +10133,13 @@ DEFUN (clear_bgp_peer_group_soft, "BGP peer-group name\n" BGP_SOFT_STR) { + int idx_word = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); } @@ -9865,7 +10186,8 @@ DEFUN (clear_ip_bgp_external_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); @@ -9886,11 +10208,13 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft, "Address Family modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, + int idx_word = 4; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_BOTH, NULL); } @@ -9958,12 +10282,13 @@ DEFUN (clear_ip_bgp_as_soft, "Clear peers with the AS number\n" BGP_SOFT_STR) { + int idx_number = 3; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } @@ -9979,12 +10304,14 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[5]->arg, "m", 1) == 0) + int idx_number = 3; + int idx_safi = 5; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } DEFUN (clear_ip_bgp_instance_as_ipv4_soft, @@ -10000,12 +10327,15 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { - if (strncmp (argv[7]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[5]->arg); + int idx_word = 4; + int idx_number = 5; + int idx_safi = 7; + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); - return bgp_clear_vty (vty, argv[4]->arg,AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[5]->arg); + return bgp_clear_vty (vty, argv[idx_word]->arg,AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } DEFUN (clear_ip_bgp_as_vpnv4_soft, @@ -10019,8 +10349,9 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft, "Address Family Modifier\n" BGP_SOFT_STR) { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } DEFUN (clear_ip_bgp_as_encap_soft, @@ -10034,8 +10365,9 @@ DEFUN (clear_ip_bgp_as_encap_soft, "Address Family Modifier\n" "Soft reconfig\n") { + int idx_number = 3; return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[3]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } /* @@ -10071,12 +10403,13 @@ DEFUN (clear_bgp_as_soft, "Clear peers with the AS number\n" BGP_SOFT_STR) { + int idx_number = 2; if (argc == 3) return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_BOTH, argv[2]); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[2]->arg); + BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); } @@ -10782,8 +11115,9 @@ DEFUN (show_ip_bgp_instance_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_word = 4; u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, uj); } DEFUN (show_ip_bgp_instance_all_summary, @@ -10825,8 +11159,9 @@ DEFUN (show_ip_bgp_ipv4_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_safi = 4; u_char uj = use_json(argc, argv); - if (strncmp (argv[4]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); @@ -10887,11 +11222,13 @@ DEFUN (show_ip_bgp_instance_ipv4_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_safi = 6; u_char uj = use_json(argc, argv); - if (strncmp (argv[6]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, uj); else - return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, uj); } @@ -10922,11 +11259,12 @@ DEFUN (show_ip_bgp_vpnv4_rd_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_ext_community = 5; int ret; struct prefix_rd prd; u_char uj = use_json(argc, argv); - ret = str2prefix_rd (argv[5]->arg, &prd); + ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -10976,7 +11314,8 @@ DEFUN (show_bgp_instance_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); + int idx_word = 3; + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); } DEFUN (show_bgp_instance_all_summary, @@ -11007,8 +11346,9 @@ DEFUN (show_bgp_ipv6_safi_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_safi = 3; u_char uj = use_json(argc, argv); - if (strncmp (argv[3]->arg, "m", 1) == 0) + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); @@ -11026,11 +11366,13 @@ DEFUN (show_bgp_instance_ipv6_safi_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + int idx_word = 3; + int idx_safi = 5; u_char uj = use_json(argc, argv); - if (strncmp (argv[5]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, uj); + if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, uj); - return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, uj); + return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, uj); } /* old command */ @@ -13061,9 +13403,10 @@ DEFUN (show_ip_bgp_instance_neighbors, "Detailed information on TCP and BGP neighbor connections\n" "JavaScript Object Notation\n") { + int idx_word = 4; u_char uj = use_json(argc, argv); - return bgp_show_neighbor_vty (vty, argv[4]->arg, show_all, NULL, uj, NULL); + return bgp_show_neighbor_vty (vty, argv[idx_word]->arg, show_all, NULL, uj, NULL); } DEFUN (show_ip_bgp_instance_all_neighbors, @@ -13121,9 +13464,11 @@ DEFUN (show_ip_bgp_instance_neighbors_peer, "Neighbor on bgp configured interface\n" "JavaScript Object Notation\n") { + int idx_word = 4; + int idx_peer = 6; u_char uj = use_json(argc, argv); - return bgp_show_neighbor_vty (vty, argv[4]->arg, show_peer, argv[6]->arg, uj, NULL); + return bgp_show_neighbor_vty (vty, argv[idx_word]->arg, show_peer, argv[idx_peer]->arg, uj, NULL); } @@ -13256,7 +13601,8 @@ DEFUN (show_ip_bgp_instance_updgrps, BGP_INSTANCE_HELP_STR "Detailed info about dynamic update groups\n") { - return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, 0)); + int idx_word = 4; + return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0)); } DEFUN (show_ip_bgp_instance_all_updgrps, @@ -13290,7 +13636,8 @@ DEFUN (show_bgp_instance_ipv6_updgrps, BGP_INSTANCE_HELP_STR "Detailed info about v6 dynamic update groups\n") { - return (bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, 0)); + int idx_word = 3; + return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, 0)); } DEFUN (show_bgp_instance_all_ipv6_updgrps, @@ -13316,11 +13663,13 @@ DEFUN (show_bgp_updgrps, "Address Family modifier\n" "Detailed info about dynamic update groups\n") { + int idx_afi = 2; + int idx_safi = 3; afi_t afi; safi_t safi; - afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); } @@ -13349,10 +13698,11 @@ DEFUN (show_ip_bgp_instance_updgrps_s, "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") { + int idx_word = 4; uint64_t subgrp_id; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, subgrp_id)); + return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, subgrp_id)); } DEFUN (show_bgp_ipv6_updgrps_s, @@ -13377,10 +13727,11 @@ DEFUN (show_bgp_instance_ipv6_updgrps_s, "Detailed info about v6 dynamic update groups\n" "Specific subgroup to display detailed info for\n") { + int idx_word = 3; uint64_t subgrp_id; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return(bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, subgrp_id)); + return(bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, subgrp_id)); } DEFUN (show_bgp_updgrps_s, @@ -13395,12 +13746,14 @@ DEFUN (show_bgp_updgrps_s, "Detailed info about v6 dynamic update groups\n" "Specific subgroup to display detailed info for") { + int idx_afi = 2; + int idx_safi = 3; afi_t afi; safi_t safi; uint64_t subgrp_id; - afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); @@ -13432,9 +13785,10 @@ DEFUN (show_bgp_instance_updgrps_stats, "BGP update groups\n" "Statistics\n") { + int idx_word = 3; struct bgp *bgp; - bgp = bgp_lookup_by_name (argv[3]->arg); + bgp = bgp_lookup_by_name (argv[idx_word]->arg); if (bgp) update_group_show_stats(bgp, vty); @@ -13476,7 +13830,8 @@ DEFUN (show_ip_bgp_updgrps_adj, "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[4]->arg, 0); + int idx_type = 4; + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -13493,7 +13848,9 @@ DEFUN (show_ip_bgp_instance_updgrps_adj, "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[6]->arg, 0); + int idx_word = 4; + int idx_type = 6; + show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -13512,12 +13869,15 @@ DEFUN (show_bgp_updgrps_afi_adj, "Packet queue\n" "Specific subgroup info wanted for\n") { + int idx_afi = 2; + int idx_safi = 3; + int idx_type = 5; afi_t afi; safi_t safi; - afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[5]->arg, 0); + afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -13531,7 +13891,8 @@ DEFUN (show_bgp_updgrps_adj, "Announced routes\n" "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[3]->arg, 0); + int idx_type = 3; + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -13546,7 +13907,9 @@ DEFUN (show_bgp_instance_updgrps_adj, "Announced routes\n" "Packet queue\n") { - show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[5]->arg, 0); + int idx_word = 3; + int idx_type = 5; + show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, 0); return CMD_SUCCESS; } @@ -13563,9 +13926,10 @@ DEFUN (show_ip_bgp_updgrps_adj_s, "Packet queue\n") { + int idx_type = 5; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[5]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); return CMD_SUCCESS; @@ -13585,11 +13949,13 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, "Packet queue\n") { + int idx_word = 4; + int idx_type = 7; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[7]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); return CMD_SUCCESS; } @@ -13609,13 +13975,16 @@ DEFUN (show_bgp_updgrps_afi_adj_s, "Packet queue\n" "Specific subgroup info wanted for\n") { + int idx_afi = 2; + int idx_safi = 3; + int idx_type = 6; afi_t afi; safi_t safi; uint64_t subgrp_id; - afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); + afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; + safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); return CMD_SUCCESS; @@ -13632,9 +14001,10 @@ DEFUN (show_bgp_updgrps_adj_s, "Announced routes\n" "Packet queue\n") { + int idx_type = 4; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[4]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); return CMD_SUCCESS; @@ -13652,11 +14022,13 @@ DEFUN (show_bgp_instance_updgrps_adj_s, "Announced routes\n" "Packet queue\n") { + int idx_word = 3; + int idx_type = 6; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); return CMD_SUCCESS; } @@ -13841,7 +14213,8 @@ DEFUN (show_ip_bgp_instance_peer_groups, BGP_INSTANCE_HELP_STR "Detailed information on all BGP peer groups\n") { - return bgp_show_peer_group_vty (vty, argv[4]->arg, show_all_groups, NULL); + int idx_word = 4; + return bgp_show_peer_group_vty (vty, argv[idx_word]->arg, show_all_groups, NULL); } DEFUN (show_ip_bgp_peer_group, @@ -13853,7 +14226,8 @@ DEFUN (show_ip_bgp_peer_group, "BGP peer-group name\n" "Detailed information on a BGP peer group\n") { - return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[4]->arg); + int idx_word = 4; + return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[idx_word]->arg); } DEFUN (show_ip_bgp_instance_peer_group, @@ -13866,7 +14240,9 @@ DEFUN (show_ip_bgp_instance_peer_group, "BGP peer-group name\n" "Detailed information on a BGP peer group\n") { - return bgp_show_peer_group_vty (vty, argv[4]->arg, show_peer_group, argv[6]->arg); + int idx_word = 4; + int idx_word_2 = 6; + return bgp_show_peer_group_vty (vty, argv[idx_word]->arg, show_peer_group, argv[idx_word_2]->arg); } /* Redistribute VTY commands. */ @@ -13877,9 +14253,10 @@ DEFUN (bgp_redistribute_ipv4, "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD) { + int idx_protocol = 1; int type; - type = proto_redistnum (AFI_IP, argv[1]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -13897,10 +14274,12 @@ DEFUN (bgp_redistribute_ipv4_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_word = 3; int type; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[1]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -13908,7 +14287,7 @@ DEFUN (bgp_redistribute_ipv4_rmap, } red = bgp_redist_add(vty->index, AFI_IP, type, 0); - bgp_redistribute_rmap_set (red, argv[3]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -13920,17 +14299,19 @@ DEFUN (bgp_redistribute_ipv4_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_protocol = 1; + int idx_number = 3; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[1]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[3]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); @@ -13947,20 +14328,23 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_protocol = 1; + int idx_word = 3; + int idx_number = 5; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[1]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[5]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); - bgp_redistribute_rmap_set (red, argv[3]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -13975,21 +14359,24 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_number = 3; + int idx_word = 5; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP, argv[1]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[3]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); - bgp_redistribute_rmap_set (red, argv[5]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP, type, 0); } @@ -14001,12 +14388,14 @@ DEFUN (bgp_redistribute_ipv4_ospf, "Non-main Kernel Routing Table\n" "Instance ID/Table ID\n") { + int idx_ospf_table = 1; + int idx_number = 2; u_short instance; u_short protocol; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; @@ -14025,18 +14414,21 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_ospf_table = 1; + int idx_number = 2; + int idx_word = 4; struct bgp_redist *red; u_short instance; int protocol; - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); - bgp_redistribute_rmap_set (red, argv[4]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -14050,18 +14442,21 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_ospf_table = 1; + int idx_number = 2; + int idx_number_2 = 4; u_int32_t metric; struct bgp_redist *red; u_short instance; int protocol; - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); - VTY_GET_INTEGER ("metric", metric, argv[4]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); @@ -14080,21 +14475,25 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_ospf_table = 1; + int idx_number = 2; + int idx_word = 4; + int idx_number_2 = 6; u_int32_t metric; struct bgp_redist *red; u_short instance; int protocol; - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); - VTY_GET_INTEGER ("metric", metric, argv[6]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); - bgp_redistribute_rmap_set (red, argv[4]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -14111,22 +14510,26 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_ospf_table = 1; + int idx_number = 2; + int idx_number_2 = 4; + int idx_word = 6; u_int32_t metric; struct bgp_redist *red; u_short instance; int protocol; - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); - VTY_GET_INTEGER ("metric", metric, argv[4]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg); red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); - bgp_redistribute_rmap_set (red, argv[6]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } @@ -14182,15 +14585,17 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, "Non-main Kernel Routing Table\n" "Instance ID/Table ID\n") { + int idx_ospf_table = 2; + int idx_number = 3; u_short instance; int protocol; - if (strncmp(argv[2]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) protocol = ZEBRA_ROUTE_OSPF; else protocol = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); } @@ -14240,9 +14645,10 @@ DEFUN (no_bgp_redistribute_ipv4, "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD) { + int idx_protocol = 2; int type; - type = proto_redistnum (AFI_IP, argv[2]->arg); + type = proto_redistnum (AFI_IP, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14262,9 +14668,10 @@ DEFUN (bgp_redistribute_ipv6, "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD) { + int idx_protocol = 1; int type; - type = proto_redistnum (AFI_IP6, argv[1]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14283,10 +14690,12 @@ DEFUN (bgp_redistribute_ipv6_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_word = 3; int type; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[1]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -14294,7 +14703,7 @@ DEFUN (bgp_redistribute_ipv6_rmap, } red = bgp_redist_add(vty->index, AFI_IP6, type, 0); - bgp_redistribute_rmap_set (red, argv[3]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14306,17 +14715,19 @@ DEFUN (bgp_redistribute_ipv6_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_protocol = 1; + int idx_number = 3; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[1]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[3]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); @@ -14333,20 +14744,23 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, "Metric for redistributed routes\n" "Default metric\n") { + int idx_protocol = 1; + int idx_word = 3; + int idx_number = 5; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[1]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[5]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); - bgp_redistribute_rmap_set (red, argv[3]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14361,21 +14775,24 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_number = 3; + int idx_word = 5; int type; u_int32_t metric; struct bgp_redist *red; - type = proto_redistnum (AFI_IP6, argv[1]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } - VTY_GET_INTEGER ("metric", metric, argv[3]->arg); + VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg); red = bgp_redist_add(vty->index, AFI_IP6, type, 0); bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); - bgp_redistribute_rmap_set (red, argv[5]->arg); + bgp_redistribute_rmap_set (red, argv[idx_word]->arg); return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } @@ -14421,9 +14838,10 @@ DEFUN (no_bgp_redistribute_ipv6, "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD) { + int idx_protocol = 2; int type; - type = proto_redistnum (AFI_IP6, argv[2]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_BGP) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); @@ -16223,9 +16641,10 @@ DEFUN (show_ip_community_list_arg, "Community-list number\n" "Community-list name\n") { + int idx_comm_list = 3; struct community_list *list; - list = community_list_lookup (bgp_clist, argv[3]->arg, COMMUNITY_LIST_MASTER); + list = community_list_lookup (bgp_clist, argv[idx_comm_list]->arg, COMMUNITY_LIST_MASTER); if (! list) { vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); @@ -16604,9 +17023,10 @@ DEFUN (show_ip_extcommunity_list_arg, "Extcommunity-list number\n" "Extcommunity-list name\n") { + int idx_comm_list = 3; struct community_list *list; - list = community_list_lookup (bgp_clist, argv[3]->arg, EXTCOMMUNITY_LIST_MASTER); + list = community_list_lookup (bgp_clist, argv[idx_comm_list]->arg, EXTCOMMUNITY_LIST_MASTER); if (! list) { vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index eff05a4125..c98f0d69f3 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -262,6 +262,78 @@ def get_token_index_variable_name(line_number, token): elif token == 'A.B.C.D|X:X::X:X': return 'idx_ip' + elif token == 'in|out': + return 'idx_in_out' + + elif token == 'deny|permit': + return 'idx_permit_deny' + + elif token == 'view|vrf': + return 'idx_view_vrf' + + elif token == 'unicast|multicast': + return 'idx_safi' + + elif token == 'bestpath|multipath': + return 'idx_bestpath' + + elif token == 'egp|igp|incomplete': + return 'idx_origin' + + elif token == 'cisco|zebra': + return 'idx_vendor' + + elif token == 'as-set|no-as-set': + return 'idx_as_set' + + elif token == 'confed|missing-as-worst': + return 'idx_med_knob' + + elif token == 'both|send|receive': + return 'idx_send_recv' + + elif token == 'both|extended|standard': + return 'idx_type' + + elif token == 'A.B.C.D|WORD': + return 'idx_ipv4_word' + + elif token == 'advertise-queue|advertised-routes|packet-queue': + return 'idx_type' + + elif token == 'ospf|table': + return 'idx_ospf_table' + + elif token == 'as-path|next-hop|med' or token == 'next-hop|med' or token == 'as-path|med' or token == 'as-path|next-hop': + return 'idx_attribute' + + elif token == '(1-4294967295)|external|internal' or token == '(1-4294967295)|internal|external': + return 'idx_remote_as' + + elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD': + return 'idx_comm_list' + + elif token == 'ipv4|ipv6': + return 'idx_afi' + + elif token == 'advertised-routes|received-routes': + return 'idx_adv_rcvd_routes' + + elif token == 'encap|multicast|unicast|vpn' or token == 'unicast|multicast|vpn|encap': + return 'idx_safi' + + elif token == 'AA:NN|local-AS|no-advertise|no-export': + return 'idx_community' + + elif token == 'all|all-et|updates|updates-et|routes-mrt': + return 'idx_dump_routes' + + elif token == 'A.B.C.D|X:X::X:X|WORD': + return 'idx_peer' + + elif token == 'A.B.C.D/M|X:X::X:X/M': + return 'idx_ipv4_ipv6_prefixlen' + elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': return 'idx_rpf_lookup_mode' From ba4c5c830745e84b6943362e7077e4b1846b8bdf Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 19:50:58 +0000 Subject: [PATCH 124/280] isisd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- isisd/isis_redist.c | 48 ++++++++----- isisd/isis_routemap.c | 24 ++++--- isisd/isis_te.c | 6 +- isisd/isis_vty.c | 143 +++++++++++++++++++++++++-------------- isisd/isisd.c | 38 +++++++---- tools/argv_translator.py | 20 +++++- 6 files changed, 188 insertions(+), 91 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 62b057eabe..fcdc11bba1 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -551,6 +551,10 @@ DEFUN (isis_redistribute, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_afi = 1; + int idx_protocol = 2; + int idx_level = 3; + int idx_metric_rmap = 4; struct isis_area *area = vty->index; int family; int afi; @@ -562,7 +566,7 @@ DEFUN (isis_redistribute, if (argc < 5) return CMD_WARNING; - family = str2family(argv[1]->arg); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -570,13 +574,13 @@ DEFUN (isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[2]->arg); + type = proto_redistnum(afi, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[3]->arg)) + if (!strcmp("level-1", argv[idx_level]->arg)) level = 1; - else if (!strcmp("level-2", argv[3]->arg)) + else if (!strcmp("level-2", argv[idx_level]->arg)) level = 2; else return CMD_WARNING; @@ -587,11 +591,11 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[4]->arg) + if (argv[idx_metric_rmap]->arg) { char *endp; - metric = strtoul(argv[4]->arg, &endp, 10); - if (argv[4]->arg[0] == '\0' || *endp != '\0') + metric = strtoul(argv[idx_metric_rmap]->arg, &endp, 10); + if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else @@ -616,6 +620,9 @@ DEFUN (no_isis_redistribute, "Redistribute into level-1\n" "Redistribute into level-2\n") { + int idx_afi = 2; + int idx_protocol = 3; + int idx_level = 4; struct isis_area *area = vty->index; int type; int level; @@ -625,7 +632,7 @@ DEFUN (no_isis_redistribute, if (argc < 3) return CMD_WARNING; - family = str2family(argv[2]->arg); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -633,13 +640,13 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[3]->arg); + type = proto_redistnum(afi, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[4]->arg)) + if (!strcmp("level-1", argv[idx_level]->arg)) level = 1; - else if (!strcmp("level-2", argv[4]->arg)) + else if (!strcmp("level-2", argv[idx_level]->arg)) level = 2; else return CMD_WARNING; @@ -663,6 +670,9 @@ DEFUN (isis_default_originate, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_afi = 2; + int idx_level = 3; + int idx_metric_rmap = 4; struct isis_area *area = vty->index; int family; int originate_type; @@ -673,13 +683,13 @@ DEFUN (isis_default_originate, if (argc < 5) return CMD_WARNING; - family = str2family(argv[2]->arg); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[3]->arg)) + if (!strcmp("level-1", argv[idx_level]->arg)) level = 1; - else if (!strcmp("level-2", argv[3]->arg)) + else if (!strcmp("level-2", argv[idx_level]->arg)) level = 2; else return CMD_WARNING; @@ -690,7 +700,7 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[4]->arg && *argv[4]->arg != '\0') + if (argv[idx_metric_rmap]->arg && *argv[idx_metric_rmap]->arg != '\0') originate_type = DEFAULT_ORIGINATE_ALWAYS; else originate_type = DEFAULT_ORIGINATE; @@ -730,6 +740,8 @@ DEFUN (no_isis_default_originate, "Distribute default route into level-1\n" "Distribute default route into level-2\n") { + int idx_afi = 3; + int idx_level = 4; struct isis_area *area = vty->index; int family; @@ -738,13 +750,13 @@ DEFUN (no_isis_default_originate, if (argc < 2) return CMD_WARNING; - family = str2family(argv[3]->arg); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[4]->arg)) + if (!strcmp("level-1", argv[idx_level]->arg)) level = 1; - else if (!strcmp("level-2", argv[4]->arg)) + else if (!strcmp("level-2", argv[idx_level]->arg)) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index fd6bff848d..b9f6c7a555 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -354,7 +354,8 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address", argv[3]->arg); + int idx_acl = 3; + return isis_route_match_add(vty, vty->index, "ip address", argv[idx_acl]->arg); } /* @@ -377,9 +378,10 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + int idx_acl = 4; if (argc == 0) return isis_route_match_delete(vty, vty->index, "ip address", NULL); - return isis_route_match_delete(vty, vty->index, "ip address", argv[4]->arg); + return isis_route_match_delete(vty, vty->index, "ip address", argv[idx_acl]->arg); } @@ -394,7 +396,8 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[4]->arg); + int idx_word = 4; + return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } /* @@ -433,7 +436,8 @@ DEFUN (match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address", argv[3]->arg); + int idx_word = 3; + return isis_route_match_add(vty, vty->index, "ipv6 address", argv[idx_word]->arg); } /* @@ -454,9 +458,10 @@ DEFUN (no_match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { + int idx_word = 4; if (argc == 0) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); - return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[4]->arg); + return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[idx_word]->arg); } @@ -471,7 +476,8 @@ DEFUN (match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[4]->arg); + int idx_word = 4; + return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); } /* @@ -512,7 +518,8 @@ DEFUN (set_metric, "Metric vale for destination routing protocol\n" "Metric value\n") { - return isis_route_set_add(vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return isis_route_set_add(vty, vty->index, "metric", argv[idx_number]->arg); } /* @@ -534,9 +541,10 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { + int idx_number = 3; if (argc == 0) return isis_route_set_delete(vty, vty->index, "metric", NULL); - return isis_route_set_delete(vty, vty->index, "metric", argv[3]->arg); + return isis_route_set_delete(vty, vty->index, "metric", argv[idx_number]->arg); } { diff --git a/isisd/isis_te.c b/isisd/isis_te.c index b958f0a213..b9e75bcf28 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1163,11 +1163,12 @@ DEFUN (isis_mpls_te_router_addr, "Stable IP address of the advertising router\n" "MPLS-TE router address in IPv4 address format\n") { + int idx_ipv4 = 2; struct in_addr value; struct listnode *node; struct isis_area *area; - if (! inet_aton (argv[2]->arg, &value)) + if (! inet_aton (argv[idx_ipv4]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1317,6 +1318,7 @@ DEFUN (show_isis_mpls_te_interface, "Interface information\n" "Interface name\n") { + int idx_interface = 4; struct interface *ifp; struct listnode *node; @@ -1329,7 +1331,7 @@ DEFUN (show_isis_mpls_te_interface, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index a3890a5954..aad8113fd5 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -61,11 +61,13 @@ DEFUN (ip_router_isis, "IS-IS Routing for IP\n" "Routing process tag\n") { + int idx_afi = 0; + int idx_word = 3; struct interface *ifp; struct isis_circuit *circuit; struct isis_area *area; - const char *af = argv[0]->arg; - const char *area_tag = argv[3]->arg; + const char *af = argv[idx_afi]->arg; + const char *area_tag = argv[idx_word]->arg; ifp = (struct interface *) vty->index; assert (ifp); @@ -115,11 +117,13 @@ DEFUN (no_ip_router_isis, "IS-IS Routing for IP\n" "Routing process tag\n") { + int idx_afi = 1; + int idx_word = 4; struct interface *ifp; struct isis_area *area; struct isis_circuit *circuit; - const char *af = argv[1]->arg; - const char *area_tag = argv[4]->arg; + const char *af = argv[idx_afi]->arg; + const char *area_tag = argv[idx_word]->arg; ifp = (struct interface *) vty->index; if (!ifp) @@ -132,7 +136,7 @@ DEFUN (no_ip_router_isis, if (!area) { vty_out (vty, "Can't find ISIS instance %s%s", - argv[1]->arg, VTY_NEWLINE); + argv[idx_afi]->arg, VTY_NEWLINE); return CMD_ERR_NO_MATCH; } @@ -199,12 +203,13 @@ DEFUN (isis_circuit_type, "Level-1-2 adjacencies are formed\n" "Level-2 only adjacencies are formed\n") { + int idx_level = 2; int is_type; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - is_type = string2circuit_t (argv[2]->arg); + is_type = string2circuit_t (argv[idx_level]->arg); if (!is_type) { vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); @@ -305,15 +310,17 @@ DEFUN (isis_passwd, "Cleartext password\n" "Circuit password\n") { + int idx_encryption = 2; + int idx_word = 3; struct isis_circuit *circuit = isis_circuit_lookup (vty); int rv; if (!circuit) return CMD_ERR_NO_MATCH; - if (argv[2]->arg[0] == 'm') - rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[3]->arg); + if (argv[idx_encryption]->arg[0] == 'm') + rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[idx_word]->arg); else - rv = isis_circuit_passwd_cleartext_set(circuit, argv[3]->arg); + rv = isis_circuit_passwd_cleartext_set(circuit, argv[idx_word]->arg); if (rv) { vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); @@ -358,12 +365,13 @@ DEFUN (isis_priority, "Set priority for Designated Router election\n" "Priority value\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[2]->arg); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -412,12 +420,13 @@ DEFUN (isis_priority_l1, "Priority value\n" "Specify priority for level-1 routing\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[2]->arg); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -466,12 +475,13 @@ DEFUN (isis_priority_l2, "Priority value\n" "Specify priority for level-2 routing\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[2]->arg); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -520,12 +530,13 @@ DEFUN (isis_metric, "Set default metric for circuit\n" "Default metric value\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[2]->arg); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -586,12 +597,13 @@ DEFUN (isis_metric_l1, "Default metric value\n" "Specify metric for level-1 routing\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[2]->arg); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -652,12 +664,13 @@ DEFUN (isis_metric_l2, "Default metric value\n" "Specify metric for level-2 routing\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[2]->arg); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -719,12 +732,13 @@ DEFUN (isis_hello_interval, "Hello interval value\n" "Holdtime 1 seconds, interval depends on multiplier\n") { + int idx_number = 2; int interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", @@ -775,12 +789,13 @@ DEFUN (isis_hello_interval_l1, "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-1 IIHs\n") { + int idx_number = 2; long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -831,12 +846,13 @@ DEFUN (isis_hello_interval_l2, "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-2 IIHs\n") { + int idx_number = 2; long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -885,12 +901,13 @@ DEFUN (isis_hello_multiplier, "Set multiplier for Hello holding time\n" "Hello multiplier value\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[2]->arg); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -939,12 +956,13 @@ DEFUN (isis_hello_multiplier_l1, "Hello multiplier value\n" "Specify hello multiplier for level-1 IIHs\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[2]->arg); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -993,12 +1011,13 @@ DEFUN (isis_hello_multiplier_l2, "Hello multiplier value\n" "Specify hello multiplier for level-2 IIHs\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[2]->arg); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -1081,12 +1100,13 @@ DEFUN (csnp_interval, "Set CSNP interval in seconds\n" "CSNP interval value\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1135,12 +1155,13 @@ DEFUN (csnp_interval_l1, "CSNP interval value\n" "Specify interval for level-1 CSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1189,12 +1210,13 @@ DEFUN (csnp_interval_l2, "CSNP interval value\n" "Specify interval for level-2 CSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1242,12 +1264,13 @@ DEFUN (psnp_interval, "Set PSNP interval in seconds\n" "PSNP interval value\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1296,12 +1319,13 @@ DEFUN (psnp_interval_l1, "PSNP interval value\n" "Specify interval for level-1 PSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1350,12 +1374,13 @@ DEFUN (psnp_interval_l2, "PSNP interval value\n" "Specify interval for level-2 PSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[2]->arg); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1442,12 +1467,13 @@ DEFUN (metric_style, "Send and accept both styles of TLVs during transition\n" "Use new style of TLVs to carry wider metric\n") { + int idx_metric_style = 1; struct isis_area *area = vty->index; int ret; assert(area); - if (strncmp (argv[1]->arg, "w", 1) == 0) + if (strncmp (argv[idx_metric_style]->arg, "w", 1) == 0) { isis_area_metricstyle_set(area, false, true); return CMD_SUCCESS; @@ -1457,9 +1483,9 @@ DEFUN (metric_style, if (ret != CMD_SUCCESS) return ret; - if (strncmp (argv[1]->arg, "t", 1) == 0) + if (strncmp (argv[idx_metric_style]->arg, "t", 1) == 0) isis_area_metricstyle_set(area, true, true); - else if (strncmp (argv[1]->arg, "n", 1) == 0) + else if (strncmp (argv[idx_metric_style]->arg, "n", 1) == 0) isis_area_metricstyle_set(area, true, false); return CMD_SUCCESS; @@ -1597,9 +1623,10 @@ DEFUN (area_lsp_mtu, "Configure the maximum size of generated LSPs\n" "Maximum size of generated LSPs\n") { + int idx_number = 1; unsigned int lsp_mtu; - VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[1]->arg, 128, 4352); + VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[idx_number]->arg, 128, 4352); return area_lsp_mtu_set(vty, lsp_mtu); } @@ -1630,6 +1657,7 @@ DEFUN (is_type, "Act as both a station router and an area router\n" "Act as an area router only\n") { + int idx_level = 1; struct isis_area *area; int type; @@ -1641,7 +1669,7 @@ DEFUN (is_type, return CMD_ERR_NO_MATCH; } - type = string2circuit_t (argv[1]->arg); + type = string2circuit_t (argv[idx_level]->arg); if (!type) { vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); @@ -1719,12 +1747,13 @@ DEFUN (lsp_gen_interval, "Minimum interval between regenerating same LSP\n" "Minimum interval in seconds\n") { + int idx_number = 1; struct isis_area *area; uint16_t interval; int level; area = vty->index; - interval = atoi (argv[1]->arg); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_1 | IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1761,12 +1790,13 @@ DEFUN (lsp_gen_interval_l1, "Set interval for level 1 only\n" "Minimum interval in seconds\n") { + int idx_number = 2; struct isis_area *area; uint16_t interval; int level; area = vty->index; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_1; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1805,12 +1835,13 @@ DEFUN (lsp_gen_interval_l2, "Set interval for level 2 only\n" "Minimum interval in seconds\n") { + int idx_number = 2; struct isis_area *area; uint16_t interval; int level; area = vty->index; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } @@ -1848,11 +1879,12 @@ DEFUN (spf_interval, "Minimum interval between SPF calculations\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 1; struct isis_area *area; u_int16_t interval; area = vty->index; - interval = atoi (argv[1]->arg); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[0] = interval; area->min_spf_interval[1] = interval; @@ -1903,11 +1935,12 @@ DEFUN (spf_interval_l1, "Set interval for level 1 only\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 2; struct isis_area *area; u_int16_t interval; area = vty->index; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[0] = interval; return CMD_SUCCESS; @@ -1937,11 +1970,12 @@ DEFUN (spf_interval_l2, "Set interval for level 2 only\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 2; struct isis_area *area; u_int16_t interval; area = vty->index; - interval = atoi (argv[2]->arg); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[1] = interval; return CMD_SUCCESS; @@ -2022,7 +2056,8 @@ DEFUN (max_lsp_lifetime, "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); + int idx_number = 1; + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); } /* @@ -2050,7 +2085,8 @@ DEFUN (max_lsp_lifetime_l1, "Maximum LSP lifetime for Level 1 only\n" "LSP lifetime for Level 1 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); + int idx_number = 2; + return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); } /* @@ -2077,7 +2113,8 @@ DEFUN (max_lsp_lifetime_l2, "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime for Level 2 only in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); + int idx_number = 2; + return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); } /* @@ -2148,7 +2185,8 @@ DEFUN (lsp_refresh_interval, "LSP refresh interval\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); + int idx_number = 1; + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); } /* @@ -2176,7 +2214,8 @@ DEFUN (lsp_refresh_interval_l1, "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); + int idx_number = 2; + return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); } /* @@ -2204,7 +2243,8 @@ DEFUN (lsp_refresh_interval_l2, "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); + int idx_number = 2; + return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); } /* @@ -2271,8 +2311,10 @@ DEFUN (area_passwd_md5, "Authentication type\n" "Level-wide password\n") { + int idx_password = 0; + int idx_word = 2; u_char snp_auth = 0; - int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { @@ -2282,7 +2324,7 @@ DEFUN (area_passwd_md5, } return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, - argv[2]->arg, snp_auth); + argv[idx_word]->arg, snp_auth); } @@ -2307,8 +2349,10 @@ DEFUN (area_passwd_clear, "Authentication type\n" "Area password\n") { + int idx_password = 0; + int idx_word = 2; u_char snp_auth = 0; - int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; if (argc > 2) { @@ -2318,7 +2362,7 @@ DEFUN (area_passwd_clear, } return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, - argv[2]->arg, snp_auth); + argv[idx_word]->arg, snp_auth); } @@ -2329,7 +2373,8 @@ DEFUN (no_area_passwd, "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") { - int level = (argv[1]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int idx_password = 1; + int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; struct isis_area *area = vty->index; if (!area) diff --git a/isisd/isisd.c b/isisd/isisd.c index 263fa63a3b..b1c21b55c9 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -533,7 +533,8 @@ DEFUN (show_isis_interface_arg, "ISIS interface\n" "ISIS interface name\n") { - return show_isis_interface_common (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_interface_common (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -707,7 +708,8 @@ DEFUN (show_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return show_isis_neighbor_common (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_neighbor_common (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (clear_isis_neighbor, @@ -728,7 +730,8 @@ DEFUN (clear_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return clear_isis_neighbor_common (vty, argv[3]->arg); + int idx_word = 3; + return clear_isis_neighbor_common (vty, argv[idx_word]->arg); } /* @@ -1530,7 +1533,8 @@ DEFUN (show_database_lsp_brief, "IS-IS link state database\n" "LSP ID\n") { - return show_isis_database (vty, argv[3]->arg, ISIS_UI_LEVEL_BRIEF); + int idx_word = 3; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_BRIEF); } DEFUN (show_database_lsp_detail, @@ -1542,7 +1546,8 @@ DEFUN (show_database_lsp_detail, "LSP ID\n" "Detailed information\n") { - return show_isis_database (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (show_database_detail, @@ -1564,7 +1569,8 @@ DEFUN (show_database_detail_lsp, "Detailed information\n" "LSP ID\n") { - return show_isis_database (vty, argv[4]->arg, ISIS_UI_LEVEL_DETAIL); + int idx_word = 4; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -1577,7 +1583,8 @@ DEFUN (router_isis, "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_get (vty, argv[2]->arg); + int idx_word = 2; + return isis_area_get (vty, argv[idx_word]->arg); } /* @@ -1588,7 +1595,8 @@ DEFUN (no_router_isis, "no router isis WORD", "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_destroy (vty, argv[3]->arg); + int idx_word = 3; + return isis_area_destroy (vty, argv[idx_word]->arg); } /* @@ -1600,7 +1608,8 @@ DEFUN (net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_net_title (vty, argv[1]->arg); + int idx_word = 1; + return area_net_title (vty, argv[idx_word]->arg); } /* @@ -1613,7 +1622,8 @@ DEFUN (no_net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_clear_net_title (vty, argv[2]->arg); + int idx_word = 2; + return area_clear_net_title (vty, argv[idx_word]->arg); } void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) @@ -1966,14 +1976,15 @@ DEFUN (topology_baseis, "A Network IS Base for this topology\n" "XXXX.XXXX.XXXX Network entity title (NET)\n") { + int idx_word = 2; struct isis_area *area; u_char buff[ISIS_SYS_ID_LEN]; area = vty->index; assert (area); - if (sysid2buff (buff, argv[2]->arg)) - sysid2buff (area->topology_baseis, argv[2]->arg); + if (sysid2buff (buff, argv[idx_word]->arg)) + sysid2buff (area->topology_baseis, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -2011,13 +2022,14 @@ DEFUN (topology_basedynh, "Dynamic hostname base for this topology\n" "Dynamic hostname base\n") { + int idx_word = 2; struct isis_area *area; area = vty->index; assert (area); /* I hope that it's enough. */ - area->topology_basedynh = strndup (argv[2]->arg, 16); + area->topology_basedynh = strndup (argv[idx_word]->arg, 16); return CMD_SUCCESS; } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index c98f0d69f3..f39457ab77 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -313,9 +313,21 @@ def get_token_index_variable_name(line_number, token): elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD': return 'idx_comm_list' - elif token == 'ipv4|ipv6': + elif token == 'ipv4|ipv6' or token == 'ip|ipv6': return 'idx_afi' + elif token == 'md5|clear': + return 'idx_encryption' + + elif token == 'narrow|transition|wide': + return 'idx_metric_style' + + elif token == 'area-password|domain-password': + return 'idx_password' + + elif token == 'param': + return 'idx_param' + elif token == 'advertised-routes|received-routes': return 'idx_adv_rcvd_routes' @@ -334,6 +346,12 @@ def get_token_index_variable_name(line_number, token): elif token == 'A.B.C.D/M|X:X::X:X/M': return 'idx_ipv4_ipv6_prefixlen' + elif token == 'level-1|level-2' or token == 'level-1|level-1-2|level-2-only': + return 'idx_level' + + elif token == 'metric (0-16777215)|route-map WORD' or token == 'always|metric (0-16777215)|route-map WORD': + return 'idx_metric_rmap' + elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': return 'idx_rpf_lookup_mode' From 51c26414159341f0b017523182431cf14e28f77e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 19:56:31 +0000 Subject: [PATCH 125/280] ospf6d: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- ospf6d/ospf6_area.c | 92 ++++++++++++++++++++++++---------------- ospf6d/ospf6_asbr.c | 30 ++++++++----- ospf6d/ospf6_bfd.c | 5 ++- ospf6d/ospf6_interface.c | 52 ++++++++++++++--------- ospf6d/ospf6_intra.c | 6 ++- ospf6d/ospf6_lsa.c | 10 +++-- ospf6d/ospf6_message.c | 30 +++++++------ ospf6d/ospf6_neighbor.c | 5 ++- ospf6d/ospf6_route.c | 18 ++++---- ospf6d/ospf6_spf.c | 9 ++-- ospf6d/ospf6_top.c | 28 +++++++----- ospf6d/ospf6_zebra.c | 10 +++-- ospf6d/ospf6d.c | 66 ++++++++++++++++------------ tools/argv_translator.py | 20 ++++++++- 14 files changed, 238 insertions(+), 143 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 1c1a524e48..d67621d7c2 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -468,18 +468,20 @@ DEFUN (area_range, "Specify IPv6 prefix\n" ) { + int idx_ipv4 = 1; + int idx_ipv6_prefixlen = 3; int ret; struct ospf6_area *oa; struct prefix prefix; struct ospf6_route *range; u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; - OSPF6_CMD_AREA_GET (argv[1]->arg, oa); + OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa); - ret = str2prefix (argv[3]->arg, &prefix); + ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { - vty_out (vty, "Malformed argument: %s%s", argv[3]->arg, VNL); + vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv6_prefixlen]->arg, VNL); return CMD_SUCCESS; } @@ -514,7 +516,7 @@ DEFUN (area_range, range->path.u.cost_config = cost; - zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[3]->arg, range->flag); + zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[idx_ipv6_prefixlen]->arg, range->flag); if (range->rnode == NULL) { ospf6_route_add (range, oa->range_table); @@ -569,26 +571,27 @@ DEFUN (no_area_range, "Configured address range\n" "Specify IPv6 prefix\n") { + int idx_ipv4 = 2; int ret; struct ospf6_area *oa; struct prefix prefix; struct ospf6_route *range, *route; - OSPF6_CMD_AREA_GET (argv[2]->arg, oa); + OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa); argc--; argv++; - ret = str2prefix (argv[2]->arg, &prefix); + ret = str2prefix (argv[idx_ipv4]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { - vty_out (vty, "Malformed argument: %s%s", argv[2]->arg, VNL); + vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } range = ospf6_route_lookup (&prefix, oa->range_table); if (range == NULL) { - vty_out (vty, "Range %s does not exists.%s", argv[2]->arg, VNL); + vty_out (vty, "Range %s does not exists.%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -677,21 +680,23 @@ DEFUN (area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + int idx_ipv4 = 1; + int idx_word = 4; struct ospf6_area *area; struct prefix_list *plist; - OSPF6_CMD_AREA_GET (argv[1]->arg, area); + OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area); argc--; argv++; - plist = prefix_list_lookup (AFI_IP6, argv[1]->arg); - if (strncmp (argv[4]->arg, "in", 2) == 0) + plist = prefix_list_lookup (AFI_IP6, argv[idx_ipv4]->arg); + if (strncmp (argv[idx_word]->arg, "in", 2) == 0) { PREFIX_LIST_IN (area) = plist; if (PREFIX_NAME_IN (area)) free (PREFIX_NAME_IN (area)); - PREFIX_NAME_IN (area) = strdup (argv[1]->arg); + PREFIX_NAME_IN (area) = strdup (argv[idx_ipv4]->arg); ospf6_abr_reimport (area); } else @@ -700,7 +705,7 @@ DEFUN (area_filter_list, if (PREFIX_NAME_OUT (area)) free (PREFIX_NAME_OUT (area)); - PREFIX_NAME_OUT (area) = strdup (argv[1]->arg); + PREFIX_NAME_OUT (area) = strdup (argv[idx_ipv4]->arg); ospf6_abr_enable_area (area); } @@ -719,16 +724,18 @@ DEFUN (no_area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + int idx_ipv4 = 2; + int idx_word = 5; struct ospf6_area *area; - OSPF6_CMD_AREA_GET (argv[2]->arg, area); + OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area); argc--; argv++; - if (strncmp (argv[5]->arg, "in", 2) == 0) + if (strncmp (argv[idx_word]->arg, "in", 2) == 0) { if (PREFIX_NAME_IN (area)) - if (strcmp (PREFIX_NAME_IN (area), argv[2]->arg) != 0) + if (strcmp (PREFIX_NAME_IN (area), argv[idx_ipv4]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_IN (area) = NULL; @@ -741,7 +748,7 @@ DEFUN (no_area_filter_list, else { if (PREFIX_NAME_OUT (area)) - if (strcmp (PREFIX_NAME_OUT (area), argv[2]->arg) != 0) + if (strcmp (PREFIX_NAME_OUT (area), argv[idx_ipv4]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_OUT (area) = NULL; @@ -763,19 +770,21 @@ DEFUN (area_import_list, "Set the filter for networks from other areas announced to the specified one\n" "Name of the acess-list\n") { + int idx_ipv4 = 1; + int idx_name = 3; struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[1]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); - list = access_list_lookup (AFI_IP6, argv[3]->arg); + list = access_list_lookup (AFI_IP6, argv[idx_name]->arg); IMPORT_LIST (area) = list; if (IMPORT_NAME (area)) free (IMPORT_NAME (area)); - IMPORT_NAME (area) = strdup (argv[3]->arg); + IMPORT_NAME (area) = strdup (argv[idx_name]->arg); ospf6_abr_reimport (area); return CMD_SUCCESS; @@ -789,9 +798,10 @@ DEFUN (no_area_import_list, "Unset the filter for networks announced to other areas\n" "NAme of the access-list\n") { + int idx_ipv4 = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[2]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); IMPORT_LIST (area) = 0; @@ -812,19 +822,21 @@ DEFUN (area_export_list, "Set the filter for networks announced to other areas\n" "Name of the acess-list\n") { + int idx_ipv4 = 1; + int idx_name = 3; struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[1]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); - list = access_list_lookup (AFI_IP6, argv[3]->arg); + list = access_list_lookup (AFI_IP6, argv[idx_name]->arg); EXPORT_LIST (area) = list; if (EXPORT_NAME (area)) free (EXPORT_NAME (area)); - EXPORT_NAME (area) = strdup (argv[3]->arg); + EXPORT_NAME (area) = strdup (argv[idx_name]->arg); ospf6_abr_enable_area (area); return CMD_SUCCESS; @@ -838,9 +850,10 @@ DEFUN (no_area_export_list, "Unset the filter for networks announced to other areas\n" "Name of the access-list\n") { + int idx_ipv4 = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[2]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); EXPORT_LIST (area) = 0; @@ -899,6 +912,7 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, "Shortest Path First caculation\n" "Show SPF tree\n") { + int idx_ipv4 = 4; u_int32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; @@ -909,15 +923,15 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix); - if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1) + if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1) { - vty_out (vty, "Malformed Area-ID: %s%s", argv[4]->arg, VNL); + vty_out (vty, "Malformed Area-ID: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } oa = ospf6_area_lookup (area_id, ospf6); if (oa == NULL) { - vty_out (vty, "No such Area: %s%s", argv[4]->arg, VNL); + vty_out (vty, "No such Area: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -944,6 +958,8 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, "Show SPF tree\n" "Specify root's router-id to calculate another router's SPF tree\n") { + int idx_ipv4 = 5; + int idx_ipv4_2 = 7; u_int32_t area_id; struct ospf6_area *oa; struct ospf6_vertex *root; @@ -955,18 +971,18 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, OSPF6_CMD_CHECK_RUNNING (); - inet_pton (AF_INET, argv[5]->arg, &router_id); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id); ospf6_linkstate_prefix (router_id, htonl (0), &prefix); - if (inet_pton (AF_INET, argv[7]->arg, &area_id) != 1) + if (inet_pton (AF_INET, argv[idx_ipv4_2]->arg, &area_id) != 1) { - vty_out (vty, "Malformed Area-ID: %s%s", argv[7]->arg, VNL); + vty_out (vty, "Malformed Area-ID: %s%s", argv[idx_ipv4_2]->arg, VNL); return CMD_SUCCESS; } oa = ospf6_area_lookup (area_id, ospf6); if (oa == NULL) { - vty_out (vty, "No such Area: %s%s", argv[7]->arg, VNL); + vty_out (vty, "No such Area: %s%s", argv[idx_ipv4_2]->arg, VNL); return CMD_SUCCESS; } @@ -1002,9 +1018,10 @@ DEFUN (ospf6_area_stub, "OSPF6 area ID as a decimal value\n" "Configure OSPF6 area as stub\n") { + int idx_ipv4_number = 1; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[1]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); if (!ospf6_area_stub_set (ospf6, area)) { @@ -1027,9 +1044,10 @@ DEFUN (ospf6_area_stub_no_summary, "Configure OSPF6 area as stub\n" "Do not inject inter-area routes into stub\n") { + int idx_ipv4_number = 1; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[1]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); if (!ospf6_area_stub_set (ospf6, area)) { @@ -1052,9 +1070,10 @@ DEFUN (no_ospf6_area_stub, "OSPF6 area ID as a decimal value\n" "Configure OSPF6 area as stub\n") { + int idx_ipv4_number = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[2]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); ospf6_area_stub_unset (ospf6, area); ospf6_area_no_summary_unset (ospf6, area); @@ -1072,9 +1091,10 @@ DEFUN (no_ospf6_area_stub_no_summary, "Configure OSPF6 area as stub\n" "Do not inject inter-area routes into area\n") { + int idx_ipv4_number = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[2]->arg, area); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); ospf6_area_stub_unset (ospf6, area); ospf6_area_no_summary_unset (ospf6, area); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 143278b42b..014320a2f8 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -667,14 +667,16 @@ DEFUN (ospf6_redistribute_routemap, "Route map name\n" ) { + int idx_protocol = 1; + int idx_word = 3; int type; - type = proto_redistnum(AFI_IP6, argv[1]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_OSPF6) return CMD_WARNING; ospf6_asbr_redistribute_unset (type); - ospf6_asbr_routemap_set (type, argv[3]->arg); + ospf6_asbr_routemap_set (type, argv[idx_word]->arg); ospf6_asbr_redistribute_set (type); return CMD_SUCCESS; } @@ -1019,8 +1021,9 @@ DEFUN (ospf6_routemap_match_address_prefixlist, "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { + int idx_word = 4; int ret = route_map_add_match ((struct route_map_index *) vty->index, - "ipv6 address prefix-list", argv[4]->arg); + "ipv6 address prefix-list", argv[idx_word]->arg); return route_map_command_status (vty, ret); } @@ -1035,8 +1038,9 @@ DEFUN (ospf6_routemap_no_match_address_prefixlist, "Match entries of prefix-lists\n" "IPv6 prefix-list name\n") { + int idx_word = 5; int ret = route_map_delete_match ((struct route_map_index *) vty->index, - "ipv6 address prefix-list", argv[5]->arg); + "ipv6 address prefix-list", argv[idx_word]->arg); return route_map_command_status (vty, ret); } @@ -1048,8 +1052,9 @@ DEFUN (ospf6_routemap_match_interface, "Match first hop interface of route\n" "Interface name\n") { + int idx_word = 2; return route_map_add_match ((struct route_map_index *) vty->index, - "interface", argv[2]->arg); + "interface", argv[idx_word]->arg); } /* "no match interface WORD" */ @@ -1084,8 +1089,9 @@ DEFUN (ospf6_routemap_set_metric_type, "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { + int idx_external = 2; int ret = route_map_add_set ((struct route_map_index *) vty->index, - "metric-type", argv[2]->arg); + "metric-type", argv[idx_external]->arg); return route_map_command_status (vty, ret); } @@ -1099,8 +1105,9 @@ DEFUN (ospf6_routemap_no_set_metric_type, "OSPF6 external type 1 metric\n" "OSPF6 external type 2 metric\n") { + int idx_external = 3; int ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric-type", argv[3]->arg); + "metric-type", argv[idx_external]->arg); return route_map_command_status (vty, ret); } @@ -1112,8 +1119,9 @@ DEFUN (set_metric, "Metric value\n" "Metric value\n") { + int idx_number = 2; int ret = route_map_add_set ((struct route_map_index *) vty->index, - "metric", argv[2]->arg); + "metric", argv[idx_number]->arg); return route_map_command_status (vty, ret); } @@ -1154,8 +1162,9 @@ DEFUN (ospf6_routemap_set_forwarding, "Forwarding Address\n" "IPv6 Address\n") { + int idx_ipv6 = 2; int ret = route_map_add_set ((struct route_map_index *) vty->index, - "forwarding-address", argv[2]->arg); + "forwarding-address", argv[idx_ipv6]->arg); return route_map_command_status (vty, ret); } @@ -1168,8 +1177,9 @@ DEFUN (ospf6_routemap_no_set_forwarding, "Forwarding Address\n" "IPv6 Address\n") { + int idx_ipv6 = 3; int ret = route_map_delete_set ((struct route_map_index *) vty->index, - "forwarding-address", argv[3]->arg); + "forwarding-address", argv[idx_ipv6]->arg); return route_map_command_status (vty, ret); } diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 29368cb9b6..5d1eae3e38 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -354,6 +354,9 @@ DEFUN (ipv6_ospf6_bfd_param, "Required min receive interval\n" "Desired min transmit interval\n") { + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; struct ospf6_interface *oi; struct interface *ifp; u_int32_t rx_val; @@ -369,7 +372,7 @@ DEFUN (ipv6_ospf6_bfd_param, oi = ospf6_interface_create (ifp); assert (oi); - if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val, + if ((ret = bfd_validate_param (vty, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 2b7d180a8f..e9d66419df 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1006,15 +1006,16 @@ DEFUN (show_ipv6_ospf6_interface, IFNAME_STR ) { + int idx_ifname = 4; struct interface *ifp; struct listnode *i; if (argc) { - ifp = if_lookup_by_name (argv[4]->arg); + ifp = if_lookup_by_name (argv[idx_ifname]->arg); if (ifp == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[4]->arg, + vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL); return CMD_WARNING; } @@ -1068,20 +1069,21 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, "Display connected prefixes to advertise\n" ) { + int idx_ifname = 4; struct interface *ifp; struct ospf6_interface *oi; - ifp = if_lookup_by_name (argv[4]->arg); + ifp = if_lookup_by_name (argv[idx_ifname]->arg); if (ifp == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL); + vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL); return CMD_WARNING; } oi = ifp->info; if (oi == NULL) { - vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[4]->arg, VNL); + vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[idx_ifname]->arg, VNL); return CMD_WARNING; } @@ -1158,6 +1160,7 @@ DEFUN (ipv6_ospf6_ifmtu, "OSPFv3 Interface MTU\n" ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; unsigned int ifmtu, iobuflen; @@ -1172,7 +1175,7 @@ DEFUN (ipv6_ospf6_ifmtu, oi = ospf6_interface_create (ifp); assert (oi); - ifmtu = strtol (argv[3]->arg, NULL, 10); + ifmtu = strtol (argv[idx_number]->arg, NULL, 10); if (oi->ifmtu == ifmtu) return CMD_SUCCESS; @@ -1266,6 +1269,7 @@ DEFUN (ipv6_ospf6_cost, "Outgoing metric of this interface\n" ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; unsigned long int lcost; @@ -1278,7 +1282,7 @@ DEFUN (ipv6_ospf6_cost, oi = ospf6_interface_create (ifp); assert (oi); - lcost = strtol (argv[3]->arg, NULL, 10); + lcost = strtol (argv[idx_number]->arg, NULL, 10); if (lcost > UINT32_MAX) { @@ -1331,13 +1335,14 @@ DEFUN (auto_cost_reference_bandwidth, "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") { + int idx_number = 2; struct ospf6 *o = vty->index; struct ospf6_area *oa; struct ospf6_interface *oi; struct listnode *i, *j; u_int32_t refbw; - refbw = strtol (argv[2]->arg, NULL, 10); + refbw = strtol (argv[idx_number]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); @@ -1398,6 +1403,7 @@ DEFUN (ipv6_ospf6_hellointerval, SECONDS_STR ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1409,7 +1415,7 @@ DEFUN (ipv6_ospf6_hellointerval, oi = ospf6_interface_create (ifp); assert (oi); - oi->hello_interval = strtol (argv[3]->arg, NULL, 10); + oi->hello_interval = strtol (argv[idx_number]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1423,6 +1429,7 @@ DEFUN (ipv6_ospf6_deadinterval, SECONDS_STR ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1434,7 +1441,7 @@ DEFUN (ipv6_ospf6_deadinterval, oi = ospf6_interface_create (ifp); assert (oi); - oi->dead_interval = strtol (argv[3]->arg, NULL, 10); + oi->dead_interval = strtol (argv[idx_number]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1448,6 +1455,7 @@ DEFUN (ipv6_ospf6_transmitdelay, SECONDS_STR ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1459,7 +1467,7 @@ DEFUN (ipv6_ospf6_transmitdelay, oi = ospf6_interface_create (ifp); assert (oi); - oi->transdelay = strtol (argv[3]->arg, NULL, 10); + oi->transdelay = strtol (argv[idx_number]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1473,6 +1481,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, SECONDS_STR ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1484,7 +1493,7 @@ DEFUN (ipv6_ospf6_retransmitinterval, oi = ospf6_interface_create (ifp); assert (oi); - oi->rxmt_interval = strtol (argv[3]->arg, NULL, 10); + oi->rxmt_interval = strtol (argv[idx_number]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1498,6 +1507,7 @@ DEFUN (ipv6_ospf6_priority, "Priority value\n" ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1509,7 +1519,7 @@ DEFUN (ipv6_ospf6_priority, oi = ospf6_interface_create (ifp); assert (oi); - oi->priority = strtol (argv[3]->arg, NULL, 10); + oi->priority = strtol (argv[idx_number]->arg, NULL, 10); if (oi->area && (oi->state == OSPF6_INTERFACE_DROTHER || @@ -1529,6 +1539,7 @@ DEFUN (ipv6_ospf6_instance, "Instance ID value\n" ) { + int idx_number = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1540,7 +1551,7 @@ DEFUN (ipv6_ospf6_instance, oi = ospf6_interface_create (ifp); assert (oi); - oi->instance_id = strtol (argv[3]->arg, NULL, 10); + oi->instance_id = strtol (argv[idx_number]->arg, NULL, 10); return CMD_SUCCESS; } @@ -1664,6 +1675,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, "Prefix list name\n" ) { + int idx_word = 4; struct ospf6_interface *oi; struct interface *ifp; @@ -1677,7 +1689,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list, if (oi->plist_name) XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name); - oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[4]->arg); + oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[idx_word]->arg); ospf6_interface_connected_route_update (oi->interface); @@ -1748,6 +1760,7 @@ DEFUN (ipv6_ospf6_network, "Specify OSPF6 point-to-point network\n" ) { + int idx_network = 3; struct ospf6_interface *oi; struct interface *ifp; @@ -1760,14 +1773,14 @@ DEFUN (ipv6_ospf6_network, } assert (oi); - if (strncmp (argv[3]->arg, "b", 1) == 0) + if (strncmp (argv[idx_network]->arg, "b", 1) == 0) { if (oi->type == OSPF_IFTYPE_BROADCAST) return CMD_SUCCESS; oi->type = OSPF_IFTYPE_BROADCAST; } - else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0) + else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0) { if (oi->type == OSPF_IFTYPE_POINTOPOINT) { return CMD_SUCCESS; @@ -1977,6 +1990,7 @@ DEFUN (clear_ipv6_ospf6_interface, IFNAME_STR ) { + int idx_ifname = 4; struct interface *ifp; struct listnode *node; @@ -1987,9 +2001,9 @@ DEFUN (clear_ipv6_ospf6_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL) { - vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL); + vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL); return CMD_WARNING; } ospf6_interface_clear (vty, ifp); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 6ed46f5cd6..586bd77f75 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1730,8 +1730,9 @@ DEFUN (debug_ospf6_brouter_router, "Specify border-router's router-id\n" ) { + int idx_ipv4 = 4; u_int32_t router_id; - inet_pton (AF_INET, argv[4]->arg, &router_id); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id); OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON (router_id); return CMD_SUCCESS; } @@ -1760,8 +1761,9 @@ DEFUN (debug_ospf6_brouter_area, "Specify Area-ID\n" ) { + int idx_ipv4 = 4; u_int32_t area_id; - inet_pton (AF_INET, argv[4]->arg, &area_id); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id); OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON (area_id); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index db34214e10..a70e450f60 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -835,6 +835,7 @@ DEFUN (debug_ospf6_lsa_type, "Specify LS type as Hexadecimal\n" ) { + int idx_lsa = 3; unsigned int i; struct ospf6_lsa_handler *handler = NULL; @@ -845,9 +846,9 @@ DEFUN (debug_ospf6_lsa_type, handler = vector_slot (ospf6_lsa_handler_vector, i); if (handler == NULL) continue; - if (strncmp (argv[3]->arg, ospf6_lsa_handler_name(handler), strlen(argv[3]->arg)) == 0) + if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0) break; - if (! strcasecmp (argv[3]->arg, handler->name)) + if (! strcasecmp (argv[idx_lsa]->arg, handler->name)) break; handler = NULL; } @@ -892,6 +893,7 @@ DEFUN (no_debug_ospf6_lsa_type, "Specify LS type as Hexadecimal\n" ) { + int idx_lsa = 4; u_int i; struct ospf6_lsa_handler *handler = NULL; @@ -902,9 +904,9 @@ DEFUN (no_debug_ospf6_lsa_type, handler = vector_slot (ospf6_lsa_handler_vector, i); if (handler == NULL) continue; - if (strncmp (argv[4]->arg, ospf6_lsa_handler_name(handler), strlen(argv[4]->arg)) == 0) + if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0) break; - if (! strcasecmp (argv[4]->arg, handler->name)) + if (! strcasecmp (argv[idx_lsa]->arg, handler->name)) break; } diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index b2dd6b6ce2..2cedc59ee5 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2371,6 +2371,7 @@ DEFUN (debug_ospf6_message, "Debug All message\n" ) { + int idx_packet = 3; unsigned char level = 0; int type = 0; int i; @@ -2378,19 +2379,19 @@ DEFUN (debug_ospf6_message, assert (argc > 0); /* check type */ - if (! strncmp (argv[3]->arg, "u", 1)) + if (! strncmp (argv[idx_packet]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; - else if (! strncmp (argv[3]->arg, "h", 1)) + else if (! strncmp (argv[idx_packet]->arg, "h", 1)) type = OSPF6_MESSAGE_TYPE_HELLO; - else if (! strncmp (argv[3]->arg, "d", 1)) + else if (! strncmp (argv[idx_packet]->arg, "d", 1)) type = OSPF6_MESSAGE_TYPE_DBDESC; - else if (! strncmp (argv[3]->arg, "lsr", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsr", 3)) type = OSPF6_MESSAGE_TYPE_LSREQ; - else if (! strncmp (argv[3]->arg, "lsu", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsu", 3)) type = OSPF6_MESSAGE_TYPE_LSUPDATE; - else if (! strncmp (argv[3]->arg, "lsa", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsa", 3)) type = OSPF6_MESSAGE_TYPE_LSACK; - else if (! strncmp (argv[3]->arg, "a", 1)) + else if (! strncmp (argv[idx_packet]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; if (argc == 1) @@ -2449,6 +2450,7 @@ DEFUN (no_debug_ospf6_message, "Debug All message\n" ) { + int idx_packet = 4; unsigned char level = 0; int type = 0; int i; @@ -2456,19 +2458,19 @@ DEFUN (no_debug_ospf6_message, assert (argc > 0); /* check type */ - if (! strncmp (argv[4]->arg, "u", 1)) + if (! strncmp (argv[idx_packet]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; - else if (! strncmp (argv[4]->arg, "h", 1)) + else if (! strncmp (argv[idx_packet]->arg, "h", 1)) type = OSPF6_MESSAGE_TYPE_HELLO; - else if (! strncmp (argv[4]->arg, "d", 1)) + else if (! strncmp (argv[idx_packet]->arg, "d", 1)) type = OSPF6_MESSAGE_TYPE_DBDESC; - else if (! strncmp (argv[4]->arg, "lsr", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsr", 3)) type = OSPF6_MESSAGE_TYPE_LSREQ; - else if (! strncmp (argv[4]->arg, "lsu", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsu", 3)) type = OSPF6_MESSAGE_TYPE_LSUPDATE; - else if (! strncmp (argv[4]->arg, "lsa", 3)) + else if (! strncmp (argv[idx_packet]->arg, "lsa", 3)) type = OSPF6_MESSAGE_TYPE_LSACK; - else if (! strncmp (argv[4]->arg, "a", 1)) + else if (! strncmp (argv[idx_packet]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; if (argc == 1) diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index fbf0efed89..76c3862eca 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -893,6 +893,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one, "Specify Router-ID as IPv4 address notation\n" ) { + int idx_ipv4 = 4; struct ospf6_neighbor *on; struct ospf6_interface *oi; struct ospf6_area *oa; @@ -903,9 +904,9 @@ DEFUN (show_ipv6_ospf6_neighbor_one, OSPF6_CMD_CHECK_RUNNING (); showfunc = ospf6_neighbor_show_detail; - if ((inet_pton (AF_INET, argv[4]->arg, &router_id)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id)) != 1) { - vty_out (vty, "Router-ID is not parsable: %s%s", argv[4]->arg, + vty_out (vty, "Router-ID is not parsable: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 8cf8196953..bc4c951f13 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1573,15 +1573,16 @@ DEFUN (debug_ospf6_route, "Debug route memory use\n" ) { + int idx_type = 3; unsigned char level = 0; - if (! strncmp (argv[3]->arg, "table", 5)) + if (! strncmp (argv[idx_type]->arg, "table", 5)) level = OSPF6_DEBUG_ROUTE_TABLE; - else if (! strncmp (argv[3]->arg, "intra", 5)) + else if (! strncmp (argv[idx_type]->arg, "intra", 5)) level = OSPF6_DEBUG_ROUTE_INTRA; - else if (! strncmp (argv[3]->arg, "inter", 5)) + else if (! strncmp (argv[idx_type]->arg, "inter", 5)) level = OSPF6_DEBUG_ROUTE_INTER; - else if (! strncmp (argv[3]->arg, "memor", 5)) + else if (! strncmp (argv[idx_type]->arg, "memor", 5)) level = OSPF6_DEBUG_ROUTE_MEMORY; OSPF6_DEBUG_ROUTE_ON (level); return CMD_SUCCESS; @@ -1597,15 +1598,16 @@ DEFUN (no_debug_ospf6_route, "Debug intra-area route calculation\n" "Debug route memory use\n") { + int idx_type = 4; unsigned char level = 0; - if (! strncmp (argv[4]->arg, "table", 5)) + if (! strncmp (argv[idx_type]->arg, "table", 5)) level = OSPF6_DEBUG_ROUTE_TABLE; - else if (! strncmp (argv[4]->arg, "intra", 5)) + else if (! strncmp (argv[idx_type]->arg, "intra", 5)) level = OSPF6_DEBUG_ROUTE_INTRA; - else if (! strncmp (argv[4]->arg, "inter", 5)) + else if (! strncmp (argv[idx_type]->arg, "inter", 5)) level = OSPF6_DEBUG_ROUTE_INTER; - else if (! strncmp (argv[4]->arg, "memor", 5)) + else if (! strncmp (argv[idx_type]->arg, "memor", 5)) level = OSPF6_DEBUG_ROUTE_MEMORY; OSPF6_DEBUG_ROUTE_OFF (level); return CMD_SUCCESS; diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 80fb904162..3aa653814b 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -885,6 +885,9 @@ DEFUN (ospf6_timers_throttle_spf, "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") { + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; unsigned int delay, hold, max; if (argc != 3) @@ -893,9 +896,9 @@ DEFUN (ospf6_timers_throttle_spf, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000); return ospf6_timers_spf_set (vty, delay, hold, max); } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 9c51b4ee7b..5fef06d7ca 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -324,16 +324,17 @@ DEFUN (ospf6_router_id, "Configure OSPF Router-ID\n" V4NOTATION_STR) { + int idx_ipv4 = 1; int ret; u_int32_t router_id; struct ospf6 *o; o = (struct ospf6 *) vty->index; - ret = inet_pton (AF_INET, argv[1]->arg, &router_id); + ret = inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id); if (ret == 0) { - vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[1]->arg, VNL); + vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -404,6 +405,7 @@ DEFUN (ospf6_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { + int idx_number = 3; unsigned int minarrival; struct ospf6 *ospf = vty->index; @@ -416,7 +418,7 @@ DEFUN (ospf6_timers_lsa, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg); ospf->lsa_minarrival = minarrival; @@ -471,6 +473,8 @@ DEFUN (ospf6_interface_area, "OSPF6 area ID in IPv4 address notation\n" ) { + int idx_ifname = 1; + int idx_ipv4 = 3; struct ospf6 *o; struct ospf6_area *oa; struct ospf6_interface *oi; @@ -480,7 +484,7 @@ DEFUN (ospf6_interface_area, o = (struct ospf6 *) vty->index; /* find/create ospf6 interface */ - ifp = if_get_by_name (argv[1]->arg); + ifp = if_get_by_name (argv[idx_ifname]->arg); oi = (struct ospf6_interface *) ifp->info; if (oi == NULL) oi = ospf6_interface_create (ifp); @@ -492,9 +496,9 @@ DEFUN (ospf6_interface_area, } /* parse Area-ID */ - if (inet_pton (AF_INET, argv[3]->arg, &area_id) != 1) + if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1) { - vty_out (vty, "Invalid Area-ID: %s%s", argv[3]->arg, VNL); + vty_out (vty, "Invalid Area-ID: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -533,15 +537,17 @@ DEFUN (no_ospf6_interface_area, "OSPF6 area ID in IPv4 address notation\n" ) { + int idx_ifname = 2; + int idx_ipv4 = 4; struct ospf6_interface *oi; struct ospf6_area *oa; struct interface *ifp; u_int32_t area_id; - ifp = if_lookup_by_name (argv[2]->arg); + ifp = if_lookup_by_name (argv[idx_ifname]->arg); if (ifp == NULL) { - vty_out (vty, "No such interface %s%s", argv[2]->arg, VNL); + vty_out (vty, "No such interface %s%s", argv[idx_ifname]->arg, VNL); return CMD_SUCCESS; } @@ -553,16 +559,16 @@ DEFUN (no_ospf6_interface_area, } /* parse Area-ID */ - if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1) + if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1) { - vty_out (vty, "Invalid Area-ID: %s%s", argv[4]->arg, VNL); + vty_out (vty, "Invalid Area-ID: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } /* Verify Area */ if (oi->area == NULL) { - vty_out (vty, "No such Area-ID: %s%s", argv[4]->arg, VNL); + vty_out (vty, "No such Area-ID: %s%s", argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 10b6b27a8b..6599fbc6cc 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -726,13 +726,14 @@ DEFUN (debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + int idx_send_recv = 3; unsigned char level = 0; if (argc) { - if (! strncmp (argv[3]->arg, "s", 1)) + if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[3]->arg, "r", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) level = OSPF6_DEBUG_ZEBRA_RECV; } else @@ -765,13 +766,14 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + int idx_send_recv = 4; unsigned char level = 0; if (argc) { - if (! strncmp (argv[4]->arg, "s", 1)) + if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[4]->arg, "r", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) level = OSPF6_DEBUG_ZEBRA_RECV; } else diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 907cd118a5..c72dde0acf 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -364,6 +364,7 @@ DEFUN (show_ipv6_ospf6_database_id, "Specify Link state ID as IPv4 address notation\n" ) { + int idx_ipv4 = 5; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -373,10 +374,10 @@ DEFUN (show_ipv6_ospf6_database_id, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[5]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -461,6 +462,7 @@ DEFUN (show_ipv6_ospf6_database_router, "Specify Advertising Router as IPv4 address notation\n" ) { + int idx_ipv4 = 6; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -470,10 +472,10 @@ DEFUN (show_ipv6_ospf6_database_router, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[6]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[6]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -596,6 +598,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, "Specify Link state ID as IPv4 address notation\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -610,10 +613,10 @@ DEFUN (show_ipv6_ospf6_database_type_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } @@ -751,6 +754,7 @@ DEFUN (show_ipv6_ospf6_database_type_router, "Specify Advertising Router as IPv4 address notation\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -765,10 +769,10 @@ DEFUN (show_ipv6_ospf6_database_type_router, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } @@ -844,6 +848,7 @@ DEFUN (show_ipv6_ospf6_database_id_router, "Specify Advertising Router as IPv4 address notation\n" ) { + int idx_ipv4 = 5; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -854,20 +859,20 @@ DEFUN (show_ipv6_ospf6_database_id_router, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[5]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[5]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -930,6 +935,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + int idx_ipv4 = 5; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -940,20 +946,20 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, OSPF6_CMD_CHECK_RUNNING (); - if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[5]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[5]->arg, VNL); + argv[idx_ipv4]->arg, VNL); return CMD_SUCCESS; } @@ -1031,6 +1037,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, "Specify Advertising Router as IPv4 address notation\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1046,20 +1053,20 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } @@ -1155,6 +1162,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1170,20 +1178,20 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) { vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) { vty_out (vty, "Link state ID is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } @@ -1436,6 +1444,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1451,10 +1460,10 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } @@ -1549,6 +1558,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, "Display Self-originated LSAs\n" ) { + int idx_lsa = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1564,10 +1574,10 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, argc--; argv++; - if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1) + if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) { vty_out (vty, "Link State ID is not parsable: %s%s", - argv[4]->arg, VNL); + argv[idx_lsa]->arg, VNL); return CMD_SUCCESS; } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index f39457ab77..0b23916e6f 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -289,7 +289,7 @@ def get_token_index_variable_name(line_number, token): elif token == 'confed|missing-as-worst': return 'idx_med_knob' - elif token == 'both|send|receive': + elif token == 'both|send|receive' or token == 'send|recv': return 'idx_send_recv' elif token == 'both|extended|standard': @@ -319,6 +319,24 @@ def get_token_index_variable_name(line_number, token): elif token == 'md5|clear': return 'idx_encryption' + elif token == 'type-1|type-2': + return 'idx_external' + + elif token == 'table|intra-area|inter-area|memory': + return 'idx_type' + + elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all': + return 'idx_packet' + + elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix': + return 'idx_lsa' + + elif token == 'broadcast|point-to-point': + return 'idx_network' + + elif token == 'A.B.C.D|(0-4294967295)': + return 'idx_ipv4_number' + elif token == 'narrow|transition|wide': return 'idx_metric_style' From 8d769265c422f5428ca3eb1ac2ab9daa43fd6f74 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 20:01:26 +0000 Subject: [PATCH 126/280] ospfd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- ospfd/ospf_bfd.c | 5 +- ospfd/ospf_dump.c | 45 ++-- ospfd/ospf_ri.c | 24 ++- ospfd/ospf_routemap.c | 31 ++- ospfd/ospf_te.c | 9 +- ospfd/ospf_vty.c | 453 +++++++++++++++++++++++++-------------- tools/argv_translator.py | 22 +- 7 files changed, 390 insertions(+), 199 deletions(-) diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index 2689cecc4a..d8fefab9cc 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -387,6 +387,9 @@ DEFUN (ip_ospf_bfd_param, "Required min receive interval\n" "Desired min transmit interval\n") { + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; struct interface *ifp = (struct interface *) vty->index; u_int32_t rx_val; u_int32_t tx_val; @@ -395,7 +398,7 @@ DEFUN (ip_ospf_bfd_param, assert (ifp); - if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val, + if ((ret = bfd_validate_param (vty, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 5c5e5ceb5a..9952513dcf 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -910,9 +910,10 @@ DEFUN (debug_ospf_instance_packet, "OSPF Link State Acknowledgment\n" "OSPF all packets\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1086,9 +1087,10 @@ DEFUN (no_debug_ospf_instance_packet, "OSPF Link State Acknowledgment\n" "OSPF all packets\n") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1176,9 +1178,10 @@ DEFUN (debug_ospf_instance_ism, "Instance ID\n" "OSPF Interface State Machine\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1268,9 +1271,10 @@ DEFUN (no_debug_ospf_instance_ism, "Instance ID\n" "OSPF Interface State Machine") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1356,9 +1360,10 @@ DEFUN (debug_ospf_instance_nsm, "Instance ID\n" "OSPF Neighbor State Machine\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1448,9 +1453,10 @@ DEFUN (no_debug_ospf_instance_nsm, "Instance ID\n" "OSPF Neighbor State Machine") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1543,9 +1549,10 @@ DEFUN (debug_ospf_instance_lsa, "Instance ID\n" "OSPF Link State Advertisement\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1641,9 +1648,10 @@ DEFUN (no_debug_ospf_instance_lsa, "Instance ID\n" "OSPF Link State Advertisement\n") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1724,9 +1732,10 @@ DEFUN (debug_ospf_instance_zebra, "Instance ID\n" "OSPF Zebra information\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1811,9 +1820,10 @@ DEFUN (no_debug_ospf_instance_zebra, "Instance ID\n" "OSPF Zebra information\n") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1857,9 +1867,10 @@ DEFUN (debug_ospf_instance_event, "Instance ID\n" "OSPF event information\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1878,9 +1889,10 @@ DEFUN (no_debug_ospf_instance_event, "Instance ID\n" "OSPF event information\n") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1925,9 +1937,10 @@ DEFUN (debug_ospf_instance_nssa, "Instance ID\n" "OSPF nssa information\n") { + int idx_number = 2; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -1946,9 +1959,10 @@ DEFUN (no_debug_ospf_instance_nssa, "Instance ID\n" "OSPF nssa information\n") { + int idx_number = 3; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; @@ -2166,10 +2180,11 @@ DEFUN (show_debugging_ospf_instance, OSPF_STR "Instance ID\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL ) return CMD_SUCCESS; diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index b70433b87e..d3875e373b 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1188,6 +1188,7 @@ DEFUN (router_info, "Enable the Router Information functionality with Area flooding scope\n" "OSPF area ID in IP format") { + int idx_ipv4 = 2; u_int8_t scope; @@ -1197,7 +1198,7 @@ DEFUN (router_info, /* Check and get Area value if present */ if (argc == 1) { - if (!inet_aton (argv[2]->arg, &OspfRI.area_id)) + if (!inet_aton (argv[idx_ipv4]->arg, &OspfRI.area_id)) { vty_out (vty, "Please specify Router Info Area by A.B.C.D%s", VTY_NEWLINE); @@ -1275,10 +1276,11 @@ DEFUN (pce_address, "Stable IP address of the PCE\n" "PCE address in IPv4 address format\n") { + int idx_ipv4 = 2; struct in_addr value; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (!inet_aton (argv[2]->arg, &value)) + if (!inet_aton (argv[idx_ipv4]->arg, &value)) { vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1322,10 +1324,11 @@ DEFUN (pce_path_scope, "Path scope visibilities of the PCE for path computation\n" "32-bit Hexadecimal value\n") { + int idx_bitpattern = 2; uint32_t scope; struct ospf_pce_info *pi = &OspfRI.pce_info; - if (sscanf (argv[2]->arg, "0x%x", &scope) != 1) + if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &scope) != 1) { vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1369,13 +1372,14 @@ DEFUN (pce_domain, "AS number where the PCE as visibilities for path computation\n" "AS number in decimal <0-65535>\n") { + int idx_number = 3; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; struct listnode *node; struct ri_pce_subtlv_domain *domain; - if (sscanf (argv[3]->arg, "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1408,11 +1412,12 @@ DEFUN (no_pce_domain, "AS number where the PCE as visibilities for path computation\n" "AS number in decimal <0-65535>\n") { + int idx_number = 4; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[4]->arg, "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_domain: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1437,13 +1442,14 @@ DEFUN (pce_neigbhor, "AS number of PCE neighbors\n" "AS number in decimal <0-65535>\n") { + int idx_number = 3; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; struct listnode *node; struct ri_pce_subtlv_neighbor *neighbor; - if (sscanf (argv[3]->arg, "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1476,11 +1482,12 @@ DEFUN (no_pce_neighbor, "AS number of PCE neighbor\n" "AS number in decimal <0-65535>\n") { + int idx_number = 4; uint32_t as; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[4]->arg, "%d", &as) != 1) + if (sscanf (argv[idx_number]->arg, "%d", &as) != 1) { vty_out (vty, "no_pce_neighbor: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); @@ -1504,11 +1511,12 @@ DEFUN (pce_cap_flag, "Capabilities of the PCE for path computation\n" "32-bit Hexadecimal value\n") { + int idx_bitpattern = 2; uint32_t cap; struct ospf_pce_info *pce = &OspfRI.pce_info; - if (sscanf (argv[2]->arg, "0x%x", &cap) != 1) + if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &cap) != 1) { vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index f1fc484e36..e2a5f53fa6 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -700,7 +700,8 @@ DEFUN (match_ip_nexthop, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); + int idx_acl = 3; + return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg); } /* @@ -736,8 +737,9 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return ospf_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[4]->arg); + argv[idx_word]->arg); } /* @@ -775,7 +777,8 @@ DEFUN (match_ip_address, "IP access-list number (expanded range)\n" "IP access-list name\n") { - return ospf_route_match_add (vty, vty->index, "ip address", argv[3]->arg); + int idx_acl = 3; + return ospf_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); } /* @@ -811,8 +814,9 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + int idx_word = 4; return ospf_route_match_add (vty, vty->index, "ip address prefix-list", - argv[4]->arg); + argv[idx_word]->arg); } /* @@ -847,7 +851,8 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return ospf_route_match_add (vty, vty->index, "interface", argv[2]->arg); + int idx_word = 2; + return ospf_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } /* @@ -877,7 +882,8 @@ DEFUN (match_tag, "Match tag of route\n" "Tag value\n") { - return ospf_route_match_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return ospf_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* @@ -907,7 +913,8 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return ospf_route_set_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return ospf_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } /* @@ -938,12 +945,13 @@ DEFUN (set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - if (strcmp (argv[2]->arg, "1") == 0) + int idx_external = 2; + if (strcmp (argv[idx_external]->arg, "1") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-1"); - if (strcmp (argv[2]->arg, "2") == 0) + if (strcmp (argv[idx_external]->arg, "2") == 0) return ospf_route_set_add (vty, vty->index, "metric-type", "type-2"); - return ospf_route_set_add (vty, vty->index, "metric-type", argv[2]->arg); + return ospf_route_set_add (vty, vty->index, "metric-type", argv[idx_external]->arg); } /* @@ -974,7 +982,8 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return ospf_route_set_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return ospf_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index c90a5b2c45..7994bddca1 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2341,6 +2341,7 @@ DEFUN (ospf_mpls_te_router_addr, "Stable IP address of the advertising router\n" "MPLS-TE router address in IPv4 address format\n") { + int idx_ipv4 = 2; struct te_tlv_router_addr *ra = &OspfMplsTE.router_addr; struct in_addr value; struct ospf *ospf = vty->index; @@ -2348,7 +2349,7 @@ DEFUN (ospf_mpls_te_router_addr, if (!ospf) return CMD_SUCCESS; - if (! inet_aton (argv[2]->arg, &value)) + if (! inet_aton (argv[idx_ipv4]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -2482,7 +2483,8 @@ DEFUN (ospf_mpls_te_inter_as_area, "OSPF area ID in IP format\n" "OSPF area ID as decimal value\n") { - return set_inter_as_mode (vty, "area", argv[3]->arg); + int idx_ipv4_number = 3; + return set_inter_as_mode (vty, "area", argv[idx_ipv4_number]->arg); } DEFUN (no_ospf_mpls_te_inter_as, @@ -2626,6 +2628,7 @@ DEFUN (show_ip_ospf_mpls_te_link, "Interface information\n" "Interface name\n") { + int idx_interface = 5; struct interface *ifp; struct listnode *node, *nnode; @@ -2638,7 +2641,7 @@ DEFUN (show_ip_ospf_mpls_te_link, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[5]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_link_sub (vty, ifp); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 8d0fb1d5d9..b3019b4653 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -228,6 +228,7 @@ DEFUN (ospf_router_id, "router-id for the OSPF process\n" "OSPF router-id in IP address format\n") { + int idx_ipv4 = 2; struct ospf *ospf = vty->index; struct listnode *node; struct ospf_area *area; @@ -237,7 +238,7 @@ DEFUN (ospf_router_id, if (!ospf) return CMD_SUCCESS; - ret = inet_aton (argv[2]->arg, &router_id); + ret = inet_aton (argv[idx_ipv4]->arg, &router_id); if (!ret) { vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); @@ -384,6 +385,7 @@ DEFUN (ospf_passive_interface, "Suppress routing updates on an interface\n" "Interface's name\n") { + int idx_ipv4 = 2; struct interface *ifp; struct in_addr addr = { .s_addr = INADDR_ANY }; int ret; @@ -400,7 +402,7 @@ DEFUN (ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[2]->arg); + ifp = if_get_by_name (argv[idx_ipv4]->arg); params = IF_DEF_PARAMS (ifp); @@ -469,6 +471,7 @@ DEFUN (no_ospf_passive_interface, "Allow routing updates on an interface\n" "Interface's name\n") { + int idx_ipv4 = 3; struct interface *ifp; struct in_addr addr = { .s_addr = INADDR_ANY }; struct ospf_if_params *params; @@ -485,7 +488,7 @@ DEFUN (no_ospf_passive_interface, return CMD_SUCCESS; } - ifp = if_get_by_name (argv[3]->arg); + ifp = if_get_by_name (argv[idx_ipv4]->arg); params = IF_DEF_PARAMS (ifp); @@ -536,6 +539,8 @@ DEFUN (ospf_network_area, "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { + int idx_ipv4_prefixlen = 1; + int idx_ipv4_number = 3; struct ospf *ospf= vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -559,8 +564,8 @@ DEFUN (ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[3]->arg); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_network_set (ospf, &p, area_id); if (ret == 0) @@ -582,6 +587,8 @@ DEFUN (no_ospf_network_area, "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { + int idx_ipv4_prefixlen = 2; + int idx_ipv4_number = 4; struct ospf *ospf = (struct ospf *) vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -598,8 +605,8 @@ DEFUN (no_ospf_network_area, } /* Get network prefix and Area ID. */ - VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg); - VTY_GET_OSPF_AREA_ID (area_id, format, argv[4]->arg); + VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_network_unset (ospf, &p, area_id); if (ret == 0) @@ -652,6 +659,8 @@ DEFUN (ospf_area_range, "Summarize routes matching address/mask (border routers only)\n" "Area range prefix\n") { + int idx_ipv4_number = 1; + int idx_ipv4_prefixlen = 3; struct ospf *ospf = vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -661,8 +670,8 @@ DEFUN (ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); - VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); if (argc > 2) @@ -687,6 +696,8 @@ DEFUN (ospf_area_range_not_advertise, "Area range prefix\n" "DoNotAdvertise this range\n") { + int idx_ipv4_number = 1; + int idx_ipv4_prefixlen = 3; struct ospf *ospf = vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -695,8 +706,8 @@ DEFUN (ospf_area_range_not_advertise, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); - VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, 0); @@ -747,6 +758,8 @@ DEFUN (no_ospf_area_range, "Summarize routes matching address/mask (border routers only)\n" "Area range prefix\n") { + int idx_ipv4_number = 2; + int idx_ipv4_prefixlen = 4; struct ospf *ospf = vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -755,8 +768,8 @@ DEFUN (no_ospf_area_range, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); - VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_unset (ospf, area_id, &p); @@ -777,6 +790,9 @@ DEFUN (ospf_area_range_substitute, "Announce area range as another prefix\n" "Network prefix to be announced instead of range\n") { + int idx_ipv4_number = 1; + int idx_ipv4_prefixlen = 3; + int idx_ipv4_prefixlen_2 = 5; struct ospf *ospf = vty->index; struct prefix_ipv4 p, s; struct in_addr area_id; @@ -785,9 +801,9 @@ DEFUN (ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); - VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[5]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg); ospf_area_range_substitute_set (ospf, area_id, &p, &s); @@ -806,6 +822,9 @@ DEFUN (no_ospf_area_range_substitute, "Announce area range as another prefix\n" "Network prefix to be announced instead of range\n") { + int idx_ipv4_number = 2; + int idx_ipv4_prefixlen = 4; + int idx_ipv4_prefixlen_2 = 6; struct ospf *ospf = vty->index; struct prefix_ipv4 p, s; struct in_addr area_id; @@ -814,9 +833,9 @@ DEFUN (no_ospf_area_range_substitute, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); - VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg); - VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[6]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); + VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg); ospf_area_range_substitute_unset (ospf, area_id, &p); @@ -1165,6 +1184,8 @@ DEFUN (ospf_area_vlink, "area virtual-link A.B.C.D", VLINK_HELPSTR_IPADDR) { + int idx_ipv4_number = 1; + int idx_ipv4 = 3; struct ospf *ospf = vty->index; struct ospf_vl_config_data vl_config; char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; @@ -1178,14 +1199,14 @@ DEFUN (ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[1]->arg, &vl_config.area_id, &vl_config.format); + ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); return CMD_WARNING; } - ret = inet_aton (argv[3]->arg, &vl_config.vl_peer); + ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1398,6 +1419,8 @@ DEFUN (no_ospf_area_vlink, NO_STR VLINK_HELPSTR_IPADDR) { + int idx_ipv4_number = 2; + int idx_ipv4 = 4; struct ospf *ospf = vty->index; struct ospf_area *area; struct ospf_vl_config_data vl_config; @@ -1411,7 +1434,7 @@ DEFUN (no_ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[2]->arg, &vl_config.area_id, &format); + ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1425,7 +1448,7 @@ DEFUN (no_ospf_area_vlink, return CMD_WARNING; } - ret = inet_aton (argv[4]->arg, &vl_config.vl_peer); + ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); if (! ret) { vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", @@ -1547,6 +1570,8 @@ DEFUN (ospf_area_shortcut, "Enable shortcutting through the area\n" "Disable shortcutting through the area\n") { + int idx_ipv4_number = 1; + int idx_enable_disable = 3; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1556,15 +1581,15 @@ DEFUN (ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); - if (strncmp (argv[3]->arg, "de", 2) == 0) + if (strncmp (argv[idx_enable_disable]->arg, "de", 2) == 0) mode = OSPF_SHORTCUT_DEFAULT; - else if (strncmp (argv[3]->arg, "di", 2) == 0) + else if (strncmp (argv[idx_enable_disable]->arg, "di", 2) == 0) mode = OSPF_SHORTCUT_DISABLE; - else if (strncmp (argv[3]->arg, "e", 1) == 0) + else if (strncmp (argv[idx_enable_disable]->arg, "e", 1) == 0) mode = OSPF_SHORTCUT_ENABLE; else return CMD_WARNING; @@ -1590,6 +1615,7 @@ DEFUN (no_ospf_area_shortcut, "Deconfigure enabled shortcutting through the area\n" "Deconfigure disabled shortcutting through the area\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1598,7 +1624,7 @@ DEFUN (no_ospf_area_shortcut, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (!area) @@ -1618,6 +1644,7 @@ DEFUN (ospf_area_stub, "OSPF area ID as a decimal value\n" "Configure OSPF area as stub\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct in_addr area_id; int ret, format; @@ -1625,7 +1652,7 @@ DEFUN (ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1649,6 +1676,7 @@ DEFUN (ospf_area_stub_no_summary, "Configure OSPF area as stub\n" "Do not inject inter-area routes into stub\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct in_addr area_id; int ret, format; @@ -1656,7 +1684,7 @@ DEFUN (ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); if (ret == 0) @@ -1680,6 +1708,7 @@ DEFUN (no_ospf_area_stub, "OSPF area ID as a decimal value\n" "Configure OSPF area as stub\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct in_addr area_id; int format; @@ -1687,7 +1716,7 @@ DEFUN (no_ospf_area_stub, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ospf_area_stub_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1705,6 +1734,7 @@ DEFUN (no_ospf_area_stub_no_summary, "Configure OSPF area as stub\n" "Do not inject inter-area routes into area\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct in_addr area_id; int format; @@ -1712,7 +1742,7 @@ DEFUN (no_ospf_area_stub_no_summary, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ospf_area_no_summary_unset (ospf, area_id); return CMD_SUCCESS; @@ -1842,6 +1872,7 @@ DEFUN (no_ospf_area_nssa, "OSPF area ID as a decimal value\n" "Configure OSPF area as nssa\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct in_addr area_id; int format; @@ -1849,7 +1880,7 @@ DEFUN (no_ospf_area_nssa, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[idx_ipv4_number]->arg); ospf_area_nssa_unset (ospf, area_id); ospf_area_no_summary_unset (ospf, area_id); @@ -1869,6 +1900,8 @@ DEFUN (ospf_area_default_cost, "Set the summary-default cost of a NSSA or stub area\n" "Stub's advertised default summary cost\n") { + int idx_ipv4_number = 1; + int idx_number = 3; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1879,8 +1912,8 @@ DEFUN (ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[1]->arg); - VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[3]->arg, 0, 16777215); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215); area = ospf_area_get (ospf, area_id, format); @@ -1914,6 +1947,8 @@ DEFUN (no_ospf_area_default_cost, "Set the summary-default cost of a NSSA or stub area\n" "Stub's advertised default summary cost\n") { + int idx_ipv4_number = 2; + int idx_number = 4; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1923,8 +1958,8 @@ DEFUN (no_ospf_area_default_cost, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[2]->arg); - VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[4]->arg, 0, OSPF_LS_INFINITY); + VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg); + VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[idx_number]->arg, 0, OSPF_LS_INFINITY); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -1962,6 +1997,7 @@ DEFUN (ospf_area_export_list, "Set the filter for networks announced to other areas\n" "Name of the access-list\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1970,7 +2006,7 @@ DEFUN (ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_export_list_set (ospf, area, argv[1]); @@ -1988,6 +2024,7 @@ DEFUN (no_ospf_area_export_list, "Unset the filter for networks announced to other areas\n" "Name of the access-list\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -1996,7 +2033,7 @@ DEFUN (no_ospf_area_export_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2017,6 +2054,7 @@ DEFUN (ospf_area_import_list, "Set the filter for networks from other areas announced to the specified one\n" "Name of the access-list\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2025,7 +2063,7 @@ DEFUN (ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); ospf_area_import_list_set (ospf, area, argv[1]); @@ -2043,6 +2081,7 @@ DEFUN (no_ospf_area_import_list, "Unset the filter for networks announced to other areas\n" "Name of the access-list\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2051,7 +2090,7 @@ DEFUN (no_ospf_area_import_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2074,6 +2113,9 @@ DEFUN (ospf_area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + int idx_ipv4_number = 1; + int idx_word = 4; + int idx_in_out = 5; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2083,17 +2125,17 @@ DEFUN (ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); - plist = prefix_list_lookup (AFI_IP, argv[4]->arg); - if (strncmp (argv[5]->arg, "in", 2) == 0) + plist = prefix_list_lookup (AFI_IP, argv[idx_word]->arg); + if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0) { PREFIX_LIST_IN (area) = plist; if (PREFIX_NAME_IN (area)) free (PREFIX_NAME_IN (area)); - PREFIX_NAME_IN (area) = strdup (argv[4]->arg); + PREFIX_NAME_IN (area) = strdup (argv[idx_word]->arg); ospf_schedule_abr_task (ospf); } else @@ -2102,7 +2144,7 @@ DEFUN (ospf_area_filter_list, if (PREFIX_NAME_OUT (area)) free (PREFIX_NAME_OUT (area)); - PREFIX_NAME_OUT (area) = strdup (argv[4]->arg); + PREFIX_NAME_OUT (area) = strdup (argv[idx_word]->arg); ospf_schedule_abr_task (ospf); } @@ -2122,6 +2164,9 @@ DEFUN (no_ospf_area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + int idx_ipv4_number = 2; + int idx_word = 5; + int idx_in_out = 6; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2130,15 +2175,15 @@ DEFUN (no_ospf_area_filter_list, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) return CMD_SUCCESS; - if (strncmp (argv[6]->arg, "in", 2) == 0) + if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0) { if (PREFIX_NAME_IN (area)) - if (strcmp (PREFIX_NAME_IN (area), argv[5]->arg) != 0) + if (strcmp (PREFIX_NAME_IN (area), argv[idx_word]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_IN (area) = NULL; @@ -2152,7 +2197,7 @@ DEFUN (no_ospf_area_filter_list, else { if (PREFIX_NAME_OUT (area)) - if (strcmp (PREFIX_NAME_OUT (area), argv[5]->arg) != 0) + if (strcmp (PREFIX_NAME_OUT (area), argv[idx_word]->arg) != 0) return CMD_SUCCESS; PREFIX_LIST_OUT (area) = NULL; @@ -2177,6 +2222,7 @@ DEFUN (ospf_area_authentication_message_digest, "Enable authentication\n" "Use message-digest authentication\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2185,7 +2231,7 @@ DEFUN (ospf_area_authentication_message_digest, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -2201,6 +2247,7 @@ DEFUN (ospf_area_authentication, "OSPF area ID as a decimal value\n" "Enable authentication\n") { + int idx_ipv4_number = 1; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2209,7 +2256,7 @@ DEFUN (ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); area->auth_type = OSPF_AUTH_SIMPLE; @@ -2226,6 +2273,7 @@ DEFUN (no_ospf_area_authentication, "OSPF area ID as a decimal value\n" "Enable authentication\n") { + int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; @@ -2234,7 +2282,7 @@ DEFUN (no_ospf_area_authentication, if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg); + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -2258,19 +2306,20 @@ DEFUN (ospf_abr_type, "Shortcut ABR\n" "Standard behavior (RFC2328)\n") { + int idx_vendor = 2; struct ospf *ospf = vty->index; u_char abr_type = OSPF_ABR_UNKNOWN; if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[2]->arg, "c", 1) == 0) + if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[2]->arg, "i", 1) == 0) + else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[2]->arg, "sh", 2) == 0) + else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[2]->arg, "st", 2) == 0) + else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2295,19 +2344,20 @@ DEFUN (no_ospf_abr_type, "Alternative ABR, IBM implementation\n" "Shortcut ABR\n") { + int idx_vendor = 3; struct ospf *ospf = vty->index; u_char abr_type = OSPF_ABR_UNKNOWN; if (!ospf) return CMD_SUCCESS; - if (strncmp (argv[3]->arg, "c", 1) == 0) + if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0) abr_type = OSPF_ABR_CISCO; - else if (strncmp (argv[3]->arg, "i", 1) == 0) + else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0) abr_type = OSPF_ABR_IBM; - else if (strncmp (argv[3]->arg, "sh", 2) == 0) + else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0) abr_type = OSPF_ABR_SHORTCUT; - else if (strncmp (argv[3]->arg, "st", 2) == 0) + else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0) abr_type = OSPF_ABR_STAND; else return CMD_WARNING; @@ -2468,6 +2518,7 @@ DEFUN (ospf_timers_min_ls_interval, "All LSA types\n" "Delay (msec) between sending LSAs\n") { + int idx_number = 4; struct ospf *ospf = vty->index; unsigned int interval; @@ -2480,7 +2531,7 @@ DEFUN (ospf_timers_min_ls_interval, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA interval", interval, argv[4]->arg); + VTY_GET_INTEGER ("LSA interval", interval, argv[idx_number]->arg); ospf->min_ls_interval = interval; @@ -2522,6 +2573,7 @@ DEFUN (ospf_timers_min_ls_arrival, "OSPF minimum arrival interval delay\n" "Delay (msec) between accepted LSAs\n") { + int idx_number = 3; struct ospf *ospf = vty->index; unsigned int arrival; @@ -2534,7 +2586,7 @@ DEFUN (ospf_timers_min_ls_arrival, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[3]->arg, 0, 1000); + VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[idx_number]->arg, 0, 1000); ospf->min_ls_arrival = arrival; @@ -2580,6 +2632,9 @@ DEFUN (ospf_timers_throttle_spf, "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") { + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; unsigned int delay, hold, max; if (argc != 3) @@ -2588,9 +2643,9 @@ DEFUN (ospf_timers_throttle_spf, return CMD_WARNING; } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000); - VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000); + VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000); return ospf_timers_spf_set (vty, delay, hold, max); } @@ -2630,6 +2685,7 @@ DEFUN (ospf_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { + int idx_number = 3; unsigned int minarrival; struct ospf *ospf = vty->index; @@ -2642,7 +2698,7 @@ DEFUN (ospf_timers_lsa, return CMD_WARNING; } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg); ospf->min_ls_arrival = minarrival; @@ -2712,6 +2768,7 @@ DEFUN (ospf_neighbor, NEIGHBOR_STR "Neighbor IP address\n") { + int idx_ipv4 = 1; struct ospf *ospf = vty->index; struct in_addr nbr_addr; unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; @@ -2720,7 +2777,7 @@ DEFUN (ospf_neighbor, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); if (argc > 1) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); @@ -2758,6 +2815,8 @@ DEFUN (ospf_neighbor_poll_interval, "Dead Neighbor Polling interval\n" "Seconds\n") { + int idx_ipv4 = 1; + int idx_number = 3; struct ospf *ospf = vty->index; struct in_addr nbr_addr; unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; @@ -2766,10 +2825,10 @@ DEFUN (ospf_neighbor_poll_interval, if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); if (argc > 1) - VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[3]->arg, 1, 65535); + VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_number]->arg, 1, 65535); if (argc > 2) VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); @@ -2826,13 +2885,14 @@ DEFUN (no_ospf_neighbor, NEIGHBOR_STR "Neighbor IP address\n") { + int idx_ipv4 = 2; struct ospf *ospf = vty->index; struct in_addr nbr_addr; if (!ospf) return CMD_SUCCESS; - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[2]->arg); + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); (void)ospf_nbr_nbma_unset (ospf, nbr_addr); @@ -2850,13 +2910,14 @@ DEFUN (ospf_refresh_timer, "Set refresh timer\n" "Timer value in seconds\n") { + int idx_number = 2; struct ospf *ospf = vty->index; unsigned int interval; if (!ospf) return CMD_SUCCESS; - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[2]->arg, 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800); interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY; ospf_timers_refresh_set (ospf, interval); @@ -2878,6 +2939,7 @@ DEFUN (no_ospf_refresh_timer, "Unset refresh timer\n" "Timer value in seconds\n") { + int idx_number = 3; struct ospf *ospf = vty->index; unsigned int interval; @@ -2886,7 +2948,7 @@ DEFUN (no_ospf_refresh_timer, if (argc == 1) { - VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[3]->arg, 10, 1800); + VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800); if (ospf->lsa_refresh_interval != interval || interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) @@ -2906,6 +2968,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth, "Use reference bandwidth method to assign OSPF cost\n" "The reference bandwidth in terms of Mbits per second\n") { + int idx_number = 2; struct ospf *ospf = vty->index; u_int32_t refbw; struct listnode *node; @@ -2914,7 +2977,7 @@ DEFUN (ospf_auto_cost_reference_bandwidth, if (!ospf) return CMD_SUCCESS; - refbw = strtol (argv[2]->arg, NULL, 10); + refbw = strtol (argv[idx_number]->arg, NULL, 10); if (refbw < 1 || refbw > 4294967) { vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); @@ -2983,13 +3046,14 @@ DEFUN (ospf_write_multiplier, "Write multiplier\n" "Maximum number of interface serviced per write\n") { + int idx_number = 2; struct ospf *ospf = vty->index; u_int32_t write_oi_count; if (!ospf) return CMD_SUCCESS; - write_oi_count = strtol (argv[2]->arg, NULL, 10); + write_oi_count = strtol (argv[idx_number]->arg, NULL, 10); if (write_oi_count < 1 || write_oi_count > 100) { vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE); @@ -3625,11 +3689,12 @@ DEFUN (show_ip_ospf_instance, "Instance ID\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4037,11 +4102,12 @@ DEFUN (show_ip_ospf_instance_interface, "Interface name\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4193,11 +4259,12 @@ DEFUN (show_ip_ospf_instance_neighbor, "Neighbor list\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4305,11 +4372,12 @@ DEFUN (show_ip_ospf_instance_neighbor_all, "include down status neighbor\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4399,11 +4467,12 @@ DEFUN (show_ip_ospf_instance_neighbor_int, "Interface name\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4765,11 +4834,12 @@ DEFUN (show_ip_ospf_instance_neighbor_id, "Neighbor ID\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4856,11 +4926,12 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, "detail of all neighbors\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -4955,11 +5026,12 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, "include down status neighbor\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5057,11 +5129,12 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, "detail of all neighbors\n" "JavaScript Object Notation\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; u_char uj = use_json(argc, argv); - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -5896,10 +5969,11 @@ DEFUN (show_ip_ospf_instance_database, "Instance ID\n" "Database summary\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -6021,10 +6095,11 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, "Advertising Router link states\n" "Advertising Router (as an IP address)\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -6053,6 +6128,8 @@ DEFUN (ip_ospf_authentication_args, "Use message-digest authentication\n" "Address of interface") { + int idx_encryption = 3; + int idx_ipv4 = 4; struct interface *ifp; struct in_addr addr; int ret; @@ -6063,7 +6140,7 @@ DEFUN (ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6076,7 +6153,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle null authentication */ - if ( argv[3]->arg[0] == 'n' ) + if ( argv[idx_encryption]->arg[0] == 'n' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_NULL; @@ -6084,7 +6161,7 @@ DEFUN (ip_ospf_authentication_args, } /* Handle message-digest authentication */ - if ( argv[3]->arg[0] == 'm' ) + if ( argv[idx_encryption]->arg[0] == 'm' ) { SET_IF_PARAM (params, auth_type); params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -6112,6 +6189,7 @@ DEFUN (ip_ospf_authentication, "Enable authentication on this interface\n" "Address of interface") { + int idx_ipv4 = 3; struct interface *ifp; struct in_addr addr; int ret; @@ -6122,7 +6200,7 @@ DEFUN (ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[3]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6163,6 +6241,8 @@ DEFUN (no_ip_ospf_authentication_args, "Use message-digest authentication\n" "Address of interface") { + int idx_encryption = 4; + int idx_ipv4 = 5; struct interface *ifp; struct in_addr addr; int ret; @@ -6175,7 +6255,7 @@ DEFUN (no_ip_ospf_authentication_args, if (argc == 2) { - ret = inet_aton(argv[5]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6199,11 +6279,11 @@ DEFUN (no_ip_ospf_authentication_args, } else { - if ( argv[4]->arg[0] == 'n' ) + if ( argv[idx_encryption]->arg[0] == 'n' ) { auth_type = OSPF_AUTH_NULL; } - else if ( argv[4]->arg[0] == 'm' ) + else if ( argv[idx_encryption]->arg[0] == 'm' ) { auth_type = OSPF_AUTH_CRYPTOGRAPHIC; } @@ -6264,6 +6344,7 @@ DEFUN (no_ip_ospf_authentication, "Enable authentication on this interface\n" "Address of interface") { + int idx_ipv4 = 4; struct interface *ifp; struct in_addr addr; int ret; @@ -6275,7 +6356,7 @@ DEFUN (no_ip_ospf_authentication, if (argc == 1) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6356,6 +6437,7 @@ DEFUN (ip_ospf_authentication_key, "The OSPF password (key)\n" "Address of interface") { + int idx_ipv4 = 4; struct interface *ifp; struct in_addr addr; int ret; @@ -6379,7 +6461,7 @@ DEFUN (ip_ospf_authentication_key, } memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy ((char *) params->auth_simple, argv[4]->arg, OSPF_AUTH_SIMPLE_SIZE); + strncpy ((char *) params->auth_simple, argv[idx_ipv4]->arg, OSPF_AUTH_SIMPLE_SIZE); SET_IF_PARAM (params, auth_simple); return CMD_SUCCESS; @@ -6497,6 +6579,8 @@ DEFUN (ip_ospf_message_digest_key, "The OSPF password (key)" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 6; struct interface *ifp; struct crypt_key *ck; u_char key_id; @@ -6521,7 +6605,7 @@ DEFUN (ip_ospf_message_digest_key, ospf_if_update_params (ifp, addr); } - key_id = strtol (argv[3]->arg, NULL, 10); + key_id = strtol (argv[idx_number]->arg, NULL, 10); if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) { vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); @@ -6531,7 +6615,7 @@ DEFUN (ip_ospf_message_digest_key, ck = ospf_crypt_key_new (); ck->key_id = (u_char) key_id; memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy ((char *) ck->auth_key, argv[6]->arg, OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, argv[idx_ipv4]->arg, OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (params->auth_crypt, ck); SET_IF_PARAM (params, auth_crypt); @@ -6573,6 +6657,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, "The OSPF password (key)" "Address of interface") { + int idx_number = 4; struct interface *ifp; struct crypt_key *ck; int key_id; @@ -6598,7 +6683,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } - key_id = strtol (argv[4]->arg, NULL, 10); + key_id = strtol (argv[idx_number]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6644,6 +6729,8 @@ DEFUN (no_ip_ospf_message_digest_key, "Key ID\n" "Address of interface") { + int idx_number = 4; + int idx_ipv4 = 5; struct interface *ifp; struct crypt_key *ck; int key_id; @@ -6656,7 +6743,7 @@ DEFUN (no_ip_ospf_message_digest_key, if (argc == 2) { - ret = inet_aton(argv[5]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6669,7 +6756,7 @@ DEFUN (no_ip_ospf_message_digest_key, return CMD_SUCCESS; } - key_id = strtol (argv[4]->arg, NULL, 10); + key_id = strtol (argv[idx_number]->arg, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6708,6 +6795,8 @@ DEFUN (ip_ospf_cost, "Cost\n" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; u_int32_t cost; struct in_addr addr; @@ -6716,7 +6805,7 @@ DEFUN (ip_ospf_cost, params = IF_DEF_PARAMS (ifp); - cost = strtol (argv[3]->arg, NULL, 10); + cost = strtol (argv[idx_number]->arg, NULL, 10); /* cost range is <1-65535>. */ if (cost < 1 || cost > 65535) @@ -6727,7 +6816,7 @@ DEFUN (ip_ospf_cost, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6792,6 +6881,7 @@ DEFUN (no_ip_ospf_cost, "Interface cost\n" "Address of interface") { + int idx_ipv4 = 4; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -6802,7 +6892,7 @@ DEFUN (no_ip_ospf_cost, if (argc == 1) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6864,6 +6954,7 @@ DEFUN (no_ip_ospf_cost2, "Interface cost\n" "Cost") { + int idx_number = 4; struct interface *ifp = vty->index; struct in_addr addr; u_int32_t cost; @@ -6878,7 +6969,7 @@ DEFUN (no_ip_ospf_cost2, * of N already configured for the interface. Thus the first argument * is always checked to be a number, but is ignored after that. */ - cost = strtol (argv[4]->arg, NULL, 10); + cost = strtol (argv[idx_number]->arg, NULL, 10); if (cost < 1 || cost > 65535) { vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); @@ -7030,10 +7121,12 @@ DEFUN (ip_ospf_dead_interval, "Seconds\n" "Address of interface\n") { + int idx_number = 3; + int idx_ipv4 = 4; if (argc == 2) - return ospf_vty_dead_interval_set (vty, argv[3]->arg, argv[4]->arg, NULL); + return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, argv[idx_ipv4]->arg, NULL); else - return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL); + return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL); } @@ -7066,10 +7159,12 @@ DEFUN (ip_ospf_dead_interval_minimal, "Number of Hellos to send each second\n" "Address of interface\n") { + int idx_number = 5; + int idx_ipv4 = 6; if (argc == 2) - return ospf_vty_dead_interval_set (vty, NULL, argv[6]->arg, argv[5]->arg); + return ospf_vty_dead_interval_set (vty, NULL, argv[idx_ipv4]->arg, argv[idx_number]->arg); else - return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg); + return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg); } @@ -7123,6 +7218,7 @@ DEFUN (no_ip_ospf_dead_interval, "Seconds\n" "Address of interface") { + int idx_ipv4 = 5; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -7135,7 +7231,7 @@ DEFUN (no_ip_ospf_dead_interval, if (argc == 2) { - ret = inet_aton(argv[5]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7205,6 +7301,8 @@ DEFUN (ip_ospf_hello_interval, "Seconds\n" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; u_int32_t seconds; struct in_addr addr; @@ -7213,7 +7311,7 @@ DEFUN (ip_ospf_hello_interval, params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[3]->arg, NULL, 10); + seconds = strtol (argv[idx_number]->arg, NULL, 10); /* HelloInterval range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7224,7 +7322,7 @@ DEFUN (ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7282,6 +7380,7 @@ DEFUN (no_ip_ospf_hello_interval, "Seconds\n" "Address of interface") { + int idx_ipv4 = 5; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -7292,7 +7391,7 @@ DEFUN (no_ip_ospf_hello_interval, if (argc == 2) { - ret = inet_aton(argv[5]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7331,6 +7430,7 @@ DEFUN (ip_ospf_network, "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") { + int idx_network = 3; struct interface *ifp = vty->index; int old_type = IF_DEF_PARAMS (ifp)->type; struct route_node *rn; @@ -7341,13 +7441,13 @@ DEFUN (ip_ospf_network, return CMD_WARNING; } - if (strncmp (argv[3]->arg, "b", 1) == 0) + if (strncmp (argv[idx_network]->arg, "b", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; - else if (strncmp (argv[3]->arg, "n", 1) == 0) + else if (strncmp (argv[idx_network]->arg, "n", 1) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; - else if (strncmp (argv[3]->arg, "point-to-m", 10) == 0) + else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; - else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0) + else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; if (IF_DEF_PARAMS (ifp)->type == old_type) @@ -7468,6 +7568,8 @@ DEFUN (ip_ospf_priority, "Priority\n" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; long priority; struct route_node *rn; @@ -7477,7 +7579,7 @@ DEFUN (ip_ospf_priority, params = IF_DEF_PARAMS (ifp); - priority = strtol (argv[3]->arg, NULL, 10); + priority = strtol (argv[idx_number]->arg, NULL, 10); /* Router Priority range is <0-255>. */ if (priority < 0 || priority > 255) @@ -7488,7 +7590,7 @@ DEFUN (ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7561,6 +7663,7 @@ DEFUN (no_ip_ospf_priority, "Priority\n" "Address of interface") { + int idx_ipv4 = 5; struct interface *ifp = vty->index; struct route_node *rn; struct in_addr addr; @@ -7572,7 +7675,7 @@ DEFUN (no_ip_ospf_priority, if (argc == 2) { - ret = inet_aton(argv[5]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7634,6 +7737,8 @@ DEFUN (ip_ospf_retransmit_interval, "Seconds\n" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; u_int32_t seconds; struct in_addr addr; @@ -7641,7 +7746,7 @@ DEFUN (ip_ospf_retransmit_interval, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[3]->arg, NULL, 10); + seconds = strtol (argv[idx_number]->arg, NULL, 10); /* Retransmit Interval range is <3-65535>. */ if (seconds < 3 || seconds > 65535) @@ -7653,7 +7758,7 @@ DEFUN (ip_ospf_retransmit_interval, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7794,6 +7899,8 @@ DEFUN (ip_ospf_transmit_delay, "Seconds\n" "Address of interface") { + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; u_int32_t seconds; struct in_addr addr; @@ -7801,7 +7908,7 @@ DEFUN (ip_ospf_transmit_delay, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[3]->arg, NULL, 10); + seconds = strtol (argv[idx_number]->arg, NULL, 10); /* Transmit Delay range is <1-65535>. */ if (seconds < 1 || seconds > 65535) @@ -7812,7 +7919,7 @@ DEFUN (ip_ospf_transmit_delay, if (argc == 2) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7955,6 +8062,7 @@ DEFUN (ip_ospf_area, "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { + int idx_ipv4_number = 3; struct interface *ifp = vty->index; int format, ret; struct in_addr area_id; @@ -7964,7 +8072,7 @@ DEFUN (ip_ospf_area, u_short instance = 0; if (argc == 2) - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_ipv4_number]->arg); ospf = ospf_lookup_instance (instance); if (ospf == NULL) @@ -8079,12 +8187,13 @@ DEFUN (no_ip_ospf_instance_area, "Instance ID\n" "Disable OSPF on this interface\n") { + int idx_number = 3; struct interface *ifp = vty->index; struct ospf *ospf; struct ospf_if_params *params; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; @@ -8115,6 +8224,8 @@ DEFUN (ospf_redistribute_source, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_redist_param = 2; struct ospf *ospf = vty->index; int source; int type = -1; @@ -8131,13 +8242,13 @@ DEFUN (ospf_redistribute_source, return CMD_SUCCESS; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[1]->arg); + source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; /* Get metric value. */ - if (argv[2]->arg != NULL) - if (!str2metric (argv[2]->arg, &metric)) + if (argv[idx_redist_param]->arg != NULL) + if (!str2metric (argv[idx_redist_param]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8169,13 +8280,14 @@ DEFUN (no_ospf_redistribute_source, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 2; struct ospf *ospf = vty->index; int source; struct ospf_redist *red; if (!ospf) return CMD_SUCCESS; - source = proto_redistnum(AFI_IP, argv[2]->arg); + source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; @@ -8202,6 +8314,9 @@ DEFUN (ospf_redistribute_instance_source, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_ospf_table = 1; + int idx_number = 2; + int idx_redist_param = 3; struct ospf *ospf = vty->index; int source; int type = -1; @@ -8212,12 +8327,12 @@ DEFUN (ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[1]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); if (!ospf) return CMD_SUCCESS; @@ -8237,8 +8352,8 @@ DEFUN (ospf_redistribute_instance_source, } /* Get metric value. */ - if (argv[3]->arg != NULL) - if (!str2metric (argv[3]->arg, &metric)) + if (argv[idx_redist_param]->arg != NULL) + if (!str2metric (argv[idx_redist_param]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ @@ -8271,6 +8386,8 @@ DEFUN (no_ospf_redistribute_instance_source, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_ospf_table = 2; + int idx_number = 3; struct ospf *ospf = vty->index; u_int instance; struct ospf_redist *red; @@ -8279,12 +8396,12 @@ DEFUN (no_ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - if (strncmp(argv[2]->arg, "o", 1) == 0) + if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0) source = ZEBRA_ROUTE_OSPF; else source = ZEBRA_ROUTE_TABLE; - VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg); if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) { @@ -8316,6 +8433,7 @@ DEFUN (ospf_distribute_list_out, OUT_STR QUAGGA_REDIST_HELP_STR_OSPFD) { + int idx_word = 1; struct ospf *ospf = vty->index; int source; @@ -8327,7 +8445,7 @@ DEFUN (ospf_distribute_list_out, if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_set (ospf, source, argv[1]->arg); + return ospf_distribute_list_out_set (ospf, source, argv[idx_word]->arg); } DEFUN (no_ospf_distribute_list_out, @@ -8339,6 +8457,7 @@ DEFUN (no_ospf_distribute_list_out, OUT_STR QUAGGA_REDIST_HELP_STR_OSPFD) { + int idx_word = 2; struct ospf *ospf = vty->index; int source; @@ -8349,7 +8468,7 @@ DEFUN (no_ospf_distribute_list_out, if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; - return ospf_distribute_list_out_unset (ospf, source, argv[2]->arg); + return ospf_distribute_list_out_unset (ospf, source, argv[idx_word]->arg); } /* Default information originate. */ @@ -8367,6 +8486,7 @@ DEFUN (ospf_default_information_originate, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_redist_param = 2; struct ospf *ospf = vty->index; int default_originate = DEFAULT_ORIGINATE_ZEBRA; int type = -1; @@ -8380,7 +8500,7 @@ DEFUN (ospf_default_information_originate, return CMD_WARNING; /* this should not happen */ /* Check whether "always" was specified */ - if (argv[2]->arg != NULL) + if (argv[idx_redist_param]->arg != NULL) default_originate = DEFAULT_ORIGINATE_ALWAYS; red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); @@ -8453,13 +8573,14 @@ DEFUN (ospf_default_metric, "Set metric of redistributed routes\n" "Default metric\n") { + int idx_number = 1; struct ospf *ospf = vty->index; int metric = -1; if (!ospf) return CMD_SUCCESS; - if (!str2metric (argv[1]->arg, &metric)) + if (!str2metric (argv[idx_number]->arg, &metric)) return CMD_WARNING; ospf->default_metric = metric; @@ -8498,12 +8619,13 @@ DEFUN (ospf_distance, "Define an administrative distance\n" "OSPF Administrative distance\n") { + int idx_number = 1; struct ospf *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - ospf->distance_all = atoi (argv[1]->arg); + ospf->distance_all = atoi (argv[idx_number]->arg); return CMD_SUCCESS; } @@ -8538,6 +8660,7 @@ DEFUN (no_ospf_distance_ospf, "External routes\n" "Distance for external routes\n") { + int idx_area_distance = 3; struct ospf *ospf = vty->index; if (!ospf) @@ -8549,7 +8672,7 @@ DEFUN (no_ospf_distance_ospf, if (!ospf) return CMD_SUCCESS; - if (argv[3]->arg != NULL) + if (argv[idx_area_distance]->arg != NULL) ospf->distance_intra = 0; if (argv[1] != NULL) @@ -8558,7 +8681,7 @@ DEFUN (no_ospf_distance_ospf, if (argv[2] != NULL) ospf->distance_external = 0; - if (argv[3]->arg || argv[1] || argv[2]) + if (argv[idx_area_distance]->arg || argv[1] || argv[2]) return CMD_SUCCESS; /* If no arguments are given, clear all distance information */ @@ -8581,6 +8704,7 @@ DEFUN (ospf_distance_ospf, "External routes\n" "Distance for external routes\n") { + int idx_area_distance = 2; struct ospf *ospf = vty->index; if (!ospf) @@ -8589,15 +8713,15 @@ DEFUN (ospf_distance_ospf, if (argc < 3) /* should not happen */ return CMD_WARNING; - if (!argv[2]->arg && !argv[1] && !argv[2]) + if (!argv[idx_area_distance]->arg && !argv[1] && !argv[2]) { vty_out(vty, "%% Command incomplete. (Arguments required)%s", VTY_NEWLINE); return CMD_WARNING; } - if (argv[2]->arg != NULL) - ospf->distance_intra = atoi(argv[2]->arg); + if (argv[idx_area_distance]->arg != NULL) + ospf->distance_intra = atoi(argv[idx_area_distance]->arg); if (argv[1] != NULL) ospf->distance_inter = atoi(argv[1]); @@ -8615,12 +8739,14 @@ DEFUN (ospf_distance_source, "Distance value\n" "IP source prefix\n") { + int idx_number = 1; + int idx_ipv4_prefixlen = 2; struct ospf *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, NULL); + ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -8633,12 +8759,14 @@ DEFUN (no_ospf_distance_source, "Distance value\n" "IP source prefix\n") { + int idx_number = 2; + int idx_ipv4_prefixlen = 3; struct ospf *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, NULL); + ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -8651,12 +8779,15 @@ DEFUN (ospf_distance_source_access_list, "IP source prefix\n" "Access list name\n") { + int idx_number = 1; + int idx_ipv4_prefixlen = 2; + int idx_word = 3; struct ospf *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, argv[3]->arg); + ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -8670,12 +8801,15 @@ DEFUN (no_ospf_distance_source_access_list, "IP source prefix\n" "Access list name\n") { + int idx_number = 2; + int idx_ipv4_prefixlen = 3; + int idx_word = 4; struct ospf *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, argv[4]->arg); + ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -8696,6 +8830,7 @@ DEFUN (ip_ospf_mtu_ignore, "Disable mtu mismatch detection\n" "Address of interface") { + int idx_ipv4 = 3; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -8705,7 +8840,7 @@ DEFUN (ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[3]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8748,6 +8883,7 @@ DEFUN (no_ip_ospf_mtu_ignore, "Disable mtu mismatch detection\n" "Address of interface") { + int idx_ipv4 = 4; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -8757,7 +8893,7 @@ DEFUN (no_ip_ospf_mtu_ignore, if (argc == 1) { - ret = inet_aton(argv[4]->arg, &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8850,6 +8986,7 @@ DEFUN (ospf_max_metric_router_lsa_startup, "Automatically advertise stub Router-LSA on startup of OSPF\n" "Time (seconds) to advertise self as stub-router\n") { + int idx_number = 3; unsigned int seconds; struct ospf *ospf = vty->index; @@ -8862,7 +8999,7 @@ DEFUN (ospf_max_metric_router_lsa_startup, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router startup period", seconds, argv[3]->arg); + VTY_GET_INTEGER ("stub-router startup period", seconds, argv[idx_number]->arg); ospf->stub_router_startup_time = seconds; @@ -8920,6 +9057,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, "Advertise stub-router prior to full shutdown of OSPF\n" "Time (seconds) to wait till full shutdown\n") { + int idx_number = 3; unsigned int seconds; struct ospf *ospf = vty->index; @@ -8932,7 +9070,7 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, return CMD_WARNING; } - VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[3]->arg); + VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[idx_number]->arg); ospf->stub_router_shutdown_time = seconds; @@ -9194,10 +9332,11 @@ DEFUN (show_ip_ospf_instance_border_routers, "Instance ID\n" "Show all the ABR's and ASBR's\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -9256,10 +9395,11 @@ DEFUN (show_ip_ospf_instance_route, "Instance ID\n" "OSPF routing table\n") { + int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) return CMD_SUCCESS; @@ -10240,6 +10380,7 @@ DEFUN (clear_ip_ospf_interface, "Interface information\n" "Interface name\n") { + int idx_ifname = 4; struct interface *ifp; struct listnode *node; @@ -10250,7 +10391,7 @@ DEFUN (clear_ip_ospf_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else ospf_interface_clear(ifp); diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 0b23916e6f..6e903d52a6 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -280,7 +280,7 @@ def get_token_index_variable_name(line_number, token): elif token == 'egp|igp|incomplete': return 'idx_origin' - elif token == 'cisco|zebra': + elif token == 'cisco|zebra' or token == 'cisco|ibm|shortcut|standard': return 'idx_vendor' elif token == 'as-set|no-as-set': @@ -316,7 +316,7 @@ def get_token_index_variable_name(line_number, token): elif token == 'ipv4|ipv6' or token == 'ip|ipv6': return 'idx_afi' - elif token == 'md5|clear': + elif token == 'md5|clear' or token == 'null|message-digest': return 'idx_encryption' elif token == 'type-1|type-2': @@ -325,13 +325,25 @@ def get_token_index_variable_name(line_number, token): elif token == 'table|intra-area|inter-area|memory': return 'idx_type' - elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all': + elif token == 'translate-candidate|translate-never|translate-always': + return 'idx_translate' + + elif token == 'intra-area (1-255)|inter-area (1-255)|external (1-255)': + return 'idx_area_distance' + + elif token == 'metric (0-16777214)|metric-type <1|2>|route-map WORD' or token == 'always|metric (0-16777214)|metric-type <1|2>|route-map WORD': + return 'idx_redist_param' + + elif token == 'default|enable|disable' or token == 'enable|disable': + return 'idx_enable_disable' + + elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all' or token == 'hello|dd|ls-request|ls-update|ls-ack|all': return 'idx_packet' - elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix': + elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix' or token == 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as': return 'idx_lsa' - elif token == 'broadcast|point-to-point': + elif token == 'broadcast|point-to-point' or token == 'broadcast|non-broadcast|point-to-multipoint|point-to-point': return 'idx_network' elif token == 'A.B.C.D|(0-4294967295)': From b181fa04e2e7badbb188de395eaf540fe0139dac Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 20:03:41 +0000 Subject: [PATCH 127/280] pimd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- pimd/pim_cmd.c | 181 ++++++++++++++++++++++++--------------- tools/argv_translator.py | 6 ++ 2 files changed, 120 insertions(+), 67 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 62159ad088..9232c48e7f 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1533,8 +1533,9 @@ DEFUN (pim_interface, "Select an interface to configure\n" "Interface's name\n") { + int idx_ifname = 1; struct interface *ifp; - const char *ifname = argv[1]->arg; + const char *ifname = argv[idx_ifname]->arg; size_t sl; sl = strlen(ifname); @@ -2368,13 +2369,14 @@ DEFUN (show_ip_rib, RIB_STR "Unicast address\n") { + int idx_ipv4 = 3; struct in_addr addr; const char *addr_str; struct pim_nexthop nexthop; char nexthop_addr_str[100]; int result; - addr_str = argv[3]->arg; + addr_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, addr_str, &addr); if (result <= 0) { vty_out(vty, "Bad unicast address %s: errno=%d: %s%s", @@ -2466,16 +2468,17 @@ DEFUN (ip_pim_rp, "Rendevous Point\n" "ip address of RP\n") { + int idx_ipv4 = 3; int result; - result = inet_pton(AF_INET, argv[3]->arg, &qpim_rp.rpf_addr.s_addr); + result = inet_pton(AF_INET, argv[idx_ipv4]->arg, &qpim_rp.rpf_addr.s_addr); if (result <= 0) { - vty_out(vty, "%% Bad RP address specified: %s", argv[3]->arg); + vty_out(vty, "%% Bad RP address specified: %s", argv[idx_ipv4]->arg); return CMD_WARNING; } if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) { - vty_out(vty, "%% No Path to RP address specified: %s", argv[3]->arg); + vty_out(vty, "%% No Path to RP address specified: %s", argv[idx_ipv4]->arg); return CMD_WARNING; } @@ -2484,7 +2487,7 @@ DEFUN (ip_pim_rp, DEFUN (no_ip_pim_rp, no_ip_pim_rp_cmd, - "no ip pim rp {A.B.C.D}", + "no ip pim rp [A.B.C.D]", NO_STR IP_STR "pim multicast routing\n" @@ -2531,9 +2534,10 @@ DEFUN (ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { + int idx_ipv4 = 2; int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[2]->arg : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2560,9 +2564,10 @@ DEFUN (no_ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { + int idx_ipv4 = 3; int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[3]->arg : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2648,6 +2653,8 @@ DEFUN (interface_ip_igmp_join, "Multicast group address\n" "Source address\n") { + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; struct interface *ifp; const char *group_str; const char *source_str; @@ -2658,7 +2665,7 @@ DEFUN (interface_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[3]->arg; + group_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2667,7 +2674,7 @@ DEFUN (interface_ip_igmp_join, } /* Source address */ - source_str = argv[4]->arg; + source_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2695,6 +2702,8 @@ DEFUN (interface_no_ip_igmp_join, "Multicast group address\n" "Source address\n") { + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; struct interface *ifp; const char *group_str; const char *source_str; @@ -2705,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[4]->arg; + group_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2714,7 +2723,7 @@ DEFUN (interface_no_ip_igmp_join, } /* Source address */ - source_str = argv[5]->arg; + source_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2865,7 +2874,7 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp, DEFUN (interface_ip_igmp_query_interval, interface_ip_igmp_query_interval_cmd, - PIM_CMD_IP_IGMP_QUERY_INTERVAL " <1-1800>", + PIM_CMD_IP_IGMP_QUERY_INTERVAL " (1-1800)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_INTERVAL_STR @@ -2960,7 +2969,7 @@ DEFUN (interface_no_ip_igmp_query_interval, DEFUN (interface_ip_igmp_query_max_response_time, interface_ip_igmp_query_max_response_time_cmd, - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME " <1-25>", + PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME " (1-25)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR @@ -3053,7 +3062,7 @@ DEFUN (interface_no_ip_igmp_query_max_response_time, DEFUN (interface_ip_igmp_query_max_response_time_dsec, interface_ip_igmp_query_max_response_time_dsec_cmd, - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC " <10-250>", + PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC " (10-250)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR @@ -3146,12 +3155,13 @@ DEFUN (interface_no_ip_igmp_query_max_response_time_dsec, DEFUN (interface_ip_pim_drprio, interface_ip_pim_drprio_cmd, - "ip pim drpriority <1-4294967295>", + "ip pim drpriority (1-4294967295)", IP_STR PIM_STR "Set the Designated Router Election Priority\n" "Value of the new DR Priority\n") { + int idx_number = 3; struct interface *ifp; struct pim_interface *pim_ifp; uint32_t old_dr_prio; @@ -3166,7 +3176,7 @@ DEFUN (interface_ip_pim_drprio, old_dr_prio = pim_ifp->pim_dr_priority; - pim_ifp->pim_dr_priority = strtol(argv[3]->arg, NULL, 10); + pim_ifp->pim_dr_priority = strtol(argv[idx_number]->arg, NULL, 10); if (old_dr_prio != pim_ifp->pim_dr_priority) { if (pim_if_dr_election(ifp)) @@ -3178,7 +3188,7 @@ DEFUN (interface_ip_pim_drprio, DEFUN (interface_no_ip_pim_drprio, interface_no_ip_pim_drprio_cmd, - "no ip pim drpriority {<1-4294967295>}", + "no ip pim drpriority [(1-4294967295)]", IP_STR PIM_STR "Revert the Designated Router Priority to default\n" @@ -3345,6 +3355,8 @@ DEFUN (interface_ip_mroute, "Outgoing interface name\n" "Group address\n") { + int idx_interface = 2; + int idx_ipv4 = 3; struct interface *iif; struct interface *oif; const char *oifname; @@ -3355,7 +3367,7 @@ DEFUN (interface_ip_mroute, iif = vty->index; - oifname = argv[2]->arg; + oifname = argv[idx_interface]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3363,7 +3375,7 @@ DEFUN (interface_ip_mroute, return CMD_WARNING; } - grp_str = argv[3]->arg; + grp_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3390,6 +3402,9 @@ DEFUN (interface_ip_mroute_source, "Group address\n" "Source address\n") { + int idx_interface = 2; + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; struct interface *iif; struct interface *oif; const char *oifname; @@ -3401,7 +3416,7 @@ DEFUN (interface_ip_mroute_source, iif = vty->index; - oifname = argv[2]->arg; + oifname = argv[idx_interface]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3409,7 +3424,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[3]->arg; + grp_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3417,7 +3432,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - src_str = argv[4]->arg; + src_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3442,6 +3457,8 @@ DEFUN (interface_no_ip_mroute, "Outgoing interface name\n" "Group Address\n") { + int idx_interface = 3; + int idx_ipv4 = 4; struct interface *iif; struct interface *oif; const char *oifname; @@ -3452,7 +3469,7 @@ DEFUN (interface_no_ip_mroute, iif = vty->index; - oifname = argv[3]->arg; + oifname = argv[idx_interface]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3460,7 +3477,7 @@ DEFUN (interface_no_ip_mroute, return CMD_WARNING; } - grp_str = argv[4]->arg; + grp_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3488,6 +3505,9 @@ DEFUN (interface_no_ip_mroute_source, "Group Address\n" "Source Address\n") { + int idx_interface = 3; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; struct interface *iif; struct interface *oif; const char *oifname; @@ -3499,7 +3519,7 @@ DEFUN (interface_no_ip_mroute_source, iif = vty->index; - oifname = argv[3]->arg; + oifname = argv[idx_interface]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3507,7 +3527,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[4]->arg; + grp_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3515,7 +3535,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - src_str = argv[5]->arg; + src_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3543,12 +3563,13 @@ DEFUN (interface_no_ip_mroute_source, */ DEFUN (interface_ip_pim_hello, interface_ip_pim_hello_cmd, - "ip pim hello <1-180>", + "ip pim hello (1-180)", IP_STR PIM_STR IFACE_PIM_HELLO_STR IFACE_PIM_HELLO_TIME_STR) { + int idx_number = 3; struct interface *ifp; struct pim_interface *pim_ifp; @@ -3560,7 +3581,7 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[3]->arg, NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[idx_number]->arg, NULL, 10); if (argc == 2) pim_ifp->pim_default_holdtime = strtol(argv[4]->arg, NULL, 10); @@ -3572,7 +3593,7 @@ DEFUN (interface_ip_pim_hello, DEFUN (interface_no_ip_pim_hello, interface_no_ip_pim_hello_cmd, - "no ip pim hello {<1-180> <1-180>}", + "no ip pim hello [(1-180) (1-180)]", NO_STR IP_STR PIM_STR @@ -3867,19 +3888,20 @@ DEFUN (debug_pim_packets, DEFUN (debug_pim_packets_filter, debug_pim_packets_filter_cmd, - "debug pim packets (hello|joins)", + "debug pim packets ", DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_PACKETS_STR DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[3]->arg,"h",1) == 0) + int idx_hello_join = 3; + if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0) { PIM_DO_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE); } - else if (strncmp(argv[3]->arg,"j",1) == 0) + else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0) { PIM_DO_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE); @@ -3912,7 +3934,7 @@ DEFUN (no_debug_pim_packets, DEFUN (no_debug_pim_packets_filter, no_debug_pim_packets_filter_cmd, - "no debug pim packets (hello|joins)", + "no debug pim packets ", NO_STR DEBUG_STR DEBUG_PIM_STR @@ -3920,12 +3942,13 @@ DEFUN (no_debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[4]->arg,"h",1) == 0) + int idx_hello_join = 4; + if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0) { PIM_DONT_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE); } - else if (strncmp(argv[4]->arg,"j",1) == 0) + else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0) { PIM_DONT_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE); @@ -4137,7 +4160,7 @@ static struct igmp_sock *find_igmp_sock_by_fd(int fd) DEFUN (test_igmp_receive_report, test_igmp_receive_report_cmd, - "test igmp receive report <0-65535> A.B.C.D <1-6> .LINE", + "test igmp receive report (0-65535) A.B.C.D (1-6) .LINE", "Test\n" "Test IGMP protocol\n" "Test IGMP message\n" @@ -4147,6 +4170,9 @@ DEFUN (test_igmp_receive_report, "Record type\n" "Sources\n") { + int idx_number = 4; + int idx_ipv4 = 5; + int idx_number_2 = 6; char buf[1000]; char *igmp_msg; struct ip *ip_hdr; @@ -4168,7 +4194,7 @@ DEFUN (test_igmp_receive_report, struct in_addr *src_addr; int argi; - socket = argv[4]->arg; + socket = argv[idx_number]->arg; socket_fd = atoi(socket); igmp = find_igmp_sock_by_fd(socket_fd); if (!igmp) { @@ -4177,7 +4203,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - grp_str = argv[5]->arg; + grp_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4185,7 +4211,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - record_type_str = argv[6]->arg; + record_type_str = argv[idx_number_2]->arg; record_type = atoi(record_type_str); /* @@ -4259,6 +4285,8 @@ DEFUN (test_pim_receive_dump, "Neighbor address\n" "Packet dump\n") { + int idx_interface = 4; + int idx_ipv4 = 5; uint8_t buf[1000]; uint8_t *pim_msg; struct ip *ip_hdr; @@ -4273,7 +4301,7 @@ DEFUN (test_pim_receive_dump, int result; /* Find interface */ - ifname = argv[4]->arg; + ifname = argv[idx_interface]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4282,7 +4310,7 @@ DEFUN (test_pim_receive_dump, } /* Neighbor address */ - neigh_str = argv[5]->arg; + neigh_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4362,7 +4390,7 @@ DEFUN (test_pim_receive_dump, DEFUN (test_pim_receive_hello, test_pim_receive_hello_cmd, - "test pim receive hello INTERFACE A.B.C.D <0-65535> <0-65535> <0-65535> <0-32767> <0-65535> <0-1>[LINE]", + "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" @@ -4377,6 +4405,14 @@ DEFUN (test_pim_receive_hello, "Neighbor LAN prune delay T-bit\n" "Neighbor secondary addresses\n") { + int idx_interface = 4; + int idx_ipv4 = 5; + int idx_number = 6; + int idx_number_2 = 7; + int idx_number_3 = 8; + int idx_number_4 = 9; + int idx_number_5 = 10; + int idx_number_6 = 11; uint8_t buf[1000]; uint8_t *pim_msg; struct ip *ip_hdr; @@ -4398,7 +4434,7 @@ DEFUN (test_pim_receive_hello, int result; /* Find interface */ - ifname = argv[4]->arg; + ifname = argv[idx_interface]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4407,7 +4443,7 @@ DEFUN (test_pim_receive_hello, } /* Neighbor address */ - neigh_str = argv[5]->arg; + neigh_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4415,12 +4451,12 @@ DEFUN (test_pim_receive_hello, return CMD_WARNING; } - neigh_holdtime = atoi(argv[6]->arg); - neigh_dr_priority = atoi(argv[7]->arg); - neigh_generation_id = atoi(argv[8]->arg); - neigh_propagation_delay = atoi(argv[9]->arg); - neigh_override_interval = atoi(argv[10]->arg); - neigh_can_disable_join_suppression = atoi(argv[11]->arg); + neigh_holdtime = atoi(argv[idx_number]->arg); + neigh_dr_priority = atoi(argv[idx_number_2]->arg); + neigh_generation_id = atoi(argv[idx_number_3]->arg); + neigh_propagation_delay = atoi(argv[idx_number_4]->arg); + neigh_override_interval = atoi(argv[idx_number_5]->arg); + neigh_can_disable_join_suppression = atoi(argv[idx_number_6]->arg); /* Tweak IP header @@ -4489,7 +4525,7 @@ DEFUN (test_pim_receive_hello, DEFUN (test_pim_receive_assert, test_pim_receive_assert_cmd, - "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D <0-65535> <0-65535> <0-1>", + "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" @@ -4502,6 +4538,13 @@ DEFUN (test_pim_receive_assert, "Assert route metric\n" "Assert RPT bit flag\n") { + int idx_interface = 4; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 7; + int idx_number = 8; + int idx_number_2 = 9; + int idx_number_3 = 10; uint8_t buf[1000]; uint8_t *buf_pastend = buf + sizeof(buf); uint8_t *pim_msg; @@ -4524,7 +4567,7 @@ DEFUN (test_pim_receive_assert, int result; /* Find interface */ - ifname = argv[4]->arg; + ifname = argv[idx_interface]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4533,7 +4576,7 @@ DEFUN (test_pim_receive_assert, } /* Neighbor address */ - neigh_str = argv[5]->arg; + neigh_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4542,7 +4585,7 @@ DEFUN (test_pim_receive_assert, } /* Group address */ - group_str = argv[6]->arg; + group_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4551,7 +4594,7 @@ DEFUN (test_pim_receive_assert, } /* Source address */ - source_str = argv[7]->arg; + source_str = argv[idx_ipv4_3]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4559,9 +4602,9 @@ DEFUN (test_pim_receive_assert, return CMD_WARNING; } - assert_metric_preference = atoi(argv[8]->arg); - assert_route_metric = atoi(argv[9]->arg); - assert_rpt_bit_flag = atoi(argv[10]->arg); + assert_metric_preference = atoi(argv[idx_number]->arg); + assert_route_metric = atoi(argv[idx_number_2]->arg); + assert_rpt_bit_flag = atoi(argv[idx_number_3]->arg); remain = buf_pastend - buf; if (remain < (int) sizeof(struct ip)) { @@ -4797,7 +4840,7 @@ static int recv_joinprune(struct vty *vty, DEFUN (test_pim_receive_join, test_pim_receive_join_cmd, - "test pim receive join INTERFACE <0-65535> A.B.C.D A.B.C.D A.B.C.D A.B.C.D", + "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" @@ -4814,7 +4857,7 @@ DEFUN (test_pim_receive_join, DEFUN (test_pim_receive_prune, test_pim_receive_prune_cmd, - "test pim receive prune INTERFACE <0-65535> A.B.C.D A.B.C.D A.B.C.D A.B.C.D", + "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" @@ -4831,7 +4874,7 @@ DEFUN (test_pim_receive_prune, DEFUN (test_pim_receive_upcall, test_pim_receive_upcall_cmd, - "test pim receive upcall (nocache|wrongvif|wholepkt) <0-65535> A.B.C.D A.B.C.D", + "test pim receive upcall (0-65535) A.B.C.D A.B.C.D", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" @@ -4843,13 +4886,17 @@ DEFUN (test_pim_receive_upcall, "Multicast group address\n" "Multicast source address\n") { + int idx_type = 4; + int idx_number = 5; + int idx_ipv4 = 6; + int idx_ipv4_2 = 7; struct igmpmsg msg; const char *upcall_type; const char *group_str; const char *source_str; int result; - upcall_type = argv[4]->arg; + upcall_type = argv[idx_type]->arg; if (upcall_type[0] == 'n') msg.im_msgtype = IGMPMSG_NOCACHE; @@ -4863,10 +4910,10 @@ DEFUN (test_pim_receive_upcall, return CMD_WARNING; } - msg.im_vif = atoi(argv[5]->arg); + msg.im_vif = atoi(argv[idx_number]->arg); /* Group address */ - group_str = argv[6]->arg; + group_str = argv[idx_ipv4]->arg; result = inet_pton(AF_INET, group_str, &msg.im_dst); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4875,7 +4922,7 @@ DEFUN (test_pim_receive_upcall, } /* Source address */ - source_str = argv[7]->arg; + source_str = argv[idx_ipv4_2]->arg; result = inet_pton(AF_INET, source_str, &msg.im_src); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 6e903d52a6..c874e0e4bb 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -385,6 +385,12 @@ def get_token_index_variable_name(line_number, token): elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': return 'idx_rpf_lookup_mode' + elif token == 'hello|joins': + return 'idx_hello_join' + + elif token == 'nocache|wrongvif|wholepkt': + return 'idx_type' + elif token in ('kernel|connected|static|rip|ospf|isis|pim|table', 'kernel|connected|static|ripng|ospf6|isis|table', 'kernel|connected|static|rip|isis|bgp|pim|table', From ab34a28ac64a24e5d736b3d90004d859a1ace1f3 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 20:04:42 +0000 Subject: [PATCH 128/280] ripngd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- ripngd/ripng_debug.c | 10 ++++++---- ripngd/ripng_interface.c | 20 ++++++++++++-------- ripngd/ripng_offset.c | 22 ++++++++++++++++++---- ripngd/ripng_routemap.c | 20 +++++++++++++------- ripngd/ripng_zebra.c | 27 +++++++++++++++++---------- ripngd/ripngd.c | 24 ++++++++++++++++-------- 6 files changed, 82 insertions(+), 41 deletions(-) diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index ecbba5b308..de5367261d 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -98,10 +98,11 @@ DEFUN (debug_ripng_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { + int idx_recv_send = 3; ripng_debug_packet |= RIPNG_DEBUG_PACKET; - if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) ripng_debug_packet |= RIPNG_DEBUG_SEND; - if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) ripng_debug_packet |= RIPNG_DEBUG_RECV; return CMD_SUCCESS; @@ -152,14 +153,15 @@ DEFUN (no_debug_ripng_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) + int idx_recv_send = 4; + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) { if (IS_RIPNG_DEBUG_RECV) ripng_debug_packet &= ~RIPNG_DEBUG_SEND; else ripng_debug_packet = 0; } - else if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) + else if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) { if (IS_RIPNG_DEBUG_SEND) ripng_debug_packet &= ~RIPNG_DEBUG_RECV; diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 930752abd0..9c434c8dfb 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -953,20 +953,21 @@ DEFUN (ripng_network, "RIPng enable on specified interface or network.\n" "Interface or address") { + int idx_if_or_addr = 1; int ret; struct prefix p; - ret = str2prefix (argv[1]->arg, &p); + ret = str2prefix (argv[idx_if_or_addr]->arg, &p); /* Given string is IPv6 network or interface name. */ if (ret) ret = ripng_enable_network_add (&p); else - ret = ripng_enable_if_add (argv[1]->arg); + ret = ripng_enable_if_add (argv[idx_if_or_addr]->arg); if (ret < 0) { - vty_out (vty, "There is same network configuration %s%s", argv[1]->arg, + vty_out (vty, "There is same network configuration %s%s", argv[idx_if_or_addr]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -982,20 +983,21 @@ DEFUN (no_ripng_network, "RIPng enable on specified interface or network.\n" "Interface or address") { + int idx_if_or_addr = 2; int ret; struct prefix p; - ret = str2prefix (argv[2]->arg, &p); + ret = str2prefix (argv[idx_if_or_addr]->arg, &p); /* Given string is interface name. */ if (ret) ret = ripng_enable_network_delete (&p); else - ret = ripng_enable_if_delete (argv[2]->arg); + ret = ripng_enable_if_delete (argv[idx_if_or_addr]->arg); if (ret < 0) { - vty_out (vty, "can't find network %s%s", argv[2]->arg, + vty_out (vty, "can't find network %s%s", argv[idx_if_or_addr]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1073,7 +1075,8 @@ DEFUN (ripng_passive_interface, "Suppress routing updates on an interface\n" "Interface name\n") { - return ripng_passive_interface_set (vty, argv[1]->arg); + int idx_ifname = 1; + return ripng_passive_interface_set (vty, argv[idx_ifname]->arg); } DEFUN (no_ripng_passive_interface, @@ -1083,7 +1086,8 @@ DEFUN (no_ripng_passive_interface, "Suppress routing updates on an interface\n" "Interface name\n") { - return ripng_passive_interface_unset (vty, argv[2]->arg); + int idx_ifname = 2; + return ripng_passive_interface_unset (vty, argv[idx_ifname]->arg); } static struct ripng_interface * diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 46ca818c46..dcddf96ebf 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -297,7 +297,10 @@ DEFUN (ripng_offset_list, "For outgoing updates\n" "Metric value\n") { - return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL); + int idx_word = 1; + int idx_in_out = 2; + int idx_number = 3; + return ripng_offset_list_set (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, NULL); } DEFUN (ripng_offset_list_ifname, @@ -310,7 +313,11 @@ DEFUN (ripng_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); + int idx_word = 1; + int idx_in_out = 2; + int idx_number = 3; + int idx_ifname = 4; + return ripng_offset_list_set (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, argv[idx_ifname]->arg); } DEFUN (no_ripng_offset_list, @@ -323,7 +330,10 @@ DEFUN (no_ripng_offset_list, "For outgoing updates\n" "Metric value\n") { - return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); + int idx_word = 2; + int idx_in_out = 3; + int idx_number = 4; + return ripng_offset_list_unset (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_ripng_offset_list_ifname, @@ -337,7 +347,11 @@ DEFUN (no_ripng_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + int idx_word = 2; + int idx_in_out = 3; + int idx_number = 4; + int idx_ifname = 5; + return ripng_offset_list_unset (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, argv[idx_ifname]->arg); } static int diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 0910f94a77..9e2c35b38e 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -507,7 +507,8 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return ripng_route_match_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return ripng_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); } /* @@ -537,7 +538,8 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return ripng_route_match_add (vty, vty->index, "interface", argv[2]->arg); + int idx_word = 2; + return ripng_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } /* @@ -567,7 +569,8 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return ripng_route_match_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return ripng_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* @@ -599,7 +602,8 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return ripng_route_set_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return ripng_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } /* @@ -631,10 +635,11 @@ DEFUN (set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { + int idx_ipv6 = 4; union sockunion su; int ret; - ret = str2sockunion (argv[4]->arg, &su); + ret = str2sockunion (argv[idx_ipv6]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop local address%s", VTY_NEWLINE); @@ -647,7 +652,7 @@ DEFUN (set_ipv6_nexthop_local, return CMD_WARNING; } - return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg); + return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); } /* @@ -681,7 +686,8 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return ripng_route_set_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return ripng_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index e455211954..a6dc20072d 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -400,15 +400,17 @@ DEFUN (ripng_redistribute_type_metric, "Metric\n" "Metric value\n") { + int idx_protocol = 1; + int idx_number = 3; int type; int metric; - metric = atoi (argv[3]->arg); - type = proto_redistnum(AFI_IP6, argv[1]->arg); + metric = atoi (argv[idx_number]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -427,17 +429,19 @@ DEFUN (ripng_redistribute_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_word = 3; int type; - type = proto_redistnum(AFI_IP6, argv[1]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; } - ripng_redistribute_routemap_set (type, argv[3]->arg); + ripng_redistribute_routemap_set (type, argv[idx_word]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; @@ -454,20 +458,23 @@ DEFUN (ripng_redistribute_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_number = 3; + int idx_word = 5; int type; int metric; - type = proto_redistnum(AFI_IP6, argv[1]->arg); - metric = atoi (argv[3]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); + metric = atoi (argv[idx_number]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; } ripng_redistribute_metric_set (type, metric); - ripng_redistribute_routemap_set (type, argv[5]->arg); + ripng_redistribute_routemap_set (type, argv[idx_word]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 5e53d44b69..d3944c1c70 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2261,11 +2261,12 @@ DEFUN (ripng_route, "Static route setup\n" "Set static RIPng route announcement\n") { + int idx_ipv6addr = 1; int ret; struct prefix_ipv6 p; struct route_node *rp; - ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2294,11 +2295,12 @@ DEFUN (no_ripng_route, "Static route setup\n" "Delete static RIPng route announcement\n") { + int idx_ipv6addr = 2; int ret; struct prefix_ipv6 p; struct route_node *rp; - ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2328,11 +2330,12 @@ DEFUN (ripng_aggregate_address, "Set aggregate RIPng route announcement\n" "Aggregate network\n") { + int idx_ipv6_prefixlen = 1; int ret; struct prefix p; struct route_node *node; - ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p); + ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *)&p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2361,11 +2364,12 @@ DEFUN (no_ripng_aggregate_address, "Delete aggregate RIPng route announcement\n" "Aggregate network") { + int idx_ipv6_prefixlen = 2; int ret; struct prefix p; struct route_node *rn; - ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *) &p); + ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *) &p); if (ret <= 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -2393,9 +2397,10 @@ DEFUN (ripng_default_metric, "Set a metric of redistribute routes\n" "Default metric\n") { + int idx_number = 1; if (ripng) { - ripng->default_metric = atoi (argv[1]->arg); + ripng->default_metric = atoi (argv[idx_number]->arg); } return CMD_SUCCESS; } @@ -2535,13 +2540,16 @@ DEFUN (ripng_timers, "Routing information timeout timer. Default is 180.\n" "Garbage collection timer. Default is 120.\n") { + int idx_number = 2; + int idx_number_2 = 3; + int idx_number_3 = 4; unsigned long update; unsigned long timeout; unsigned long garbage; - VTY_GET_INTEGER_RANGE("update timer", update, argv[2]->arg, 0, 65535); - VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[3]->arg, 0, 65535); - VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[4]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE("update timer", update, argv[idx_number]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[idx_number_2]->arg, 0, 65535); + VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[idx_number_3]->arg, 0, 65535); /* Set each timer value. */ ripng->update_time = update; From 80fa0c69e86e8bbb81e6459c70bdfe1a622795c8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 20:06:40 +0000 Subject: [PATCH 129/280] ripd: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- ripd/rip_debug.c | 10 ++++--- ripd/rip_interface.c | 49 +++++++++++++++++++++-------------- ripd/rip_offset.c | 22 +++++++++++++--- ripd/rip_routemap.c | 32 +++++++++++++++-------- ripd/rip_zebra.c | 56 +++++++++++++++++++++++++--------------- ripd/ripd.c | 48 +++++++++++++++++++++++----------- tools/argv_translator.py | 9 ++++--- 7 files changed, 149 insertions(+), 77 deletions(-) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index 3566d28ffa..fbf2262b8c 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -97,10 +97,11 @@ DEFUN (debug_rip_packet_direct, "RIP receive packet\n" "RIP send packet\n") { + int idx_recv_send = 3; rip_debug_packet |= RIP_DEBUG_PACKET; - if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_SEND; - if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0) + if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) rip_debug_packet |= RIP_DEBUG_RECV; return CMD_SUCCESS; } @@ -150,14 +151,15 @@ DEFUN (no_debug_rip_packet_direct, "RIP option set for receive packet\n" "RIP option set for send packet\n") { - if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0) + int idx_recv_send = 4; + if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) { if (IS_RIP_DEBUG_RECV) rip_debug_packet &= ~RIP_DEBUG_SEND; else rip_debug_packet = 0; } - else if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0) + else if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) { if (IS_RIP_DEBUG_SEND) rip_debug_packet &= ~RIP_DEBUG_RECV; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 4ad750304e..036edeac8b 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1225,19 +1225,20 @@ DEFUN (rip_network, "IP prefix /, e.g., 35.0.0.0/8\n" "Interface name\n") { + int idx_ipv4_word = 1; int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[1]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_word]->arg, &p); if (ret) ret = rip_enable_network_add ((struct prefix *) &p); else - ret = rip_enable_if_add (argv[1]->arg); + ret = rip_enable_if_add (argv[idx_ipv4_word]->arg); if (ret < 0) { - vty_out (vty, "There is a same network configuration %s%s", argv[1]->arg, + vty_out (vty, "There is a same network configuration %s%s", argv[idx_ipv4_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1254,19 +1255,20 @@ DEFUN (no_rip_network, "IP prefix /, e.g., 35.0.0.0/8\n" "Interface name\n") { + int idx_ipv4_word = 2; int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[2]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_word]->arg, &p); if (ret) ret = rip_enable_network_delete ((struct prefix *) &p); else - ret = rip_enable_if_delete (argv[2]->arg); + ret = rip_enable_if_delete (argv[idx_ipv4_word]->arg); if (ret < 0) { - vty_out (vty, "Can't find network configuration %s%s", argv[2]->arg, + vty_out (vty, "Can't find network configuration %s%s", argv[idx_ipv4_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1281,10 +1283,11 @@ DEFUN (rip_neighbor, "Specify a neighbor router\n" "Neighbor address\n") { + int idx_ipv4 = 1; int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[1]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p); if (ret <= 0) { @@ -1305,10 +1308,11 @@ DEFUN (no_rip_neighbor, "Specify a neighbor router\n" "Neighbor address\n") { + int idx_ipv4 = 2; int ret; struct prefix_ipv4 p; - ret = str2prefix_ipv4 (argv[2]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p); if (ret <= 0) { @@ -1331,6 +1335,7 @@ DEFUN (ip_rip_receive_version, "RIP version 1\n" "RIP version 2\n") { + int idx_type = 4; struct interface *ifp; struct rip_interface *ri; @@ -1338,12 +1343,12 @@ DEFUN (ip_rip_receive_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[4]->arg) == 1) + if (atoi (argv[idx_type]->arg) == 1) { ri->ri_receive = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[4]->arg) == 2) + if (atoi (argv[idx_type]->arg) == 2) { ri->ri_receive = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1435,6 +1440,7 @@ DEFUN (ip_rip_send_version, "RIP version 1\n" "RIP version 2\n") { + int idx_type = 4; struct interface *ifp; struct rip_interface *ri; @@ -1442,12 +1448,12 @@ DEFUN (ip_rip_send_version, ri = ifp->info; /* Version 1. */ - if (atoi (argv[4]->arg) == 1) + if (atoi (argv[idx_type]->arg) == 1) { ri->ri_send = RI_RIP_VERSION_1; return CMD_SUCCESS; } - if (atoi (argv[4]->arg) == 2) + if (atoi (argv[idx_type]->arg) == 2) { ri->ri_send = RI_RIP_VERSION_2; return CMD_SUCCESS; @@ -1553,6 +1559,7 @@ DEFUN (ip_rip_authentication_mode, "Keyed message digest\n" "Clear text authentication\n") { + int idx_encryption = 4; struct interface *ifp; struct rip_interface *ri; int auth_type; @@ -1566,9 +1573,9 @@ DEFUN (ip_rip_authentication_mode, return CMD_WARNING; } - if (strncmp ("md5", argv[4]->arg, strlen (argv[4]->arg)) == 0) + if (strncmp ("md5", argv[idx_encryption]->arg, strlen (argv[idx_encryption]->arg)) == 0) auth_type = RIP_AUTH_MD5; - else if (strncmp ("text", argv[4]->arg, strlen (argv[4]->arg)) == 0) + else if (strncmp ("text", argv[idx_encryption]->arg, strlen (argv[idx_encryption]->arg)) == 0) auth_type = RIP_AUTH_SIMPLE_PASSWORD; else { @@ -1657,13 +1664,14 @@ DEFUN (ip_rip_authentication_string, "Authentication string\n" "Authentication string\n") { + int idx_line = 4; struct interface *ifp; struct rip_interface *ri; ifp = (struct interface *)vty->index; ri = ifp->info; - if (strlen (argv[4]->arg) > 16) + if (strlen (argv[idx_line]->arg) > 16) { vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s", VTY_NEWLINE); @@ -1679,7 +1687,7 @@ DEFUN (ip_rip_authentication_string, if (ri->auth_str) free (ri->auth_str); - ri->auth_str = strdup (argv[4]->arg); + ri->auth_str = strdup (argv[idx_line]->arg); return CMD_SUCCESS; } @@ -1728,6 +1736,7 @@ DEFUN (ip_rip_authentication_key_chain, "Authentication key-chain\n" "name of key-chain\n") { + int idx_line = 4; struct interface *ifp; struct rip_interface *ri; @@ -1744,7 +1753,7 @@ DEFUN (ip_rip_authentication_key_chain, if (ri->key_chain) free (ri->key_chain); - ri->key_chain = strdup (argv[4]->arg); + ri->key_chain = strdup (argv[idx_line]->arg); return CMD_SUCCESS; } @@ -1878,7 +1887,8 @@ DEFUN (rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[1]->arg; + int idx_ifname = 1; + const char *ifname = argv[idx_ifname]->arg; if (!strcmp(ifname,"default")) { passive_default = 1; @@ -1899,7 +1909,8 @@ DEFUN (no_rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - const char *ifname = argv[2]->arg; + int idx_ifname = 2; + const char *ifname = argv[idx_ifname]->arg; if (!strcmp(ifname,"default")) { passive_default = 0; diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index f57c6684e4..5e0e71579a 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -289,7 +289,10 @@ DEFUN (rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL); + int idx_word = 1; + int idx_in_out = 2; + int idx_number = 3; + return rip_offset_list_set (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, NULL); } DEFUN (rip_offset_list_ifname, @@ -302,7 +305,11 @@ DEFUN (rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg); + int idx_word = 1; + int idx_in_out = 2; + int idx_number = 3; + int idx_ifname = 4; + return rip_offset_list_set (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, argv[idx_ifname]->arg); } DEFUN (no_rip_offset_list, @@ -315,7 +322,10 @@ DEFUN (no_rip_offset_list, "For outgoing updates\n" "Metric value\n") { - return rip_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL); + int idx_word = 2; + int idx_in_out = 3; + int idx_number = 4; + return rip_offset_list_unset (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_rip_offset_list_ifname, @@ -329,7 +339,11 @@ DEFUN (no_rip_offset_list_ifname, "Metric value\n" "Interface to match\n") { - return rip_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg); + int idx_word = 2; + int idx_in_out = 3; + int idx_number = 4; + int idx_ifname = 5; + return rip_offset_list_unset (vty, argv[idx_word]->arg, argv[idx_in_out]->arg, argv[idx_number]->arg, argv[idx_ifname]->arg); } static int diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 35e869172c..e16f2d941b 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -742,7 +742,8 @@ DEFUN (match_metric, "Match metric of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return rip_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); } /* @@ -772,7 +773,8 @@ DEFUN (match_interface, "Match first hop interface of route\n" "Interface name\n") { - return rip_route_match_add (vty, vty->index, "interface", argv[2]->arg); + int idx_word = 2; + return rip_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } /* @@ -805,7 +807,8 @@ DEFUN (match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop", argv[3]->arg); + int idx_acl = 3; + return rip_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg); } /* @@ -841,7 +844,8 @@ DEFUN (match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[4]->arg); + int idx_word = 4; + return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[idx_word]->arg); } /* @@ -879,7 +883,8 @@ DEFUN (match_ip_address, "IP Access-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address", argv[3]->arg); + int idx_acl = 3; + return rip_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); } /* @@ -915,7 +920,8 @@ DEFUN (match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[4]->arg); + int idx_word = 4; + return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } /* @@ -949,7 +955,8 @@ DEFUN (match_tag, "Match tag of route\n" "Metric value\n") { - return rip_route_match_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return rip_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* @@ -989,7 +996,8 @@ DEFUN (set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - return rip_route_set_add (vty, vty->index, "metric", argv[2]->arg); + int idx_number = 2; + return rip_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } @@ -1028,10 +1036,11 @@ DEFUN (set_ip_nexthop, "Next hop address\n" "IP address of next hop\n") { + int idx_ipv4 = 3; union sockunion su; int ret; - ret = str2sockunion (argv[3]->arg, &su); + ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE); @@ -1045,7 +1054,7 @@ DEFUN (set_ip_nexthop, return CMD_WARNING; } - return rip_route_set_add (vty, vty->index, "ip next-hop", argv[3]->arg); + return rip_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); } /* @@ -1077,7 +1086,8 @@ DEFUN (set_tag, "Tag value for routing protocol\n" "Tag value\n") { - return rip_route_set_add (vty, vty->index, "tag", argv[2]->arg); + int idx_number = 2; + return rip_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } /* diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 56f4623f3f..3596938bbf 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -417,20 +417,22 @@ DEFUN (rip_redistribute_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_word = 3; int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[1]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { - rip_routemap_set (redist_type[i].type, argv[3]->arg); + rip_routemap_set (redist_type[i].type, argv[idx_word]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[1]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -445,21 +447,23 @@ DEFUN (no_rip_redistribute_type_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 2; + int idx_word = 4; int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[2]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { - if (rip_routemap_unset (redist_type[i].type,argv[4]->arg)) + if (rip_routemap_unset (redist_type[i].type,argv[idx_word]->arg)) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[2]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -473,13 +477,15 @@ DEFUN (rip_redistribute_type_metric, "Metric\n" "Metric value\n") { + int idx_protocol = 1; + int idx_number = 3; int i; int metric; - metric = atoi (argv[3]->arg); + metric = atoi (argv[idx_number]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[1]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); @@ -489,7 +495,7 @@ DEFUN (rip_redistribute_type_metric, } } - vty_out(vty, "Invalid type %s%s", argv[1]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -504,21 +510,23 @@ DEFUN (no_rip_redistribute_type_metric, "Metric\n" "Metric value\n") { + int idx_protocol = 2; + int idx_number = 4; int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[2]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[4]->arg))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[idx_number]->arg))) return CMD_WARNING; rip_redistribute_unset (redist_type[i].type); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[2]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -534,24 +542,27 @@ DEFUN (rip_redistribute_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 1; + int idx_number = 3; + int idx_word = 5; int i; int metric; - metric = atoi (argv[3]->arg); + metric = atoi (argv[idx_number]->arg); for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[1]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { rip_redistribute_metric_set (redist_type[i].type, metric); - rip_routemap_set (redist_type[i].type, argv[5]->arg); + rip_routemap_set (redist_type[i].type, argv[idx_word]->arg); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, redist_type[i].type, 0, VRF_DEFAULT); return CMD_SUCCESS; } } - vty_out(vty, "Invalid type %s%s", argv[1]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -569,18 +580,21 @@ DEFUN (no_rip_redistribute_type_metric_routemap, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_protocol = 2; + int idx_number = 4; + int idx_word = 6; int i; for (i = 0; redist_type[i].str; i++) { - if (strncmp(redist_type[i].str, argv[2]->arg, + if (strncmp(redist_type[i].str, argv[idx_protocol]->arg, redist_type[i].str_min_len) == 0) { - if (rip_metric_unset (redist_type[i].type, atoi(argv[4]->arg))) + if (rip_metric_unset (redist_type[i].type, atoi(argv[idx_number]->arg))) return CMD_WARNING; - if (rip_routemap_unset (redist_type[i].type, argv[6]->arg)) + if (rip_routemap_unset (redist_type[i].type, argv[idx_word]->arg)) { - rip_redistribute_metric_set(redist_type[i].type, atoi(argv[4]->arg)); + rip_redistribute_metric_set(redist_type[i].type, atoi(argv[idx_number]->arg)); return CMD_WARNING; } rip_redistribute_unset (redist_type[i].type); @@ -588,7 +602,7 @@ DEFUN (no_rip_redistribute_type_metric_routemap, } } - vty_out(vty, "Invalid type %s%s", argv[2]->arg, + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); return CMD_WARNING; diff --git a/ripd/ripd.c b/ripd/ripd.c index 9fa11ef9ab..a7f35de276 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2947,9 +2947,10 @@ DEFUN (rip_version, "Set routing protocol version\n" "version\n") { + int idx_number = 1; int version; - version = atoi (argv[1]->arg); + version = atoi (argv[idx_number]->arg); if (version != RIPv1 && version != RIPv2) { vty_out (vty, "invalid rip version %d%s", version, @@ -2960,7 +2961,7 @@ DEFUN (rip_version, rip->version_recv = version; return CMD_SUCCESS; -} +} /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -2981,7 +2982,7 @@ DEFUN (no_rip_version, rip->version_recv = RI_RIP_VERSION_1_AND_2; return CMD_SUCCESS; -} +} DEFUN (rip_route, @@ -2990,11 +2991,12 @@ DEFUN (rip_route, "RIP static route configuration\n" "IP prefix /\n") { + int idx_ipv4_prefixlen = 1; int ret; struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[1]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3026,11 +3028,12 @@ DEFUN (no_rip_route, "RIP static route configuration\n" "IP prefix /\n") { + int idx_ipv4_prefixlen = 2; int ret; struct prefix_ipv4 p; struct route_node *node; - ret = str2prefix_ipv4 (argv[2]->arg, &p); + ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p); if (ret < 0) { vty_out (vty, "Malformed address%s", VTY_NEWLINE); @@ -3042,7 +3045,7 @@ DEFUN (no_rip_route, node = route_node_lookup (rip->route, (struct prefix *) &p); if (! node) { - vty_out (vty, "Can't find route %s.%s", argv[2]->arg, + vty_out (vty, "Can't find route %s.%s", argv[idx_ipv4_prefixlen]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -3079,9 +3082,10 @@ DEFUN (rip_default_metric, "Set a metric of redistribute routes\n" "Default metric\n") { + int idx_number = 1; if (rip) { - rip->default_metric = atoi (argv[1]->arg); + rip->default_metric = atoi (argv[idx_number]->arg); /* rip_update_default_metric (); */ } return CMD_SUCCESS; @@ -3120,6 +3124,9 @@ DEFUN (rip_timers, "Routing information timeout timer. Default is 180.\n" "Garbage collection timer. Default is 120.\n") { + int idx_number = 2; + int idx_number_2 = 3; + int idx_number_3 = 4; unsigned long update; unsigned long timeout; unsigned long garbage; @@ -3127,21 +3134,21 @@ DEFUN (rip_timers, unsigned long RIP_TIMER_MAX = 2147483647; unsigned long RIP_TIMER_MIN = 5; - update = strtoul (argv[2]->arg, &endptr, 10); + update = strtoul (argv[idx_number]->arg, &endptr, 10); if (update > RIP_TIMER_MAX || update < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "update timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - timeout = strtoul (argv[3]->arg, &endptr, 10); + timeout = strtoul (argv[idx_number_2]->arg, &endptr, 10); if (timeout > RIP_TIMER_MAX || timeout < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "timeout timer value error%s", VTY_NEWLINE); return CMD_WARNING; } - garbage = strtoul (argv[4]->arg, &endptr, 10); + garbage = strtoul (argv[idx_number_3]->arg, &endptr, 10); if (garbage > RIP_TIMER_MAX || garbage < RIP_TIMER_MIN || *endptr != '\0') { vty_out (vty, "garbage timer value error%s", VTY_NEWLINE); @@ -3392,7 +3399,8 @@ DEFUN (rip_distance, "Administrative distance\n" "Distance value\n") { - rip->distance = atoi (argv[1]->arg); + int idx_number = 1; + rip->distance = atoi (argv[idx_number]->arg); return CMD_SUCCESS; } @@ -3414,7 +3422,9 @@ DEFUN (rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_set (vty, argv[1]->arg, argv[2]->arg, NULL); + int idx_number = 1; + int idx_ipv4_prefixlen = 2; + rip_distance_set (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -3426,7 +3436,9 @@ DEFUN (no_rip_distance_source, "Distance value\n" "IP source prefix\n") { - rip_distance_unset (vty, argv[2]->arg, argv[3]->arg, NULL); + int idx_number = 2; + int idx_ipv4_prefixlen = 3; + rip_distance_unset (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); return CMD_SUCCESS; } @@ -3438,7 +3450,10 @@ DEFUN (rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg); + int idx_number = 1; + int idx_ipv4_prefixlen = 2; + int idx_word = 3; + rip_distance_set (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -3451,7 +3466,10 @@ DEFUN (no_rip_distance_source_access_list, "IP source prefix\n" "Access list name\n") { - rip_distance_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg); + int idx_number = 2; + int idx_ipv4_prefixlen = 3; + int idx_word = 4; + rip_distance_unset (vty, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); return CMD_SUCCESS; } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index c874e0e4bb..b637cf69f9 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -292,10 +292,10 @@ def get_token_index_variable_name(line_number, token): elif token == 'both|send|receive' or token == 'send|recv': return 'idx_send_recv' - elif token == 'both|extended|standard': + elif token == 'both|extended|standard' or token == '1|2': return 'idx_type' - elif token == 'A.B.C.D|WORD': + elif token == 'A.B.C.D|WORD' or token == 'A.B.C.D/M|WORD': return 'idx_ipv4_word' elif token == 'advertise-queue|advertised-routes|packet-queue': @@ -316,9 +316,12 @@ def get_token_index_variable_name(line_number, token): elif token == 'ipv4|ipv6' or token == 'ip|ipv6': return 'idx_afi' - elif token == 'md5|clear' or token == 'null|message-digest': + elif token == 'md5|clear' or token == 'null|message-digest' or token == 'md5|text': return 'idx_encryption' + elif token == 'IFNAME|default': + return 'idx_ifname' + elif token == 'type-1|type-2': return 'idx_external' From f667a580b74670ceccfcbe33b9f6d76c74265dd6 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 23 Sep 2016 20:08:47 +0000 Subject: [PATCH 130/280] 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 --- lib/command.c | 17 +++++++++------ lib/filter.c | 58 ++++++++++++++++++++++++++++--------------------- lib/routemap.c | 59 ++++++++++++++++++++++---------------------------- lib/vty.c | 19 +++++++++------- 4 files changed, 80 insertions(+), 73 deletions(-) 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); From c349116d7ca8acd51b7fe596a269dc5839af0abd Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 20:17:29 +0000 Subject: [PATCH 131/280] lib: add 'int idx_foo' argv index variables Signed-off-by: Daniel Walton --- lib/command.c | 62 +++--- lib/filter.c | 268 ++++++++++++++++++------ lib/if.c | 9 +- lib/if_rmap.c | 22 +- lib/keychain.c | 181 ++++++++++++---- lib/ns.c | 12 +- lib/plist.c | 434 +++++++++++++++++++++++++++++---------- lib/routemap.c | 30 ++- lib/smux.c | 6 +- lib/thread.c | 14 +- lib/vty.c | 19 +- tools/argv_translator.py | 21 ++ 12 files changed, 806 insertions(+), 272 deletions(-) diff --git a/lib/command.c b/lib/command.c index d3b3f3a2b5..f18338589b 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1148,6 +1148,7 @@ DEFUN (config_write, "Write configuration currently in memory\n" "Write configuration to terminal\n") { + int idx_type = 1; unsigned int i; int fd; struct cmd_node *node; @@ -1159,8 +1160,8 @@ DEFUN (config_write, struct stat conf_stat; // if command was 'write terminal' or 'show running-config' - if (argc == 2 && (!strcmp(argv[1]->arg, "terminal") || - !strcmp(argv[1]->arg, "running-config"))) + if (argc == 2 && (!strcmp(argv[idx_type]->arg, "terminal") || + !strcmp(argv[idx_type]->arg, "running-config"))) { if (vty->type == VTY_SHELL_SERV) { @@ -1364,6 +1365,8 @@ DEFUN (config_password, "Specifies a HIDDEN password will follow\n" "The password string\n") { + int idx_8 = 1; + int idx_word = 2; if (argc == 3) // '8' was specified { if (host.password) @@ -1371,11 +1374,11 @@ DEFUN (config_password, host.password = NULL; if (host.password_encrypt) XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[2]->arg); + host.password_encrypt = XSTRDUP (MTYPE_HOST, argv[idx_word]->arg); return CMD_SUCCESS; } - if (!isalnum (argv[1]->arg[0])) + if (!isalnum (argv[idx_8]->arg[0])) { vty_out (vty, "Please specify string starting with alphanumeric%s", VTY_NEWLINE); @@ -1390,10 +1393,10 @@ DEFUN (config_password, { if (host.password_encrypt) XFREE (MTYPE_HOST, host.password_encrypt); - host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[1]->arg)); + host.password_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[idx_8]->arg)); } else - host.password = XSTRDUP (MTYPE_HOST, argv[1]->arg); + host.password = XSTRDUP (MTYPE_HOST, argv[idx_8]->arg); return CMD_SUCCESS; } @@ -1408,10 +1411,12 @@ DEFUN (config_enable_password, "dummy string \n" "The HIDDEN 'enable' password string\n") { + int idx_8 = 2; + int idx_word = 3; /* Crypt type is specified. */ if (argc == 4) { - if (argv[2]->arg[0] == '8') + if (argv[idx_8]->arg[0] == '8') { if (host.enable) XFREE (MTYPE_HOST, host.enable); @@ -1419,7 +1424,7 @@ DEFUN (config_enable_password, if (host.enable_encrypt) XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[3]->arg); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -1430,7 +1435,7 @@ DEFUN (config_enable_password, } } - if (!isalnum (argv[2]->arg[0])) + if (!isalnum (argv[idx_8]->arg[0])) { vty_out (vty, "Please specify string starting with alphanumeric%s", VTY_NEWLINE); @@ -1446,10 +1451,10 @@ DEFUN (config_enable_password, { if (host.enable_encrypt) XFREE (MTYPE_HOST, host.enable_encrypt); - host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[2]->arg)); + host.enable_encrypt = XSTRDUP (MTYPE_HOST, zencrypt (argv[idx_8]->arg)); } else - host.enable = XSTRDUP (MTYPE_HOST, argv[2]->arg); + host.enable = XSTRDUP (MTYPE_HOST, argv[idx_8]->arg); return CMD_SUCCESS; } @@ -1530,10 +1535,11 @@ DEFUN (config_terminal_length, "Set number of lines on a screen\n" "Number of lines on screen (0 for no pausing)\n") { + int idx_number = 2; int lines; char *endptr = NULL; - lines = strtol (argv[2]->arg, &endptr, 10); + lines = strtol (argv[idx_number]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -1562,10 +1568,11 @@ DEFUN (service_terminal_length, "System wide terminal length configuration\n" "Number of lines of VTY (0 means no line control)\n") { + int idx_number = 2; int lines; char *endptr = NULL; - lines = strtol (argv[2]->arg, &endptr, 10); + lines = strtol (argv[idx_number]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -1610,10 +1617,11 @@ DEFUN (config_logmsg, LOG_LEVEL_DESC "The message to send\n") { + int idx_log_level = 1; int level; char *message; - if ((level = level_match(argv[1]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); @@ -1682,6 +1690,7 @@ DEFUN (config_log_stdout, "Set stdout logging level\n" LOG_LEVEL_DESC) { + int idx_log_level = 2; if (argc == 2) { zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); @@ -1689,7 +1698,7 @@ DEFUN (config_log_stdout, } int level; - if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_STDOUT, level); return CMD_SUCCESS; @@ -1714,6 +1723,7 @@ DEFUN (config_log_monitor, "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { + int idx_log_level = 2; if (argc == 2) { zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); @@ -1721,7 +1731,7 @@ DEFUN (config_log_monitor, } int level; - if ((level = level_match(argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_MONITOR, level); return CMD_SUCCESS; @@ -1801,15 +1811,17 @@ DEFUN (config_log_file, "Logging filename\n" LOG_LEVEL_DESC) { + int idx_filename = 2; + int idx_log_levels = 3; if (argc == 4) { int level; - if ((level = level_match(argv[3]->arg)) == ZLOG_DISABLED) + if ((level = level_match(argv[idx_log_levels]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; - return set_log_file(vty, argv[2]->arg, level); + return set_log_file(vty, argv[idx_filename]->arg, level); } else - return set_log_file(vty, argv[2]->arg, zlog_default->default_lvl); + return set_log_file(vty, argv[idx_filename]->arg, zlog_default->default_lvl); } DEFUN (no_config_log_file, @@ -1839,10 +1851,11 @@ DEFUN (config_log_syslog, "Set syslog logging level\n" LOG_LEVEL_DESC) { + int idx_log_levels = 2; if (argc == 3) { int level; - if ((level = level_match (argv[2]->arg)) == ZLOG_DISABLED) + if ((level = level_match (argv[idx_log_levels]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; zlog_set_level (NULL, ZLOG_DEST_SYSLOG, level); return CMD_SUCCESS; @@ -1889,7 +1902,8 @@ DEFUN (config_log_facility, "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) { - int facility = facility_match(argv[2]->arg); + int idx_target = 2; + int facility = facility_match(argv[idx_target]->arg); zlog_default->facility = facility; return CMD_SUCCESS; @@ -1968,8 +1982,9 @@ DEFUN (config_log_timestamp_precision, "Set the timestamp precision\n" "Number of subsecond digits\n") { + int idx_number = 3; VTY_GET_INTEGER_RANGE("Timestamp Precision", - zlog_default->timestamp_precision, argv[3]->arg, 0, 6); + zlog_default->timestamp_precision, argv[idx_number]->arg, 0, 6); return CMD_SUCCESS; } @@ -2017,7 +2032,8 @@ DEFUN (banner_motd_file, "Banner from a file\n" "Filename\n") { - const char *filename = argv[3]->arg; + int idx_file = 3; + const char *filename = argv[idx_file]->arg; int cmd = cmd_banner_motd_file (filename); if (cmd == CMD_ERR_NO_FILE) diff --git a/lib/filter.c b/lib/filter.c index 52d6d956d9..40bf0a3395 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -713,7 +713,11 @@ DEFUN (access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, 0, 1); } @@ -727,7 +731,10 @@ DEFUN (access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -742,7 +749,10 @@ DEFUN (access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 1); } @@ -756,7 +766,9 @@ DEFUN (access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 1); } @@ -772,7 +784,11 @@ DEFUN (no_access_list_standard, "Address to match\n" "Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, 0, 0); } @@ -787,7 +803,10 @@ DEFUN (no_access_list_standard_nomask, "Specify packets to forward\n" "Address to match\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 4; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -803,7 +822,10 @@ DEFUN (no_access_list_standard_host, "A single host address\n" "Address to match\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", NULL, NULL, 0, 0); } @@ -818,7 +840,9 @@ DEFUN (no_access_list_standard_any, "Specify packets to forward\n" "Any source host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", NULL, NULL, 0, 0); } @@ -837,8 +861,14 @@ DEFUN (access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, 1 ,1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + int idx_ipv4_3 = 6; + int idx_ipv4_4 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, argv[idx_ipv4_4]->arg, 1 ,1); } DEFUN (access_list_extended_mask_any, @@ -854,8 +884,12 @@ DEFUN (access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, "0.0.0.0", "255.255.255.255", 1, 1); } @@ -872,9 +906,13 @@ DEFUN (access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", - "255.255.255.255", argv[5]->arg, - argv[6]->arg, 1, 1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, 1, 1); } DEFUN (access_list_extended_any_any, @@ -889,7 +927,9 @@ DEFUN (access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", + int idx_acl = 1; + int idx_permit_deny = 2; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -908,8 +948,13 @@ DEFUN (access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 4; + int idx_ipv4_2 = 5; + int idx_ipv4_3 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, "0.0.0.0", 1, 1); } @@ -927,9 +972,14 @@ DEFUN (access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, - "0.0.0.0", argv[6]->arg, - argv[7]->arg, 1, 1); + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, + argv[idx_ipv4_3]->arg, 1, 1); } DEFUN (access_list_extended_host_host, @@ -946,8 +996,12 @@ DEFUN (access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, - "0.0.0.0", argv[7]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + int idx_ipv4_2 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, "0.0.0.0", 1, 1); } @@ -964,8 +1018,11 @@ DEFUN (access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, "0.0.0.0", - "255.255.255.255", argv[6]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, "0.0.0.0", 1, 1); } @@ -982,7 +1039,10 @@ DEFUN (access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[1]->arg, argv[2]->arg, argv[5]->arg, + int idx_acl = 1; + int idx_permit_deny = 2; + int idx_ipv4 = 5; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 1); } @@ -1002,8 +1062,14 @@ DEFUN (no_access_list_extended, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, argv[7]->arg, argv[8]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 7; + int idx_ipv4_4 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, argv[idx_ipv4_4]->arg, 1, 0); } DEFUN (no_access_list_extended_mask_any, @@ -1020,8 +1086,12 @@ DEFUN (no_access_list_extended_mask_any, "Source wildcard bits\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1039,9 +1109,13 @@ DEFUN (no_access_list_extended_any_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", - "255.255.255.255", argv[6]->arg, - argv[7]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, 1, 0); } DEFUN (no_access_list_extended_any_any, @@ -1057,7 +1131,9 @@ DEFUN (no_access_list_extended_any_any, "Any source host\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", + int idx_acl = 2; + int idx_permit_deny = 3; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", "255.255.255.255", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1077,8 +1153,13 @@ DEFUN (no_access_list_extended_mask_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 5; + int idx_ipv4_2 = 6; + int idx_ipv4_3 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, argv[idx_ipv4_3]->arg, "0.0.0.0", 1, 0); } @@ -1097,9 +1178,14 @@ DEFUN (no_access_list_extended_host_mask, "Destination address\n" "Destination Wildcard bits\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, - "0.0.0.0", argv[7]->arg, - argv[8]->arg, 1, 0); + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 7; + int idx_ipv4_3 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, + argv[idx_ipv4_3]->arg, 1, 0); } DEFUN (no_access_list_extended_host_host, @@ -1117,8 +1203,12 @@ DEFUN (no_access_list_extended_host_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, - "0.0.0.0", argv[8]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + int idx_ipv4_2 = 8; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, + "0.0.0.0", argv[idx_ipv4_2]->arg, "0.0.0.0", 1, 0); } @@ -1136,8 +1226,11 @@ DEFUN (no_access_list_extended_any_host, "A single destination host\n" "Destination address\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, "0.0.0.0", - "255.255.255.255", argv[7]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 7; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, "0.0.0.0", + "255.255.255.255", argv[idx_ipv4]->arg, "0.0.0.0", 1, 0); } @@ -1155,7 +1248,10 @@ DEFUN (no_access_list_extended_host_any, "Source address\n" "Any destination host\n") { - return filter_set_cisco (vty, argv[2]->arg, argv[3]->arg, argv[6]->arg, + int idx_acl = 2; + int idx_permit_deny = 3; + int idx_ipv4 = 6; + return filter_set_cisco (vty, argv[idx_acl]->arg, argv[idx_permit_deny]->arg, argv[idx_ipv4]->arg, "0.0.0.0", "0.0.0.0", "255.255.255.255", 1, 0); } @@ -1251,7 +1347,10 @@ DEFUN (access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 0, 1); + int idx_word = 1; + int idx_permit_deny = 2; + int idx_ipv4_prefixlen = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 0, 1); } DEFUN (access_list_exact, @@ -1264,7 +1363,10 @@ DEFUN (access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, argv[3]->arg, 1, 1); + int idx_word = 1; + int idx_permit_deny = 2; + int idx_ipv4_prefixlen = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 1, 1); } DEFUN (access_list_any, @@ -1276,7 +1378,9 @@ DEFUN (access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[1]->arg, argv[2]->arg, AFI_IP, "0.0.0.0/0", 0, 1); + int idx_word = 1; + int idx_permit_deny = 2; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, "0.0.0.0/0", 0, 1); } DEFUN (no_access_list, @@ -1289,7 +1393,10 @@ DEFUN (no_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 0, 0); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 0, 0); } DEFUN (no_access_list_exact, @@ -1303,7 +1410,10 @@ DEFUN (no_access_list_exact, "Prefix to match. e.g. 10.0.0.0/8\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, argv[4]->arg, 1, 0); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, argv[idx_ipv4_prefixlen]->arg, 1, 0); } DEFUN (no_access_list_any, @@ -1316,7 +1426,9 @@ DEFUN (no_access_list_any, "Specify packets to forward\n" "Prefix to match. e.g. 10.0.0.0/8\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP, "0.0.0.0/0", 0, 0); + int idx_word = 2; + int idx_permit_deny = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP, "0.0.0.0/0", 0, 0); } DEFUN (no_access_list_all, @@ -1330,14 +1442,15 @@ DEFUN (no_access_list_all, "IP extended access list (expanded range)\n" "IP zebra access-list name\n") { + int idx_acl = 2; struct access_list *access; struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP, argv[2]->arg); + access = access_list_lookup (AFI_IP, argv[idx_acl]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[2]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_acl]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1367,9 +1480,10 @@ DEFUN (access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + int idx_acl = 1; struct access_list *access; - access = access_list_get (AFI_IP, argv[1]->arg); + access = access_list_get (AFI_IP, argv[idx_acl]->arg); if (access->remark) { @@ -1393,7 +1507,8 @@ DEFUN (no_access_list_remark, "IP zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP, argv[2]->arg); + int idx_acl = 2; + return vty_access_list_remark_unset (vty, AFI_IP, argv[idx_acl]->arg); } /* ALIAS_FIXME */ @@ -1425,7 +1540,10 @@ DEFUN (ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 0, 1); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1439,7 +1557,10 @@ DEFUN (ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, argv[4]->arg, 1, 1); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 1, 1); } DEFUN (ipv6_access_list_any, @@ -1452,7 +1573,9 @@ DEFUN (ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[2]->arg, argv[3]->arg, AFI_IP6, "::/0", 0, 1); + int idx_word = 2; + int idx_permit_deny = 3; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, "::/0", 0, 1); } DEFUN (no_ipv6_access_list, @@ -1466,7 +1589,10 @@ DEFUN (no_ipv6_access_list, "Specify packets to forward\n" "Prefix to match. e.g. 3ffe:506::/32\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 0, 0); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 0, 0); } DEFUN (no_ipv6_access_list_exact, @@ -1481,7 +1607,10 @@ DEFUN (no_ipv6_access_list_exact, "Prefix to match. e.g. 3ffe:506::/32\n" "Exact match of the prefixes\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, argv[5]->arg, 1, 0); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 1, 0); } DEFUN (no_ipv6_access_list_any, @@ -1495,7 +1624,9 @@ DEFUN (no_ipv6_access_list_any, "Specify packets to forward\n" "Any prefixi to match\n") { - return filter_set_zebra (vty, argv[3]->arg, argv[4]->arg, AFI_IP6, "::/0", 0, 0); + int idx_word = 3; + int idx_permit_deny = 4; + return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, "::/0", 0, 0); } @@ -1507,14 +1638,15 @@ DEFUN (no_ipv6_access_list_all, "Add an access list entry\n" "IPv6 zebra access-list\n") { + int idx_word = 3; struct access_list *access; struct access_master *master; /* Looking up access_list. */ - access = access_list_lookup (AFI_IP6, argv[3]->arg); + access = access_list_lookup (AFI_IP6, argv[idx_word]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[3]->arg, + vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -1541,9 +1673,10 @@ DEFUN (ipv6_access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + int idx_word = 2; struct access_list *access; - access = access_list_get (AFI_IP6, argv[2]->arg); + access = access_list_get (AFI_IP6, argv[idx_word]->arg); if (access->remark) { @@ -1564,7 +1697,8 @@ DEFUN (no_ipv6_access_list_remark, "IPv6 zebra access-list\n" "Access list entry comment\n") { - return vty_access_list_remark_unset (vty, AFI_IP6, argv[3]->arg); + int idx_word = 3; + return vty_access_list_remark_unset (vty, AFI_IP6, argv[idx_word]->arg); } /* ALIAS_FIXME */ @@ -1715,7 +1849,8 @@ DEFUN (show_ip_access_list_name, "IP extended access list (expanded range)\n" "IP zebra access-list\n") { - return filter_show (vty, argv[3]->arg, AFI_IP); + int idx_acl = 3; + return filter_show (vty, argv[idx_acl]->arg, AFI_IP); } #ifdef HAVE_IPV6 @@ -1737,7 +1872,8 @@ DEFUN (show_ipv6_access_list_name, "List IPv6 access lists\n" "IPv6 zebra access-list\n") { - return filter_show (vty, argv[3]->arg, AFI_IP6); + int idx_word = 3; + return filter_show (vty, argv[idx_word]->arg, AFI_IP6); } #endif /* HAVE_IPV6 */ diff --git a/lib/if.c b/lib/if.c index c19b8d1f86..4c4b66cda5 100644 --- a/lib/if.c +++ b/lib/if.c @@ -755,7 +755,8 @@ DEFUN (interface, "Interface's name\n" VRF_CMD_HELP_STR) { - const char *ifname = argv[1]->arg; + int idx_ifname = 1; + const char *ifname = argv[idx_ifname]->arg; const char *vrfname = (argc > 2) ? argv[3]->arg : NULL; struct interface *ifp; @@ -836,7 +837,8 @@ DEFUN (vrf, "Select a VRF to configure\n" "VRF's name\n") { - const char *vrfname = argv[1]->arg; + int idx_name = 1; + const char *vrfname = argv[idx_name]->arg; struct vrf *vrfp; size_t sl; @@ -897,6 +899,7 @@ DEFUN (show_address, "address\n" VRF_CMD_HELP_STR) { + int idx_vrf_cmd_str = 2; struct listnode *node; struct listnode *node2; struct interface *ifp; @@ -905,7 +908,7 @@ DEFUN (show_address, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 2) - VRF_GET_ID (vrf_id, argv[2]->arg); + VRF_GET_ID (vrf_id, argv[idx_vrf_cmd_str]->arg); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { diff --git a/lib/if_rmap.c b/lib/if_rmap.c index abed32c9e3..070d55d4b6 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -228,11 +228,14 @@ DEFUN (if_rmap, "Route map set for output filtering\n" "Route map interface name\n") { + int idx_rmap_name = 1; + int idx_in_out = 2; + int idx_ifname = 3; enum if_rmap_type type; - if (strncmp (argv[2]->arg, "i", 1) == 0) + if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[2]->arg, "o", 1) == 0) + else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -240,10 +243,10 @@ DEFUN (if_rmap, return CMD_WARNING; } - if_rmap_set (argv[3]->arg, type, argv[1]->arg); + if_rmap_set (argv[idx_ifname]->arg, type, argv[idx_rmap_name]->arg); return CMD_SUCCESS; -} +} /* @@ -267,12 +270,15 @@ DEFUN (no_if_rmap, "Route map for output filtering\n" "Route map interface name\n") { + int idx_routemap_name = 2; + int idx_in_out = 3; + int idx_ifname = 4; int ret; enum if_rmap_type type; - if (strncmp (argv[3]->arg, "i", 1) == 0) + if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[3]->arg, "o", 1) == 0) + else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0) type = IF_RMAP_OUT; else { @@ -280,14 +286,14 @@ DEFUN (no_if_rmap, return CMD_WARNING; } - ret = if_rmap_unset (argv[4]->arg, type, argv[2]->arg); + ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg); if (! ret) { vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; -} +} /* Configuration write function. */ diff --git a/lib/keychain.c b/lib/keychain.c index 0796d81f1a..c2d6e45714 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -237,9 +237,10 @@ DEFUN (key_chain, "Key-chain management\n" "Key-chain name\n") { + int idx_word = 2; struct keychain *keychain; - keychain = keychain_get (argv[2]->arg); + keychain = keychain_get (argv[idx_word]->arg); vty->index = keychain; vty->node = KEYCHAIN_NODE; @@ -254,13 +255,14 @@ DEFUN (no_key_chain, "Key-chain management\n" "Key-chain name\n") { + int idx_word = 3; struct keychain *keychain; - keychain = keychain_lookup (argv[3]->arg); + keychain = keychain_lookup (argv[idx_word]->arg); if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out (vty, "Can't find keychain %s%s", argv[idx_word]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -275,13 +277,14 @@ DEFUN (key, "Configure a key\n" "Key identifier number\n") { + int idx_number = 1; struct keychain *keychain; struct key *key; u_int32_t index; keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[1]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_get (keychain, index); vty->index_sub = key; vty->node = KEYCHAIN_KEY_NODE; @@ -296,13 +299,14 @@ DEFUN (no_key, "Delete a key\n" "Key identifier number\n") { + int idx_number = 2; struct keychain *keychain; struct key *key; u_int32_t index; keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[2]->arg); + VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_lookup (keychain, index); if (! key) { @@ -323,13 +327,14 @@ DEFUN (key_string, "Set key string\n" "The key\n") { + int idx_line = 1; struct key *key; key = vty->index_sub; if (key->string) XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[1]->arg); + key->string = XSTRDUP(MTYPE_KEY, argv[idx_line]->arg); return CMD_SUCCESS; } @@ -552,12 +557,20 @@ DEFUN (accept_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_day_month_month_day, @@ -573,12 +586,20 @@ DEFUN (accept_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_day_month, @@ -594,12 +615,20 @@ DEFUN (accept_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_month_day, @@ -615,12 +644,20 @@ DEFUN (accept_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_infinite_day_month, @@ -633,12 +670,16 @@ DEFUN (accept_lifetime_infinite_day_month, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_infinite_month_day, @@ -651,12 +692,16 @@ DEFUN (accept_lifetime_infinite_month_day, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, - argv[2]->arg, argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_duration_day_month, @@ -670,12 +715,17 @@ DEFUN (accept_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[2]->arg, - argv[3]->arg, argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (accept_lifetime_duration_month_day, @@ -689,12 +739,17 @@ DEFUN (accept_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->accept, argv[1]->arg, argv[3]->arg, - argv[2]->arg, argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (send_lifetime_day_month_day_month, @@ -710,12 +765,20 @@ DEFUN (send_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_day_month_month_day, @@ -731,12 +794,20 @@ DEFUN (send_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_day_month, @@ -752,12 +823,20 @@ DEFUN (send_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[6]->arg, argv[7]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_month_day, @@ -773,12 +852,20 @@ DEFUN (send_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; struct key *key; key = vty->index_sub; - return key_lifetime_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[6]->arg, argv[8]->arg); + return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_infinite_day_month, @@ -791,12 +878,16 @@ DEFUN (send_lifetime_infinite_day_month, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg); } DEFUN (send_lifetime_infinite_month_day, @@ -809,12 +900,16 @@ DEFUN (send_lifetime_infinite_month_day, "Year to start\n" "Never expires") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; struct key *key; key = vty->index_sub; - return key_lifetime_infinite_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg); + return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg); } DEFUN (send_lifetime_duration_day_month, @@ -828,12 +923,17 @@ DEFUN (send_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[2]->arg, argv[3]->arg, - argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (send_lifetime_duration_month_day, @@ -847,12 +947,17 @@ DEFUN (send_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; struct key *key; key = vty->index_sub; - return key_lifetime_duration_set (vty, &key->send, argv[1]->arg, argv[3]->arg, argv[2]->arg, - argv[4]->arg, argv[6]->arg); + return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, + argv[idx_number_2]->arg, argv[idx_number_3]->arg); } static struct cmd_node keychain_node = diff --git a/lib/ns.c b/lib/ns.c index 9480546e38..d8db1e45a1 100644 --- a/lib/ns.c +++ b/lib/ns.c @@ -557,14 +557,16 @@ DEFUN (ns_netns, "The Name Space\n" "The file name in " NS_RUN_DIR ", or a full pathname\n") { + int idx_number = 1; + int idx_name = 3; ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[3]->arg); + char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[1]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg); ns = ns_get (ns_id); if (ns->name && strcmp (ns->name, pathname) != 0) @@ -596,14 +598,16 @@ DEFUN (no_ns_netns, "The Name Space\n" "The file name in " NS_RUN_DIR ", or a full pathname\n") { + int idx_number = 2; + int idx_name = 4; ns_id_t ns_id = NS_DEFAULT; struct ns *ns = NULL; - char *pathname = ns_netns_pathname (vty, argv[4]->arg); + char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) return CMD_WARNING; - VTY_GET_INTEGER ("NS ID", ns_id, argv[2]->arg); + VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg); ns = ns_lookup (ns_id); if (!ns) diff --git a/lib/plist.c b/lib/plist.c index 164bc1d7e1..5386605973 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1415,8 +1415,11 @@ DEFUN (ip_prefix_list, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, - argv[3]->arg, argv[4]->arg, NULL, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_any = 4; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, + argv[idx_permit_deny]->arg, argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (ip_prefix_list_ge, @@ -1431,8 +1434,12 @@ DEFUN (ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (ip_prefix_list_ge_le, @@ -1449,8 +1456,13 @@ DEFUN (ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[8]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_le, @@ -1465,8 +1477,12 @@ DEFUN (ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (ip_prefix_list_le_ge, @@ -1483,8 +1499,13 @@ DEFUN (ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[8]->arg, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv4_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (ip_prefix_list_seq, @@ -1500,8 +1521,12 @@ DEFUN (ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_any = 6; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (ip_prefix_list_seq_ge, @@ -1518,8 +1543,13 @@ DEFUN (ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ip_prefix_list_seq_ge_le, @@ -1538,8 +1568,14 @@ DEFUN (ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, argv[10]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (ip_prefix_list_seq_le, @@ -1556,8 +1592,13 @@ DEFUN (ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_seq_le_ge, @@ -1576,8 +1617,14 @@ DEFUN (ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[10]->arg, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv4_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list, @@ -1588,7 +1635,8 @@ DEFUN (no_ip_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, NULL, + int idx_word = 3; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -1604,8 +1652,11 @@ DEFUN (no_ip_prefix_list_prefix, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_any = 5; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_ge, @@ -1621,8 +1672,12 @@ DEFUN (no_ip_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_ip_prefix_list_ge_le, @@ -1640,8 +1695,13 @@ DEFUN (no_ip_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[9]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list_le, @@ -1657,8 +1717,12 @@ DEFUN (no_ip_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (no_ip_prefix_list_le_ge, @@ -1676,8 +1740,13 @@ DEFUN (no_ip_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[9]->arg, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv4_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (no_ip_prefix_list_seq, @@ -1694,8 +1763,12 @@ DEFUN (no_ip_prefix_list_seq, "IP prefix /, e.g., 35.0.0.0/8\n" "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_any = 7; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_any]->arg, NULL, NULL); } DEFUN (no_ip_prefix_list_seq_ge, @@ -1713,8 +1786,13 @@ DEFUN (no_ip_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ip_prefix_list_seq_ge_le, @@ -1734,8 +1812,14 @@ DEFUN (no_ip_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, argv[11]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (no_ip_prefix_list_seq_le, @@ -1753,8 +1837,13 @@ DEFUN (no_ip_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (no_ip_prefix_list_seq_le_ge, @@ -1774,8 +1863,14 @@ DEFUN (no_ip_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[11]->arg, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv4_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (ip_prefix_list_sequence_number, @@ -1810,9 +1905,10 @@ DEFUN (ip_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + int idx_word = 2; struct prefix_list *plist; - plist = prefix_list_get (AFI_IP, 0, argv[2]->arg); + plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg); if (plist->desc) { @@ -1822,7 +1918,7 @@ DEFUN (ip_prefix_list_description, plist->desc = argv_concat(argv, argc, 1); return CMD_SUCCESS; -} +} /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -1844,7 +1940,8 @@ DEFUN (no_ip_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP, argv[3]->arg); + int idx_word = 3; + return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg); } @@ -1866,7 +1963,8 @@ DEFUN (show_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, NULL, normal_display); + int idx_word = 3; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, normal_display); } DEFUN (show_ip_prefix_list_name_seq, @@ -1879,7 +1977,9 @@ DEFUN (show_ip_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[3]->arg, argv[5]->arg, sequential_display); + int idx_word = 3; + int idx_number = 5; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); } DEFUN (show_ip_prefix_list_prefix, @@ -1891,7 +1991,9 @@ DEFUN (show_ip_prefix_list_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, normal_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, normal_display); } DEFUN (show_ip_prefix_list_prefix_longer, @@ -1904,7 +2006,9 @@ DEFUN (show_ip_prefix_list_prefix_longer, "IP prefix /, e.g., 35.0.0.0/8\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, longer_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, longer_display); } DEFUN (show_ip_prefix_list_prefix_first_match, @@ -1917,7 +2021,9 @@ DEFUN (show_ip_prefix_list_prefix_first_match, "IP prefix /, e.g., 35.0.0.0/8\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP, argv[3]->arg, argv[4]->arg, first_match_display); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, first_match_display); } DEFUN (show_ip_prefix_list_summary, @@ -1940,7 +2046,8 @@ DEFUN (show_ip_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, summary_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, summary_display); } @@ -1964,7 +2071,8 @@ DEFUN (show_ip_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP, argv[4]->arg, NULL, detail_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, detail_display); } DEFUN (clear_ip_prefix_list, @@ -1985,7 +2093,8 @@ DEFUN (clear_ip_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, NULL); + int idx_word = 3; + return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL); } DEFUN (clear_ip_prefix_list_name_prefix, @@ -1997,7 +2106,9 @@ DEFUN (clear_ip_prefix_list_name_prefix, "Name of a prefix list\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - return vty_clear_prefix_list (vty, AFI_IP, argv[3]->arg, argv[4]->arg); + int idx_word = 3; + int idx_ipv4_prefixlen = 4; + return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg); } #ifdef HAVE_IPV6 @@ -2012,8 +2123,11 @@ DEFUN (ipv6_prefix_list, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, - argv[3]->arg, argv[4]->arg, NULL, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_any = 4; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, + argv[idx_permit_deny]->arg, argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_ge, @@ -2028,8 +2142,12 @@ DEFUN (ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, NULL); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (ipv6_prefix_list_ge_le, @@ -2047,8 +2165,13 @@ DEFUN (ipv6_prefix_list_ge_le, "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[6]->arg, argv[8]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_le, @@ -2063,8 +2186,12 @@ DEFUN (ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, NULL, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (ipv6_prefix_list_le_ge, @@ -2081,8 +2208,13 @@ DEFUN (ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, NULL, argv[3]->arg, - argv[4]->arg, argv[8]->arg, argv[6]->arg); + int idx_word = 2; + int idx_permit_deny = 3; + int idx_ipv6_prefixlen = 4; + int idx_number = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (ipv6_prefix_list_seq, @@ -2098,8 +2230,12 @@ DEFUN (ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_any = 6; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (ipv6_prefix_list_seq_ge, @@ -2116,8 +2252,13 @@ DEFUN (ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, NULL); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (ipv6_prefix_list_seq_ge_le, @@ -2136,8 +2277,14 @@ DEFUN (ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[8]->arg, argv[10]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (ipv6_prefix_list_seq_le, @@ -2154,8 +2301,13 @@ DEFUN (ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, NULL, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_seq_le_ge, @@ -2174,8 +2326,14 @@ DEFUN (ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_install (vty, AFI_IP6, argv[2]->arg, argv[4]->arg, argv[5]->arg, - argv[6]->arg, argv[10]->arg, argv[8]->arg); + int idx_word = 2; + int idx_number = 4; + int idx_permit_deny = 5; + int idx_ipv6_prefixlen = 6; + int idx_number_2 = 8; + int idx_number_3 = 10; + return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list, @@ -2186,7 +2344,8 @@ DEFUN (no_ipv6_prefix_list, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, NULL, + int idx_word = 3; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, NULL, NULL, NULL, NULL); } @@ -2202,8 +2361,11 @@ DEFUN (no_ipv6_prefix_list_prefix, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_any = 5; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_ge, @@ -2219,8 +2381,12 @@ DEFUN (no_ipv6_prefix_list_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, NULL); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL); } DEFUN (no_ipv6_prefix_list_ge_le, @@ -2238,8 +2404,13 @@ DEFUN (no_ipv6_prefix_list_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[7]->arg, argv[9]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list_le, @@ -2255,8 +2426,12 @@ DEFUN (no_ipv6_prefix_list_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, NULL, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg); } DEFUN (no_ipv6_prefix_list_le_ge, @@ -2274,8 +2449,13 @@ DEFUN (no_ipv6_prefix_list_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, NULL, argv[4]->arg, - argv[5]->arg, argv[9]->arg, argv[7]->arg); + int idx_word = 3; + int idx_permit_deny = 4; + int idx_ipv6_prefixlen = 5; + int idx_number = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg); } DEFUN (no_ipv6_prefix_list_seq, @@ -2292,8 +2472,12 @@ DEFUN (no_ipv6_prefix_list_seq, "IPv6 prefix /, e.g., 3ffe::/16\n" "Any prefix match. Same as \"::0/0 le 128\"\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_any = 7; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_any]->arg, NULL, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge, @@ -2311,8 +2495,13 @@ DEFUN (no_ipv6_prefix_list_seq_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, NULL); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL); } DEFUN (no_ipv6_prefix_list_seq_ge_le, @@ -2332,8 +2521,14 @@ DEFUN (no_ipv6_prefix_list_seq_ge_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[9]->arg, argv[11]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); } DEFUN (no_ipv6_prefix_list_seq_le, @@ -2351,8 +2546,13 @@ DEFUN (no_ipv6_prefix_list_seq_le, "Maximum prefix length to be matched\n" "Maximum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, NULL, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg); } DEFUN (no_ipv6_prefix_list_seq_le_ge, @@ -2372,8 +2572,14 @@ DEFUN (no_ipv6_prefix_list_seq_le_ge, "Minimum prefix length to be matched\n" "Minimum prefix length\n") { - return vty_prefix_list_uninstall (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, argv[6]->arg, - argv[7]->arg, argv[11]->arg, argv[9]->arg); + int idx_word = 3; + int idx_number = 5; + int idx_permit_deny = 6; + int idx_ipv6_prefixlen = 7; + int idx_number_2 = 9; + int idx_number_3 = 11; + return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg, + argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg); } DEFUN (ipv6_prefix_list_sequence_number, @@ -2408,9 +2614,10 @@ DEFUN (ipv6_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + int idx_word = 2; struct prefix_list *plist; - plist = prefix_list_get (AFI_IP6, 0, argv[2]->arg); + plist = prefix_list_get (AFI_IP6, 0, argv[idx_word]->arg); if (plist->desc) { @@ -2420,7 +2627,7 @@ DEFUN (ipv6_prefix_list_description, plist->desc = argv_concat(argv, argc, 1); return CMD_SUCCESS; -} +} /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -2442,7 +2649,8 @@ DEFUN (no_ipv6_prefix_list_description, "Name of a prefix list\n" "Prefix-list specific description\n") { - return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[3]->arg); + int idx_word = 3; + return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[idx_word]->arg); } @@ -2464,7 +2672,8 @@ DEFUN (show_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL, normal_display); + int idx_word = 3; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, normal_display); } DEFUN (show_ipv6_prefix_list_name_seq, @@ -2477,7 +2686,9 @@ DEFUN (show_ipv6_prefix_list_name_seq, "sequence number of an entry\n" "Sequence number\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[5]->arg, sequential_display); + int idx_word = 3; + int idx_number = 5; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display); } DEFUN (show_ipv6_prefix_list_prefix, @@ -2489,7 +2700,9 @@ DEFUN (show_ipv6_prefix_list_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, normal_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, normal_display); } DEFUN (show_ipv6_prefix_list_prefix_longer, @@ -2502,7 +2715,9 @@ DEFUN (show_ipv6_prefix_list_prefix_longer, "IPv6 prefix /, e.g., 3ffe::/16\n" "Lookup longer prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, longer_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, longer_display); } DEFUN (show_ipv6_prefix_list_prefix_first_match, @@ -2515,7 +2730,9 @@ DEFUN (show_ipv6_prefix_list_prefix_first_match, "IPv6 prefix /, e.g., 3ffe::/16\n" "First matched prefix\n") { - return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[3]->arg, argv[4]->arg, first_match_display); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, first_match_display); } DEFUN (show_ipv6_prefix_list_summary, @@ -2538,7 +2755,8 @@ DEFUN (show_ipv6_prefix_list_summary_name, "Summary of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, summary_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, summary_display); } DEFUN (show_ipv6_prefix_list_detail, @@ -2561,7 +2779,8 @@ DEFUN (show_ipv6_prefix_list_detail_name, "Detail of prefix lists\n" "Name of a prefix list\n") { - return vty_show_prefix_list (vty, AFI_IP6, argv[4]->arg, NULL, detail_display); + int idx_word = 4; + return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, detail_display); } DEFUN (clear_ipv6_prefix_list, @@ -2582,7 +2801,8 @@ DEFUN (clear_ipv6_prefix_list_name, PREFIX_LIST_STR "Name of a prefix list\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, NULL); + int idx_word = 3; + return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL); } DEFUN (clear_ipv6_prefix_list_name_prefix, @@ -2594,7 +2814,9 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, "Name of a prefix list\n" "IPv6 prefix /, e.g., 3ffe::/16\n") { - return vty_clear_prefix_list (vty, AFI_IP6, argv[3]->arg, argv[4]->arg); + int idx_word = 3; + int idx_ipv6_prefixlen = 4; + return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg); } #endif /* HAVE_IPV6 */ diff --git a/lib/routemap.c b/lib/routemap.c index 88cdf97e55..7ad75b4154 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1406,12 +1406,15 @@ DEFUN (route_map, "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { + int idx_word = 1; + int idx_permit_deny = 2; + int idx_number = 3; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - int permit = argv[2]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; - unsigned long pref = strtoul (argv[3]->arg, &endptr, 10); - const char *mapname = argv[1]->arg; + int permit = argv[idx_permit_deny]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + unsigned long pref = strtoul (argv[idx_number]->arg, &endptr, 10); + const char *mapname = argv[idx_word]->arg; /* Get route map. */ map = route_map_get (mapname); @@ -1429,7 +1432,8 @@ DEFUN (no_route_map_all, "Create route-map or enter route-map command mode\n" "Route map tag\n") { - const char *mapname = argv[2]->arg; + int idx_word = 2; + const char *mapname = argv[idx_word]->arg; struct route_map *map; map = route_map_lookup_by_name (mapname); @@ -1454,12 +1458,15 @@ DEFUN (no_route_map, "Route map permits set operations\n" "Sequence to insert to/delete from existing route-map entry\n") { + int idx_word = 2; + int idx_permit_deny = 3; + int idx_number = 4; struct route_map *map; struct route_map_index *index; char *endptr = NULL; - int permit = argv[3]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; - const char *prefstr = argv[4]->arg; - const char *mapname = argv[2]->arg; + int permit = argv[idx_permit_deny]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY; + const char *prefstr = argv[idx_number]->arg; + const char *mapname = argv[idx_word]->arg; unsigned long pref = strtoul (prefstr, &endptr, 10); /* Existence check. */ @@ -1537,11 +1544,12 @@ DEFUN (rmap_onmatch_goto, "Goto Clause number\n" "Number\n") { + int idx_number = 2; char *num = NULL; if (!strcmp (argv[0]->text, "continue")) num = argv[1]->arg; else - num = argv[2]->arg; + num = argv[idx_number]->arg; struct route_map_index *index = vty->index; int d = 0; @@ -1623,7 +1631,8 @@ DEFUN (rmap_show_name, "route-map information\n" "route-map name\n") { - const char *name = (argc == 3) ? argv[2]->arg : NULL; + int idx_word = 2; + const char *name = (argc == 3) ? argv[idx_word]->arg : NULL; return vty_show_route_map (vty, name); } @@ -1633,8 +1642,9 @@ DEFUN (rmap_call, "Jump to another Route-Map after match+set\n" "Target route-map name\n") { + int idx_word = 1; struct route_map_index *index; - const char *rmap = argv[1]->arg; + const char *rmap = argv[idx_word]->arg; index = vty->index; if (index) diff --git a/lib/smux.c b/lib/smux.c index 5727227248..82bf64f1c8 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1370,7 +1370,8 @@ DEFUN (smux_peer, "SNMP MUX peer settings\n" "Object ID used in SMUX peering\n") { - if (smux_peer_oid (vty, argv[2]->arg, NULL) == 0) + int idx_oid = 2; + if (smux_peer_oid (vty, argv[idx_oid]->arg, NULL) == 0) { smux_start(); return CMD_SUCCESS; @@ -1387,7 +1388,8 @@ DEFUN (smux_peer_password, "SMUX peering object ID\n" "SMUX peering password\n") { - if (smux_peer_oid (vty, argv[2]->arg, argv[3]->rg) == 0) + int idx_oid = 2; + if (smux_peer_oid (vty, argv[idx_oid]->arg, argv[3]->rg) == 0) { smux_start(); return CMD_SUCCESS; diff --git a/lib/thread.c b/lib/thread.c index ba9a0ea2a6..76acd07789 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -299,15 +299,16 @@ DEFUN (show_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; if (argc > 3) { filter = 0; - while (argv[3]->arg[i] != '\0') + while (argv[idx_filter]->arg[i] != '\0') { - switch ( argv[3]->arg[i] ) + switch ( argv[idx_filter]->arg[i] ) { case 'r': case 'R': @@ -342,7 +343,7 @@ DEFUN (show_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[3]->arg, VTY_NEWLINE); + argv[idx_filter]->arg, VTY_NEWLINE); return CMD_WARNING; } } @@ -381,15 +382,16 @@ DEFUN (clear_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; if (argc > 3) { filter = 0; - while (argv[3]->arg[i] != '\0') + while (argv[idx_filter]->arg[i] != '\0') { - switch ( argv[3]->arg[i] ) + switch ( argv[idx_filter]->arg[i] ) { case 'r': case 'R': @@ -424,7 +426,7 @@ DEFUN (clear_thread_cpu, { vty_out(vty, "Invalid filter \"%s\" specified," " must contain at least one of 'RWTEXB'%s", - argv[3]->arg, VTY_NEWLINE); + argv[idx_filter]->arg, VTY_NEWLINE); return CMD_WARNING; } } diff --git a/lib/vty.c b/lib/vty.c index 03a5308280..e922c672a8 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2748,7 +2748,8 @@ DEFUN (exec_timeout_min, "Set timeout value\n" "Timeout value in minutes\n") { - return exec_timeout (vty, argv[1]->arg, NULL); + int idx_number = 1; + return exec_timeout (vty, argv[idx_number]->arg, NULL); } DEFUN (exec_timeout_sec, @@ -2758,7 +2759,9 @@ DEFUN (exec_timeout_sec, "Timeout in minutes\n" "Timeout in seconds\n") { - return exec_timeout (vty, argv[1]->arg, argv[2]->arg); + int idx_number = 1; + int idx_number_2 = 2; + return exec_timeout (vty, argv[idx_number]->arg, argv[idx_number_2]->arg); } DEFUN (no_exec_timeout, @@ -2777,10 +2780,11 @@ DEFUN (vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { + int idx_word = 1; if (vty_accesslist_name) XFREE(MTYPE_VTY, vty_accesslist_name); - vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[1]->arg); + vty_accesslist_name = XSTRDUP(MTYPE_VTY, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -2793,7 +2797,8 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - const char *accesslist = (argc == 3) ? argv[2]->arg : NULL; + int idx_word = 2; + const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL; if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist))) { vty_out (vty, "Access-class is not currently applied to vty%s", @@ -2817,10 +2822,11 @@ DEFUN (vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { + int idx_word = 2; if (vty_ipv6_accesslist_name) XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); - vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[2]->arg); + vty_ipv6_accesslist_name = XSTRDUP(MTYPE_VTY, argv[idx_word]->arg); return CMD_SUCCESS; } @@ -2834,7 +2840,8 @@ DEFUN (no_vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { - const char *accesslist = (argc == 4) ? argv[3]->arg : NULL; + int idx_word = 3; + const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL; if (! vty_ipv6_accesslist_name || (argc && strcmp(vty_ipv6_accesslist_name, accesslist))) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index b637cf69f9..7998baaee9 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -394,6 +394,25 @@ def get_token_index_variable_name(line_number, token): elif token == 'nocache|wrongvif|wholepkt': return 'idx_type' + elif token == 'file|memory|terminal': + return 'idx_type' + + elif token == 'prefix': + return 'idx_prefix' + + elif token == 'A.B.C.D/M|any': + return 'idx_ipv4_any' + + elif token == 'X:X::X:X/M|any': + return 'idx_ipv6_any' + + elif token == '(1-99)|(1300-1999)' or token == '(100-199)|(2000-2699)' or token == '(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD': + return 'idx_acl' + + elif token == 'kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7': + return 'idx_target' + + elif token in ('kernel|connected|static|rip|ospf|isis|pim|table', 'kernel|connected|static|ripng|ospf6|isis|table', 'kernel|connected|static|rip|isis|bgp|pim|table', @@ -406,6 +425,8 @@ def get_token_index_variable_name(line_number, token): 'kernel|connected|static|ospf|isis|bgp|pim|table', 'kernel|connected|static|ripng|isis|bgp|table', # '', + 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd', + 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd', 'bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static', 'kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table'): return 'idx_protocol' From 9bf96c846d927972101ddc0a0a8c9e2fc7f3b6c4 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 21:17:10 +0000 Subject: [PATCH 132/280] zebra: zebra_vty.c compiles Signed-off-by: Daniel Walton --- zebra/zebra_vty.c | 377 ++++++++++++++-------------------------------- 1 file changed, 111 insertions(+), 266 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 99d7bd6fdb..17e9538ba0 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2855,26 +2855,19 @@ DEFUN (show_ip_route_vrf, return do_show_ip_route (vty, argv[idx_json]->arg, SAFI_UNICAST, uj); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip nht " VRF_CMD_STR, - * SHOW_STR - * IP_STR - * "IP nexthop tracking table\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_ip_nht, show_ip_nht_cmd, - "show ip nht", + "show ip nht [vrf NAME]", SHOW_STR IP_STR - "IP nexthop tracking table\n") + "IP nexthop tracking table\n" + VRF_CMD_HELP_STR) { + int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc) - VRF_GET_ID (vrf_id, argv[0]); + if (argc == 5) + VRF_GET_ID (vrf_id, argv[idx_vrf]->arg); zebra_print_rnh_table(vrf_id, AF_INET, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -2902,26 +2895,19 @@ DEFUN (show_ip_nht_vrf_all, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 nht " VRF_CMD_STR, - * SHOW_STR - * IPV6_STR - * "IPv6 nexthop tracking table\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_ipv6_nht, show_ipv6_nht_cmd, - "show ipv6 nht", + "show ipv6 nht [vrf NAME]", SHOW_STR IPV6_STR - "IPv6 nexthop tracking table\n") + "IPv6 nexthop tracking table\n" + VRF_CMD_HELP_STR) { + int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc) - VRF_GET_ID (vrf_id, argv[0]); + if (argc == 5) + VRF_GET_ID (vrf_id, argv[idx_vrf]->arg); zebra_print_rnh_table(vrf_id, AF_INET6, vty, RNH_NEXTHOP_TYPE); return CMD_SUCCESS; @@ -3011,41 +2997,32 @@ DEFUN (no_ipv6_nht_default_route, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " tag <1-65535>", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "Show only routes with tag\n" - * "Tag value\n" - * - */ DEFUN (show_ip_route_tag, show_ip_route_tag_cmd, - "show ip route tag (1-65535)", + "show ip route [vrf NAME] tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "Show only routes with tag\n" "Tag value\n") { - int idx_number = 4; struct route_table *table; struct route_node *rn; struct rib *rib; int first = 1; u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - - if (argc > 1) - { - tag = atoi(argv[1]); - VRF_GET_ID (vrf_id, argv[idx_number]->arg); - } - else - tag = atoi(argv[idx_number]->arg); + + if (strcmp(argv[3]->text, "vrf")) + { + VRF_GET_ID (vrf_id, argv[4]->arg); + tag = atoi(argv[6]->arg); + } + else + { + tag = atoi(argv[4]->arg); + } table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3068,28 +3045,16 @@ DEFUN (show_ip_route_tag, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " A.B.C.D/M longer-prefixes", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "Show route matching the specified Network/Mask pair only\n" - * - */ DEFUN (show_ip_route_prefix_longer, show_ip_route_prefix_longer_cmd, - "show ip route A.B.C.D/M longer-prefixes", + "show ip route [vrf NAME] A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "IP prefix /, e.g., 35.0.0.0/8\n" "Show route matching the specified Network/Mask pair only\n") { - int idx_ipv4_prefixlen = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -3098,13 +3063,15 @@ DEFUN (show_ip_route_prefix_longer, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - ret = str2prefix (argv[1], &p); - VRF_GET_ID (vrf_id, argv[idx_ipv4_prefixlen]->arg); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix (argv[5]->arg, &p); } else - ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p); + { + ret = str2prefix (argv[3]->arg, &p); + } if (! ret) { @@ -3131,23 +3098,13 @@ DEFUN (show_ip_route_prefix_longer, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " supernets-only", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "Show supernet entries only\n" - * - */ DEFUN (show_ip_route_supernets, show_ip_route_supernets_cmd, - "show ip route supernets-only", + "show ip route [vrf NAME] supernets-only", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "Show supernet entries only\n") { struct route_table *table; @@ -3157,8 +3114,8 @@ DEFUN (show_ip_route_supernets, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3185,23 +3142,13 @@ DEFUN (show_ip_route_supernets, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * QUAGGA_IP_REDIST_HELP_STR_ZEBRA - * - */ DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR QUAGGA_IP_REDIST_HELP_STR_ZEBRA) { int type; @@ -3211,13 +3158,15 @@ DEFUN (show_ip_route_protocol, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - type = proto_redistnum (AFI_IP, argv[1]); + type = proto_redistnum (AFI_IP, argv[5]->arg); VRF_GET_ID (vrf_id, argv[4]->arg); - } + } else - type = proto_redistnum (AFI_IP, argv[4]->arg); + { + type = proto_redistnum (AFI_IP, argv[3]->arg); + } if (type < 0) { @@ -3282,38 +3231,30 @@ DEFUN (show_ip_route_ospf_instance, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " A.B.C.D", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "Network in the IP routing table to display\n" - * - */ DEFUN (show_ip_route_addr, show_ip_route_addr_cmd, - "show ip route A.B.C.D", + "show ip route [vrf NAME] A.B.C.D", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "Network in the IP routing table to display\n") { - int idx_ipv4 = 3; int ret; struct prefix_ipv4 p; struct route_table *table; struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_ipv4]->arg); - ret = str2prefix_ipv4 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix_ipv4 (argv[5]->arg, &p); } else - ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p); + { + ret = str2prefix_ipv4 (argv[3]->arg, &p); + } if (ret <= 0) { @@ -3339,39 +3280,30 @@ DEFUN (show_ip_route_addr, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " A.B.C.D/M", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "IP prefix /, e.g., 35.0.0.0/8\n" - * - */ DEFUN (show_ip_route_prefix, show_ip_route_prefix_cmd, - "show ip route A.B.C.D/M", + "show ip route [vrf NAME] A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "IP prefix /, e.g., 35.0.0.0/8\n") { - int idx_ipv4_prefixlen = 3; int ret; struct prefix_ipv4 p; struct route_table *table; struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_ipv4_prefixlen]->arg); - ret = str2prefix_ipv4 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix_ipv4 (argv[5]->arg, &p); } else - ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p); + { + ret = str2prefix_ipv4 (argv[3]->arg, &p); + } if (ret <= 0) { @@ -3548,29 +3480,20 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) } /* Show route summary. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " summary", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "Summary of all routes\n" - * - */ DEFUN (show_ip_route_summary, show_ip_route_summary_cmd, - "show ip route summary", + "show ip route [vrf NAME] summary", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "Summary of all routes\n") { struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -3583,31 +3506,21 @@ DEFUN (show_ip_route_summary, /* Show route summary prefix. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip route " VRF_CMD_STR " summary prefix", - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * "Summary of all routes\n" - * "Prefix routes\n" - * - */ DEFUN (show_ip_route_summary_prefix, show_ip_route_summary_prefix_cmd, - "show ip route summary prefix", + "show ip route [vrf NAME] summary prefix", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR "Summary of all routes\n" "Prefix routes\n") { struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); if (! table) @@ -5580,28 +5493,16 @@ DEFUN (show_ipv6_route, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " tag <1-65535>", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "Show only routes with tag\n" - * "Tag value\n" - * - */ DEFUN (show_ipv6_route_tag, show_ipv6_route_tag_cmd, - "show ipv6 route tag (1-65535)", + "show ipv6 route [vrf NAME] tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "Show only routes with tag\n" "Tag value\n") { - int idx_number = 4; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -5609,13 +5510,15 @@ DEFUN (show_ipv6_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_number]->arg); - tag = atoi(argv[1]); + VRF_GET_ID (vrf_id, argv[4]->arg); + tag = atoi(argv[6]->arg); } else - tag = atoi(argv[idx_number]->arg); + { + tag = atoi(argv[4]->arg); + } table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5638,28 +5541,16 @@ DEFUN (show_ipv6_route_tag, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " X:X::X:X/M longer-prefixes", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "IPv6 prefix\n" - * "Show route matching the specified Network/Mask pair only\n" - * - */ DEFUN (show_ipv6_route_prefix_longer, show_ipv6_route_prefix_longer_cmd, - "show ipv6 route X:X::X:X/M longer-prefixes", + "show ipv6 route [vrf NAME] X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "IPv6 prefix\n" "Show route matching the specified Network/Mask pair only\n") { - int idx_ipv6_prefixlen = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -5668,13 +5559,15 @@ DEFUN (show_ipv6_route_prefix_longer, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_ipv6_prefixlen]->arg); - ret = str2prefix (argv[1], &p); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix (argv[5]->arg, &p); } else - ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p); + { + ret = str2prefix (argv[3]->arg, &p); + } if (! ret) { @@ -5761,39 +5654,30 @@ DEFUN (show_ipv6_route_protocol, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " X:X::X:X", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "IPv6 Address\n" - * - */ DEFUN (show_ipv6_route_addr, show_ipv6_route_addr_cmd, - "show ipv6 route X:X::X:X", + "show ipv6 route [vrf NAME] X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "IPv6 Address\n") { - int idx_ipv6 = 3; int ret; struct prefix_ipv6 p; struct route_table *table; struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1 ) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_ipv6]->arg); - ret = str2prefix_ipv6 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix_ipv6 (argv[5]->arg, &p); } else - ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p); + { + ret = str2prefix_ipv6 (argv[3]->arg, &p); + } if (ret <= 0) { @@ -5819,39 +5703,28 @@ DEFUN (show_ipv6_route_addr, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " X:X::X:X/M ", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "IPv6 prefix\n" - * - */ DEFUN (show_ipv6_route_prefix, show_ipv6_route_prefix_cmd, - "show ipv6 route X:X::X:X/M", + "show ipv6 route [vrf NAME] X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "IPv6 prefix\n") { - int idx_ipv6_prefixlen = 3; int ret; struct prefix_ipv6 p; struct route_table *table; struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 1) + if (strcmp(argv[3]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[idx_ipv6_prefixlen]->arg); - ret = str2prefix_ipv6 (argv[1], &p); + VRF_GET_ID (vrf_id, argv[4]->arg); + ret = str2prefix_ipv6 (argv[5]->arg, &p); } else - ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p); + ret = str2prefix_ipv6 (argv[3]->arg, &p); if (ret <= 0) { @@ -5879,29 +5752,20 @@ DEFUN (show_ipv6_route_prefix, /* Show route summary. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " summary", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "Summary of all IPv6 routes\n" - * - */ DEFUN (show_ipv6_route_summary, show_ipv6_route_summary_cmd, - "show ipv6 route summary", + "show ipv6 route [vrf NAME] summary", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "Summary of all IPv6 routes\n") { struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5914,31 +5778,21 @@ DEFUN (show_ipv6_route_summary, /* Show ipv6 route summary prefix. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " summary prefix", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * "Summary of all IPv6 routes\n" - * "Prefix routes\n" - * - */ DEFUN (show_ipv6_route_summary_prefix, show_ipv6_route_summary_prefix_cmd, - "show ipv6 route summary prefix", + "show ipv6 route [vrf NAME] summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" + VRF_CMD_HELP_STR "Summary of all IPv6 routes\n" "Prefix routes\n") { struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); if (! table) @@ -5954,22 +5808,13 @@ DEFUN (show_ipv6_route_summary_prefix, * Show IPv6 mroute command.Used to dump * the Multicast routing table. */ - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 mroute " VRF_CMD_STR, - * SHOW_STR - * IP_STR - * "IPv6 Multicast routing table\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_ipv6_mroute, show_ipv6_mroute_cmd, - "show ipv6 mroute", + "show ipv6 mroute [vrf NAME]", SHOW_STR IP_STR - "IPv6 Multicast routing table\n") + "IPv6 Multicast routing table\n" + VRF_CMD_HELP_STR) { struct route_table *table; struct route_node *rn; @@ -5977,8 +5822,8 @@ DEFUN (show_ipv6_mroute, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[0]); + if (strcmp(argv[3]->text, "vrf")) + VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); if (! table) From d862bffbda978e1292f80dbf482360dbb7176f58 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 23 Sep 2016 21:34:33 +0000 Subject: [PATCH 133/280] lib: lib compiles Signed-off-by: Quentin Young --- lib/command.c | 45 +++++++++++++++++++++++++++++---------------- lib/if_rmap.c | 26 ++------------------------ lib/plist.c | 51 +++++++++++++++++++++++++++++---------------------- 3 files changed, 60 insertions(+), 62 deletions(-) diff --git a/lib/command.c b/lib/command.c index f18338589b..ed2c30ad63 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1128,18 +1128,7 @@ DEFUN (config_list, } /* Write current configuration into file. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "copy running-config startup-config", - * "Copy configuration\n" - * "Copy running config to... \n" - * "Copy running config to startup config (same as write file)\n" - * - * "show running-config", - * SHOW_STR - * "running configuration\n" - * - */ + DEFUN (config_write, config_write_cmd, "write []", @@ -1159,9 +1148,10 @@ DEFUN (config_write, struct vty *file_vty; struct stat conf_stat; - // if command was 'write terminal' or 'show running-config' - if (argc == 2 && (!strcmp(argv[idx_type]->arg, "terminal") || - !strcmp(argv[idx_type]->arg, "running-config"))) + // if command was 'write terminal', 'write memory' or 'show running-config' + if (argc == 2 && (!strcmp(argv[idx_type]->text, "terminal") || + !strcmp(argv[idx_type]->text, "memory") || + !strcmp(argv[0]->text, "show"))) { if (vty->type == VTY_SHELL_SERV) { @@ -1285,8 +1275,27 @@ finished: return ret; } +/* ALIAS_FIXME for 'write ' */ +DEFUN (show_running_config, + show_running_config_cmd, + "show running-config", + SHOW_STR + "running configuration (same as write terminal/memory)\n") +{ + return config_write (self, vty, argc, argv); +} -/* Write current configuration into the terminal. */ +/* ALIAS_FIXME for 'write file' */ +DEFUN (copy_runningconf_startupconf, + copy_runningconf_startupconf_cmd, + "copy running-config startup-config", + "Copy configuration\n" + "Copy running config to... \n" + "Copy running config to startup config (same as write file)\n") +{ + return config_write (self, vty, argc, argv); +} +/** -- **/ /* Write startup configuration into the terminal. */ DEFUN (show_startup_config, @@ -2113,11 +2122,13 @@ void install_default (enum node_type node) { install_element (node, &config_exit_cmd); + install_element (node, &config_quit_cmd); install_element (node, &config_end_cmd); install_element (node, &config_help_cmd); install_element (node, &config_list_cmd); install_element (node, &config_write_cmd); + install_element (node, &show_running_config_cmd); } /* Initialize command interface. Install basic nodes and commands. */ @@ -2151,6 +2162,7 @@ cmd_init (int terminal) { install_element (VIEW_NODE, &config_list_cmd); install_element (VIEW_NODE, &config_exit_cmd); + install_element (VIEW_NODE, &config_quit_cmd); install_element (VIEW_NODE, &config_help_cmd); install_element (VIEW_NODE, &config_enable_cmd); install_element (VIEW_NODE, &config_terminal_length_cmd); @@ -2174,6 +2186,7 @@ cmd_init (int terminal) install_default (ENABLE_NODE); install_element (ENABLE_NODE, &config_disable_cmd); install_element (ENABLE_NODE, &config_terminal_cmd); + install_element (ENABLE_NODE, ©_runningconf_startupconf_cmd); } install_element (ENABLE_NODE, &show_startup_config_cmd); install_element (ENABLE_NODE, &show_version_cmd); diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 070d55d4b6..2afb08c7ca 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -209,16 +209,6 @@ if_rmap_unset (const char *ifname, enum if_rmap_type type, return 1; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "route-map RMAP_NAME (in|out) IFNAME", - * "Route map set\n" - * "Route map name\n" - * "Route map set for input filtering\n" - * "Route map set for output filtering\n" - * "Route map interface name\n" - * - */ DEFUN (if_rmap, if_rmap_cmd, "route-map RMAP_NAME IFNAME", @@ -233,9 +223,9 @@ DEFUN (if_rmap, int idx_ifname = 3; enum if_rmap_type type; - if (strncmp (argv[idx_in_out]->arg, "i", 1) == 0) + if (strncmp (argv[idx_in_out]->text, "in", 1) == 0) type = IF_RMAP_IN; - else if (strncmp (argv[idx_in_out]->arg, "o", 1) == 0) + else if (strncmp (argv[idx_in_out]->text, "out", 1) == 0) type = IF_RMAP_OUT; else { @@ -248,18 +238,6 @@ DEFUN (if_rmap, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no route-map ROUTEMAP_NAME (in|out) IFNAME", - * NO_STR - * "Route map unset\n" - * "Route map name\n" - * "Route map for input filtering\n" - * "Route map for output filtering\n" - * "Route map interface name\n" - * - */ DEFUN (no_if_rmap, no_if_rmap_cmd, "no route-map ROUTEMAP_NAME IFNAME", diff --git a/lib/plist.c b/lib/plist.c index 5386605973..5911d6cf7f 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1920,17 +1920,6 @@ DEFUN (ip_prefix_list_description, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip prefix-list WORD description .LINE", - * NO_STR - * IP_STR - * PREFIX_LIST_STR - * "Name of a prefix list\n" - * "Prefix-list specific description\n" - * "Up to 80 characters describing this prefix-list\n" - * - */ DEFUN (no_ip_prefix_list_description, no_ip_prefix_list_description_cmd, "no ip prefix-list WORD description", @@ -1944,6 +1933,19 @@ DEFUN (no_ip_prefix_list_description, return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg); } +/* ALIAS_FIXME */ +DEFUN (no_ip_prefix_list_description_comment, + no_ip_prefix_list_description_comment_cmd, + "no ip prefix-list WORD description LINE...", + NO_STR + IP_STR + PREFIX_LIST_STR + "Name of a prefix list\n" + "Prefix-list specific description\n" + "Up to 80 characters describing this prefix-list\n") +{ + return no_ip_prefix_list_description (self, vty, argc, argv); +} DEFUN (show_ip_prefix_list, show_ip_prefix_list_cmd, @@ -2629,17 +2631,6 @@ DEFUN (ipv6_prefix_list_description, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 prefix-list WORD description .LINE", - * NO_STR - * IPV6_STR - * PREFIX_LIST_STR - * "Name of a prefix list\n" - * "Prefix-list specific description\n" - * "Up to 80 characters describing this prefix-list\n" - * - */ DEFUN (no_ipv6_prefix_list_description, no_ipv6_prefix_list_description_cmd, "no ipv6 prefix-list WORD description", @@ -2653,6 +2644,20 @@ DEFUN (no_ipv6_prefix_list_description, return vty_prefix_list_desc_unset (vty, AFI_IP6, argv[idx_word]->arg); } +/* ALIAS_FIXME */ +DEFUN (no_ipv6_prefix_list_description_comment, + no_ipv6_prefix_list_description_comment_cmd, + "no ipv6 prefix-list WORD description LINE...", + NO_STR + IPV6_STR + PREFIX_LIST_STR + "Name of a prefix list\n" + "Prefix-list specific description\n" + "Up to 80 characters describing this prefix-list\n") +{ + return no_ipv6_prefix_list_description_comment (self, vty, argc, argv); +} + DEFUN (show_ipv6_prefix_list, show_ipv6_prefix_list_cmd, @@ -3172,6 +3177,7 @@ prefix_list_init_ipv4 (void) install_element (CONFIG_NODE, &ip_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd); + install_element (CONFIG_NODE, &no_ip_prefix_list_description_comment_cmd); install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd); install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd); @@ -3248,6 +3254,7 @@ prefix_list_init_ipv6 (void) install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd); + install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_comment_cmd); install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd); install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd); From 412e5cd94f087fbb68a6c8805a8465f526e45bee Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 23 Sep 2016 22:12:11 +0000 Subject: [PATCH 134/280] lib: added strmatch() Signed-off-by: Daniel Walton --- lib/str.c | 8 ++++++++ lib/str.h | 2 ++ zebra/zebra_vty.c | 30 +++++++++++++++--------------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lib/str.c b/lib/str.c index 16f759c074..cfdb6e024e 100644 --- a/lib/str.c +++ b/lib/str.c @@ -133,3 +133,11 @@ strndup (const char *s, size_t maxlen) return (char *) memcpy (new, s, len); } #endif + +extern int +strmatch (const char *str1, const char *str2) +{ + if (!strcmp(str1, str2)) + return 1; + return 0; +} diff --git a/lib/str.h b/lib/str.h index 7b83fe1cb1..dc8e7e5d67 100644 --- a/lib/str.h +++ b/lib/str.h @@ -29,5 +29,7 @@ extern size_t strnlen(const char *s, size_t maxlen); extern char * strndup (const char *, size_t); #endif +extern int strmatch (const char *, const char *); + #endif /* _ZEBRA_STR_H */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 17e9538ba0..ebe0ca4054 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -3014,7 +3014,7 @@ DEFUN (show_ip_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); tag = atoi(argv[6]->arg); @@ -3063,7 +3063,7 @@ DEFUN (show_ip_route_prefix_longer, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix (argv[5]->arg, &p); @@ -3114,7 +3114,7 @@ DEFUN (show_ip_route_supernets, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); @@ -3158,7 +3158,7 @@ DEFUN (show_ip_route_protocol, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { type = proto_redistnum (AFI_IP, argv[5]->arg); VRF_GET_ID (vrf_id, argv[4]->arg); @@ -3246,7 +3246,7 @@ DEFUN (show_ip_route_addr, struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix_ipv4 (argv[5]->arg, &p); @@ -3295,7 +3295,7 @@ DEFUN (show_ip_route_prefix, struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix_ipv4 (argv[5]->arg, &p); @@ -3492,7 +3492,7 @@ DEFUN (show_ip_route_summary, struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); @@ -3519,7 +3519,7 @@ DEFUN (show_ip_route_summary_prefix, struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); @@ -5510,7 +5510,7 @@ DEFUN (show_ipv6_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); tag = atoi(argv[6]->arg); @@ -5559,7 +5559,7 @@ DEFUN (show_ipv6_route_prefix_longer, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix (argv[5]->arg, &p); @@ -5669,7 +5669,7 @@ DEFUN (show_ipv6_route_addr, struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix_ipv6 (argv[5]->arg, &p); @@ -5718,7 +5718,7 @@ DEFUN (show_ipv6_route_prefix, struct route_node *rn; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) { VRF_GET_ID (vrf_id, argv[4]->arg); ret = str2prefix_ipv6 (argv[5]->arg, &p); @@ -5764,7 +5764,7 @@ DEFUN (show_ipv6_route_summary, struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); @@ -5791,7 +5791,7 @@ DEFUN (show_ipv6_route_summary_prefix, struct route_table *table; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); @@ -5822,7 +5822,7 @@ DEFUN (show_ipv6_mroute, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if (strcmp(argv[3]->text, "vrf")) + if (strmatch(argv[3]->text, "vrf")) VRF_GET_ID (vrf_id, argv[4]->arg); table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id); From 838758acbe73838f747dd528129151e2c489c5e1 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sat, 24 Sep 2016 03:14:42 +0000 Subject: [PATCH 135/280] bgpd: fixed some CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 717 +++++++++++-------------------------------------- 1 file changed, 154 insertions(+), 563 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8f1db7624d..b7fa1ce750 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -623,22 +623,14 @@ DEFUN (bgp_config_type, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp config-type (cisco|zebra)", - * NO_STR - * BGP_STR - * "Configuration type\n" - * "cisco\n" - * "zebra\n" - * - */ DEFUN (no_bgp_config_type, no_bgp_config_type_cmd, - "no bgp config-type", + "no bgp config-type [cisco|zebra]", NO_STR BGP_STR - "Display configuration type\n") + "Display configuration type\n" + "cisco\n" + "zebra\n") { bgp_option_unset (BGP_OPT_CONFIG_CISCO); return CMD_SUCCESS; @@ -752,8 +744,6 @@ DEFUN (router_bgp, return CMD_SUCCESS; } - - /* "no router bgp" commands. */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -900,21 +890,13 @@ DEFUN (no_bgp_router_id, /* BGP Cluster ID. */ - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "bgp cluster-id <1-4294967295>", - * BGP_STR - * "Configure Route-Reflector Cluster-id\n" - * "Route-Reflector Cluster-id as 32 bit quantity\n" - * - */ DEFUN (bgp_cluster_id, bgp_cluster_id_cmd, - "bgp cluster-id A.B.C.D", + "bgp cluster-id ", BGP_STR "Configure Route-Reflector Cluster-id\n" - "Route-Reflector Cluster-id in IP address format\n") + "Route-Reflector Cluster-id in IP address format\n" + "Route-Reflector Cluster-id as 32 bit quantity\n") { int idx_ipv4 = 2; int ret; @@ -936,53 +918,24 @@ DEFUN (bgp_cluster_id, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp cluster-id A.B.C.D", - * NO_STR - * BGP_STR - * "Configure Route-Reflector Cluster-id\n" - * "Route-Reflector Cluster-id in IP address format\n" - * - * "no bgp cluster-id <1-4294967295>", - * NO_STR - * BGP_STR - * "Configure Route-Reflector Cluster-id\n" - * "Route-Reflector Cluster-id as 32 bit quantity\n" - * - */ DEFUN (no_bgp_cluster_id, no_bgp_cluster_id_cmd, - "no bgp cluster-id", + "no bgp cluster-id [A.B.C.D|(1-4294967295)]", NO_STR BGP_STR - "Configure Route-Reflector Cluster-id\n") + "Configure Route-Reflector Cluster-id\n" + "Route-Reflector Cluster-id in IP address format\n" + "Route-Reflector Cluster-id as 32 bit quantity\n") { - int ret; struct bgp *bgp; - struct in_addr cluster; bgp = vty->index; - - if (argc == 1) - { - ret = inet_aton (argv[3]->arg, &cluster); - if (! ret) - { - vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - bgp_cluster_id_unset (bgp); bgp_clear_star_soft_out (vty, bgp->name); return CMD_SUCCESS; } - - DEFUN (bgp_confederation_identifier, bgp_confederation_identifier_cmd, "bgp confederation identifier " CMD_AS_RANGE, @@ -1004,19 +957,9 @@ DEFUN (bgp_confederation_identifier, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp confederation identifier " CMD_AS_RANGE, - * NO_STR - * "BGP specific commands\n" - * "AS confederation parameters\n" - * "AS number\n" - * "Set routing domain confederation AS\n" - * - */ DEFUN (no_bgp_confederation_identifier, no_bgp_confederation_identifier_cmd, - "no bgp confederation identifier", + "no bgp confederation identifier [(1-4294967295)]", NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -1025,13 +968,11 @@ DEFUN (no_bgp_confederation_identifier, struct bgp *bgp; bgp = vty->index; - bgp_confederation_id_unset (bgp); return CMD_SUCCESS; } - DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, "bgp confederation peers ." CMD_AS_RANGE, @@ -1170,38 +1111,25 @@ DEFUN (bgp_maxmed_admin_medv, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp max-med administrative <0-4294967294>", - * NO_STR - * BGP_STR - * "Advertise routes with max-med\n" - * "Administratively applied, for an indefinite period\n" - * "Max MED value to be used\n" - * - */ DEFUN (no_bgp_maxmed_admin, no_bgp_maxmed_admin_cmd, - "no bgp max-med administrative", + "no bgp max-med administrative [<0-4294967294>]", NO_STR BGP_STR "Advertise routes with max-med\n" - "Administratively applied, for an indefinite period\n") + "Administratively applied, for an indefinite period\n" + "Max MED value to be used\n") { struct bgp *bgp; bgp = vty->index; - bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; - bgp_maxmed_update(bgp); return CMD_SUCCESS; } - - DEFUN (bgp_maxmed_onstartup, bgp_maxmed_onstartup_cmd, "bgp max-med on-startup (5-86400)", @@ -1258,31 +1186,15 @@ DEFUN (bgp_maxmed_onstartup_medv, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp max-med on-startup <5-86400> <0-4294967294>", - * NO_STR - * BGP_STR - * "Advertise routes with max-med\n" - * "Effective on a startup\n" - * "Time (seconds) period for max-med\n" - * "Max MED value to be used\n" - * - * "no bgp max-med on-startup <5-86400>", - * NO_STR - * BGP_STR - * "Advertise routes with max-med\n" - * "Effective on a startup\n" - * "Time (seconds) period for max-med\n" - * - */ DEFUN (no_bgp_maxmed_onstartup, no_bgp_maxmed_onstartup_cmd, - "no bgp max-med on-startup", + "no bgp max-med on-startup [<5-86400> [<0-4294967294>]]", NO_STR BGP_STR "Advertise routes with max-med\n" - "Effective on a startup\n") + "Effective on a startup\n" + "Time (seconds) period for max-med\n" + "Max MED value to be used\n") { struct bgp *bgp; @@ -1303,8 +1215,6 @@ DEFUN (no_bgp_maxmed_onstartup, return CMD_SUCCESS; } - - static int bgp_update_delay_config_vty (struct vty *vty, const char *delay, const char *wait) @@ -1394,20 +1304,13 @@ DEFUN (bgp_update_delay_establish_wait, } /* Update-delay deconfiguration */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no update-delay <0-3600> <1-3600>", - * "Force initial delay for best-path and updates\n" - * "Seconds\n" - * "Wait for peers to be established\n" - * "Seconds\n" - * - */ DEFUN (no_bgp_update_delay, no_bgp_update_delay_cmd, - "no update-delay (0-3600)", + "no update-delay [(0-3600) [(1-3600)]]", + NO_STR "Force initial delay for best-path and updates\n" - "Seconds\n") + "Seconds\n" + "Wait for peers to be established\n") { return bgp_update_delay_deconfig_vty(vty); } @@ -1544,17 +1447,9 @@ DEFUN (bgp_maxpaths_ibgp_cluster, BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), - * NO_STR - * "Forward packets over multiple paths\n" - * "Number of paths\n" - * - */ DEFUN (no_bgp_maxpaths, no_bgp_maxpaths_cmd, - "no maximum-paths", + "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR "Forward packets over multiple paths\n" "Number of paths\n") @@ -1562,36 +1457,18 @@ DEFUN (no_bgp_maxpaths, return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", - * NO_STR - * "Forward packets over multiple paths\n" - * "iBGP-multipath\n" - * "Number of paths\n" - * "Match the cluster length\n" - * - * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), - * NO_STR - * "Forward packets over multiple paths\n" - * "iBGP-multipath\n" - * "Number of paths\n" - * - */ DEFUN (no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_cmd, - "no maximum-paths ibgp", + "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM) " [equal-cluster-length]]", NO_STR "Forward packets over multiple paths\n" "iBGP-multipath\n" - "Number of paths\n") + "Number of paths\n" + "Match the cluster length\n") { return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); } - - int bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, int *write) @@ -1651,22 +1528,14 @@ DEFUN (bgp_timers, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers bgp <0-65535> <0-65535>", - * NO_STR - * "Adjust routing timers\n" - * "BGP timers\n" - * "Keepalive interval\n" - * "Holdtime\n" - * - */ DEFUN (no_bgp_timers, no_bgp_timers_cmd, - "no timers bgp", + "no timers bgp [(0-65535) (0-65535)]", NO_STR "Adjust routing timers\n" - "BGP timers\n") + "BGP timers\n" + "Keepalive interval\n" + "Holdtime\n") { struct bgp *bgp; @@ -1882,23 +1751,14 @@ DEFUN (bgp_graceful_restart_restart_time, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp graceful-restart stalepath-time <1-3600>", - * NO_STR - * "BGP specific commands\n" - * "Graceful restart capability parameters\n" - * "Set the max time to hold onto restarting peer's stale paths\n" - * "Delay value (seconds)\n" - * - */ DEFUN (no_bgp_graceful_restart_stalepath_time, no_bgp_graceful_restart_stalepath_time_cmd, - "no bgp graceful-restart stalepath-time", + "no bgp graceful-restart stalepath-time [(1-3600)]", NO_STR "BGP specific commands\n" "Graceful restart capability parameters\n" - "Set the max time to hold onto restarting peer's stale paths\n") + "Set the max time to hold onto restarting peer's stale paths\n" + "Delay value (seconds)\n") { struct bgp *bgp; @@ -1910,23 +1770,14 @@ DEFUN (no_bgp_graceful_restart_stalepath_time, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp graceful-restart restart-time <1-3600>", - * NO_STR - * "BGP specific commands\n" - * "Graceful restart capability parameters\n" - * "Set the time to wait to delete stale routes before a BGP open message is received\n" - * "Delay value (seconds)\n" - * - */ DEFUN (no_bgp_graceful_restart_restart_time, no_bgp_graceful_restart_restart_time_cmd, - "no bgp graceful-restart restart-time", + "no bgp graceful-restart restart-time [(1-3600)]", NO_STR "BGP specific commands\n" "Graceful restart capability parameters\n" - "Set the time to wait to delete stale routes before a BGP open message is received\n") + "Set the time to wait to delete stale routes before a BGP open message is received\n" + "Delay value (seconds)\n") { struct bgp *bgp; @@ -1938,8 +1789,6 @@ DEFUN (no_bgp_graceful_restart_restart_time, return CMD_SUCCESS; } - - /* "bgp fast-external-failover" configuration. */ DEFUN (bgp_fast_external_failover, bgp_fast_external_failover_cmd, @@ -2209,24 +2058,16 @@ DEFUN (bgp_bestpath_med, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "bgp bestpath med missing-as-worst confed", - * "BGP specific commands\n" - * "Change the default bestpath selection\n" - * "MED attribute\n" - * "Treat missing MED as the least preferred one\n" - * "Compare MED among confederation paths\n" - * - */ DEFUN (bgp_bestpath_med2, bgp_bestpath_med2_cmd, - "bgp bestpath med confed missing-as-worst", + "bgp bestpath med (confed missing-as-worst|missing-as-worst confed)", "BGP specific commands\n" "Change the default bestpath selection\n" "MED attribute\n" "Compare MED among confederation paths\n" - "Treat missing MED as the least preferred one\n") + "Treat missing MED as the least preferred one\n" + "Treat missing MED as the least preferred one\n" + "Compare MED among confederation paths\n") { struct bgp *bgp; @@ -2264,20 +2105,9 @@ DEFUN (no_bgp_bestpath_med, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp bestpath med missing-as-worst confed", - * NO_STR - * "BGP specific commands\n" - * "Change the default bestpath selection\n" - * "MED attribute\n" - * "Treat missing MED as the least preferred one\n" - * "Compare MED among confederation paths\n" - * - */ DEFUN (no_bgp_bestpath_med2, no_bgp_bestpath_med2_cmd, - "no bgp bestpath med confed missing-as-worst", + "no bgp bestpath med [confed] missing-as-worst", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" @@ -2295,7 +2125,6 @@ DEFUN (no_bgp_bestpath_med2, return CMD_SUCCESS; } - /* "no bgp default ipv4-unicast". */ DEFUN (no_bgp_default_ipv4_unicast, no_bgp_default_ipv4_unicast_cmd, @@ -2426,23 +2255,14 @@ DEFUN (bgp_default_local_preference, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp default local-preference <0-4294967295>", - * NO_STR - * "BGP specific commands\n" - * "Configure BGP defaults\n" - * "local preference (higher=more preferred)\n" - * "Configure default local preference value\n" - * - */ DEFUN (no_bgp_default_local_preference, no_bgp_default_local_preference_cmd, - "no bgp default local-preference", + "no bgp default local-preference [(0-4294967295)]", NO_STR "BGP specific commands\n" "Configure BGP defaults\n" - "local preference (higher=more preferred)\n") + "local preference (higher=more preferred)\n" + "Configure default local preference value\n") { struct bgp *bgp; @@ -2475,23 +2295,14 @@ DEFUN (bgp_default_subgroup_pkt_queue_max, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp default subgroup-pkt-queue-max <20-100>", - * NO_STR - * "BGP specific commands\n" - * "Configure BGP defaults\n" - * "subgroup-pkt-queue-max\n" - * "Configure subgroup packet queue max\n" - * - */ DEFUN (no_bgp_default_subgroup_pkt_queue_max, no_bgp_default_subgroup_pkt_queue_max_cmd, - "no bgp default subgroup-pkt-queue-max", + "no bgp default subgroup-pkt-queue-max [(20-100)]", NO_STR "BGP specific commands\n" "Configure BGP defaults\n" - "subgroup-pkt-queue-max\n") + "subgroup-pkt-queue-max\n" + "Configure subgroup packet queue max\n") { struct bgp *bgp; @@ -2567,23 +2378,14 @@ DEFUN (bgp_listen_limit, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, - * NO_STR - * "BGP specific commands\n" - * "Configure BGP defaults\n" - * "maximum number of BGP Dynamic Neighbors that can be created\n" - * "Configure Dynamic Neighbors listen limit value\n" - * - */ DEFUN (no_bgp_listen_limit, no_bgp_listen_limit_cmd, - "no bgp listen limit", + "no bgp listen limit [(1-5000)]", "BGP specific commands\n" "Configure BGP defaults\n" "unset maximum number of BGP Dynamic Neighbors that can be created\n" - "Configure Dynamic Neighbors listen limit value to default\n") + "Configure Dynamic Neighbors listen limit value to default\n" + "Configure Dynamic Neighbors listen limit value\n") { struct bgp *bgp; @@ -3246,11 +3048,6 @@ DEFUN (no_neighbor_interface_config, return CMD_SUCCESS; } - - - - - DEFUN (no_neighbor_peer_group, no_neighbor_peer_group_cmd, "no neighbor WORD peer-group", @@ -6557,137 +6354,55 @@ DEFUN (clear_ip_bgp_all, return bgp_clear_vty (vty, argv[4]->arg, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); } - - - - - /* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor IP address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor IP address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * - * "clear bgp (A.B.C.D|X:X::X:X|WORD)", - * CLEAR_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor IP address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * + * CHECK ME need ipv6 equivalent */ DEFUN (clear_ip_bgp_peer, clear_ip_bgp_peer_cmd, - "clear ip bgp ", + "clear [ip] bgp [ WORD] ", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "BGP neighbor IP address to clear\n" "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n") -{ - int idx_peer = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); - - return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); -} - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp peer-group WORD", - * CLEAR_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * - * "clear bgp ipv6 peer-group WORD", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * - */ -DEFUN (clear_ip_bgp_peer_group, - clear_ip_bgp_peer_group_cmd, - "clear ip bgp peer-group WORD", - CLEAR_STR - IP_STR - BGP_STR + "BGP neighbor on interface to clear\n" "Clear all members of peer-group\n" "BGP peer-group name\n") { - int idx_word = 4; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_peer = 5; + char *vrf_name = NULL; + enum clear_sort clearer; - return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[idx_word]->arg); + if (!strmatch(argv[idx_ip]->text, "ip")) + { + idx_view_vrf--; + idx_vrf--; + idx_peer--; + } + + if (argv[idx_view_vrf]->type == WORD_TKN) + vrf_name = argv[idx_vrf]->arg; + else + idx_peer -= 2; + + /* peer-group WORD */ + if (argv[idx_peer]->type == WORD_TKN) + { + clearer = clear_group; + idx_peer += 1; + } + else + { + clearer = clear_peer; + } + + return bgp_clear_vty (vty, vrf_name, 0, 0, clearer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); } - - - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp " BGP_INSTANCE_CMD " ipv6 external", @@ -6697,107 +6412,72 @@ DEFUN (clear_ip_bgp_peer_group, * "Address family\n" * "Clear all external peers\n" * - * "clear bgp " BGP_INSTANCE_CMD " external", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * - * "clear bgp external", - * CLEAR_STR - * BGP_STR - * "Clear all external peers\n" - * * "clear bgp ipv6 external", * CLEAR_STR * BGP_STR * "Address family\n" * "Clear all external peers\n" - * - * "clear ip bgp " BGP_INSTANCE_CMD " external", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * */ DEFUN (clear_ip_bgp_external, clear_ip_bgp_external_cmd, - "clear ip bgp external", + "clear [ip] bgp [ WORD] external", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all external peers\n") { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf_name = NULL; - return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); + if (!strmatch(argv[idx_ip]->text, "ip")) + { + idx_view_vrf--; + idx_vrf--; + } + + if (argv[idx_view_vrf]->type == WORD_TKN) + vrf_name = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf_name, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); } - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear bestpath and re-advertise\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * - * "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear bestpath and re-advertise\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * - * "clear bgp prefix A.B.C.D/M", - * CLEAR_STR - * BGP_STR - * "Clear bestpath and re-advertise\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * - */ DEFUN (clear_ip_bgp_prefix, clear_ip_bgp_prefix_cmd, - "clear ip bgp prefix A.B.C.D/M", + "clear [ip] bgp [ WORD] prefix A.B.C.D/M", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear bestpath and re-advertise\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - int idx_ipv4_prefixlen = 4; - if (argc == 3) - return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_ipv4_prefixlen = 6; + char *vrf_name = NULL; - return bgp_clear_prefix (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); + if (!strmatch(argv[idx_ip]->text, "ip")) + { + idx_view_vrf--; + idx_vrf--; + idx_ipv4_prefixlen--; + } + + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf_name = argv[idx_vrf]->arg; + else + idx_ipv4_prefixlen -= 2; + + return bgp_clear_prefix (vty, vrf_name, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); } - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" + * need ipv6 options * * "clear bgp ipv6 " CMD_AS_RANGE, * CLEAR_STR @@ -6811,98 +6491,62 @@ DEFUN (clear_ip_bgp_prefix, * BGP_INSTANCE_HELP_STR * "Address family\n" * "Clear peers with the AS number\n" - * - * "clear bgp " CMD_AS_RANGE, - * CLEAR_STR - * BGP_STR - * "Clear peers with the AS number\n" - * */ DEFUN (clear_ip_bgp_as, clear_ip_bgp_as_cmd, - "clear ip bgp " CMD_AS_RANGE, + "clear [ip] bgp [ WORD] " CMD_AS_RANGE, CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear peers with the AS number\n") { + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; int idx_number = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); + char *vrf_name = NULL; - return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); + if (!strmatch(argv[idx_ip]->text, "ip")) + { + idx_view_vrf--; + idx_vrf--; + idx_number--; + } + + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf_name = argv[idx_vrf]->arg; + else + idx_number -= 2; + + return bgp_clear_vty (vty, vrf_name, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); } - - - - - /* Outbound soft-reconfiguration */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " * out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " * soft out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear ip bgp * out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_all_soft_out, clear_ip_bgp_all_soft_out_cmd, - "clear ip bgp * soft out", + "clear ip bgp [ WORD] * [soft] out", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all peers\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf_name = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf_name = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf_name, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_all_ipv4_soft_out, clear_ip_bgp_all_ipv4_soft_out_cmd, - "clear ip bgp * ipv4 soft out", + "clear ip bgp * ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6922,23 +6566,9 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, clear_ip_bgp_instance_all_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft out", + "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6960,23 +6590,9 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * vpnv4 unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family Modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_all_vpnv4_soft_out, clear_ip_bgp_all_vpnv4_soft_out_cmd, - "clear ip bgp * vpnv4 unicast soft out", + "clear ip bgp * vpnv4 unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6990,22 +6606,9 @@ DEFUN (clear_ip_bgp_all_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * encap unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family Modifier\n" - * "Soft reconfig outbound update\n" - * - */ DEFUN (clear_ip_bgp_all_encap_soft_out, clear_ip_bgp_all_encap_soft_out_cmd, - "clear ip bgp * encap unicast soft out", + "clear ip bgp * encap unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7094,12 +6697,6 @@ DEFUN (clear_bgp_all_soft_out, } - - - - - - DEFUN (clear_bgp_ipv6_safi_prefix, clear_bgp_ipv6_safi_prefix_cmd, "clear bgp ipv6 prefix X:X::X:X/M", @@ -7188,9 +6785,6 @@ DEFUN (clear_ip_bgp_peer_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", @@ -7270,8 +6864,6 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } - - /* NOTE: WORD peers have not been tested for vpnv4 */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -15897,7 +15489,6 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); From 7757e5e1aea9ba91b460a2c5cac03456a5b90529 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 24 Sep 2016 17:42:34 +0000 Subject: [PATCH 136/280] zebra: fix zebra_routemap.c checkme's Signed-off-by: Quentin Young --- zebra/zebra_routemap.c | 434 +++++++++++++---------------------------- 1 file changed, 141 insertions(+), 293 deletions(-) diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 9ca4cd9473..ed90042b8c 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -306,26 +306,16 @@ DEFUN (match_interface, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * NO_STR - * MATCH_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface", + "no match interface [WORD]", NO_STR MATCH_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "interface", NULL, RMAP_EVENT_MATCH_DELETED); - - return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED); + char *iface = (argc == 4) ? argv[3]->arg : NULL; + return zebra_route_match_delete (vty, vty->index, "interface", iface, RMAP_EVENT_MATCH_DELETED); } @@ -341,27 +331,15 @@ DEFUN (match_tag, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match tag <1-65535>", - * NO_STR - * MATCH_STR - * "Match tag of route\n" - * - */ DEFUN (no_match_tag, no_match_tag_cmd, - "no match tag", + "no match tag [(1-65535)]", NO_STR MATCH_STR "Match tag of route\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "tag", NULL, - RMAP_EVENT_MATCH_DELETED); - - return zebra_route_match_delete (vty, vty->index, "tag", argv[0], - RMAP_EVENT_MATCH_DELETED); + char *tag = (argc == 4) ? argv[3]->arg : NULL; + return zebra_route_match_delete (vty, vty->index, "tag", tag, RMAP_EVENT_MATCH_DELETED); } @@ -379,32 +357,19 @@ DEFUN (match_ip_next_hop, return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match next-hop address of route\n") + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "ip next-hop", NULL, - RMAP_EVENT_FILTER_DELETED); - - return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0], - RMAP_EVENT_FILTER_DELETED); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return zebra_route_match_delete (vty, vty->index, "ip next-hop", al, RMAP_EVENT_FILTER_DELETED); } @@ -422,33 +387,19 @@ DEFUN (match_ip_next_hop_prefix_list, argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list", + "no match ip next-hop prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match next-hop address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-list", NULL, - RMAP_EVENT_PLIST_DELETED); - + char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-list", argv[0], + "ip next-hop prefix-list", plist, RMAP_EVENT_PLIST_DELETED); } @@ -469,32 +420,19 @@ DEFUN (match_ip_address, RMAP_EVENT_FILTER_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ DEFUN (no_match_ip_address, no_match_ip_address_cmd, - "no match ip address", + "no match ip address [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match address of route\n") + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, "ip address", NULL, - RMAP_EVENT_FILTER_DELETED); - - return zebra_route_match_delete (vty, vty->index, "ip address", argv[0], - RMAP_EVENT_FILTER_DELETED); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return zebra_route_match_delete (vty, vty->index, "ip address", al, RMAP_EVENT_FILTER_DELETED); } @@ -512,40 +450,26 @@ DEFUN (match_ip_address_prefix_list, argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", + "no match ip address prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, - "ip address prefix-list", NULL, - RMAP_EVENT_PLIST_DELETED); - + char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, - "ip address prefix-list", argv[0], + "ip address prefix-list", plist, RMAP_EVENT_PLIST_DELETED); } DEFUN (match_ip_address_prefix_len, match_ip_address_prefix_len_cmd, - "match ip address prefix-len NUMBER", + "match ip address prefix-len (0-32)", MATCH_STR IP_STR "Match prefix length of ip address\n" @@ -553,42 +477,28 @@ DEFUN (match_ip_address_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip address prefix-len", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[4]->arg, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-len NUMBER", - * NO_STR - * MATCH_STR - * IP_STR - * "Match prefixlen of ip address of route\n" - * "prefix length of ip address\n" - * - */ DEFUN (no_match_ip_address_prefix_len, no_match_ip_address_prefix_len_cmd, - "no match ip address prefix-len", + "no match ip address prefix-len [(0-32)]", NO_STR MATCH_STR IP_STR "Match prefixlen of ip address of route\n" - "prefix length of ip address\n") + "Prefix length\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, - "ip address prefix-len", NULL, - RMAP_EVENT_MATCH_DELETED); - + char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, - "ip address prefix-len", argv[0], + "ip address prefix-len", plen, RMAP_EVENT_MATCH_DELETED); } DEFUN (match_ip_nexthop_prefix_len, match_ip_nexthop_prefix_len_cmd, - "match ip next-hop prefix-len NUMBER", + "match ip next-hop prefix-len (0-32)", MATCH_STR IP_STR "Match prefixlen of nexthop ip address\n" @@ -596,33 +506,22 @@ DEFUN (match_ip_nexthop_prefix_len, "Prefix length\n") { return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-len", - argv[0], RMAP_EVENT_MATCH_ADDED); + argv[4]->arg, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop prefix-len NUMBER", - * MATCH_STR - * "Match prefixlen of ip address of route\n" - * "prefix length of ip address\n" - * - */ DEFUN (no_match_ip_nexthop_prefix_len, no_match_ip_nexthop_prefix_len_cmd, - "no match ip next-hop prefix-len", + "no match ip next-hop prefix-len [(0-32)]", NO_STR MATCH_STR IP_STR "Match prefixlen of nexthop ip address\n" - "Match prefix length of nexthop\n") + "Match prefix length of nexthop\n" + "Prefix length\n") { - if (argc == 0) - return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-len", NULL, - RMAP_EVENT_MATCH_DELETED); - + char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-len", argv[0], + "ip next-hop prefix-len", plen, RMAP_EVENT_MATCH_DELETED); } @@ -633,43 +532,28 @@ DEFUN (match_source_protocol, MATCH_STR "Match protocol via which the route was learnt\n") { - int idx_protocol = 2; + char *proto = argv[2]->text; int i; - i = proto_name2num(argv[idx_protocol]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_match_add (vty, vty->index, "source-protocol", - argv[idx_protocol]->arg, RMAP_EVENT_MATCH_ADDED); + return zebra_route_match_add (vty, vty->index, "source-protocol", proto, RMAP_EVENT_MATCH_ADDED); } DEFUN (no_match_source_protocol, no_match_source_protocol_cmd, - "no match source-protocol ", + "no match source-protocol []", NO_STR MATCH_STR - "No match protocol via which the route was learnt\n") + "No match protocol via which the route was learnt\n" + ) { - int idx_protocol = 3; - int i; - - if (argc >= 1) - { - i = proto_name2num(argv[idx_protocol]->arg); - if (i < 0) - { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); - return CMD_WARNING; - } - } - return zebra_route_match_delete (vty, vty->index, - "source-protocol", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : NULL, - RMAP_EVENT_MATCH_DELETED); + char *proto = (argc == 4) ? argv[3]->text : NULL; + return zebra_route_match_delete (vty, vty->index, "source-protocol", proto, RMAP_EVENT_MATCH_DELETED); } /* set functions */ @@ -709,8 +593,8 @@ DEFUN (set_src, if (!zebra_check_addr(&p)) { - vty_out (vty, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE); - return CMD_WARNING; + vty_out (vty, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE); + return CMD_WARNING; } for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) @@ -736,16 +620,13 @@ DEFUN (set_src, DEFUN (no_set_src, no_set_src_cmd, - "no set src [A.B.C.D|X:X::X:X]", + "no set src []", NO_STR SET_STR "Source address for route\n") { - int idx_ip = 3; - if (argc == 0) - return zebra_route_set_delete (vty, vty->index, "src", NULL); - - return zebra_route_set_delete (vty, vty->index, "src", argv[idx_ip]->arg); + char *ip = (argc == 4) ? argv[3]->arg : NULL; + return zebra_route_set_delete (vty, vty->index, "src", ip); } DEFUN (zebra_route_map_timer, @@ -763,21 +644,14 @@ DEFUN (zebra_route_map_timer, return (CMD_SUCCESS); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no zebra route-map delay-timer <0-600>", - * NO_STR - * "Time to wait before route-map updates are processed\n" - * "Reset delay-timer to default value, 30 secs\n" - * "0 means event-driven updates are disabled\n" - * - */ DEFUN (no_zebra_route_map_timer, no_zebra_route_map_timer_cmd, - "no zebra route-map delay-timer", + "no zebra route-map delay-timer [(0-600)]", NO_STR "Time to wait before route-map updates are processed\n" - "Reset delay-timer to default value, 30 secs\n") + "Reset delay-timer to default value, 30 secs\n" + "0 means event-driven updates are disabled\n") + { zebra_route_map_set_delay_timer(ZEBRA_RMAP_DEFAULT_UPDATE_TIMER); @@ -791,81 +665,75 @@ DEFUN (ip_protocol, IP_STR "Filter routing info exchanged between zebra and protocol\n" QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route-map\n" "Route map name\n") { - int idx_protocol = 2; + char *proto = argv[2]->text; + char *rmap = argv[4]->arg; int i; - if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[idx_protocol]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP][i]) { - if (strcmp(proto_rm[AFI_IP][i], argv[1]) == 0) + if (strcmp(proto_rm[AFI_IP][i], rmap) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); } - proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[idx_protocol]->arg); + VRF_DEFAULT, proto); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - * NO_STR - * IP_STR - * "Stop filtering routing info between zebra and protocol\n" - * QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA - * "route map name" - * - */ DEFUN (no_ip_protocol, no_ip_protocol_cmd, - "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA, + "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", NO_STR IP_STR "Stop filtering routing info between zebra and protocol\n" QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA - "Protocol from which to stop filtering routes\n") + "Specify route map\n" + "Route map name\n") { + char *proto = argv[3]->text; + char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; - if (strcasecmp(argv[4]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[4]->arg); + i = proto_name2num(proto); + if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } + if (!proto_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP][i]) == 0) || - (argc < 2)) + if (!rmap || strcmp (rmap, proto_rm[AFI_IP][i]) == 0) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]); proto_rm[AFI_IP][i] = NULL; if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv4 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[4]->arg); + VRF_DEFAULT, proto); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } return CMD_SUCCESS; @@ -907,81 +775,73 @@ DEFUN (ipv6_protocol, IP6_STR "Filter IPv6 routing info exchanged between zebra and protocol\n" QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route map\n" "Route map name\n") { - int idx_protocol = 2; + char *proto = argv[2]->text; + char *rmap = argv[4]->arg; int i; - if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[idx_protocol]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } if (proto_rm[AFI_IP6][i]) { - if (strcmp(proto_rm[AFI_IP6][i], argv[1]) == 0) + if (strcmp(proto_rm[AFI_IP6][i], rmap) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); } - proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + proto_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap config for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[idx_protocol]->arg); + VRF_DEFAULT, proto); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - * NO_STR - * IP6_STR - * "Stop filtering IPv6 routing info between zebra and protocol\n" - * QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA - * "route map name" - * - */ DEFUN (no_ipv6_protocol, no_ipv6_protocol_cmd, - "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA, + "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", NO_STR IP6_STR "Stop filtering IPv6 routing info between zebra and protocol\n" QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA - "Protocol from which to stop filtering routes\n") + "Specify route map\n" + "Route map name\n") { + const char *proto = argv[3]->text; + const char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; - if (strcasecmp(argv[4]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[4]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } if (!proto_rm[AFI_IP6][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], proto_rm[AFI_IP6][i]) == 0) || - (argc < 2)) + if (!rmap || strcmp(rmap, proto_rm[AFI_IP6][i]) == 0) { XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP6][i]); proto_rm[AFI_IP6][i] = NULL; if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IPv6 Routemap unconfig for protocol %s, scheduling RIB processing", - VRF_DEFAULT, argv[4]->arg); + VRF_DEFAULT, proto); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); } @@ -1024,69 +884,63 @@ DEFUN (ip_protocol_nht_rmap, IP_STR "Filter Next Hop tracking route resolution\n" QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route map\n" "Route map name\n") { - int idx_protocol = 2; + char *proto = argv[2]->text; + char *rmap = argv[4]->arg; int i; - if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[idx_protocol]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP][i]) { - if (strcmp(nht_rm[AFI_IP][i], argv[1]) == 0) + if (strcmp(nht_rm[AFI_IP][i], rmap) == 0) return CMD_SUCCESS; XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); } - nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + nht_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap); zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - * IP_STR - * "Filter Next Hop tracking route resolution\n" - * QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA - * "Route map name\n" - * - */ DEFUN (no_ip_protocol_nht_rmap, no_ip_protocol_nht_rmap_cmd, - "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA, + "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", NO_STR IP_STR "Filter Next Hop tracking route resolution\n" - QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA) + QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route map\n" + "Route map name\n") { + char *proto = argv[3]->text; + char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; - if (strcasecmp(argv[4]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[4]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", - VTY_NEWLINE); - return CMD_WARNING; + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); + return CMD_WARNING; } if (!nht_rm[AFI_IP][i]) return CMD_SUCCESS; - if ((argc == 2 && strcmp(argv[1], nht_rm[AFI_IP][i]) == 0) || - (argc < 2)) + if (!rmap && strcmp(rmap, nht_rm[AFI_IP][i]) == 0) { XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); nht_rm[AFI_IP][i] = NULL; @@ -1131,63 +985,57 @@ DEFUN (ipv6_protocol_nht_rmap, IP6_STR "Filter Next Hop tracking route resolution\n" QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route map\n" "Route map name\n") { - int idx_protocol = 2; + char *proto = argv[2]->text; + char *rmap = argv[4]->arg; int i; - if (strcasecmp(argv[idx_protocol]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[idx_protocol]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[idx_protocol]->arg ? argv[idx_protocol]->arg : "", - VTY_NEWLINE); + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } if (nht_rm[AFI_IP6][i]) XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP6][i]); - nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]); + nht_rm[AFI_IP6][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, rmap); zebra_evaluate_rnh(0, AF_INET6, 1, RNH_NEXTHOP_TYPE, NULL); return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", - * NO_STR - * IP6_STR - * "Filter Next Hop tracking route resolution\n" - * QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA - * "Route map name\n" - * - */ DEFUN (no_ipv6_protocol_nht_rmap, no_ipv6_protocol_nht_rmap_cmd, - "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA, + "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", NO_STR IP6_STR "Filter Next Hop tracking route resolution\n" - QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA) + QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA + "Specify route map\n" + "Route map name\n") { + char *proto = argv[3]->text; + char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; - if (strcasecmp(argv[4]->arg, "any") == 0) + if (strcasecmp(proto, "any") == 0) i = ZEBRA_ROUTE_MAX; else - i = proto_name2num(argv[4]->arg); + i = proto_name2num(proto); if (i < 0) { - vty_out (vty, "invalid protocol name \"%s\"%s", argv[4]->arg ? argv[4]->arg : "", - VTY_NEWLINE); - return CMD_WARNING; + vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); + return CMD_WARNING; } - if (nht_rm[AFI_IP6][i] && argc == 2 && strcmp(argv[1], nht_rm[AFI_IP6][i])) + if (nht_rm[AFI_IP6][i] && rmap && strcmp(rmap, nht_rm[AFI_IP6][i])) { - vty_out (vty, "invalid route-map \"%s\"%s", argv[1], VTY_NEWLINE); + vty_out (vty, "invalid route-map \"%s\"%s", rmap, VTY_NEWLINE); return CMD_WARNING; } From 6af6be86163306886fe85e10a3b324cf57038957 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 24 Sep 2016 21:58:50 +0000 Subject: [PATCH 137/280] zebra: refactor zserv.c Signed-off-by: Quentin Young --- zebra/zserv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zebra/zserv.c b/zebra/zserv.c index fc7b41954d..5c4957a682 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2263,13 +2263,13 @@ DEFUN (config_table, "Configure target kernel routing table\n" "TABLE integer\n") { - zebrad.rtm_table_default = strtol (argv[0], (char**)0, 10); + zebrad.rtm_table_default = strtol (argv[1]->arg, (char**)0, 10); return CMD_SUCCESS; } DEFUN (no_config_table, no_config_table_cmd, - "no table TABLENO", + "no table [TABLENO]", NO_STR "Configure target kernel routing table\n" "TABLE integer\n") From 34ccea1ec54a69dbf260dcb20240dc8124a5591f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 25 Sep 2016 02:13:43 +0000 Subject: [PATCH 138/280] zebra: refactor rtadv.c Signed-off-by: Quentin Young --- zebra/rtadv.c | 528 ++++++++------------------------------------------ 1 file changed, 85 insertions(+), 443 deletions(-) diff --git a/zebra/rtadv.c b/zebra/rtadv.c index ec4736463c..7edba55953 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1,4 +1,5 @@ /* Router advertisement + * Copyright (C) 2016 Cumulus Networks * Copyright (C) 2005 6WIND * Copyright (C) 1999 Kunihiro Ishiguro * @@ -987,29 +988,16 @@ DEFUN (ipv6_nd_ra_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd ra-interval <1-1800>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Router Advertisement interval\n" - * - * "no ipv6 nd ra-interval msec <1-1800000>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Router Advertisement interval\n" - * "Router Advertisement interval in milliseconds\n" - * - */ DEFUN (no_ipv6_nd_ra_interval, no_ipv6_nd_ra_interval_cmd, - "no ipv6 nd ra-interval", + "no ipv6 nd ra-interval [<(1-1800)|msec (1-1800000)>]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Router Advertisement interval\n") + "Router Advertisement interval\n" + "Router Advertisement interval in seconds\n" + "Specify millisecond router advertisement interval\n" + "Router Advertisement interval in milliseconds\n") { struct interface *ifp; struct zebra_if *zif; @@ -1031,8 +1019,6 @@ DEFUN (no_ipv6_nd_ra_interval, return CMD_SUCCESS; } - - DEFUN (ipv6_nd_ra_lifetime, ipv6_nd_ra_lifetime_cmd, "ipv6 nd ra-lifetime (0-9000)", @@ -1066,23 +1052,14 @@ DEFUN (ipv6_nd_ra_lifetime, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd ra-lifetime <0-9000>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Router lifetime\n" - * "Router lifetime in seconds (0 stands for a non-default gw)\n" - * - */ DEFUN (no_ipv6_nd_ra_lifetime, no_ipv6_nd_ra_lifetime_cmd, - "no ipv6 nd ra-lifetime", + "no ipv6 nd ra-lifetime [(0-9000)]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Router lifetime\n") + "Router lifetime\n" + "Router lifetime in seconds (0 stands for a non-default gw)\n") { struct interface *ifp; struct zebra_if *zif; @@ -1095,7 +1072,6 @@ DEFUN (no_ipv6_nd_ra_lifetime, return CMD_SUCCESS; } - DEFUN (ipv6_nd_reachable_time, ipv6_nd_reachable_time_cmd, "ipv6 nd reachable-time (1-3600000)", @@ -1111,23 +1087,14 @@ DEFUN (ipv6_nd_reachable_time, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd reachable-time <1-3600000>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Reachable time\n" - * "Reachable time in milliseconds\n" - * - */ DEFUN (no_ipv6_nd_reachable_time, no_ipv6_nd_reachable_time_cmd, - "no ipv6 nd reachable-time", + "no ipv6 nd reachable-time [(1-3600000)]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Reachable time\n") + "Reachable time\n" + "Reachable time in milliseconds\n") { struct interface *ifp; struct zebra_if *zif; @@ -1140,7 +1107,6 @@ DEFUN (no_ipv6_nd_reachable_time, return CMD_SUCCESS; } - DEFUN (ipv6_nd_homeagent_preference, ipv6_nd_homeagent_preference_cmd, "ipv6 nd home-agent-preference (0-65535)", @@ -1156,23 +1122,14 @@ DEFUN (ipv6_nd_homeagent_preference, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd home-agent-preference <0-65535>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Home Agent preference\n" - * "preference value (default is 0, least preferred)\n" - * - */ DEFUN (no_ipv6_nd_homeagent_preference, no_ipv6_nd_homeagent_preference_cmd, - "no ipv6 nd home-agent-preference", + "no ipv6 nd home-agent-preference [(0-65535)]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Home Agent preference\n") + "Home Agent preference\n" + "preference value (default is 0, least preferred)\n") { struct interface *ifp; struct zebra_if *zif; @@ -1185,7 +1142,6 @@ DEFUN (no_ipv6_nd_homeagent_preference, return CMD_SUCCESS; } - DEFUN (ipv6_nd_homeagent_lifetime, ipv6_nd_homeagent_lifetime_cmd, "ipv6 nd home-agent-lifetime (0-65520)", @@ -1201,23 +1157,14 @@ DEFUN (ipv6_nd_homeagent_lifetime, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd home-agent-lifetime <0-65520>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Home Agent lifetime\n" - * "Home Agent lifetime in seconds (0 to track ra-lifetime)\n" - * - */ DEFUN (no_ipv6_nd_homeagent_lifetime, no_ipv6_nd_homeagent_lifetime_cmd, - "no ipv6 nd home-agent-lifetime", + "no ipv6 nd home-agent-lifetime [(0-65520)]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Home Agent lifetime\n") + "Home Agent lifetime\n" + "Home Agent lifetime in seconds (0 to track ra-lifetime)\n") { struct interface *ifp; struct zebra_if *zif; @@ -1230,7 +1177,6 @@ DEFUN (no_ipv6_nd_homeagent_lifetime, return CMD_SUCCESS; } - DEFUN (ipv6_nd_managed_config_flag, ipv6_nd_managed_config_flag_cmd, "ipv6 nd managed-config-flag", @@ -1379,142 +1325,9 @@ DEFUN (no_ipv6_nd_other_config_flag, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for autoconfiguration\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * - * "ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for onlink determination\n" - * "Do not use prefix for autoconfiguration\n" - * - * "ipv6 nd prefix X:X::X:X/M (router-address|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Set Router Address flag\n" - * - * "ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (router-address|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Set Router Address flag\n" - * - * "ipv6 nd prefix X:X::X:X/M", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (off-link|) (no-autoconfig|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for onlink determination\n" - * "Do not use prefix for autoconfiguration\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * - * "ipv6 nd prefix X:X::X:X/M (off-link|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for onlink determination\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (no-autoconfig|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (off-link|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for onlink determination\n" - * - * "ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) " - * "(<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * "Set Router Address flag\n" - * - */ DEFUN (ipv6_nd_prefix, ipv6_nd_prefix_cmd, - "ipv6 nd prefix X:X::X:X/M <(0-4294967295)|infinite> <(0-4294967295)|infinite> ", + "ipv6 nd prefix X:X::X:X/M [<(0-4294967295)|infinite> <(0-4294967295)|infinite>] []", "Interface IPv6 config commands\n" "Neighbor discovery\n" "Prefix information\n" @@ -1523,16 +1336,38 @@ DEFUN (ipv6_nd_prefix, "Infinite valid lifetime\n" "Preferred lifetime in seconds\n" "Infinite preferred lifetime\n" + "Set Router Address flag\n" "Do not use prefix for onlink determination\n" "Do not use prefix for autoconfiguration\n" - "Set Router Address flag\n") + "Do not use prefix for autoconfiguration\n" + "Do not use prefix for onlink determination\n") { - int idx_ipv6_prefixlen = 3; - int idx_number_infinite = 4; - int idx_number_infinite_2 = 5; - int i; + /* prelude */ + char *prefix = argv[3]->arg; + int lifetimes = (argc > 4) && (argv[4]->type == RANGE_TKN || strmatch (argv[4]->text, "infinite")); + int routeropts = lifetimes ? argc > 6 : argc > 4; + + int idx_routeropts = routeropts ? (lifetimes ? 6 : 4) : 0; + + char *lifetime = NULL, *preflifetime = NULL; + int routeraddr = 0, offlink = 0, noautoconf = 0; + if (lifetimes) + { + lifetime = argv[4]->type == RANGE_TKN ? argv[4]->arg : argv[4]->text; + preflifetime = argv[5]->type == RANGE_TKN ? argv[5]->arg : argv[5]->text; + } + if (routeropts) + { + routeraddr = strmatch (argv[idx_routeropts]->text, "router-address"); + if (!routeraddr) + { + offlink = (argc > idx_routeropts + 1 || strmatch (argv[idx_routeropts]->text, "off-link")); + noautoconf = (argc > idx_routeropts + 1 || strmatch (argv[idx_routeropts]->text, "no-autoconfig")); + } + } + + /* business */ int ret; - int cursor = 1; struct interface *ifp; struct zebra_if *zebra_if; struct rtadv_prefix rp; @@ -1540,226 +1375,64 @@ DEFUN (ipv6_nd_prefix, ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &rp.prefix); + ret = str2prefix_ipv6 (prefix, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); return CMD_WARNING; } apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */ - rp.AdvOnLinkFlag = 1; - rp.AdvAutonomousFlag = 1; - rp.AdvRouterAddressFlag = 0; + rp.AdvOnLinkFlag = !offlink; + rp.AdvAutonomousFlag = !noautoconf; + rp.AdvRouterAddressFlag = routeraddr; rp.AdvValidLifetime = RTADV_VALID_LIFETIME; rp.AdvPreferredLifetime = RTADV_PREFERRED_LIFETIME; - if (argc > 1) - { - if ((isdigit((unsigned char)argv[idx_number_infinite]->arg[0])) - || strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0) - { - if ( strncmp (argv[idx_number_infinite]->arg, "i", 1) == 0) - rp.AdvValidLifetime = UINT32_MAX; - else - rp.AdvValidLifetime = (u_int32_t) strtoll (argv[idx_number_infinite]->arg, - (char **)NULL, 10); - - if ( strncmp (argv[idx_number_infinite_2]->arg, "i", 1) == 0) - rp.AdvPreferredLifetime = UINT32_MAX; - else - rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[idx_number_infinite_2]->arg, - (char **)NULL, 10); - - if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) - { - vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE); - return CMD_WARNING; - } - cursor = cursor + 2; - } - if (argc > cursor) - { - for (i = cursor; i < argc; i++) - { - if (strncmp (argv[i], "of", 2) == 0) - rp.AdvOnLinkFlag = 0; - if (strncmp (argv[i], "no", 2) == 0) - rp.AdvAutonomousFlag = 0; - if (strncmp (argv[i], "ro", 2) == 0) - rp.AdvRouterAddressFlag = 1; - } - } - } + if (lifetimes) + { + rp.AdvValidLifetime = strmatch (lifetime, "infinite") ? UINT32_MAX : strtoll (lifetime, NULL, 10); + rp.AdvPreferredLifetime = strmatch (preflifetime, "infinite") ? UINT32_MAX : strtoll (preflifetime, NULL, 10); + if (rp.AdvPreferredLifetime > rp.AdvValidLifetime) + { + vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE); + return CMD_WARNING; + } + } rtadv_prefix_set (zebra_if, &rp); return CMD_SUCCESS; } - - - - - - - - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|) (no-autoconfig|) (router-address|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for onlink determination\n" - * "Do not use prefix for autoconfiguration\n" - * "Set Router Address flag\n" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (off-link|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for onlink determination\n" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (no-autoconfig|) (off-link|) (router-address|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * "Set Router Address flag\n" - * - * "no ipv6 nd prefix X:X::X:X/M (router-address|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Set Router Address flag\n" - * - * "no ipv6 nd prefix X:X::X:X/M (off-link|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for onlink determination\n" - * - * "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for autoconfiguration\n" - * - * "no ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for autoconfiguration\n" - * "Do not use prefix for onlink determination\n" - * - * "no ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Do not use prefix for onlink determination\n" - * "Do not use prefix for autoconfiguration\n" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite) (router-address|)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * "Set Router Address flag\n" - * - * "no ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) (<0-4294967295>|infinite)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Prefix information\n" - * "IPv6 prefix\n" - * "Valid lifetime in seconds\n" - * "Infinite valid lifetime\n" - * "Preferred lifetime in seconds\n" - * "Infinite preferred lifetime\n" - * - */ DEFUN (no_ipv6_nd_prefix, no_ipv6_nd_prefix_cmd, - "no ipv6 nd prefix IPV6PREFIX", - NO_STR + "no ipv6 nd prefix X:X::X:X/M [<(0-4294967295)|infinite> <(0-4294967295)|infinite>] []", + NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" "Prefix information\n" - "IPv6 prefix\n") + "IPv6 prefix\n" + "Valid lifetime in seconds\n" + "Infinite valid lifetime\n" + "Preferred lifetime in seconds\n" + "Infinite preferred lifetime\n" + "Set Router Address flag\n" + "Do not use prefix for onlink determination\n" + "Do not use prefix for autoconfiguration\n" + "Do not use prefix for autoconfiguration\n" + "Do not use prefix for onlink determination\n") { int ret; struct interface *ifp; struct zebra_if *zebra_if; struct rtadv_prefix rp; + char *prefix = argv[4]->arg; + ifp = (struct interface *) vty->index; zebra_if = ifp->info; - ret = str2prefix_ipv6 (argv[0], &rp.prefix); + ret = str2prefix_ipv6 (prefix, &rp.prefix); if (!ret) { vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE); @@ -1770,25 +1443,13 @@ DEFUN (no_ipv6_nd_prefix, ret = rtadv_prefix_reset (zebra_if, &rp); if (!ret) { - vty_out (vty, "Non-exist IPv6 prefix%s", VTY_NEWLINE); + vty_out (vty, "Non-existant IPv6 prefix%s", VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; } - - - - - - - - - - - - DEFUN (ipv6_nd_router_preference, ipv6_nd_router_preference_cmd, "ipv6 nd router-preference ", @@ -1820,25 +1481,16 @@ DEFUN (ipv6_nd_router_preference, return CMD_ERR_NO_MATCH; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd router-preference (high|medium|low)", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Default router preference\n" - * "High default router preference\n" - * "Low default router preference\n" - * "Medium default router preference (default)\n" - * - */ DEFUN (no_ipv6_nd_router_preference, no_ipv6_nd_router_preference_cmd, - "no ipv6 nd router-preference", + "no ipv6 nd router-preference []", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Default router preference\n") + "Default router preference\n" + "High default router preference\n" + "Medium default router preference (default)\n" + "Low default router preference\n") { struct interface *ifp; struct zebra_if *zif; @@ -1851,7 +1503,6 @@ DEFUN (no_ipv6_nd_router_preference, return CMD_SUCCESS; } - DEFUN (ipv6_nd_mtu, ipv6_nd_mtu_cmd, "ipv6 nd mtu (1-65535)", @@ -1867,23 +1518,14 @@ DEFUN (ipv6_nd_mtu, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 nd mtu <1-65535>", - * NO_STR - * "Interface IPv6 config commands\n" - * "Neighbor discovery\n" - * "Advertised MTU\n" - * "MTU in bytes\n" - * - */ DEFUN (no_ipv6_nd_mtu, no_ipv6_nd_mtu_cmd, - "no ipv6 nd mtu", + "no ipv6 nd mtu [(1-65535)]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" - "Advertised MTU\n") + "Advertised MTU\n" + "MTU in bytes\n") { struct interface *ifp = (struct interface *) vty->index; struct zebra_if *zif = ifp->info; From 8334fd5ade6980ad2eadf1c1b743bea15d4b8525 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sun, 25 Sep 2016 02:29:38 +0000 Subject: [PATCH 139/280] bgpd: fixed more CHECK MEs in bgp_vty.c Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 1613 +++++++------------------------------- tools/argv_translator.py | 69 +- 2 files changed, 322 insertions(+), 1360 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index b7fa1ce750..c7d0102a45 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1113,7 +1113,7 @@ DEFUN (bgp_maxmed_admin_medv, DEFUN (no_bgp_maxmed_admin, no_bgp_maxmed_admin_cmd, - "no bgp max-med administrative [<0-4294967294>]", + "no bgp max-med administrative [(0-4294967294)]", NO_STR BGP_STR "Advertise routes with max-med\n" @@ -1188,7 +1188,7 @@ DEFUN (bgp_maxmed_onstartup_medv, DEFUN (no_bgp_maxmed_onstartup, no_bgp_maxmed_onstartup_cmd, - "no bgp max-med on-startup [<5-86400> [<0-4294967294>]]", + "no bgp max-med on-startup [(5-86400) [(0-4294967294)]]", NO_STR BGP_STR "Advertise routes with max-med\n" @@ -2060,7 +2060,7 @@ DEFUN (bgp_bestpath_med, DEFUN (bgp_bestpath_med2, bgp_bestpath_med2_cmd, - "bgp bestpath med (confed missing-as-worst|missing-as-worst confed)", + "bgp bestpath med ", "BGP specific commands\n" "Change the default bestpath selection\n" "MED attribute\n" @@ -4838,23 +4838,14 @@ DEFUN (neighbor_port, return peer_port_vty (vty, argv[idx_ip]->arg, AFI_IP, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD "port <0-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR - * "Neighbor's BGP port\n" - * "TCP port number\n" - * - */ DEFUN (no_neighbor_port, no_neighbor_port_cmd, - NO_NEIGHBOR_CMD "port", + NO_NEIGHBOR_CMD "port [(0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR - "Neighbor's BGP port\n") + "Neighbor's BGP port\n" + "TCP port number\n") { int idx_ip = 2; return peer_port_vty (vty, argv[idx_ip]->arg, AFI_IP, NULL); @@ -4907,23 +4898,14 @@ DEFUN (neighbor_weight, return peer_weight_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "weight <0-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Set default weight for routes from this neighbor\n" - * "default weight\n" - * - */ DEFUN (no_neighbor_weight, no_neighbor_weight_cmd, - NO_NEIGHBOR_CMD2 "weight", + NO_NEIGHBOR_CMD2 "weight [(0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Set default weight for routes from this neighbor\n") + "Set default weight for routes from this neighbor\n" + "default weight\n") { int idx_peer = 2; return peer_weight_unset_vty (vty, argv[idx_peer]->arg); @@ -5028,24 +5010,15 @@ DEFUN (neighbor_timers, return peer_timers_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP per neighbor timers\n" - * "Keepalive interval\n" - * "Holdtime\n" - * - */ DEFUN (no_neighbor_timers, no_neighbor_timers_cmd, - NO_NEIGHBOR_CMD2 "timers", + NO_NEIGHBOR_CMD2 "timers [(0-65535) (0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n") + "BGP per neighbor timers\n" + "Keepalive interval\n" + "Holdtime\n") { int idx_peer = 2; return peer_timers_unset_vty (vty, argv[idx_peer]->arg); @@ -5100,25 +5073,15 @@ DEFUN (neighbor_timers_connect, return peer_timers_connect_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "timers connect <1-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP per neighbor timers\n" - * "BGP connect timer\n" - * "Connect timer\n" - * - */ DEFUN (no_neighbor_timers_connect, no_neighbor_timers_connect_cmd, - NO_NEIGHBOR_CMD2 "timers connect", + NO_NEIGHBOR_CMD2 "timers connect [(1-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n" - "BGP connect timer\n") + "BGP connect timer\n" + "Connect timer\n") { int idx_peer = 2; return peer_timers_connect_unset_vty (vty, argv[idx_peer]->arg); @@ -5161,23 +5124,14 @@ DEFUN (neighbor_advertise_interval, return peer_advertise_interval_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg, 1); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Minimum interval between sending BGP routing updates\n" - * "time in seconds\n" - * - */ DEFUN (no_neighbor_advertise_interval, no_neighbor_advertise_interval_cmd, - NO_NEIGHBOR_CMD2 "advertisement-interval", + NO_NEIGHBOR_CMD2 "advertisement-interval [(0-600)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Minimum interval between sending BGP routing updates\n") + "Minimum interval between sending BGP routing updates\n" + "time in seconds\n") { int idx_peer = 2; return peer_advertise_interval_vty (vty, argv[idx_peer]->arg, NULL, 0); @@ -5215,21 +5169,13 @@ DEFUN (bgp_set_route_map_delay_timer, return CMD_WARNING; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp route-map delay-timer <0-600>", - * NO_STR - * "Default BGP route-map delay timer\n" - * "Reset to default time to wait for processing route-map changes\n" - * "0 disables the timer, no route updates happen when route-maps change\n" - * - */ DEFUN (no_bgp_set_route_map_delay_timer, no_bgp_set_route_map_delay_timer_cmd, - "no bgp route-map delay-timer", + "no bgp route-map delay-timer [(0-600)]", NO_STR "Default BGP route-map delay timer\n" - "Reset to default time to wait for processing route-map changes\n") + "Reset to default time to wait for processing route-map changes\n" + "0 disables the timer, no route updates happen when route-maps change\n") { bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; @@ -5941,24 +5887,14 @@ DEFUN (neighbor_allowas_in, return bgp_vty_return (vty, ret); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "allowas-in <1-10>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "allow local ASN appears in aspath attribute\n" - * "Number of occurances of AS number\n" - * - */ DEFUN (no_neighbor_allowas_in, no_neighbor_allowas_in_cmd, - NO_NEIGHBOR_CMD2 "allowas-in", + NO_NEIGHBOR_CMD2 "allowas-in [(1-10)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "allow local ASN appears in aspath attribute\n") + "allow local ASN appears in aspath attribute\n" + "Number of occurances of AS number\n") { int idx_peer = 2; int ret; @@ -6145,55 +6081,33 @@ DEFUN (address_family_ipv6_safi, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "address-family vpnv4 unicast", - * "Enter Address Family command mode\n" - * "Address family\n" - * "Address Family Modifier\n" - * - */ DEFUN (address_family_vpnv4, address_family_vpnv4_cmd, - "address-family vpnv4", + "address-family vpnv4 [unicast]", "Enter Address Family command mode\n" - "Address family\n") + "Address family\n" + "Address Family Modifier\n") { vty->node = BGP_VPNV4_NODE; return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "address-family vpnv6 unicast", - * "Enter Address Family command mode\n" - * "Address family\n" - * "Address Family Modifier\n" - * - */ DEFUN (address_family_vpnv6, address_family_vpnv6_cmd, - "address-family vpnv6", + "address-family vpnv6 [unicast]", "Enter Address Family command mode\n" - "Address family\n") + "Address family\n" + "Address Family Modifier\n") { vty->node = BGP_VPNV6_NODE; return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "address-family encapv4", - * "Enter Address Family command mode\n" - * "Address family\n" - * - */ DEFUN (address_family_encap, address_family_encap_cmd, - "address-family encap", + "address-family ", "Enter Address Family command mode\n" + "Address family\n" "Address family\n") { vty->node = BGP_ENCAP_NODE; @@ -6323,35 +6237,29 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, * "Address family\n" * "Clear all peers\n" * - * "clear ip bgp " BGP_INSTANCE_CMD " *", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * * "clear bgp ipv6 *", * CLEAR_STR * BGP_STR * "Address family\n" * "Clear all peers\n" - * - * "clear bgp " BGP_INSTANCE_CMD " *", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear ip bgp *", + "clear ip bgp [ WORD] *", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all peers\n") { - return bgp_clear_vty (vty, argv[4]->arg, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf = NULL; + + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); } /* @@ -6374,7 +6282,7 @@ DEFUN (clear_ip_bgp_peer, int idx_view_vrf = 3; int idx_vrf = 4; int idx_peer = 5; - char *vrf_name = NULL; + char *vrf = NULL; enum clear_sort clearer; if (!strmatch(argv[idx_ip]->text, "ip")) @@ -6385,7 +6293,7 @@ DEFUN (clear_ip_bgp_peer, } if (argv[idx_view_vrf]->type == WORD_TKN) - vrf_name = argv[idx_vrf]->arg; + vrf = argv[idx_vrf]->arg; else idx_peer -= 2; @@ -6400,7 +6308,7 @@ DEFUN (clear_ip_bgp_peer, clearer = clear_peer; } - return bgp_clear_vty (vty, vrf_name, 0, 0, clearer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); + return bgp_clear_vty (vty, vrf, 0, 0, clearer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); } /* @@ -6430,7 +6338,7 @@ DEFUN (clear_ip_bgp_external, int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; - char *vrf_name = NULL; + char *vrf = NULL; if (!strmatch(argv[idx_ip]->text, "ip")) { @@ -6439,9 +6347,9 @@ DEFUN (clear_ip_bgp_external, } if (argv[idx_view_vrf]->type == WORD_TKN) - vrf_name = argv[idx_vrf]->arg; + vrf = argv[idx_vrf]->arg; - return bgp_clear_vty (vty, vrf_name, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); + return bgp_clear_vty (vty, vrf, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); } DEFUN (clear_ip_bgp_prefix, @@ -6458,7 +6366,7 @@ DEFUN (clear_ip_bgp_prefix, int idx_view_vrf = 3; int idx_vrf = 4; int idx_ipv4_prefixlen = 6; - char *vrf_name = NULL; + char *vrf = NULL; if (!strmatch(argv[idx_ip]->text, "ip")) { @@ -6468,11 +6376,11 @@ DEFUN (clear_ip_bgp_prefix, } if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf_name = argv[idx_vrf]->arg; + vrf = argv[idx_vrf]->arg; else idx_ipv4_prefixlen -= 2; - return bgp_clear_prefix (vty, vrf_name, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, vrf, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); } /* @@ -6505,7 +6413,7 @@ DEFUN (clear_ip_bgp_as, int idx_view_vrf = 3; int idx_vrf = 4; int idx_number = 3; - char *vrf_name = NULL; + char *vrf = NULL; if (!strmatch(argv[idx_ip]->text, "ip")) { @@ -6515,11 +6423,11 @@ DEFUN (clear_ip_bgp_as, } if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf_name = argv[idx_vrf]->arg; + vrf = argv[idx_vrf]->arg; else idx_number -= 2; - return bgp_clear_vty (vty, vrf_name, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); + return bgp_clear_vty (vty, vrf, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); } /* Outbound soft-reconfiguration */ @@ -6536,12 +6444,12 @@ DEFUN (clear_ip_bgp_all_soft_out, { int idx_view_vrf = 3; int idx_vrf = 4; - char *vrf_name = NULL; + char *vrf = NULL; if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf_name = argv[idx_vrf]->arg; + vrf = argv[idx_vrf]->arg; - return bgp_clear_vty (vty, vrf_name, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); } DEFUN (clear_ip_bgp_all_ipv4_soft_out, @@ -6622,77 +6530,26 @@ DEFUN (clear_ip_bgp_all_encap_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 * soft out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " * soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 * out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp * out", - * CLEAR_STR - * BGP_STR - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " * out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_OUT_STR - * - */ +/* neither 'ipv6' or 'soft' do anything here */ DEFUN (clear_bgp_all_soft_out, clear_bgp_all_soft_out_cmd, - "clear bgp * soft out", + "clear bgp [ WORD] [ipv6] * [soft] out", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR + IPV6_STR "Clear all peers\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); + int idx_view_vrf = 2; + int idx_vrf = 3; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); } @@ -6735,73 +6592,35 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear ip bgp (A.B.C.D|WORD) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_peer_soft_out, clear_ip_bgp_peer_soft_out_cmd, - "clear ip bgp soft out", + "clear ip bgp [ WORD] [soft] out", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "BGP neighbor address to clear\n" "BGP neighbor on interface to clear\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - int idx_ipv4_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[2]); + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_ipv4_word = 5; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + idx_ipv4_word -= 2; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, clear_ip_bgp_peer_ipv4_soft_out_cmd, - "clear ip bgp ipv4 soft out", + "clear ip bgp ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6823,24 +6642,9 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft out", + "clear ip bgp " BGP_INSTANCE_CMD " ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6865,22 +6669,9 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, } /* NOTE: WORD peers have not been tested for vpnv4 */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family Modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, clear_ip_bgp_peer_vpnv4_soft_out_cmd, - "clear ip bgp vpnv4 unicast soft out", + "clear ip bgp vpnv4 unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6896,22 +6687,9 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp A.B.C.D encap unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "Address family\n" - * "Address Family Modifier\n" - * "Soft reconfig outbound update\n" - * - */ DEFUN (clear_ip_bgp_peer_encap_soft_out, clear_ip_bgp_peer_encap_soft_out_cmd, - "clear ip bgp A.B.C.D encap unicast soft out", + "clear ip bgp A.B.C.D encap unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6926,174 +6704,69 @@ DEFUN (clear_ip_bgp_peer_encap_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_ipv4]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp (A.B.C.D|X:X::X:X|WORD) out", - * CLEAR_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_bgp_peer_soft_out, clear_bgp_peer_soft_out_cmd, - "clear bgp soft out", + "clear bgp [ WORD] [ipv6] [soft] out", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR + IPV6_STR "BGP neighbor address to clear\n" "BGP IPv6 neighbor to clear\n" "BGP neighbor on interface to clear\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - int idx_peer = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[2]); + int idx_view_vrf = 2; + int idx_vrf = 3; + int idx_ipv6 = 4; + int idx_peer = 5; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + { + idx_peer -= 2; + idx_ipv6 -= 2; + } + + if (! strmatch(argv[idx_ipv6]->text, "ipv6")) + idx_peer--; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_OUT, argv[idx_peer]->arg); } - - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp peer-group WORD out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_peer_group_soft_out, clear_ip_bgp_peer_group_soft_out_cmd, - "clear ip bgp peer-group WORD soft out", + "clear ip bgp [ WORD] peer-group WORD [soft] out", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all members of peer-group\n" "BGP peer-group name\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { + int idx_view_vrf = 2; + int idx_vrf = 3; int idx_word = 4; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[2]); + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + idx_word -= 2; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, clear_ip_bgp_peer_group_ipv4_soft_out_cmd, - "clear ip bgp peer-group WORD ipv4 soft out", + "clear ip bgp peer-group WORD ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7115,24 +6788,9 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft out", + "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7156,161 +6814,63 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_word_2]->arg); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 peer-group WORD soft out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp peer-group WORD out", - * CLEAR_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 peer-group WORD out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_bgp_peer_group_soft_out, clear_bgp_peer_group_soft_out_cmd, - "clear bgp peer-group WORD soft out", + "clear bgp [ WORD] [ipv6] peer-group WORD [soft] out", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all members of peer-group\n" "BGP peer-group name\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - int idx_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[2]); + int idx_view_vrf = 2; + int idx_vrf = 3; + int idx_ipv6 = 4; + int idx_word = 6; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + { + idx_ipv6 -= 2; + idx_word -= 2; + } + + if (!strmatch(argv[idx_ipv6]->text, "ipv6")) + idx_word--; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_group, BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); } - - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " external soft out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " external out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - * "clear ip bgp external out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_external_soft_out, clear_ip_bgp_external_soft_out_cmd, - "clear ip bgp external soft out", + "clear ip bgp [ WORD] external [soft] out", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all external peers\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp external ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all external peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_external_ipv4_soft_out, clear_ip_bgp_external_ipv4_soft_out_cmd, - "clear ip bgp external ipv4 soft out", + "clear ip bgp external ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7330,23 +6890,9 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, clear_ip_bgp_instance_external_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft out", + "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7368,153 +6914,55 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, NULL); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 external WORD out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " external soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " external out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 external soft out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp external out", - * CLEAR_STR - * BGP_STR - * "Clear all external peers\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_bgp_external_soft_out, clear_bgp_external_soft_out_cmd, - "clear bgp external soft out", + "clear bgp [ WORD] [ipv6] external [soft] out", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all external peers\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); + int idx_view_vrf = 2; + int idx_vrf = 3; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_OUT, NULL); } - - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " CMD_AS_RANGE " out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " soft out", + "clear ip bgp [ WORD] " CMD_AS_RANGE " [soft] out", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear peers with the AS number\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - int idx_number = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[2]); + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_asn = 5; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + idx_asn -= 2; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[idx_asn]->arg); } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 soft out", + "clear ip bgp " CMD_AS_RANGE " ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7535,23 +6983,9 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, clear_ip_bgp_instance_as_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft out", + "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7574,23 +7008,9 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7605,22 +7025,9 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " encap unicast out", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Soft reconfig outbound update\n" - * - */ DEFUN (clear_ip_bgp_as_encap_soft_out, clear_ip_bgp_as_encap_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", + "clear ip bgp " CMD_AS_RANGE " encap unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7635,171 +7042,81 @@ DEFUN (clear_ip_bgp_as_encap_soft_out, BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 " CMD_AS_RANGE " soft out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " CMD_AS_RANGE " out", - * CLEAR_STR - * BGP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp ipv6 " CMD_AS_RANGE " out", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_OUT_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_OUT_STR - * - */ DEFUN (clear_bgp_as_soft_out, clear_bgp_as_soft_out_cmd, - "clear bgp " CMD_AS_RANGE " soft out", + "clear bgp [ WORD] [ipv6] " CMD_AS_RANGE " [soft] out", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR + IPV6_STR "Clear peers with the AS number\n" BGP_SOFT_STR BGP_SOFT_OUT_STR) { - int idx_number = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[2]); + int idx_view_vrf = 2; + int idx_vrf = 3; + int idx_asn = 4; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + idx_asn -= 2; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_as, + BGP_CLEAR_SOFT_OUT, argv[idx_asn]->arg); } - - - - - - /* Inbound soft-reconfiguration */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " * in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " * soft in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear ip bgp * in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_all_soft_in, clear_ip_bgp_all_soft_in_cmd, - "clear ip bgp * soft in", + "clear ip bgp [ WORD] * [soft] in", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all peers\n" BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); } - - DEFUN (clear_ip_bgp_all_in_prefix_filter, clear_ip_bgp_all_in_prefix_filter_cmd, - "clear ip bgp * in prefix-filter", + "clear ip bgp [ WORD] * in prefix-filter", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all peers\n" BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") { - if (argc== 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); + int idx_view_vrf = 3; + int idx_vrf = 4; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_all_ipv4_soft_in, clear_ip_bgp_all_ipv4_soft_in_cmd, - "clear ip bgp * ipv4 soft in", + "clear ip bgp * ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7819,23 +7136,9 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, clear_ip_bgp_instance_all_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft in", + "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7881,21 +7184,9 @@ DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * vpnv4 unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family Modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_all_vpnv4_soft_in, clear_ip_bgp_all_vpnv4_soft_in_cmd, - "clear ip bgp * vpnv4 unicast soft in", + "clear ip bgp * vpnv4 unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7909,22 +7200,9 @@ DEFUN (clear_ip_bgp_all_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp * encap unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all peers\n" - * "Address family\n" - * "Address Family Modifier\n" - * "Soft reconfig inbound update\n" - * - */ DEFUN (clear_ip_bgp_all_encap_soft_in, clear_ip_bgp_all_encap_soft_in_cmd, - "clear ip bgp * encap unicast soft in", + "clear ip bgp * encap unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7938,103 +7216,34 @@ DEFUN (clear_ip_bgp_all_encap_soft_in, BGP_CLEAR_SOFT_IN, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 * soft in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp * in", - * CLEAR_STR - * BGP_STR - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " * in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 * in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " * soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_bgp_all_soft_in, clear_bgp_all_soft_in_cmd, - "clear bgp * soft in", + "clear bgp [ WORD] [ipv6] * [soft] in", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR "Clear all peers\n" BGP_SOFT_STR BGP_SOFT_IN_STR) { - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); + // dwalton + int idx_view_vrf = 2; + int idx_vrf = 3; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); } - - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 * in prefix-filter", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_IN_STR - * "Push out prefix-list ORF and do inbound soft reconfig\n" - * - */ DEFUN (clear_bgp_all_in_prefix_filter, clear_bgp_all_in_prefix_filter_cmd, - "clear bgp * in prefix-filter", + "clear bgp [ipv6] * in prefix-filter", CLEAR_STR BGP_STR + IPV6_STR "Clear all peers\n" BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n") @@ -8043,60 +7252,33 @@ DEFUN (clear_bgp_all_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear ip bgp (A.B.C.D|WORD) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_peer_soft_in, clear_ip_bgp_peer_soft_in_cmd, - "clear ip bgp soft in", + "clear ip bgp [ WORD] [soft] in", CLEAR_STR IP_STR BGP_STR + BGP_INSTANCE_HELP_STR "BGP neighbor address to clear\n" "BGP neighbor on interface to clear\n" BGP_SOFT_STR BGP_SOFT_IN_STR) { + int idx_view_vrf = 2; + int idx_vrf = 3; int idx_ipv4_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[2]); + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + idx_ipv4_word -= 2; + + return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } - - DEFUN (clear_ip_bgp_peer_in_prefix_filter, clear_ip_bgp_peer_in_prefix_filter_cmd, "clear ip bgp in prefix-filter", @@ -8113,23 +7295,9 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, clear_ip_bgp_peer_ipv4_soft_in_cmd, - "clear ip bgp ipv4 soft in", + "clear ip bgp ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8151,24 +7319,9 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft in", + "clear ip bgp " BGP_INSTANCE_CMD " ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8218,22 +7371,9 @@ DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * "Address family\n" - * "Address Family Modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, clear_ip_bgp_peer_vpnv4_soft_in_cmd, - "clear ip bgp vpnv4 unicast soft in", + "clear ip bgp vpnv4 unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8249,22 +7389,9 @@ DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp A.B.C.D encap unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "Address family\n" - * "Address Family Modifier\n" - * "Soft reconfig inbound update\n" - * - */ DEFUN (clear_ip_bgp_peer_encap_soft_in, clear_ip_bgp_peer_encap_soft_in_cmd, - "clear ip bgp A.B.C.D encap unicast soft in", + "clear ip bgp A.B.C.D encap unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8279,104 +7406,40 @@ DEFUN (clear_ip_bgp_peer_encap_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_ipv4]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp (A.B.C.D|X:X::X:X|WORD) in", - * CLEAR_STR - * BGP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_bgp_peer_soft_in, clear_bgp_peer_soft_in_cmd, - "clear bgp soft in", + "clear bgp [ WORD] [ipv6] [soft] in", CLEAR_STR BGP_STR + BGP_INSTANCE_HELP_STR "BGP neighbor address to clear\n" "BGP IPv6 neighbor to clear\n" "BGP neighbor on interface to clear\n" BGP_SOFT_STR BGP_SOFT_IN_STR) { - int idx_peer = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[2]); + int idx_view_vrf = 2; + int idx_vrf = 3; + int idx_ipv6 = 4; + int idx_peer = 5; + char *vrf = NULL; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + else + { + idx_ipv6 -= 2; + idx_peer -= 2; + } + + if (!strmatch(argv[idx_ipv6]->text, "ipv6")) + idx_peer--; + + return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_peer, BGP_CLEAR_SOFT_IN, argv[idx_peer]->arg); } - - - - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", @@ -8476,23 +7539,9 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, clear_ip_bgp_peer_group_ipv4_soft_in_cmd, - "clear ip bgp peer-group WORD ipv4 soft in", + "clear ip bgp peer-group WORD ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8514,24 +7563,9 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft in", + "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8663,13 +7697,6 @@ DEFUN (clear_bgp_peer_group_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); } - - - - - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp ipv6 peer-group WORD in prefix-filter", @@ -8760,22 +7787,9 @@ DEFUN (clear_ip_bgp_external_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp external ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all external peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_external_ipv4_soft_in, clear_ip_bgp_external_ipv4_soft_in_cmd, - "clear ip bgp external ipv4 soft in", + "clear ip bgp external ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8795,23 +7809,9 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, BGP_CLEAR_SOFT_IN, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, clear_ip_bgp_instance_external_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft in", + "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8930,13 +7930,6 @@ DEFUN (clear_bgp_external_soft_in, BGP_CLEAR_SOFT_IN, NULL); } - - - - - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp ipv6 external in prefix-filter", @@ -9008,9 +8001,6 @@ DEFUN (clear_ip_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } - - - DEFUN (clear_ip_bgp_as_in_prefix_filter, clear_ip_bgp_as_in_prefix_filter_cmd, "clear ip bgp " CMD_AS_RANGE " in prefix-filter", @@ -9026,22 +8016,9 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 soft in", + "clear ip bgp " CMD_AS_RANGE " ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -9062,23 +8039,9 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, clear_ip_bgp_instance_as_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft in", + "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -9101,8 +8064,6 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } - - DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, "clear ip bgp " CMD_AS_RANGE " ipv4 in prefix-filter", @@ -9126,21 +8087,9 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * BGP_SOFT_IN_STR - * - */ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -9155,22 +8104,9 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " encap unicast in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * "Address family\n" - * "Address Family modifier\n" - * "Soft reconfig inbound update\n" - * - */ DEFUN (clear_ip_bgp_as_encap_soft_in, clear_ip_bgp_as_encap_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", + "clear ip bgp " CMD_AS_RANGE " encap unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -9185,7 +8121,6 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp ipv6 " CMD_AS_RANGE " in", @@ -9260,13 +8195,6 @@ DEFUN (clear_bgp_as_soft_in, BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); } - - - - - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", @@ -9322,8 +8250,6 @@ DEFUN (clear_ip_bgp_all_soft, BGP_CLEAR_SOFT_BOTH, NULL); } - - DEFUN (clear_ip_bgp_all_ipv4_soft, clear_ip_bgp_all_ipv4_soft_cmd, "clear ip bgp * ipv4 soft", @@ -9439,9 +8365,6 @@ DEFUN (clear_bgp_all_soft, BGP_CLEAR_SOFT_BOTH, NULL); } - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", @@ -9734,9 +8657,6 @@ DEFUN (clear_bgp_peer_group_soft, BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); } - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear ip bgp " BGP_INSTANCE_CMD " external soft", @@ -9851,9 +8771,6 @@ DEFUN (clear_bgp_external_soft, BGP_CLEAR_SOFT_BOTH, NULL); } - - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", @@ -16755,4 +15672,4 @@ community_list_vty (void) install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); -} +T } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 7998baaee9..a35f0e0821 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -1,5 +1,28 @@ #!/usr/bin/env python +""" +Usage: + + argv_translator.py rebuild-defuns [] + argv_translator.py idx-logic + +Help: + rebuild-defuns : foo + +""" + +# This script did different things at different times as we migrated code +# to quentin's parse engine. The following were its rebuild-defuns phases: +# +# - originally was used to change all of the argv[2] to argv[4]->arg. This +# calculated the new argv index and added the ->arg. +# - next it was used to replace the 4 in argv[4]->arg with an idx_foo variable +# +# idx-logic +# - used to take a command string and build out an idx_ logic skeleton +# + +import argparse import re import sys import os @@ -7,6 +30,7 @@ import subprocess from collections import OrderedDict from copy import deepcopy from pprint import pformat, pprint +from network_docopt import NetworkDocopt, get_network_docopt_info def token_is_variable(line_number, token): @@ -475,6 +499,12 @@ def get_command_string_index_variable_table(line_number, line): return indexes + +def get_idx_logic(wildcard): + # dwalton + return None + + def expand_command_string(line): # in the middle @@ -697,6 +727,13 @@ DEFUN (no_bgp_maxmed_onstartup, lines.extend(self.help_strings) lines.append('{\n') + lines.extend(self.guts) + + ''' + This is no longer used but was used to do the "- next it was used to + replace the 4 in argv[4]->arg with an idx_foo variable" run mentioned + at the top of this file. + # only print the variables that will be used else we get a compile error idx_table = get_command_string_index_variable_table(self.line_number, new_command_string_expanded) idx_table_used = self.get_used_idx_variables(idx_table) @@ -715,6 +752,7 @@ DEFUN (no_bgp_maxmed_onstartup, lines.append(line) else: lines.append(line) + ''' lines.append('}\n') return ''.join(lines) @@ -802,11 +840,9 @@ def update_argvs(filename): lines.append(line) - for defun in defuns.itervalues(): defun.sanity_check() - # Now write the file but allow the DEFUN object to update the contents of the DEFUN () with open(filename, 'w') as fh: state = None @@ -832,16 +868,25 @@ def update_argvs(filename): state = None - if __name__ == '__main__': + (print_options, ended_with_space, sys.argv) = get_network_docopt_info(sys.argv) + cli = NetworkDocopt(__doc__) - if len(sys.argv) == 2: - filename = sys.argv[1] - update_argvs(filename) - + if print_options: + cli.print_options(ended_with_space) else: - output = subprocess.check_output("grep -l DEFUN *.c", shell=True).splitlines() - for filename in output: - filename = filename.strip() - print "crunching %s" % filename - update_argvs(filename) + cli.run() + + if cli.get('rebuild-defuns'): + if cli.get(''): + filename = cli.get('') + update_argvs(filename) + + else: + output = subprocess.check_output("grep -l DEFUN *.c", shell=True).splitlines() + for filename in output: + filename = filename.strip() + print "crunching %s" % filename + update_argvs(filename) + elif cli.get('idx-logic'): + print get_idx_logic(cli.args.get('')) From 92300491f60ef24128054bbf42b1b22ed12f2f9e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sun, 25 Sep 2016 03:00:04 +0000 Subject: [PATCH 140/280] zebra: CHECK ME fixes Signed-off-by: Daniel Walton --- ospf6d/ospf6_asbr.c | 7 +++++ ospf6d/ospf6d.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ zebra/interface.c | 1 - zebra/router-id.c | 46 ++++++++++------------------ 4 files changed, 95 insertions(+), 32 deletions(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 014320a2f8..c35b30a65b 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1421,3 +1421,10 @@ config_write_ospf6_debug_asbr (struct vty *vty) } void +install_element_ospf6_debug_asbr () +{ + install_element (ENABLE_NODE, &debug_ospf6_asbr_cmd); + install_element (ENABLE_NODE, &no_debug_ospf6_asbr_cmd); + install_element (CONFIG_NODE, &debug_ospf6_asbr_cmd); + install_element (CONFIG_NODE, &no_debug_ospf6_asbr_cmd); +} diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index c72dde0acf..b572288851 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -1790,3 +1790,76 @@ ospf6_init (void) ospf6_bfd_init(); install_node (&debug_node, config_write_ospf6_debug); + install_element_ospf6_debug_message (); + install_element_ospf6_debug_lsa (); + install_element_ospf6_debug_interface (); + install_element_ospf6_debug_neighbor (); + install_element_ospf6_debug_zebra (); + install_element_ospf6_debug_spf (); + install_element_ospf6_debug_route (); + install_element_ospf6_debug_brouter (); + install_element_ospf6_debug_asbr (); + install_element_ospf6_debug_abr (); + install_element_ospf6_debug_flood (); + + install_element_ospf6_clear_interface (); + + install_element (VIEW_NODE, &show_version_ospf6_cmd); + install_element (ENABLE_NODE, &show_version_ospf6_cmd); + + install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); + install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd); + + install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); + install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); + install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd); + install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); + +#define INSTALL(n,c) \ + install_element (n ## _NODE, &show_ipv6_ospf6_ ## c) + + INSTALL (VIEW, database_cmd); + INSTALL (VIEW, database_type_cmd); + INSTALL (VIEW, database_id_cmd); + INSTALL (VIEW, database_router_cmd); + INSTALL (VIEW, database_type_id_cmd); + INSTALL (VIEW, database_type_router_cmd); + INSTALL (VIEW, database_adv_router_linkstate_id_cmd); + INSTALL (VIEW, database_id_router_cmd); + INSTALL (VIEW, database_type_id_router_cmd); + INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd); + INSTALL (VIEW, database_self_originated_cmd); + INSTALL (VIEW, database_type_self_originated_cmd); + INSTALL (VIEW, database_type_id_self_originated_cmd); + INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd); + + INSTALL (ENABLE, database_cmd); + INSTALL (ENABLE, database_type_cmd); + INSTALL (ENABLE, database_id_cmd); + INSTALL (ENABLE, database_router_cmd); + INSTALL (ENABLE, database_type_id_cmd); + INSTALL (ENABLE, database_type_router_cmd); + INSTALL (ENABLE, database_adv_router_linkstate_id_cmd); + INSTALL (ENABLE, database_id_router_cmd); + INSTALL (ENABLE, database_type_id_router_cmd); + INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd); + INSTALL (ENABLE, database_self_originated_cmd); + INSTALL (ENABLE, database_type_self_originated_cmd); + INSTALL (ENABLE, database_type_id_self_originated_cmd); + INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd); + + /* Make ospf protocol socket. */ + ospf6_serv_sock (); + thread_add_read (master, ospf6_receive, NULL, ospf6_sock); +} + +void +ospf6_clean (void) +{ + if (!ospf6) + return; + if (ospf6->route_table) + ospf6_route_remove_all (ospf6->route_table); + if (ospf6->brouter_table) + ospf6_route_remove_all (ospf6->brouter_table); +} diff --git a/zebra/interface.c b/zebra/interface.c index 26315bd6c7..d1f21c17b3 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -2987,7 +2987,6 @@ zebra_if_init (void) install_element (ENABLE_NODE, &show_interface_desc_vrf_all_cmd); install_element (CONFIG_NODE, &zebra_interface_cmd); install_element (CONFIG_NODE, &no_interface_cmd); - install_element (CONFIG_NODE, &no_interface_vrf_cmd); install_default (INTERFACE_NODE); install_element (INTERFACE_NODE, &interface_desc_cmd); install_element (INTERFACE_NODE, &no_interface_desc_cmd); diff --git a/zebra/router-id.c b/zebra/router-id.c index 6e1d434ec4..23b8cc743c 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -214,21 +214,16 @@ router_id_write (struct vty *vty) } } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "router-id A.B.C.D " VRF_CMD_STR, - * "Manually set the router-id\n" - * "IP address to use for router-id\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (router_id, router_id_cmd, - "router-id A.B.C.D", + "router-id A.B.C.D [vrf NAME]", "Manually set the router-id\n" - "IP address to use for router-id\n") + "IP address to use for router-id\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 1; + int idx_name = 3; + struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; @@ -239,35 +234,24 @@ DEFUN (router_id, rid.prefixlen = 32; rid.family = AF_INET; - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (argc > 2) + VRF_GET_ID (vrf_id, argv[idx_name]->arg); router_id_set (&rid, vrf_id); return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no router-id A.B.C.D", - * NO_STR - * "Remove the manually configured router-id\n" - * "IP address to use for router-id\n" - * - * "no router-id A.B.C.D " VRF_CMD_STR, - * NO_STR - * "Remove the manually configured router-id\n" - * "IP address to use for router-id\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (no_router_id, no_router_id_cmd, - "no router-id", + "no router-id [A.B.C.D [vrf NAME]]", NO_STR - "Remove the manually configured router-id\n") + "Remove the manually configured router-id\n" + "IP address to use for router-id\n" + VRF_CMD_HELP_STR) { + int idx_name = 4; + struct prefix rid; vrf_id_t vrf_id = VRF_DEFAULT; @@ -275,8 +259,8 @@ DEFUN (no_router_id, rid.prefixlen = 0; rid.family = AF_INET; - if (argc > 1) - VRF_GET_ID (vrf_id, argv[1]); + if (argc > 3) + VRF_GET_ID (vrf_id, argv[idx_name]->arg); router_id_set (&rid, vrf_id); From 9ccf14f739123d3fa6aa89f12749c56da86c2992 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sun, 25 Sep 2016 14:10:48 +0000 Subject: [PATCH 141/280] Expand #defines in command strings Signed-off-by: Daniel Walton --- bgpd/bgp_bfd.c | 6 +- bgpd/bgp_nexthop.c | 6 +- bgpd/bgp_route.c | 116 ++++----- bgpd/bgp_routemap.c | 12 +- bgpd/bgp_vty.c | 518 +++++++++++++++++++-------------------- isisd/isis_redist.c | 4 +- lib/command.c | 6 +- lib/if.c | 2 +- ospf6d/ospf6_asbr.c | 8 +- ospf6d/ospf6_bfd.c | 2 +- ospfd/ospf_bfd.c | 4 +- ospfd/ospf_vty.c | 32 +-- pimd/pim_cmd.c | 16 +- ripd/rip_zebra.c | 16 +- ripngd/ripng_zebra.c | 16 +- tools/argv_translator.py | 39 ++- zebra/interface.c | 12 +- zebra/zebra_routemap.c | 16 +- zebra/zebra_vty.c | 210 ++++++++-------- 19 files changed, 529 insertions(+), 512 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 170b207a85..bb8f4ceeea 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -555,7 +555,7 @@ bgp_bfd_show_info(struct vty *vty, struct peer *peer, u_char use_json, json_obje DEFUN (neighbor_bfd, neighbor_bfd_cmd, - NEIGHBOR_CMD2 "bfd", + "neighbor bfd", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n") @@ -578,7 +578,7 @@ DEFUN (neighbor_bfd, DEFUN (neighbor_bfd_param, neighbor_bfd_param_cmd, - NEIGHBOR_CMD2 "bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + "neighbor bfd (2-255) (50-60000) (50-60000)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" @@ -652,7 +652,7 @@ DEFUN_HIDDEN (neighbor_bfd_type, */ DEFUN (no_neighbor_bfd, no_neighbor_bfd_cmd, - NO_NEIGHBOR_CMD2 "bfd", + "no neighbor bfd", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index e648af91e7..f59971c1b8 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -513,7 +513,7 @@ DEFUN (show_ip_bgp_nexthop_detail, DEFUN (show_ip_bgp_instance_nexthop, show_ip_bgp_instance_nexthop_cmd, - "show ip bgp " BGP_INSTANCE_CMD " nexthop", + "show ip bgp WORD nexthop", SHOW_STR IP_STR BGP_STR @@ -526,7 +526,7 @@ DEFUN (show_ip_bgp_instance_nexthop, DEFUN (show_ip_bgp_instance_all_nexthop, show_ip_bgp_instance_all_nexthop_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " nexthop", + "show ip bgp all nexthop", SHOW_STR IP_STR BGP_STR @@ -539,7 +539,7 @@ DEFUN (show_ip_bgp_instance_all_nexthop, DEFUN (show_ip_bgp_instance_nexthop_detail, show_ip_bgp_instance_nexthop_detail_cmd, - "show ip bgp " BGP_INSTANCE_CMD " nexthop detail", + "show ip bgp WORD nexthop detail", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6238f28dda..14aaf7eebb 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8444,7 +8444,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_prefix, DEFUN (show_ip_bgp_view, show_ip_bgp_instance_cmd, - "show ip bgp " BGP_INSTANCE_CMD " [json]", + "show ip bgp WORD [json]", SHOW_STR IP_STR BGP_STR @@ -8467,7 +8467,7 @@ DEFUN (show_ip_bgp_view, DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " [json]", + "show ip bgp all [json]", SHOW_STR IP_STR BGP_STR @@ -8482,7 +8482,7 @@ DEFUN (show_ip_bgp_instance_all, DEFUN (show_ip_bgp_instance_route, show_ip_bgp_instance_route_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D [json]", + "show ip bgp WORD A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8497,7 +8497,7 @@ DEFUN (show_ip_bgp_instance_route, DEFUN (show_ip_bgp_instance_route_pathtype, show_ip_bgp_instance_route_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D [json]", + "show ip bgp WORD A.B.C.D [json]", SHOW_STR IP_STR BGP_STR @@ -8520,7 +8520,7 @@ DEFUN (show_ip_bgp_instance_route_pathtype, DEFUN (show_ip_bgp_instance_prefix, show_ip_bgp_instance_prefix_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M [json]", + "show ip bgp WORD A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8535,7 +8535,7 @@ DEFUN (show_ip_bgp_instance_prefix, DEFUN (show_ip_bgp_instance_prefix_pathtype, show_ip_bgp_instance_prefix_pathtype_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M [json]", + "show ip bgp WORD A.B.C.D/M [json]", SHOW_STR IP_STR BGP_STR @@ -8836,7 +8836,7 @@ DEFUN (show_ipv6_bgp_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 [json]", + * "show bgp WORD ipv6 [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8846,7 +8846,7 @@ DEFUN (show_ipv6_bgp_prefix, */ DEFUN (show_bgp_view, show_bgp_instance_cmd, - "show bgp " BGP_INSTANCE_CMD " [json]", + "show bgp WORD [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8868,7 +8868,7 @@ DEFUN (show_bgp_view, DEFUN (show_bgp_instance_all, show_bgp_instance_all_cmd, - "show bgp " BGP_INSTANCE_ALL_CMD " [json]", + "show bgp all [json]", SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR @@ -8883,7 +8883,7 @@ DEFUN (show_bgp_instance_all, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X [json]", + * "show bgp WORD ipv6 X:X::X:X [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8894,7 +8894,7 @@ DEFUN (show_bgp_instance_all, */ DEFUN (show_bgp_instance_route, show_bgp_instance_route_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X [json]", + "show bgp WORD X:X::X:X [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8909,7 +8909,7 @@ DEFUN (show_bgp_instance_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X (bestpath|multipath) [json]", + * "show bgp WORD ipv6 X:X::X:X (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8922,7 +8922,7 @@ DEFUN (show_bgp_instance_route, */ DEFUN (show_bgp_instance_route_pathtype, show_bgp_instance_route_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X [json]", + "show bgp WORD X:X::X:X [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8944,7 +8944,7 @@ DEFUN (show_bgp_instance_route_pathtype, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M [json]", + * "show bgp WORD ipv6 X:X::X:X/M [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8955,7 +8955,7 @@ DEFUN (show_bgp_instance_route_pathtype, */ DEFUN (show_bgp_instance_prefix, show_bgp_instance_prefix_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M [json]", + "show bgp WORD X:X::X:X/M [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -8970,7 +8970,7 @@ DEFUN (show_bgp_instance_prefix, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M (bestpath|multipath) [json]", + * "show bgp WORD ipv6 X:X::X:X/M (bestpath|multipath) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8983,7 +8983,7 @@ DEFUN (show_bgp_instance_prefix, */ DEFUN (show_bgp_instance_prefix_pathtype, show_bgp_instance_prefix_pathtype_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M [json]", + "show bgp WORD X:X::X:X/M [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9005,7 +9005,7 @@ DEFUN (show_bgp_instance_prefix_pathtype, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 prefix-list WORD", + * "show bgp WORD ipv6 prefix-list WORD", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9016,7 +9016,7 @@ DEFUN (show_bgp_instance_prefix_pathtype, */ DEFUN (show_bgp_instance_prefix_list, show_bgp_instance_prefix_list_cmd, - "show bgp " BGP_INSTANCE_CMD " prefix-list WORD", + "show bgp WORD prefix-list WORD", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9032,7 +9032,7 @@ DEFUN (show_bgp_instance_prefix_list, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 filter-list WORD", + * "show bgp WORD ipv6 filter-list WORD", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9043,7 +9043,7 @@ DEFUN (show_bgp_instance_prefix_list, */ DEFUN (show_bgp_instance_filter_list, show_bgp_instance_filter_list_cmd, - "show bgp " BGP_INSTANCE_CMD " filter-list WORD", + "show bgp WORD filter-list WORD", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9059,7 +9059,7 @@ DEFUN (show_bgp_instance_filter_list, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 route-map WORD", + * "show bgp WORD ipv6 route-map WORD", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9070,7 +9070,7 @@ DEFUN (show_bgp_instance_filter_list, */ DEFUN (show_bgp_instance_route_map, show_bgp_instance_route_map_cmd, - "show bgp " BGP_INSTANCE_CMD " route-map WORD", + "show bgp WORD route-map WORD", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9086,7 +9086,7 @@ DEFUN (show_bgp_instance_route_map, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 community-list (<1-500>|WORD)", + * "show bgp WORD ipv6 community-list (<1-500>|WORD)", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9098,7 +9098,7 @@ DEFUN (show_bgp_instance_route_map, */ DEFUN (show_bgp_instance_community_list, show_bgp_instance_community_list_cmd, - "show bgp " BGP_INSTANCE_CMD " community-list <(1-500)|WORD>", + "show bgp WORD community-list <(1-500)|WORD>", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9114,7 +9114,7 @@ DEFUN (show_bgp_instance_community_list, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 X:X::X:X/M longer-prefixes", + * "show bgp WORD ipv6 X:X::X:X/M longer-prefixes", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9125,7 +9125,7 @@ DEFUN (show_bgp_instance_community_list, */ DEFUN (show_bgp_instance_prefix_longer, show_bgp_instance_prefix_longer_cmd, - "show bgp " BGP_INSTANCE_CMD " X:X::X:X/M longer-prefixes", + "show bgp WORD X:X::X:X/M longer-prefixes", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9387,7 +9387,7 @@ DEFUN (show_ip_bgp_prefix_list, DEFUN (show_ip_bgp_instance_prefix_list, show_ip_bgp_instance_prefix_list_cmd, - "show ip bgp " BGP_INSTANCE_CMD " prefix-list WORD", + "show ip bgp WORD prefix-list WORD", SHOW_STR IP_STR BGP_STR @@ -9549,7 +9549,7 @@ DEFUN (show_ip_bgp_filter_list, DEFUN (show_ip_bgp_instance_filter_list, show_ip_bgp_instance_filter_list_cmd, - "show ip bgp " BGP_INSTANCE_CMD " filter-list WORD", + "show ip bgp WORD filter-list WORD", SHOW_STR IP_STR BGP_STR @@ -9787,7 +9787,7 @@ DEFUN (show_ip_bgp_route_map, DEFUN (show_ip_bgp_instance_route_map, show_ip_bgp_instance_route_map_cmd, - "show ip bgp " BGP_INSTANCE_CMD " route-map WORD", + "show ip bgp WORD route-map WORD", SHOW_STR IP_STR BGP_STR @@ -10246,7 +10246,7 @@ DEFUN (show_ip_bgp_ipv4_community, DEFUN (show_bgp_instance_afi_safi_community_all, show_bgp_instance_afi_safi_community_all_cmd, - "show bgp " BGP_INSTANCE_CMD " community", + "show bgp WORD community", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -10278,7 +10278,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -10300,7 +10300,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, * "Do not advertise to any peer (well-known community)\n" * "Do not export to next AS (well-known community)\n" * - * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -10326,7 +10326,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, * "Do not advertise to any peer (well-known community)\n" * "Do not export to next AS (well-known community)\n" * - * "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", + * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -10347,7 +10347,7 @@ DEFUN (show_bgp_instance_afi_safi_community_all, */ DEFUN (show_bgp_instance_afi_safi_community, show_bgp_instance_afi_safi_community_cmd, - "show bgp " BGP_INSTANCE_CMD " community ", + "show bgp WORD community ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -11208,7 +11208,7 @@ DEFUN (show_ip_bgp_community_list, DEFUN (show_ip_bgp_instance_community_list, show_ip_bgp_instance_community_list_cmd, - "show ip bgp " BGP_INSTANCE_CMD " community-list <(1-500)|WORD>", + "show ip bgp WORD community-list <(1-500)|WORD>", SHOW_STR IP_STR BGP_STR @@ -11441,7 +11441,7 @@ DEFUN (show_ip_bgp_prefix_longer, DEFUN (show_ip_bgp_instance_prefix_longer, show_ip_bgp_instance_prefix_longer_cmd, - "show ip bgp " BGP_INSTANCE_CMD " A.B.C.D/M longer-prefixes", + "show ip bgp WORD A.B.C.D/M longer-prefixes", SHOW_STR IP_STR BGP_STR @@ -12032,7 +12032,7 @@ DEFUN (show_bgp_statistics, DEFUN (show_bgp_statistics_view, show_bgp_statistics_view_cmd, - "show bgp " BGP_INSTANCE_CMD " statistics", + "show bgp WORD statistics", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12266,7 +12266,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors prefix-counts [json]", + "show ip bgp WORD neighbors prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -12316,7 +12316,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, show_bgp_instance_ipv6_neighbor_prefix_counts_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors prefix-counts [json]", + "show bgp WORD ipv6 neighbors prefix-counts [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12640,7 +12640,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", + * "show ip bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12655,7 +12655,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, */ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors advertised-routes [json]", + "show ip bgp WORD neighbors advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -12787,7 +12787,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -12802,7 +12802,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_advertised_route, show_bgp_instance_neighbor_advertised_route_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors advertised-routes [json]", + "show bgp WORD neighbors advertised-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12918,7 +12918,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -12933,7 +12933,7 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route, */ DEFUN (show_bgp_instance_neighbor_received_routes, show_bgp_instance_neighbor_received_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors received-routes [json]", + "show bgp WORD neighbors received-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12958,7 +12958,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", + * "show ip bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", * SHOW_STR * IP_STR * BGP_STR @@ -12973,7 +12973,7 @@ DEFUN (show_bgp_instance_neighbor_received_routes, */ DEFUN (show_ip_bgp_instance_neighbor_received_routes, show_ip_bgp_instance_neighbor_received_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors received-routes [json]", + "show ip bgp WORD neighbors received-routes [json]", SHOW_STR IP_STR BGP_STR @@ -13101,7 +13101,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors [json]", + "show bgp WORD neighbors [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13535,7 +13535,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13551,7 +13551,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes, */ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, show_bgp_instance_neighbor_received_prefix_filter_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors received prefix-filter [json]", + "show bgp WORD neighbors received prefix-filter [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13694,7 +13694,7 @@ DEFUN (show_ip_bgp_neighbor_routes, DEFUN (show_ip_bgp_instance_neighbor_routes, show_ip_bgp_instance_neighbor_routes_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors routes [json]", + "show ip bgp WORD neighbors routes [json]", SHOW_STR IP_STR BGP_STR @@ -13805,7 +13805,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, #ifdef HAVE_IPV6 /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13820,7 +13820,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_routes, show_bgp_instance_neighbor_routes_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors routes [json]", + "show bgp WORD neighbors routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13857,7 +13857,7 @@ DEFUN (show_bgp_instance_neighbor_routes, * "Display the dampened routes received from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13883,7 +13883,7 @@ DEFUN (show_bgp_instance_neighbor_routes, */ DEFUN (show_bgp_instance_neighbor_damp, show_bgp_instance_neighbor_damp_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors dampened-routes [json]", + "show bgp WORD neighbors dampened-routes [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -13926,7 +13926,7 @@ DEFUN (show_bgp_instance_neighbor_damp, * "Display flap statistics of the routes learned from neighbor\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -13952,7 +13952,7 @@ DEFUN (show_bgp_instance_neighbor_damp, */ DEFUN (show_bgp_instance_neighbor_flap, show_bgp_instance_neighbor_flap_cmd, - "show bgp " BGP_INSTANCE_CMD " neighbors flap-statistics [json]", + "show bgp WORD neighbors flap-statistics [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 0b43b14e68..e1d8ca896d 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3846,7 +3846,7 @@ DEFUN (no_set_weight, */ DEFUN (set_aspath_prepend, set_aspath_prepend_cmd, - "set as-path prepend ." CMD_AS_RANGE, + "set as-path prepend . (1-4294967295)", SET_STR "Transform BGP AS_PATH attribute\n" "Prepend to the as-path\n" @@ -3865,7 +3865,7 @@ DEFUN (set_aspath_prepend, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set as-path prepend ." CMD_AS_RANGE, + * "no set as-path prepend . (1-4294967295)", * NO_STR * SET_STR * "Transform BGP AS_PATH attribute\n" @@ -3893,7 +3893,7 @@ DEFUN (no_set_aspath_prepend, DEFUN (set_aspath_exclude, set_aspath_exclude_cmd, - "set as-path exclude ." CMD_AS_RANGE, + "set as-path exclude . (1-4294967295)", SET_STR "Transform BGP AS-path attribute\n" "Exclude from the as-path\n" @@ -3910,7 +3910,7 @@ DEFUN (set_aspath_exclude, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set as-path exclude ." CMD_AS_RANGE, + * "no set as-path exclude . (1-4294967295)", * NO_STR * SET_STR * "Transform BGP AS_PATH attribute\n" @@ -4254,7 +4254,7 @@ DEFUN (no_set_atomic_aggregate, DEFUN (set_aggregator_as, set_aggregator_as_cmd, - "set aggregator as " CMD_AS_RANGE " A.B.C.D", + "set aggregator as (1-4294967295) A.B.C.D", SET_STR "BGP aggregator attribute\n" "AS number of aggregator\n" @@ -4288,7 +4288,7 @@ DEFUN (set_aggregator_as, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set aggregator as " CMD_AS_RANGE " A.B.C.D", + * "no set aggregator as (1-4294967295) A.B.C.D", * NO_STR * SET_STR * "BGP aggregator attribute\n" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index c7d0102a45..f1411ea5eb 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -662,7 +662,7 @@ DEFUN (no_auto_summary, * ROUTER_STR * BGP_STR * - * "router bgp " CMD_AS_RANGE " (view|vrf) WORD", + * "router bgp (1-4294967295) (view|vrf) WORD", * ROUTER_STR * BGP_STR * AS_STR @@ -672,7 +672,7 @@ DEFUN (no_auto_summary, */ DEFUN (router_bgp, router_bgp_cmd, - "router bgp " CMD_AS_RANGE, + "router bgp (1-4294967295)", ROUTER_STR BGP_STR AS_STR) @@ -752,7 +752,7 @@ DEFUN (router_bgp, * ROUTER_STR * BGP_STR * - * "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", + * "no router bgp (1-4294967295) (view|vrf) WORD", * NO_STR * ROUTER_STR * BGP_STR @@ -763,7 +763,7 @@ DEFUN (router_bgp, */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp " CMD_AS_RANGE, + "no router bgp (1-4294967295)", NO_STR ROUTER_STR BGP_STR @@ -938,7 +938,7 @@ DEFUN (no_bgp_cluster_id, DEFUN (bgp_confederation_identifier, bgp_confederation_identifier_cmd, - "bgp confederation identifier " CMD_AS_RANGE, + "bgp confederation identifier (1-4294967295)", "BGP specific commands\n" "AS confederation parameters\n" "AS number\n" @@ -975,7 +975,7 @@ DEFUN (no_bgp_confederation_identifier, DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, - "bgp confederation peers ." CMD_AS_RANGE, + "bgp confederation peers . (1-4294967295)", "BGP specific commands\n" "AS confederation parameters\n" "Peer ASs in BGP confederation\n" @@ -1005,7 +1005,7 @@ DEFUN (bgp_confederation_peers, DEFUN (no_bgp_confederation_peers, no_bgp_confederation_peers_cmd, - "no bgp confederation peers ." CMD_AS_RANGE, + "no bgp confederation peers . (1-4294967295)", NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -1415,7 +1415,7 @@ DEFUN (no_bgp_coalesce_time, /* Maximum-paths configuration */ DEFUN (bgp_maxpaths, bgp_maxpaths_cmd, - "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), + "maximum-paths (1-255)", "Forward packets over multiple paths\n" "Number of paths\n") { @@ -1425,7 +1425,7 @@ DEFUN (bgp_maxpaths, DEFUN (bgp_maxpaths_ibgp, bgp_maxpaths_ibgp_cmd, - "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), + "maximum-paths ibgp (1-255)", "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n") @@ -1436,7 +1436,7 @@ DEFUN (bgp_maxpaths_ibgp, DEFUN (bgp_maxpaths_ibgp_cluster, bgp_maxpaths_ibgp_cluster_cmd, - "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", + "maximum-paths ibgp (1-255) equal-cluster-length", "Forward packets over multiple paths\n" "iBGP-multipath\n" "Number of paths\n" @@ -1449,7 +1449,7 @@ DEFUN (bgp_maxpaths_ibgp_cluster, DEFUN (no_bgp_maxpaths, no_bgp_maxpaths_cmd, - "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", + "no maximum-paths [(1-255)]", NO_STR "Forward packets over multiple paths\n" "Number of paths\n") @@ -1459,7 +1459,7 @@ DEFUN (no_bgp_maxpaths, DEFUN (no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_cmd, - "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM) " [equal-cluster-length]]", + "no maximum-paths ibgp [(1-255) [equal-cluster-length]]", NO_STR "Forward packets over multiple paths\n" "iBGP-multipath\n" @@ -2357,7 +2357,7 @@ DEFUN (no_bgp_rr_allow_outbound_policy, DEFUN (bgp_listen_limit, bgp_listen_limit_cmd, - "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, + "bgp listen limit (1-5000)", "BGP specific commands\n" "Configure BGP defaults\n" "maximum number of BGP Dynamic Neighbors that can be created\n" @@ -2429,7 +2429,7 @@ listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) DEFUN (bgp_listen_range, bgp_listen_range_cmd, - LISTEN_RANGE_CMD "peer-group WORD" , + "bgp listen range peer-group WORD", "BGP specific commands\n" "Configure BGP Dynamic Neighbors\n" "add a listening range for Dynamic Neighbors\n" @@ -2503,7 +2503,7 @@ DEFUN (bgp_listen_range, DEFUN (no_bgp_listen_range, no_bgp_listen_range_cmd, - "no bgp listen range A.B.C.D/M peer-group WORD" , + "no bgp listen range A.B.C.D/M peer-group WORD", "BGP specific commands\n" "Configure BGP defaults\n" "delete a listening range for Dynamic Neighbors\n" @@ -2688,7 +2688,7 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_remote_as, neighbor_remote_as_cmd, - NEIGHBOR_CMD2 "remote-as <" CMD_AS_RANGE "|external|internal>", + "neighbor remote-as <(1-4294967295)|external|internal>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" @@ -2855,7 +2855,7 @@ DEFUN (neighbor_interface_config_v6only, DEFUN (neighbor_interface_config_remote_as, neighbor_interface_config_remote_as_cmd, - "neighbor WORD interface remote-as <" CMD_AS_RANGE "|external|internal>", + "neighbor WORD interface remote-as <(1-4294967295)|external|internal>", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" @@ -2869,7 +2869,7 @@ DEFUN (neighbor_interface_config_remote_as, DEFUN (neighbor_interface_v6only_config_remote_as, neighbor_interface_v6only_config_remote_as_cmd, - "neighbor WORD interface v6only remote-as <" CMD_AS_RANGE "|external|internal>", + "neighbor WORD interface v6only remote-as <(1-4294967295)|external|internal>", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" @@ -2920,7 +2920,7 @@ DEFUN (neighbor_peer_group, */ DEFUN (no_neighbor, no_neighbor_cmd, - NO_NEIGHBOR_CMD2, + "no neighbor ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2) @@ -2980,7 +2980,7 @@ DEFUN (no_neighbor, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", + * "no neighbor WORD interface remote-as ((1-4294967295)|internal|external)", * NO_STR * NEIGHBOR_STR * "Interface name\n" @@ -2996,7 +2996,7 @@ DEFUN (no_neighbor, * "Member of the peer-group\n" * "peer-group name\n" * - * "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", + * "no neighbor WORD interface v6only remote-as ((1-4294967295)|internal|external)", * NO_STR * NEIGHBOR_STR * "Interface name\n" @@ -3072,7 +3072,7 @@ DEFUN (no_neighbor_peer_group, DEFUN (no_neighbor_interface_peer_group_remote_as, no_neighbor_interface_peer_group_remote_as_cmd, - "no neighbor WORD remote-as <" CMD_AS_RANGE "|internal|external>", + "no neighbor WORD remote-as <(1-4294967295)|internal|external>", NO_STR NEIGHBOR_STR "Interface name or neighbor tag\n" @@ -3104,7 +3104,7 @@ DEFUN (no_neighbor_interface_peer_group_remote_as, DEFUN (neighbor_local_as, neighbor_local_as_cmd, - NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, + "neighbor local-as (1-4294967295)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -3125,7 +3125,7 @@ DEFUN (neighbor_local_as, DEFUN (neighbor_local_as_no_prepend, neighbor_local_as_no_prepend_cmd, - NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", + "neighbor local-as (1-4294967295) no-prepend", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -3147,7 +3147,7 @@ DEFUN (neighbor_local_as_no_prepend, DEFUN (neighbor_local_as_no_prepend_replace_as, neighbor_local_as_no_prepend_replace_as_cmd, - NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", + "neighbor local-as (1-4294967295) no-prepend replace-as", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -3198,7 +3198,7 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, */ DEFUN (no_neighbor_local_as, no_neighbor_local_as_cmd, - NO_NEIGHBOR_CMD2 "local-as", + "no neighbor local-as", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3221,7 +3221,7 @@ DEFUN (no_neighbor_local_as, DEFUN (neighbor_solo, neighbor_solo_cmd, - NEIGHBOR_CMD2 "solo", + "neighbor solo", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Solo peer - part of its own update group\n") @@ -3240,7 +3240,7 @@ DEFUN (neighbor_solo, DEFUN (no_neighbor_solo, no_neighbor_solo_cmd, - NO_NEIGHBOR_CMD2 "solo", + "no neighbor solo", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3260,7 +3260,7 @@ DEFUN (no_neighbor_solo, DEFUN (neighbor_password, neighbor_password_cmd, - NEIGHBOR_CMD2 "password LINE", + "neighbor password LINE", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Set a password\n" @@ -3291,7 +3291,7 @@ DEFUN (neighbor_password, */ DEFUN (no_neighbor_password, no_neighbor_password_cmd, - NO_NEIGHBOR_CMD2 "password", + "no neighbor password", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3312,7 +3312,7 @@ DEFUN (no_neighbor_password, DEFUN (neighbor_activate, neighbor_activate_cmd, - NEIGHBOR_CMD2 "activate", + "neighbor activate", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enable the Address Family for this Neighbor\n") @@ -3334,7 +3334,7 @@ DEFUN (neighbor_activate, DEFUN (no_neighbor_activate, no_neighbor_activate_cmd, - NO_NEIGHBOR_CMD2 "activate", + "no neighbor activate", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3358,7 +3358,7 @@ DEFUN (no_neighbor_activate, DEFUN (neighbor_set_peer_group, neighbor_set_peer_group_cmd, - NEIGHBOR_CMD2 "peer-group WORD", + "neighbor peer-group WORD", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Member of the peer-group\n" @@ -3425,7 +3425,7 @@ DEFUN (neighbor_set_peer_group, DEFUN (no_neighbor_set_peer_group, no_neighbor_set_peer_group_cmd, - NO_NEIGHBOR_CMD2 "peer-group WORD", + "no neighbor peer-group WORD", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3501,7 +3501,7 @@ peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) /* neighbor passive. */ DEFUN (neighbor_passive, neighbor_passive_cmd, - NEIGHBOR_CMD2 "passive", + "neighbor passive", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Don't send open messages to this neighbor\n") @@ -3512,7 +3512,7 @@ DEFUN (neighbor_passive, DEFUN (no_neighbor_passive, no_neighbor_passive_cmd, - NO_NEIGHBOR_CMD2 "passive", + "no neighbor passive", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3525,7 +3525,7 @@ DEFUN (no_neighbor_passive, /* neighbor shutdown. */ DEFUN (neighbor_shutdown, neighbor_shutdown_cmd, - NEIGHBOR_CMD2 "shutdown", + "neighbor shutdown", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") @@ -3536,7 +3536,7 @@ DEFUN (neighbor_shutdown, DEFUN (no_neighbor_shutdown, no_neighbor_shutdown_cmd, - NO_NEIGHBOR_CMD2 "shutdown", + "no neighbor shutdown", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3549,7 +3549,7 @@ DEFUN (no_neighbor_shutdown, /* neighbor capability dynamic. */ DEFUN (neighbor_capability_dynamic, neighbor_capability_dynamic_cmd, - NEIGHBOR_CMD2 "capability dynamic", + "neighbor capability dynamic", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Advertise capability to the peer\n" @@ -3561,7 +3561,7 @@ DEFUN (neighbor_capability_dynamic, DEFUN (no_neighbor_capability_dynamic, no_neighbor_capability_dynamic_cmd, - NO_NEIGHBOR_CMD2 "capability dynamic", + "no neighbor capability dynamic", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3575,7 +3575,7 @@ DEFUN (no_neighbor_capability_dynamic, /* neighbor dont-capability-negotiate */ DEFUN (neighbor_dont_capability_negotiate, neighbor_dont_capability_negotiate_cmd, - NEIGHBOR_CMD2 "dont-capability-negotiate", + "neighbor dont-capability-negotiate", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Do not perform capability negotiation\n") @@ -3586,7 +3586,7 @@ DEFUN (neighbor_dont_capability_negotiate, DEFUN (no_neighbor_dont_capability_negotiate, no_neighbor_dont_capability_negotiate_cmd, - NO_NEIGHBOR_CMD2 "dont-capability-negotiate", + "no neighbor dont-capability-negotiate", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3599,7 +3599,7 @@ DEFUN (no_neighbor_dont_capability_negotiate, /* neighbor capability extended next hop encoding */ DEFUN (neighbor_capability_enhe, neighbor_capability_enhe_cmd, - NEIGHBOR_CMD2 "capability extended-nexthop", + "neighbor capability extended-nexthop", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Advertise capability to the peer\n" @@ -3611,7 +3611,7 @@ DEFUN (neighbor_capability_enhe, DEFUN (no_neighbor_capability_enhe, no_neighbor_capability_enhe_cmd, - NO_NEIGHBOR_CMD2 "capability extended-nexthop", + "no neighbor capability extended-nexthop", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3658,7 +3658,7 @@ peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, /* neighbor capability orf prefix-list. */ DEFUN (neighbor_capability_orf_prefix, neighbor_capability_orf_prefix_cmd, - NEIGHBOR_CMD2 "capability orf prefix-list ", + "neighbor capability orf prefix-list ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Advertise capability to the peer\n" @@ -3687,7 +3687,7 @@ DEFUN (neighbor_capability_orf_prefix, DEFUN (no_neighbor_capability_orf_prefix, no_neighbor_capability_orf_prefix_cmd, - NO_NEIGHBOR_CMD2 "capability orf prefix-list ", + "no neighbor capability orf prefix-list ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3718,7 +3718,7 @@ DEFUN (no_neighbor_capability_orf_prefix, /* neighbor next-hop-self. */ DEFUN (neighbor_nexthop_self, neighbor_nexthop_self_cmd, - NEIGHBOR_CMD2 "next-hop-self", + "neighbor next-hop-self", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") @@ -3731,7 +3731,7 @@ DEFUN (neighbor_nexthop_self, /* neighbor next-hop-self. */ DEFUN (neighbor_nexthop_self_force, neighbor_nexthop_self_force_cmd, - NEIGHBOR_CMD2 "next-hop-self force", + "neighbor next-hop-self force", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n" @@ -3745,7 +3745,7 @@ DEFUN (neighbor_nexthop_self_force, DEFUN (no_neighbor_nexthop_self, no_neighbor_nexthop_self_cmd, - NO_NEIGHBOR_CMD2 "next-hop-self", + "no neighbor next-hop-self", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3759,7 +3759,7 @@ DEFUN (no_neighbor_nexthop_self, DEFUN (no_neighbor_nexthop_self_force, no_neighbor_nexthop_self_force_cmd, - NO_NEIGHBOR_CMD2 "next-hop-self force", + "no neighbor next-hop-self force", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3775,7 +3775,7 @@ DEFUN (no_neighbor_nexthop_self_force, /* neighbor as-override */ DEFUN (neighbor_as_override, neighbor_as_override_cmd, - NEIGHBOR_CMD2 "as-override", + "neighbor as-override", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") @@ -3788,7 +3788,7 @@ DEFUN (neighbor_as_override, DEFUN (no_neighbor_as_override, no_neighbor_as_override_cmd, - NO_NEIGHBOR_CMD2 "as-override", + "no neighbor as-override", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3803,7 +3803,7 @@ DEFUN (no_neighbor_as_override, /* neighbor remove-private-AS. */ DEFUN (neighbor_remove_private_as, neighbor_remove_private_as_cmd, - NEIGHBOR_CMD2 "remove-private-AS", + "neighbor remove-private-AS", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") @@ -3816,7 +3816,7 @@ DEFUN (neighbor_remove_private_as, DEFUN (neighbor_remove_private_as_all, neighbor_remove_private_as_all_cmd, - NEIGHBOR_CMD2 "remove-private-AS all", + "neighbor remove-private-AS all", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" @@ -3830,7 +3830,7 @@ DEFUN (neighbor_remove_private_as_all, DEFUN (neighbor_remove_private_as_replace_as, neighbor_remove_private_as_replace_as_cmd, - NEIGHBOR_CMD2 "remove-private-AS replace-AS", + "neighbor remove-private-AS replace-AS", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" @@ -3844,7 +3844,7 @@ DEFUN (neighbor_remove_private_as_replace_as, DEFUN (neighbor_remove_private_as_all_replace_as, neighbor_remove_private_as_all_replace_as_cmd, - NEIGHBOR_CMD2 "remove-private-AS all replace-AS", + "neighbor remove-private-AS all replace-AS", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" @@ -3859,7 +3859,7 @@ DEFUN (neighbor_remove_private_as_all_replace_as, DEFUN (no_neighbor_remove_private_as, no_neighbor_remove_private_as_cmd, - NO_NEIGHBOR_CMD2 "remove-private-AS", + "no neighbor remove-private-AS", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3873,7 +3873,7 @@ DEFUN (no_neighbor_remove_private_as, DEFUN (no_neighbor_remove_private_as_all, no_neighbor_remove_private_as_all_cmd, - NO_NEIGHBOR_CMD2 "remove-private-AS all", + "no neighbor remove-private-AS all", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3888,7 +3888,7 @@ DEFUN (no_neighbor_remove_private_as_all, DEFUN (no_neighbor_remove_private_as_replace_as, no_neighbor_remove_private_as_replace_as_cmd, - NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", + "no neighbor remove-private-AS replace-AS", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3903,7 +3903,7 @@ DEFUN (no_neighbor_remove_private_as_replace_as, DEFUN (no_neighbor_remove_private_as_all_replace_as, no_neighbor_remove_private_as_all_replace_as_cmd, - NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", + "no neighbor remove-private-AS all replace-AS", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3921,7 +3921,7 @@ DEFUN (no_neighbor_remove_private_as_all_replace_as, /* neighbor send-community. */ DEFUN (neighbor_send_community, neighbor_send_community_cmd, - NEIGHBOR_CMD2 "send-community", + "neighbor send-community", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") @@ -3934,7 +3934,7 @@ DEFUN (neighbor_send_community, DEFUN (no_neighbor_send_community, no_neighbor_send_community_cmd, - NO_NEIGHBOR_CMD2 "send-community", + "no neighbor send-community", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3949,7 +3949,7 @@ DEFUN (no_neighbor_send_community, /* neighbor send-community extended. */ DEFUN (neighbor_send_community_type, neighbor_send_community_type_cmd, - NEIGHBOR_CMD2 "send-community ", + "neighbor send-community ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n" @@ -3976,7 +3976,7 @@ DEFUN (neighbor_send_community_type, DEFUN (no_neighbor_send_community_type, no_neighbor_send_community_type_cmd, - NO_NEIGHBOR_CMD2 "send-community ", + "no neighbor send-community ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4005,7 +4005,7 @@ DEFUN (no_neighbor_send_community_type, /* neighbor soft-reconfig. */ DEFUN (neighbor_soft_reconfiguration, neighbor_soft_reconfiguration_cmd, - NEIGHBOR_CMD2 "soft-reconfiguration inbound", + "neighbor soft-reconfiguration inbound", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Per neighbor soft reconfiguration\n" @@ -4019,7 +4019,7 @@ DEFUN (neighbor_soft_reconfiguration, DEFUN (no_neighbor_soft_reconfiguration, no_neighbor_soft_reconfiguration_cmd, - NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", + "no neighbor soft-reconfiguration inbound", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4034,7 +4034,7 @@ DEFUN (no_neighbor_soft_reconfiguration, DEFUN (neighbor_route_reflector_client, neighbor_route_reflector_client_cmd, - NEIGHBOR_CMD2 "route-reflector-client", + "neighbor route-reflector-client", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") @@ -4054,7 +4054,7 @@ DEFUN (neighbor_route_reflector_client, DEFUN (no_neighbor_route_reflector_client, no_neighbor_route_reflector_client_cmd, - NO_NEIGHBOR_CMD2 "route-reflector-client", + "no neighbor route-reflector-client", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4069,7 +4069,7 @@ DEFUN (no_neighbor_route_reflector_client, /* neighbor route-server-client. */ DEFUN (neighbor_route_server_client, neighbor_route_server_client_cmd, - NEIGHBOR_CMD2 "route-server-client", + "neighbor route-server-client", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") @@ -4087,7 +4087,7 @@ DEFUN (neighbor_route_server_client, DEFUN (no_neighbor_route_server_client, no_neighbor_route_server_client_cmd, - NO_NEIGHBOR_CMD2 "route-server-client", + "no neighbor route-server-client", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4101,7 +4101,7 @@ DEFUN (no_neighbor_route_server_client, DEFUN (neighbor_nexthop_local_unchanged, neighbor_nexthop_local_unchanged_cmd, - NEIGHBOR_CMD2 "nexthop-local unchanged", + "neighbor nexthop-local unchanged", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure treatment of outgoing link-local nexthop attribute\n" @@ -4115,7 +4115,7 @@ DEFUN (neighbor_nexthop_local_unchanged, DEFUN (no_neighbor_nexthop_local_unchanged, no_neighbor_nexthop_local_unchanged_cmd, - NO_NEIGHBOR_CMD2 "nexthop-local unchanged", + "no neighbor nexthop-local unchanged", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4181,7 +4181,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, */ DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, - NEIGHBOR_CMD2 "attribute-unchanged", + "neighbor attribute-unchanged", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n") @@ -4196,7 +4196,7 @@ DEFUN (neighbor_attr_unchanged, DEFUN (neighbor_attr_unchanged1, neighbor_attr_unchanged1_cmd, - NEIGHBOR_CMD2 "attribute-unchanged ", + "neighbor attribute-unchanged ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4221,7 +4221,7 @@ DEFUN (neighbor_attr_unchanged1, DEFUN (neighbor_attr_unchanged2, neighbor_attr_unchanged2_cmd, - NEIGHBOR_CMD2 "attribute-unchanged as-path ", + "neighbor attribute-unchanged as-path ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4245,7 +4245,7 @@ DEFUN (neighbor_attr_unchanged2, DEFUN (neighbor_attr_unchanged3, neighbor_attr_unchanged3_cmd, - NEIGHBOR_CMD2 "attribute-unchanged next-hop ", + "neighbor attribute-unchanged next-hop ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4268,7 +4268,7 @@ DEFUN (neighbor_attr_unchanged3, DEFUN (neighbor_attr_unchanged4, neighbor_attr_unchanged4_cmd, - NEIGHBOR_CMD2 "attribute-unchanged med ", + "neighbor attribute-unchanged med ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4354,7 +4354,7 @@ DEFUN (neighbor_attr_unchanged4, */ DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged", + "no neighbor attribute-unchanged", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4370,7 +4370,7 @@ DEFUN (no_neighbor_attr_unchanged, DEFUN (no_neighbor_attr_unchanged1, no_neighbor_attr_unchanged1_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged ", + "no neighbor attribute-unchanged ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4396,7 +4396,7 @@ DEFUN (no_neighbor_attr_unchanged1, DEFUN (no_neighbor_attr_unchanged2, no_neighbor_attr_unchanged2_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged as-path ", + "no neighbor attribute-unchanged as-path ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4420,7 +4420,7 @@ DEFUN (no_neighbor_attr_unchanged2, DEFUN (no_neighbor_attr_unchanged3, no_neighbor_attr_unchanged3_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop ", + "no neighbor attribute-unchanged next-hop ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4444,7 +4444,7 @@ DEFUN (no_neighbor_attr_unchanged3, DEFUN (no_neighbor_attr_unchanged4, no_neighbor_attr_unchanged4_cmd, - NO_NEIGHBOR_CMD2 "attribute-unchanged med ", + "no neighbor attribute-unchanged med ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4510,7 +4510,7 @@ peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) /* neighbor ebgp-multihop. */ DEFUN (neighbor_ebgp_multihop, neighbor_ebgp_multihop_cmd, - NEIGHBOR_CMD2 "ebgp-multihop", + "neighbor ebgp-multihop", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n") @@ -4521,7 +4521,7 @@ DEFUN (neighbor_ebgp_multihop, DEFUN (neighbor_ebgp_multihop_ttl, neighbor_ebgp_multihop_ttl_cmd, - NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), + "neighbor ebgp-multihop (1-255)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Allow EBGP neighbors not on directly connected networks\n" @@ -4544,7 +4544,7 @@ DEFUN (neighbor_ebgp_multihop_ttl, */ DEFUN (no_neighbor_ebgp_multihop, no_neighbor_ebgp_multihop_cmd, - NO_NEIGHBOR_CMD2 "ebgp-multihop", + "no neighbor ebgp-multihop", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4566,7 +4566,7 @@ DEFUN (no_neighbor_ebgp_multihop, */ DEFUN (neighbor_disable_connected_check, neighbor_disable_connected_check_cmd, - NEIGHBOR_CMD2 "disable-connected-check", + "neighbor disable-connected-check", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n") @@ -4586,7 +4586,7 @@ DEFUN (neighbor_disable_connected_check, */ DEFUN (no_neighbor_disable_connected_check, no_neighbor_disable_connected_check_cmd, - NO_NEIGHBOR_CMD2 "disable-connected-check", + "no neighbor disable-connected-check", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4602,7 +4602,7 @@ DEFUN (no_neighbor_disable_connected_check, DEFUN (neighbor_description, neighbor_description_cmd, - NEIGHBOR_CMD2 "description .LINE", + "neighbor description .LINE", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Neighbor specific description\n" @@ -4640,7 +4640,7 @@ DEFUN (neighbor_description, */ DEFUN (no_neighbor_description, no_neighbor_description_cmd, - NO_NEIGHBOR_CMD2 "description", + "no neighbor description", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4699,7 +4699,7 @@ peer_update_source_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_update_source, neighbor_update_source_cmd, - NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, + "neighbor update-source ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Source of routing updates\n" @@ -4712,7 +4712,7 @@ DEFUN (neighbor_update_source, DEFUN (no_neighbor_update_source, no_neighbor_update_source_cmd, - NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, + "no neighbor update-source [A.B.C.D|X:X::X:X|WORD]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4746,7 +4746,7 @@ peer_default_originate_set_vty (struct vty *vty, const char *peer_str, /* neighbor default-originate. */ DEFUN (neighbor_default_originate, neighbor_default_originate_cmd, - NEIGHBOR_CMD2 "default-originate", + "neighbor default-originate", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n") @@ -4758,7 +4758,7 @@ DEFUN (neighbor_default_originate, DEFUN (neighbor_default_originate_rmap, neighbor_default_originate_rmap_cmd, - NEIGHBOR_CMD2 "default-originate route-map WORD", + "neighbor default-originate route-map WORD", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Originate default route to this neighbor\n" @@ -4784,7 +4784,7 @@ DEFUN (neighbor_default_originate_rmap, */ DEFUN (no_neighbor_default_originate, no_neighbor_default_originate_cmd, - NO_NEIGHBOR_CMD2 "default-originate", + "no neighbor default-originate", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4827,7 +4827,7 @@ peer_port_vty (struct vty *vty, const char *ip_str, int afi, /* Set specified peer's BGP port. */ DEFUN (neighbor_port, neighbor_port_cmd, - NEIGHBOR_CMD "port (0-65535)", + "neighbor port (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR "Neighbor's BGP port\n" @@ -4840,7 +4840,7 @@ DEFUN (neighbor_port, DEFUN (no_neighbor_port, no_neighbor_port_cmd, - NO_NEIGHBOR_CMD "port [(0-65535)]", + "no neighbor port [(0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR @@ -4887,7 +4887,7 @@ peer_weight_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_weight, neighbor_weight_cmd, - NEIGHBOR_CMD2 "weight (0-65535)", + "neighbor weight (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Set default weight for routes from this neighbor\n" @@ -4900,7 +4900,7 @@ DEFUN (neighbor_weight, DEFUN (no_neighbor_weight, no_neighbor_weight_cmd, - NO_NEIGHBOR_CMD2 "weight [(0-65535)]", + "no neighbor weight [(0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4915,7 +4915,7 @@ DEFUN (no_neighbor_weight, /* Override capability negotiation. */ DEFUN (neighbor_override_capability, neighbor_override_capability_cmd, - NEIGHBOR_CMD2 "override-capability", + "neighbor override-capability", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Override capability negotiation result\n") @@ -4926,7 +4926,7 @@ DEFUN (neighbor_override_capability, DEFUN (no_neighbor_override_capability, no_neighbor_override_capability_cmd, - NO_NEIGHBOR_CMD2 "override-capability", + "no neighbor override-capability", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4938,7 +4938,7 @@ DEFUN (no_neighbor_override_capability, DEFUN (neighbor_strict_capability, neighbor_strict_capability_cmd, - NEIGHBOR_CMD "strict-capability-match", + "neighbor strict-capability-match", NEIGHBOR_STR NEIGHBOR_ADDR_STR "Strict capability negotiation match\n") @@ -4949,7 +4949,7 @@ DEFUN (neighbor_strict_capability, DEFUN (no_neighbor_strict_capability, no_neighbor_strict_capability_cmd, - NO_NEIGHBOR_CMD "strict-capability-match", + "no neighbor strict-capability-match", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR @@ -4997,7 +4997,7 @@ peer_timers_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_timers, neighbor_timers_cmd, - NEIGHBOR_CMD2 "timers (0-65535) (0-65535)", + "neighbor timers (0-65535) (0-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n" @@ -5012,7 +5012,7 @@ DEFUN (neighbor_timers, DEFUN (no_neighbor_timers, no_neighbor_timers_cmd, - NO_NEIGHBOR_CMD2 "timers [(0-65535) (0-65535)]", + "no neighbor timers [(0-65535) (0-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5061,7 +5061,7 @@ peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) DEFUN (neighbor_timers_connect, neighbor_timers_connect_cmd, - NEIGHBOR_CMD2 "timers connect (1-65535)", + "neighbor timers connect (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP per neighbor timers\n" @@ -5075,7 +5075,7 @@ DEFUN (neighbor_timers_connect, DEFUN (no_neighbor_timers_connect, no_neighbor_timers_connect_cmd, - NO_NEIGHBOR_CMD2 "timers connect [(1-65535)]", + "no neighbor timers connect [(1-65535)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5113,7 +5113,7 @@ peer_advertise_interval_vty (struct vty *vty, const char *ip_str, DEFUN (neighbor_advertise_interval, neighbor_advertise_interval_cmd, - NEIGHBOR_CMD2 "advertisement-interval (0-600)", + "neighbor advertisement-interval (0-600)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Minimum interval between sending BGP routing updates\n" @@ -5126,7 +5126,7 @@ DEFUN (neighbor_advertise_interval, DEFUN (no_neighbor_advertise_interval, no_neighbor_advertise_interval_cmd, - NO_NEIGHBOR_CMD2 "advertisement-interval [(0-600)]", + "no neighbor advertisement-interval [(0-600)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5204,7 +5204,7 @@ peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) DEFUN (neighbor_interface, neighbor_interface_cmd, - NEIGHBOR_CMD "interface WORD", + "neighbor interface WORD", NEIGHBOR_STR NEIGHBOR_ADDR_STR "Interface\n" @@ -5220,7 +5220,7 @@ DEFUN (neighbor_interface, DEFUN (no_neighbor_interface, no_neighbor_interface_cmd, - NO_NEIGHBOR_CMD2 "interface WORD", + "no neighbor interface WORD", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR @@ -5281,7 +5281,7 @@ peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_distribute_list, neighbor_distribute_list_cmd, - NEIGHBOR_CMD2 "distribute-list <(1-199)|(1300-2699)|WORD> ", + "neighbor distribute-list <(1-199)|(1300-2699)|WORD> ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" @@ -5300,7 +5300,7 @@ DEFUN (neighbor_distribute_list, DEFUN (no_neighbor_distribute_list, no_neighbor_distribute_list_cmd, - NO_NEIGHBOR_CMD2 "distribute-list <(1-199)|(1300-2699)|WORD> ", + "no neighbor distribute-list <(1-199)|(1300-2699)|WORD> ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5367,7 +5367,7 @@ peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_prefix_list, neighbor_prefix_list_cmd, - NEIGHBOR_CMD2 "prefix-list WORD ", + "neighbor prefix-list WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" @@ -5384,7 +5384,7 @@ DEFUN (neighbor_prefix_list, DEFUN (no_neighbor_prefix_list, no_neighbor_prefix_list_cmd, - NO_NEIGHBOR_CMD2 "prefix-list WORD ", + "no neighbor prefix-list WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5449,7 +5449,7 @@ peer_aslist_unset_vty (struct vty *vty, const char *ip_str, DEFUN (neighbor_filter_list, neighbor_filter_list_cmd, - NEIGHBOR_CMD2 "filter-list WORD ", + "neighbor filter-list WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" @@ -5466,7 +5466,7 @@ DEFUN (neighbor_filter_list, DEFUN (no_neighbor_filter_list, no_neighbor_filter_list_cmd, - NO_NEIGHBOR_CMD2 "filter-list WORD ", + "no neighbor filter-list WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5531,7 +5531,7 @@ peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_route_map, neighbor_route_map_cmd, - NEIGHBOR_CMD2 "route-map WORD ", + "neighbor route-map WORD ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Apply route map to neighbor\n" @@ -5548,7 +5548,7 @@ DEFUN (neighbor_route_map, DEFUN (no_neighbor_route_map, no_neighbor_route_map_cmd, - NO_NEIGHBOR_CMD2 "route-map WORD ", + "no neighbor route-map WORD ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5599,7 +5599,7 @@ peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_unsuppress_map, neighbor_unsuppress_map_cmd, - NEIGHBOR_CMD2 "unsuppress-map WORD", + "neighbor unsuppress-map WORD", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Route-map to selectively unsuppress suppressed routes\n" @@ -5613,7 +5613,7 @@ DEFUN (neighbor_unsuppress_map, DEFUN (no_neighbor_unsuppress_map, no_neighbor_unsuppress_map_cmd, - NO_NEIGHBOR_CMD2 "unsuppress-map WORD", + "no neighbor unsuppress-map WORD", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5678,7 +5678,7 @@ peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, each peer configuration. */ DEFUN (neighbor_maximum_prefix, neighbor_maximum_prefix_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295)", + "neighbor maximum-prefix (1-4294967295)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5693,7 +5693,7 @@ DEFUN (neighbor_maximum_prefix, DEFUN (neighbor_maximum_prefix_threshold, neighbor_maximum_prefix_threshold_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100)", + "neighbor maximum-prefix (1-4294967295) (1-100)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5710,7 +5710,7 @@ DEFUN (neighbor_maximum_prefix_threshold, DEFUN (neighbor_maximum_prefix_warning, neighbor_maximum_prefix_warning_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) warning-only", + "neighbor maximum-prefix (1-4294967295) warning-only", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5726,7 +5726,7 @@ DEFUN (neighbor_maximum_prefix_warning, DEFUN (neighbor_maximum_prefix_threshold_warning, neighbor_maximum_prefix_threshold_warning_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100) warning-only", + "neighbor maximum-prefix (1-4294967295) (1-100) warning-only", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5743,7 +5743,7 @@ DEFUN (neighbor_maximum_prefix_threshold_warning, DEFUN (neighbor_maximum_prefix_restart, neighbor_maximum_prefix_restart_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) restart (1-65535)", + "neighbor maximum-prefix (1-4294967295) restart (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5760,7 +5760,7 @@ DEFUN (neighbor_maximum_prefix_restart, DEFUN (neighbor_maximum_prefix_threshold_restart, neighbor_maximum_prefix_threshold_restart_cmd, - NEIGHBOR_CMD2 "maximum-prefix (1-4294967295) (1-100) restart (1-65535)", + "neighbor maximum-prefix (1-4294967295) (1-100) restart (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" @@ -5833,7 +5833,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, */ DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, - NO_NEIGHBOR_CMD2 "maximum-prefix", + "no neighbor maximum-prefix", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5862,7 +5862,7 @@ DEFUN (no_neighbor_maximum_prefix, */ DEFUN (neighbor_allowas_in, neighbor_allowas_in_cmd, - NEIGHBOR_CMD2 "allowas-in", + "neighbor allowas-in", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Accept as-path with my AS present in it\n") @@ -5889,7 +5889,7 @@ DEFUN (neighbor_allowas_in, DEFUN (no_neighbor_allowas_in, no_neighbor_allowas_in_cmd, - NO_NEIGHBOR_CMD2 "allowas-in [(1-10)]", + "no neighbor allowas-in [(1-10)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5912,7 +5912,7 @@ DEFUN (no_neighbor_allowas_in, DEFUN (neighbor_ttl_security, neighbor_ttl_security_cmd, - NEIGHBOR_CMD2 "ttl-security hops (1-254)", + "neighbor ttl-security hops (1-254)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify the maximum number of hops to the BGP peer\n") @@ -5943,7 +5943,7 @@ DEFUN (neighbor_ttl_security, DEFUN (no_neighbor_ttl_security, no_neighbor_ttl_security_cmd, - NO_NEIGHBOR_CMD2 "ttl-security hops (1-254)", + "no neighbor ttl-security hops (1-254)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5961,7 +5961,7 @@ DEFUN (no_neighbor_ttl_security, DEFUN (neighbor_addpath_tx_all_paths, neighbor_addpath_tx_all_paths_cmd, - NEIGHBOR_CMD2 "addpath-tx-all-paths", + "neighbor addpath-tx-all-paths", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Use addpath to advertise all paths to a neighbor\n") @@ -5980,7 +5980,7 @@ DEFUN (neighbor_addpath_tx_all_paths, DEFUN (no_neighbor_addpath_tx_all_paths, no_neighbor_addpath_tx_all_paths_cmd, - NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", + "no neighbor addpath-tx-all-paths", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -5994,7 +5994,7 @@ DEFUN (no_neighbor_addpath_tx_all_paths, DEFUN (neighbor_addpath_tx_bestpath_per_as, neighbor_addpath_tx_bestpath_per_as_cmd, - NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", + "neighbor addpath-tx-bestpath-per-AS", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Use addpath to advertise the bestpath per each neighboring AS\n") @@ -6013,7 +6013,7 @@ DEFUN (neighbor_addpath_tx_bestpath_per_as, DEFUN (no_neighbor_addpath_tx_bestpath_per_as, no_neighbor_addpath_tx_bestpath_per_as_cmd, - NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", + "no neighbor addpath-tx-bestpath-per-AS", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -6230,7 +6230,7 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, * BGP_STR * "Clear all peers\n" * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 *", + * "clear bgp WORD ipv6 *", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -6313,7 +6313,7 @@ DEFUN (clear_ip_bgp_peer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external", + * "clear bgp WORD ipv6 external", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -6387,13 +6387,13 @@ DEFUN (clear_ip_bgp_prefix, * CHECK ME - The following ALIASes need to be implemented in this DEFUN * need ipv6 options * - * "clear bgp ipv6 " CMD_AS_RANGE, + * "clear bgp ipv6 (1-4294967295)", * CLEAR_STR * BGP_STR * "Address family\n" * "Clear peers with the AS number\n" * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, + * "clear bgp WORD ipv6 (1-4294967295)", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -6402,7 +6402,7 @@ DEFUN (clear_ip_bgp_prefix, */ DEFUN (clear_ip_bgp_as, clear_ip_bgp_as_cmd, - "clear [ip] bgp [ WORD] " CMD_AS_RANGE, + "clear [ip] bgp [ WORD] (1-4294967295)", CLEAR_STR IP_STR BGP_STR @@ -6476,7 +6476,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_out, DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, clear_ip_bgp_instance_all_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 [soft] out", + "clear ip bgp WORD * ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6574,7 +6574,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, DEFUN (clear_bgp_instance_ipv6_safi_prefix, clear_bgp_instance_ipv6_safi_prefix_cmd, - "clear bgp " BGP_INSTANCE_CMD " ipv6 prefix X:X::X:X/M", + "clear bgp WORD ipv6 prefix X:X::X:X/M", CLEAR_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -6644,7 +6644,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_out, DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " ipv4 [soft] out", + "clear ip bgp WORD ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6790,7 +6790,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 [soft] out", + "clear ip bgp WORD peer-group WORD ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6892,7 +6892,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_out, DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, clear_ip_bgp_instance_external_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 [soft] out", + "clear ip bgp WORD external ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6937,7 +6937,7 @@ DEFUN (clear_bgp_external_soft_out, DEFUN (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_soft_out_cmd, - "clear ip bgp [ WORD] " CMD_AS_RANGE " [soft] out", + "clear ip bgp [ WORD] (1-4294967295) [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6962,7 +6962,7 @@ DEFUN (clear_ip_bgp_as_soft_out, DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 [soft] out", + "clear ip bgp (1-4294967295) ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -6985,7 +6985,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, clear_ip_bgp_instance_as_ipv4_soft_out_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 [soft] out", + "clear ip bgp WORD (1-4294967295) ipv4 [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7010,7 +7010,7 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, DEFUN (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast [soft] out", + "clear ip bgp (1-4294967295) vpnv4 unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7027,7 +7027,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, DEFUN (clear_ip_bgp_as_encap_soft_out, clear_ip_bgp_as_encap_soft_out_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast [soft] out", + "clear ip bgp (1-4294967295) encap unicast [soft] out", CLEAR_STR IP_STR BGP_STR @@ -7044,7 +7044,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_out, DEFUN (clear_bgp_as_soft_out, clear_bgp_as_soft_out_cmd, - "clear bgp [ WORD] [ipv6] " CMD_AS_RANGE " [soft] out", + "clear bgp [ WORD] [ipv6] (1-4294967295) [soft] out", CLEAR_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -7138,7 +7138,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft_in, DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, clear_ip_bgp_instance_all_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 [soft] in", + "clear ip bgp WORD * ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7321,7 +7321,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft_in, DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " ipv4 [soft] in", + "clear ip bgp WORD ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7472,7 +7472,7 @@ DEFUN (clear_bgp_peer_in_prefix_filter, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", + * "clear ip bgp WORD peer-group WORD soft in", * CLEAR_STR * IP_STR * BGP_STR @@ -7490,7 +7490,7 @@ DEFUN (clear_bgp_peer_in_prefix_filter, * "BGP peer-group name\n" * BGP_SOFT_IN_STR * - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", + * "clear ip bgp WORD peer-group WORD in", * CLEAR_STR * IP_STR * BGP_STR @@ -7565,7 +7565,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 [soft] in", + "clear ip bgp WORD peer-group WORD ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7625,7 +7625,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, * "BGP peer-group name\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", + * "clear bgp WORD ipv6 peer-group WORD soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7635,7 +7635,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", + * "clear bgp WORD peer-group WORD soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7651,7 +7651,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, * "BGP peer-group name\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", + * "clear bgp WORD peer-group WORD in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7668,7 +7668,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", + * "clear bgp WORD ipv6 peer-group WORD in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7734,7 +7734,7 @@ DEFUN (clear_bgp_peer_group_in_prefix_filter, * "Clear all external peers\n" * BGP_SOFT_IN_STR * - * "clear ip bgp " BGP_INSTANCE_CMD " external in", + * "clear ip bgp WORD external in", * CLEAR_STR * IP_STR * BGP_STR @@ -7742,7 +7742,7 @@ DEFUN (clear_bgp_peer_group_in_prefix_filter, * "Clear all external peers\n" * BGP_SOFT_IN_STR * - * "clear ip bgp " BGP_INSTANCE_CMD " external soft in", + * "clear ip bgp WORD external soft in", * CLEAR_STR * IP_STR * BGP_STR @@ -7811,7 +7811,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft_in, DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, clear_ip_bgp_instance_external_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 [soft] in", + "clear ip bgp WORD external ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -7859,14 +7859,14 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " external in", + * "clear bgp WORD external in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Clear all external peers\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", + * "clear bgp WORD ipv6 external soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7875,7 +7875,7 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " external soft in", + * "clear bgp WORD external soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7883,7 +7883,7 @@ DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", + * "clear bgp WORD ipv6 external WORD in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -7957,14 +7957,14 @@ DEFUN (clear_bgp_external_in_prefix_filter, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " CMD_AS_RANGE " in", + * "clear ip bgp (1-4294967295) in", * CLEAR_STR * IP_STR * BGP_STR * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", + * "clear ip bgp WORD (1-4294967295) in", * CLEAR_STR * IP_STR * BGP_STR @@ -7972,7 +7972,7 @@ DEFUN (clear_bgp_external_in_prefix_filter, * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", + * "clear ip bgp WORD (1-4294967295) soft in", * CLEAR_STR * IP_STR * BGP_STR @@ -7984,7 +7984,7 @@ DEFUN (clear_bgp_external_in_prefix_filter, */ DEFUN (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " soft in", + "clear ip bgp (1-4294967295) soft in", CLEAR_STR IP_STR BGP_STR @@ -8003,7 +8003,7 @@ DEFUN (clear_ip_bgp_as_soft_in, DEFUN (clear_ip_bgp_as_in_prefix_filter, clear_ip_bgp_as_in_prefix_filter_cmd, - "clear ip bgp " CMD_AS_RANGE " in prefix-filter", + "clear ip bgp (1-4294967295) in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8018,7 +8018,7 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 [soft] in", + "clear ip bgp (1-4294967295) ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8041,7 +8041,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, clear_ip_bgp_instance_as_ipv4_soft_in_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 [soft] in", + "clear ip bgp WORD (1-4294967295) ipv4 [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8066,7 +8066,7 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 in prefix-filter", + "clear ip bgp (1-4294967295) ipv4 in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -8089,7 +8089,7 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, DEFUN (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast [soft] in", + "clear ip bgp (1-4294967295) vpnv4 unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8106,7 +8106,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, DEFUN (clear_ip_bgp_as_encap_soft_in, clear_ip_bgp_as_encap_soft_in_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast [soft] in", + "clear ip bgp (1-4294967295) encap unicast [soft] in", CLEAR_STR IP_STR BGP_STR @@ -8123,21 +8123,21 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 " CMD_AS_RANGE " in", + * "clear bgp ipv6 (1-4294967295) in", * CLEAR_STR * BGP_STR * "Address family\n" * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", + * "clear bgp WORD (1-4294967295) in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", + * "clear bgp WORD ipv6 (1-4294967295) in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8145,7 +8145,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear bgp ipv6 " CMD_AS_RANGE " soft in", + * "clear bgp ipv6 (1-4294967295) soft in", * CLEAR_STR * BGP_STR * "Address family\n" @@ -8153,7 +8153,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", + * "clear bgp WORD (1-4294967295) soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8161,13 +8161,13 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, * BGP_SOFT_STR * BGP_SOFT_IN_STR * - * "clear bgp " CMD_AS_RANGE " in", + * "clear bgp (1-4294967295) in", * CLEAR_STR * BGP_STR * "Clear peers with the AS number\n" * BGP_SOFT_IN_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", + * "clear bgp WORD ipv6 (1-4294967295) soft in", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8179,7 +8179,7 @@ DEFUN (clear_ip_bgp_as_encap_soft_in, */ DEFUN (clear_bgp_as_soft_in, clear_bgp_as_soft_in_cmd, - "clear bgp " CMD_AS_RANGE " soft in", + "clear bgp (1-4294967295) soft in", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -8197,7 +8197,7 @@ DEFUN (clear_bgp_as_soft_in, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", + * "clear bgp ipv6 (1-4294967295) in prefix-filter", * CLEAR_STR * BGP_STR * "Address family\n" @@ -8208,7 +8208,7 @@ DEFUN (clear_bgp_as_soft_in, */ DEFUN (clear_bgp_as_in_prefix_filter, clear_bgp_as_in_prefix_filter_cmd, - "clear bgp " CMD_AS_RANGE " in prefix-filter", + "clear bgp (1-4294967295) in prefix-filter", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -8224,7 +8224,7 @@ DEFUN (clear_bgp_as_in_prefix_filter, /* Both soft-reconfiguration */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " * soft", + * "clear ip bgp WORD * soft", * CLEAR_STR * IP_STR * BGP_STR @@ -8273,7 +8273,7 @@ DEFUN (clear_ip_bgp_all_ipv4_soft, DEFUN (clear_ip_bgp_instance_all_ipv4_soft, clear_ip_bgp_instance_all_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 soft", + "clear ip bgp WORD * ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8333,14 +8333,14 @@ DEFUN (clear_ip_bgp_all_encap_soft, * "Clear all peers\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " * soft", + * "clear bgp WORD * soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Clear all peers\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", + * "clear bgp WORD ipv6 * soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8367,7 +8367,7 @@ DEFUN (clear_bgp_all_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", + * "clear ip bgp WORD (A.B.C.D|WORD) soft", * CLEAR_STR * IP_STR * BGP_STR @@ -8422,7 +8422,7 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft, DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, clear_ip_bgp_instance_peer_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " ipv4 soft", + "clear ip bgp WORD ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8489,7 +8489,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft, * "BGP neighbor on interface to clear\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", + * "clear bgp WORD ipv6 (A.B.C.D|X:X::X:X|WORD) soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8499,7 +8499,7 @@ DEFUN (clear_ip_bgp_peer_encap_soft, * "BGP neighbor on interface to clear\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", + * "clear bgp WORD (A.B.C.D|X:X::X:X|WORD) soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8533,7 +8533,7 @@ DEFUN (clear_bgp_peer_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", + * "clear ip bgp WORD peer-group WORD soft", * CLEAR_STR * IP_STR * BGP_STR @@ -8588,7 +8588,7 @@ DEFUN (clear_ip_bgp_peer_group_ipv4_soft, DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 soft", + "clear ip bgp WORD peer-group WORD ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8613,7 +8613,7 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", + * "clear bgp WORD ipv6 peer-group WORD soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8622,7 +8622,7 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, * "BGP peer-group name\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", + * "clear bgp WORD peer-group WORD soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8659,7 +8659,7 @@ DEFUN (clear_bgp_peer_group_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " external soft", + * "clear ip bgp WORD external soft", * CLEAR_STR * IP_STR * BGP_STR @@ -8709,7 +8709,7 @@ DEFUN (clear_ip_bgp_external_ipv4_soft, DEFUN (clear_ip_bgp_instance_external_ipv4_soft, clear_ip_bgp_instance_external_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 soft", + "clear ip bgp WORD external ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8732,14 +8732,14 @@ DEFUN (clear_ip_bgp_instance_external_ipv4_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp " BGP_INSTANCE_CMD " external soft", + * "clear bgp WORD external soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Clear all external peers\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", + * "clear bgp WORD ipv6 external soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8773,7 +8773,7 @@ DEFUN (clear_bgp_external_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", + * "clear ip bgp WORD (1-4294967295) soft", * CLEAR_STR * IP_STR * BGP_STR @@ -8784,7 +8784,7 @@ DEFUN (clear_bgp_external_soft, */ DEFUN (clear_ip_bgp_as_soft, clear_ip_bgp_as_soft_cmd, - "clear ip bgp " CMD_AS_RANGE " soft", + "clear ip bgp (1-4294967295) soft", CLEAR_STR IP_STR BGP_STR @@ -8803,7 +8803,7 @@ DEFUN (clear_ip_bgp_as_soft, DEFUN (clear_ip_bgp_as_ipv4_soft, clear_ip_bgp_as_ipv4_soft_cmd, - "clear ip bgp " CMD_AS_RANGE " ipv4 soft", + "clear ip bgp (1-4294967295) ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8825,7 +8825,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, DEFUN (clear_ip_bgp_instance_as_ipv4_soft, clear_ip_bgp_instance_as_ipv4_soft_cmd, - "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 soft", + "clear ip bgp WORD (1-4294967295) ipv4 soft", CLEAR_STR IP_STR BGP_STR @@ -8849,7 +8849,7 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft, DEFUN (clear_ip_bgp_as_vpnv4_soft, clear_ip_bgp_as_vpnv4_soft_cmd, - "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", + "clear ip bgp (1-4294967295) vpnv4 unicast soft", CLEAR_STR IP_STR BGP_STR @@ -8865,7 +8865,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft, DEFUN (clear_ip_bgp_as_encap_soft, clear_ip_bgp_as_encap_soft_cmd, - "clear ip bgp " CMD_AS_RANGE " encap unicast soft", + "clear ip bgp (1-4294967295) encap unicast soft", CLEAR_STR IP_STR BGP_STR @@ -8881,14 +8881,14 @@ DEFUN (clear_ip_bgp_as_encap_soft, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 " CMD_AS_RANGE " soft", + * "clear bgp ipv6 (1-4294967295) soft", * CLEAR_STR * BGP_STR * "Address family\n" * "Clear peers with the AS number\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", + * "clear bgp WORD ipv6 (1-4294967295) soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8896,7 +8896,7 @@ DEFUN (clear_ip_bgp_as_encap_soft, * "Clear peers with the AS number\n" * BGP_SOFT_STR * - * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", + * "clear bgp WORD (1-4294967295) soft", * CLEAR_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -8906,7 +8906,7 @@ DEFUN (clear_ip_bgp_as_encap_soft, */ DEFUN (clear_bgp_as_soft, clear_bgp_as_soft_cmd, - "clear bgp " CMD_AS_RANGE " soft", + "clear bgp (1-4294967295) soft", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -9616,7 +9616,7 @@ DEFUN (show_ip_bgp_summary, DEFUN (show_ip_bgp_instance_summary, show_ip_bgp_instance_summary_cmd, - "show ip bgp " BGP_INSTANCE_CMD " summary [json]", + "show ip bgp WORD summary [json]", SHOW_STR IP_STR BGP_STR @@ -9631,7 +9631,7 @@ DEFUN (show_ip_bgp_instance_summary, DEFUN (show_ip_bgp_instance_all_summary, show_ip_bgp_instance_all_summary_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " summary [json]", + "show ip bgp all summary [json]", SHOW_STR IP_STR BGP_STR @@ -9806,7 +9806,7 @@ DEFUN (show_bgp_summary, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 summary [json]", + * "show bgp WORD ipv6 summary [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -9816,7 +9816,7 @@ DEFUN (show_bgp_summary, */ DEFUN (show_bgp_instance_summary, show_bgp_instance_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " summary [json]", + "show bgp WORD summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -9829,7 +9829,7 @@ DEFUN (show_bgp_instance_summary, DEFUN (show_bgp_instance_all_summary, show_bgp_instance_all_summary_cmd, - "show bgp " BGP_INSTANCE_ALL_CMD " summary [json]", + "show bgp all summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR @@ -9865,7 +9865,7 @@ DEFUN (show_bgp_ipv6_safi_summary, DEFUN (show_bgp_instance_ipv6_safi_summary, show_bgp_instance_ipv6_safi_summary_cmd, - "show bgp " BGP_INSTANCE_CMD " ipv6 summary [json]", + "show bgp WORD ipv6 summary [json]", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -11886,14 +11886,14 @@ DEFUN (show_ip_bgp_neighbors_peer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " neighbors [json]", + * "show bgp WORD neighbors [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR * "Detailed information on TCP and BGP neighbor connections\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors [json]", + * "show bgp WORD ipv6 neighbors [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -11904,7 +11904,7 @@ DEFUN (show_ip_bgp_neighbors_peer, */ DEFUN (show_ip_bgp_instance_neighbors, show_ip_bgp_instance_neighbors_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors [json]", + "show ip bgp WORD neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -11920,7 +11920,7 @@ DEFUN (show_ip_bgp_instance_neighbors, DEFUN (show_ip_bgp_instance_all_neighbors, show_ip_bgp_instance_all_neighbors_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors [json]", + "show ip bgp all neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -11938,7 +11938,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", + * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -11949,7 +11949,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, * "Neighbor on bgp configured interface\n" * "JavaScript Object Notation\n" * - * "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", + * "show bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) [json]", * SHOW_STR * BGP_STR * BGP_INSTANCE_HELP_STR @@ -11962,7 +11962,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, */ DEFUN (show_ip_bgp_instance_neighbors_peer, show_ip_bgp_instance_neighbors_peer_cmd, - "show ip bgp " BGP_INSTANCE_CMD " neighbors [json]", + "show ip bgp WORD neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -12103,7 +12103,7 @@ DEFUN (show_ip_bgp_updgrps, DEFUN (show_ip_bgp_instance_updgrps, show_ip_bgp_instance_updgrps_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups", + "show ip bgp WORD update-groups", SHOW_STR IP_STR BGP_STR @@ -12116,7 +12116,7 @@ DEFUN (show_ip_bgp_instance_updgrps, DEFUN (show_ip_bgp_instance_all_updgrps, show_ip_bgp_instance_all_updgrps_cmd, - "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", + "show ip bgp all update-groups", SHOW_STR IP_STR BGP_STR @@ -12139,7 +12139,7 @@ DEFUN (show_bgp_ipv6_updgrps, DEFUN (show_bgp_instance_ipv6_updgrps, show_bgp_instance_ipv6_updgrps_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups", + "show bgp WORD update-groups", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12151,7 +12151,7 @@ DEFUN (show_bgp_instance_ipv6_updgrps, DEFUN (show_bgp_instance_all_ipv6_updgrps, show_bgp_instance_all_ipv6_updgrps_cmd, - "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", + "show bgp all update-groups", SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR @@ -12199,7 +12199,7 @@ DEFUN (show_ip_bgp_updgrps_s, DEFUN (show_ip_bgp_instance_updgrps_s, show_ip_bgp_instance_updgrps_s_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", + "show ip bgp WORD update-groups SUBGROUP-ID", SHOW_STR IP_STR BGP_STR @@ -12230,7 +12230,7 @@ DEFUN (show_bgp_ipv6_updgrps_s, DEFUN (show_bgp_instance_ipv6_updgrps_s, show_bgp_instance_ipv6_updgrps_s_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", + "show bgp WORD update-groups SUBGROUP-ID", SHOW_STR BGP_STR "Detailed info about v6 dynamic update groups\n" @@ -12287,7 +12287,7 @@ DEFUN (show_bgp_updgrps_stats, DEFUN (show_bgp_instance_updgrps_stats, show_bgp_instance_updgrps_stats_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups statistics", + "show bgp WORD update-groups statistics", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12346,7 +12346,7 @@ DEFUN (show_ip_bgp_updgrps_adj, DEFUN (show_ip_bgp_instance_updgrps_adj, show_ip_bgp_instance_updgrps_adj_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups ", + "show ip bgp WORD update-groups ", SHOW_STR IP_STR BGP_STR @@ -12407,7 +12407,7 @@ DEFUN (show_bgp_updgrps_adj, DEFUN (show_bgp_instance_updgrps_adj, show_bgp_instance_updgrps_adj_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups ", + "show bgp WORD update-groups ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12446,7 +12446,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, DEFUN (show_ip_bgp_instance_updgrps_adj_s, show_ip_bgp_instance_updgrps_adj_s_cmd, - "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID ", + "show ip bgp WORD update-groups SUBGROUP-ID ", SHOW_STR IP_STR BGP_STR @@ -12521,7 +12521,7 @@ DEFUN (show_bgp_updgrps_adj_s, DEFUN (show_bgp_instance_updgrps_adj_s, show_bgp_instance_updgrps_adj_s_cmd, - "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID ", + "show bgp WORD update-groups SUBGROUP-ID ", SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR @@ -12715,7 +12715,7 @@ DEFUN (show_ip_bgp_peer_groups, DEFUN (show_ip_bgp_instance_peer_groups, show_ip_bgp_instance_peer_groups_cmd, - "show ip bgp " BGP_INSTANCE_CMD " peer-group", + "show ip bgp WORD peer-group", SHOW_STR IP_STR BGP_STR @@ -12741,7 +12741,7 @@ DEFUN (show_ip_bgp_peer_group, DEFUN (show_ip_bgp_instance_peer_group, show_ip_bgp_instance_peer_group_cmd, - "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", + "show ip bgp WORD peer-group WORD", SHOW_STR IP_STR BGP_STR @@ -12758,7 +12758,7 @@ DEFUN (show_ip_bgp_instance_peer_group, DEFUN (bgp_redistribute_ipv4, bgp_redistribute_ipv4_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD, + "redistribute ", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD) { @@ -12777,7 +12777,7 @@ DEFUN (bgp_redistribute_ipv4, DEFUN (bgp_redistribute_ipv4_rmap, bgp_redistribute_ipv4_rmap_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", + "redistribute route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -12802,7 +12802,7 @@ DEFUN (bgp_redistribute_ipv4_rmap, DEFUN (bgp_redistribute_ipv4_metric, bgp_redistribute_ipv4_metric_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric (0-4294967295)", + "redistribute metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -12829,7 +12829,7 @@ DEFUN (bgp_redistribute_ipv4_metric, DEFUN (bgp_redistribute_ipv4_rmap_metric, bgp_redistribute_ipv4_rmap_metric_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric (0-4294967295)", + "redistribute route-map WORD metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -12860,7 +12860,7 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric, DEFUN (bgp_redistribute_ipv4_metric_rmap, bgp_redistribute_ipv4_metric_rmap_cmd, - "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric (0-4294967295) route-map WORD", + "redistribute metric (0-4294967295) route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -13114,7 +13114,7 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + * "no redistribute metric <0-4294967295> route-map WORD", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP_REDIST_HELP_STR_BGPD @@ -13123,14 +13123,14 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, * "Route map reference\n" * "Pointer to route-map entries\n" * - * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", + * "no redistribute route-map WORD", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP_REDIST_HELP_STR_BGPD * "Route map reference\n" * "Pointer to route-map entries\n" * - * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + * "no redistribute route-map WORD metric <0-4294967295>", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP_REDIST_HELP_STR_BGPD @@ -13139,7 +13139,7 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, * "Metric for redistributed routes\n" * "Default metric\n" * - * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", + * "no redistribute metric <0-4294967295>", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP_REDIST_HELP_STR_BGPD @@ -13149,7 +13149,7 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, */ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, + "no redistribute ", NO_STR "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD) @@ -13173,7 +13173,7 @@ DEFUN (no_bgp_redistribute_ipv4, #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, + "redistribute ", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD) { @@ -13193,7 +13193,7 @@ DEFUN (bgp_redistribute_ipv6, DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", + "redistribute route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -13218,7 +13218,7 @@ DEFUN (bgp_redistribute_ipv6_rmap, DEFUN (bgp_redistribute_ipv6_metric, bgp_redistribute_ipv6_metric_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric (0-4294967295)", + "redistribute metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -13245,7 +13245,7 @@ DEFUN (bgp_redistribute_ipv6_metric, DEFUN (bgp_redistribute_ipv6_rmap_metric, bgp_redistribute_ipv6_rmap_metric_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric (0-4294967295)", + "redistribute route-map WORD metric (0-4294967295)", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Route map reference\n" @@ -13276,7 +13276,7 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric, DEFUN (bgp_redistribute_ipv6_metric_rmap, bgp_redistribute_ipv6_metric_rmap_cmd, - "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric (0-4294967295) route-map WORD", + "redistribute metric (0-4294967295) route-map WORD", "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD "Metric for redistributed routes\n" @@ -13307,14 +13307,14 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", + * "no redistribute route-map WORD", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP6_REDIST_HELP_STR_BGPD * "Route map reference\n" * "Pointer to route-map entries\n" * - * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", + * "no redistribute route-map WORD metric <0-4294967295>", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP6_REDIST_HELP_STR_BGPD @@ -13323,7 +13323,7 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, * "Metric for redistributed routes\n" * "Default metric\n" * - * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", + * "no redistribute metric <0-4294967295> route-map WORD", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP6_REDIST_HELP_STR_BGPD @@ -13332,7 +13332,7 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, * "Route map reference\n" * "Pointer to route-map entries\n" * - * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", + * "no redistribute metric <0-4294967295>", * NO_STR * "Redistribute information from another routing protocol\n" * QUAGGA_IP6_REDIST_HELP_STR_BGPD @@ -13342,7 +13342,7 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, */ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, + "no redistribute ", NO_STR "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index fcdc11bba1..a0ca5ad2c5 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -539,7 +539,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute " QUAGGA_REDIST_STR_ISISD " [metric (0-16777215)|route-map WORD]", + "redistribute [metric (0-16777215)|route-map WORD]", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" @@ -611,7 +611,7 @@ DEFUN (isis_redistribute, DEFUN (no_isis_redistribute, no_isis_redistribute_cmd, - "no redistribute " QUAGGA_REDIST_STR_ISISD " ", + "no redistribute ", NO_STR REDIST_STR "Redistribute IPv4 routes\n" diff --git a/lib/command.c b/lib/command.c index ed2c30ad63..6fb265f97a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1893,7 +1893,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [" LOG_FACILITIES "] [" LOG_LEVELS "]", + "no log syslog [] [" LOG_LEVELS "]", NO_STR "Logging control\n" "Cancel logging to syslog\n" @@ -1906,7 +1906,7 @@ DEFUN (no_config_log_syslog, DEFUN (config_log_facility, config_log_facility_cmd, - "log facility " LOG_FACILITIES, + "log facility ", "Logging control\n" "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) @@ -1920,7 +1920,7 @@ DEFUN (config_log_facility, DEFUN (no_config_log_facility, no_config_log_facility_cmd, - "no log facility [" LOG_FACILITIES "]", + "no log facility []", NO_STR "Logging control\n" "Reset syslog facility to default (daemon)\n" diff --git a/lib/if.c b/lib/if.c index 4c4b66cda5..a0083933f8 100644 --- a/lib/if.c +++ b/lib/if.c @@ -926,7 +926,7 @@ DEFUN (show_address, DEFUN (show_address_vrf_all, show_address_vrf_all_cmd, - "show address " VRF_ALL_CMD_STR, + "show address vrf all", SHOW_STR "address\n" VRF_ALL_CMD_HELP_STR) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index c35b30a65b..379320e869 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -642,7 +642,7 @@ ospf6_asbr_redistribute_remove (int type, ifindex_t ifindex, DEFUN (ospf6_redistribute, ospf6_redistribute_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPF6D, + "redistribute ", "Redistribute\n" QUAGGA_REDIST_HELP_STR_OSPF6D ) @@ -660,7 +660,7 @@ DEFUN (ospf6_redistribute, DEFUN (ospf6_redistribute_routemap, ospf6_redistribute_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", + "redistribute route-map WORD", "Redistribute\n" QUAGGA_REDIST_HELP_STR_OSPF6D "Route map reference\n" @@ -683,7 +683,7 @@ DEFUN (ospf6_redistribute_routemap, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", + * "no redistribute route-map WORD", * NO_STR * "Redistribute\n" * QUAGGA_REDIST_HELP_STR_OSPF6D @@ -693,7 +693,7 @@ DEFUN (ospf6_redistribute_routemap, */ DEFUN (no_ospf6_redistribute, no_ospf6_redistribute_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPF6D, + "no redistribute ", NO_STR "Redistribute\n" QUAGGA_REDIST_HELP_STR_OSPF6D diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 5d1eae3e38..ffbefd139d 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -346,7 +346,7 @@ DEFUN (ipv6_ospf6_bfd, DEFUN (ipv6_ospf6_bfd_param, ipv6_ospf6_bfd_param_cmd, - "ipv6 ospf6 bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + "ipv6 ospf6 bfd (2-255) (50-60000) (50-60000)", IP6_STR OSPF6_STR "Enables BFD support\n" diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index d8fefab9cc..ae4691efa9 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -379,7 +379,7 @@ DEFUN (ip_ospf_bfd, DEFUN (ip_ospf_bfd_param, ip_ospf_bfd_param_cmd, - "ip ospf bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + "ip ospf bfd (2-255) (50-60000) (50-60000)", "IP Information\n" "OSPF interface commands\n" "Enables BFD support\n" @@ -409,7 +409,7 @@ DEFUN (ip_ospf_bfd_param, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + * "no ip ospf bfd (2-255) (50-60000) (50-60000)", * NO_STR * "IP Information\n" * "OSPF interface commands\n" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index b3019b4653..b022261d2d 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -5858,7 +5858,7 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", + * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5866,7 +5866,7 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, * OSPF_LSA_TYPES_DESC * "Link State ID (as an IP address)\n" * - * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", + * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5876,7 +5876,7 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, * "Self-originated link states\n" * "\n" * - * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", + * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5886,7 +5886,7 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, * "Advertising Router link states\n" * "Advertising Router (as an IP address)\n" * - * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", + * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5918,7 +5918,7 @@ DEFUN (show_ip_ospf_database, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", + * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5929,7 +5929,7 @@ DEFUN (show_ip_ospf_database, * "Advertising Router link states\n" * "Advertising Router (as an IP address)\n" * - * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", + * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5938,7 +5938,7 @@ DEFUN (show_ip_ospf_database, * OSPF_LSA_TYPES_DESC * "Link State ID (as an IP address)\n" * - * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", + * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -5949,7 +5949,7 @@ DEFUN (show_ip_ospf_database, * "Self-originated link states\n" * "\n" * - * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", + * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -6042,7 +6042,7 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", + * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -6053,7 +6053,7 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf */ DEFUN (show_ip_ospf_database_type_adv_router, show_ip_ospf_database_type_adv_router_cmd, - "show ip ospf database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D", + "show ip ospf database adv-router A.B.C.D", SHOW_STR IP_STR "OSPF information\n" @@ -6073,7 +6073,7 @@ DEFUN (show_ip_ospf_database_type_adv_router, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", + * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)", * SHOW_STR * IP_STR * "OSPF information\n" @@ -6085,7 +6085,7 @@ DEFUN (show_ip_ospf_database_type_adv_router, */ DEFUN (show_ip_ospf_instance_database_type_adv_router, show_ip_ospf_instance_database_type_adv_router_cmd, - "show ip ospf (1-65535) database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D", + "show ip ospf (1-65535) database adv-router A.B.C.D", SHOW_STR IP_STR "OSPF information\n" @@ -8213,7 +8213,7 @@ DEFUN (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "redistribute [metric (0-16777214)|metric-type <1|2>|route-map WORD]", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8268,7 +8268,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "no redistribute [metric (0-16777214)|metric-type <1|2>|route-map WORD]", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8427,7 +8427,7 @@ DEFUN (no_ospf_redistribute_instance_source, DEFUN (ospf_distribute_list_out, ospf_distribute_list_out_cmd, - "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, + "distribute-list WORD out ", "Filter networks in routing updates\n" "Access-list name\n" OUT_STR @@ -8450,7 +8450,7 @@ DEFUN (ospf_distribute_list_out, DEFUN (no_ospf_distribute_list_out, no_ospf_distribute_list_out_cmd, - "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, + "no distribute-list WORD out ", NO_STR "Filter networks in routing updates\n" "Access-list name\n" diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 9232c48e7f..52302a6460 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2501,7 +2501,7 @@ DEFUN (no_ip_pim_rp, DEFUN (ip_multicast_routing, ip_multicast_routing_cmd, - PIM_CMD_IP_MULTICAST_ROUTING, + "ip multicast-routing", IP_STR "Enable IP multicast forwarding\n") { @@ -2514,7 +2514,7 @@ DEFUN (ip_multicast_routing, DEFUN (no_ip_multicast_routing, no_ip_multicast_routing_cmd, - PIM_CMD_NO " " PIM_CMD_IP_MULTICAST_ROUTING, + "no ip multicast-routing", NO_STR IP_STR "Global IP configuration subcommands\n" @@ -2874,7 +2874,7 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp, DEFUN (interface_ip_igmp_query_interval, interface_ip_igmp_query_interval_cmd, - PIM_CMD_IP_IGMP_QUERY_INTERVAL " (1-1800)", + "ip igmp query-interval (1-1800)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_INTERVAL_STR @@ -2933,7 +2933,7 @@ DEFUN (interface_ip_igmp_query_interval, DEFUN (interface_no_ip_igmp_query_interval, interface_no_ip_igmp_query_interval_cmd, - PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_INTERVAL, + "no ip igmp query-interval", NO_STR IP_STR IFACE_IGMP_STR @@ -2969,7 +2969,7 @@ DEFUN (interface_no_ip_igmp_query_interval, DEFUN (interface_ip_igmp_query_max_response_time, interface_ip_igmp_query_max_response_time_cmd, - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME " (1-25)", + "ip igmp query-max-response-time (1-25)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR @@ -3026,7 +3026,7 @@ DEFUN (interface_ip_igmp_query_max_response_time, DEFUN (interface_no_ip_igmp_query_max_response_time, interface_no_ip_igmp_query_max_response_time_cmd, - PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME, + "no ip igmp query-max-response-time", NO_STR IP_STR IFACE_IGMP_STR @@ -3062,7 +3062,7 @@ DEFUN (interface_no_ip_igmp_query_max_response_time, DEFUN (interface_ip_igmp_query_max_response_time_dsec, interface_ip_igmp_query_max_response_time_dsec_cmd, - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC " (10-250)", + "ip igmp query-max-response-time-dsec (10-250)", IP_STR IFACE_IGMP_STR IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR @@ -3122,7 +3122,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec, DEFUN (interface_no_ip_igmp_query_max_response_time_dsec, interface_no_ip_igmp_query_max_response_time_dsec_cmd, - PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC, + "no ip igmp query-max-response-time-dsec", NO_STR IP_STR IFACE_IGMP_STR diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 3596938bbf..f4cca7e8ab 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -359,7 +359,7 @@ DEFUN (no_rip_redistribute_rip, DEFUN (rip_redistribute_type, rip_redistribute_type_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD, + "redistribute ", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD) { @@ -384,7 +384,7 @@ DEFUN (rip_redistribute_type, DEFUN (no_rip_redistribute_type, no_rip_redistribute_type_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD, + "no redistribute ", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD) @@ -411,7 +411,7 @@ DEFUN (no_rip_redistribute_type, DEFUN (rip_redistribute_type_routemap, rip_redistribute_type_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD " route-map WORD", + "redistribute route-map WORD", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD "Route map reference\n" @@ -440,7 +440,7 @@ DEFUN (rip_redistribute_type_routemap, DEFUN (no_rip_redistribute_type_routemap, no_rip_redistribute_type_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD " route-map WORD", + "no redistribute route-map WORD", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD @@ -471,7 +471,7 @@ DEFUN (no_rip_redistribute_type_routemap, DEFUN (rip_redistribute_type_metric, rip_redistribute_type_metric_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16)", + "redistribute metric (0-16)", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD "Metric\n" @@ -503,7 +503,7 @@ DEFUN (rip_redistribute_type_metric, DEFUN (no_rip_redistribute_type_metric, no_rip_redistribute_type_metric_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16)", + "no redistribute metric (0-16)", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD @@ -534,7 +534,7 @@ DEFUN (no_rip_redistribute_type_metric, DEFUN (rip_redistribute_type_metric_routemap, rip_redistribute_type_metric_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16) route-map WORD", + "redistribute metric (0-16) route-map WORD", REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD "Metric\n" @@ -571,7 +571,7 @@ DEFUN (rip_redistribute_type_metric_routemap, DEFUN (no_rip_redistribute_type_metric_routemap, no_rip_redistribute_type_metric_routemap_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPD " metric (0-16) route-map WORD", + "no redistribute metric (0-16) route-map WORD", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_RIPD diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index a6dc20072d..07c51ca6d2 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -327,7 +327,7 @@ DEFUN (no_ripng_redistribute_ripng, DEFUN (ripng_redistribute_type, ripng_redistribute_type_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD, + "redistribute ", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD) { @@ -347,21 +347,21 @@ DEFUN (ripng_redistribute_type, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD", + * "no redistribute metric <0-16> route-map WORD", * NO_STR * "Redistribute\n" * QUAGGA_REDIST_HELP_STR_RIPNGD * "Route map reference\n" * "Pointer to route-map entries\n" * - * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>", + * "no redistribute metric <0-16>", * NO_STR * "Redistribute\n" * QUAGGA_REDIST_HELP_STR_RIPNGD * "Metric\n" * "Metric value\n" * - * "no redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", + * "no redistribute route-map WORD", * NO_STR * "Redistribute\n" * QUAGGA_REDIST_HELP_STR_RIPNGD @@ -371,7 +371,7 @@ DEFUN (ripng_redistribute_type, */ DEFUN (no_ripng_redistribute_type, no_ripng_redistribute_type_cmd, - "no redistribute " QUAGGA_REDIST_STR_RIPNGD, + "no redistribute ", NO_STR "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD) @@ -394,7 +394,7 @@ DEFUN (no_ripng_redistribute_type, DEFUN (ripng_redistribute_type_metric, ripng_redistribute_type_metric_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric (0-16)", + "redistribute metric (0-16)", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" @@ -423,7 +423,7 @@ DEFUN (ripng_redistribute_type_metric, DEFUN (ripng_redistribute_type_routemap, ripng_redistribute_type_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD", + "redistribute route-map WORD", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD "Route map reference\n" @@ -450,7 +450,7 @@ DEFUN (ripng_redistribute_type_routemap, DEFUN (ripng_redistribute_type_metric_routemap, ripng_redistribute_type_metric_routemap_cmd, - "redistribute " QUAGGA_REDIST_STR_RIPNGD " metric (0-16) route-map WORD", + "redistribute metric (0-16) route-map WORD", "Redistribute\n" QUAGGA_REDIST_HELP_STR_RIPNGD "Metric\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index a35f0e0821..8a4a0b8cf2 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -4,7 +4,6 @@ Usage: argv_translator.py rebuild-defuns [] - argv_translator.py idx-logic Help: rebuild-defuns : foo @@ -500,11 +499,6 @@ def get_command_string_index_variable_table(line_number, line): return indexes -def get_idx_logic(wildcard): - # dwalton - return None - - def expand_command_string(line): # in the middle @@ -579,6 +573,10 @@ def expand_command_string(line): if line.rstrip().endswith('" ,'): line = line.replace('" ,', '",') + # compress duplicate white spaces + re_space = re.search('^(\s*).*(\s*)$', line) + line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) + return line @@ -721,9 +719,12 @@ DEFUN (no_bgp_maxmed_onstartup, new_command_string = self.get_new_command_string() new_command_string_expanded = expand_command_string(new_command_string) lines = [] + + # dwalton lines.append("DEFUN (%s,\n" % self.name) lines.append(" %s,\n" % self.name_cmd) - lines.append(new_command_string) + # lines.append(new_command_string) + lines.append(new_command_string_expanded) lines.extend(self.help_strings) lines.append('{\n') @@ -847,10 +848,14 @@ def update_argvs(filename): with open(filename, 'w') as fh: state = None - for line in lines: + for (line_number, line) in enumerate(lines): if state is None: - if line.startswith('DEFUN ('): + if 'The following ALIASes need to be implemented in this DEFUN' in line: + state = 'CHANGE ME' + fh.write(line) + + elif line.startswith('DEFUN ('): state = 'DEFUN_HEADER' re_name = re.search('DEFUN \((.*),', line.strip()) name = re_name.group(1) @@ -859,6 +864,17 @@ def update_argvs(filename): else: fh.write(line) + elif state == 'CHANGE ME': + if line.strip() == '*/': + state = None + fh.write(line) + elif line.strip().startswith('* "'): + # dwalton + new_line = expand_command_string(line[3:]) # chop the leading " * " + fh.write(" * %s" % new_line) + else: + fh.write(line) + elif state == 'DEFUN_HEADER': if line.strip() == '{': state = 'DEFUN_BODY' @@ -867,6 +883,9 @@ def update_argvs(filename): if line.rstrip() == '}': state = None + # uncomment to debug state machine + # print "%5d %12s: %s" % (line_number, state, line.rstrip()) + if __name__ == '__main__': (print_options, ended_with_space, sys.argv) = get_network_docopt_info(sys.argv) @@ -888,5 +907,3 @@ if __name__ == '__main__': filename = filename.strip() print "crunching %s" % filename update_argvs(filename) - elif cli.get('idx-logic'): - print get_idx_logic(cli.args.get('')) diff --git a/zebra/interface.c b/zebra/interface.c index d1f21c17b3..c1fbc9cdd3 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1300,7 +1300,7 @@ struct cmd_node vrf_node = /* Show all interfaces to vty. */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show interface " VRF_CMD_STR, + * "show interface vrf NAME", * SHOW_STR * "Interface status and configuration\n" * VRF_CMD_HELP_STR @@ -1332,7 +1332,7 @@ DEFUN (show_interface, /* Show all interfaces to vty. */ DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd, - "show interface " VRF_ALL_CMD_STR, + "show interface vrf all", SHOW_STR "Interface status and configuration\n" VRF_ALL_CMD_HELP_STR) @@ -1355,7 +1355,7 @@ DEFUN (show_interface_vrf_all, DEFUN (show_interface_name_vrf, show_interface_name_vrf_cmd, - "show interface IFNAME " VRF_CMD_STR, + "show interface IFNAME vrf NAME", SHOW_STR "Interface status and configuration\n" "Interface name\n" @@ -1395,7 +1395,7 @@ DEFUN (show_interface_name_vrf, */ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, - "show interface IFNAME " VRF_ALL_CMD_STR, + "show interface IFNAME vrf all", SHOW_STR "Interface status and configuration\n" "Interface name\n" @@ -1472,7 +1472,7 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id) /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show interface description " VRF_CMD_STR, + * "show interface description vrf NAME", * SHOW_STR * "Interface status and configuration\n" * "Interface description\n" @@ -1499,7 +1499,7 @@ DEFUN (show_interface_desc, DEFUN (show_interface_desc_vrf_all, show_interface_desc_vrf_all_cmd, - "show interface description " VRF_ALL_CMD_STR, + "show interface description vrf all", SHOW_STR "Interface status and configuration\n" "Interface description\n" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index ed90042b8c..6b861d7804 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -661,7 +661,7 @@ DEFUN (no_zebra_route_map_timer, DEFUN (ip_protocol, ip_protocol_cmd, - "ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + "ip protocol route-map ROUTE-MAP", IP_STR "Filter routing info exchanged between zebra and protocol\n" QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA @@ -700,7 +700,7 @@ DEFUN (ip_protocol, DEFUN (no_ip_protocol, no_ip_protocol_cmd, - "no ip protocol " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", + "no ip protocol [route-map ROUTE-MAP]", NO_STR IP_STR "Stop filtering routing info between zebra and protocol\n" @@ -771,7 +771,7 @@ DEFUN (show_ip_protocol, DEFUN (ipv6_protocol, ipv6_protocol_cmd, - "ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + "ipv6 protocol route-map ROUTE-MAP", IP6_STR "Filter IPv6 routing info exchanged between zebra and protocol\n" QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA @@ -810,7 +810,7 @@ DEFUN (ipv6_protocol, DEFUN (no_ipv6_protocol, no_ipv6_protocol_cmd, - "no ipv6 protocol " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", + "no ipv6 protocol [route-map ROUTE-MAP]", NO_STR IP6_STR "Stop filtering IPv6 routing info between zebra and protocol\n" @@ -880,7 +880,7 @@ DEFUN (show_ipv6_protocol, DEFUN (ip_protocol_nht_rmap, ip_protocol_nht_rmap_cmd, - "ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + "ip nht route-map ROUTE-MAP", IP_STR "Filter Next Hop tracking route resolution\n" QUAGGA_IP_PROTOCOL_MAP_HELP_STR_ZEBRA @@ -916,7 +916,7 @@ DEFUN (ip_protocol_nht_rmap, DEFUN (no_ip_protocol_nht_rmap, no_ip_protocol_nht_rmap_cmd, - "no ip nht " QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", + "no ip nht [route-map ROUTE-MAP]", NO_STR IP_STR "Filter Next Hop tracking route resolution\n" @@ -981,7 +981,7 @@ DEFUN (show_ip_protocol_nht, DEFUN (ipv6_protocol_nht_rmap, ipv6_protocol_nht_rmap_cmd, - "ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " route-map ROUTE-MAP", + "ipv6 nht route-map ROUTE-MAP", IP6_STR "Filter Next Hop tracking route resolution\n" QUAGGA_IP6_PROTOCOL_MAP_HELP_STR_ZEBRA @@ -1011,7 +1011,7 @@ DEFUN (ipv6_protocol_nht_rmap, DEFUN (no_ipv6_protocol_nht_rmap, no_ipv6_protocol_nht_rmap_cmd, - "no ipv6 nht " QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA " [route-map ROUTE-MAP]", + "no ipv6 nht [route-map ROUTE-MAP]", NO_STR IP6_STR "Filter Next Hop tracking route resolution\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ebe0ca4054..878af09ee0 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1297,7 +1297,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, /* Static route configuration. */ DEFUN (ip_route_vrf, ip_route_vrf_cmd, - "ip route A.B.C.D/M " VRF_CMD_STR, + "ip route A.B.C.D/M vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1314,7 +1314,7 @@ DEFUN (ip_route_vrf, DEFUN (ip_route_tag_vrf, ip_route_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1334,7 +1334,7 @@ DEFUN (ip_route_tag_vrf, DEFUN (ip_route_flags_vrf, ip_route_flags_vrf_cmd, - "ip route A.B.C.D/M " VRF_CMD_STR, + "ip route A.B.C.D/M vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1353,7 +1353,7 @@ DEFUN (ip_route_flags_vrf, DEFUN (ip_route_flags_tag_vrf, ip_route_flags_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1376,7 +1376,7 @@ DEFUN (ip_route_flags_tag_vrf, DEFUN (ip_route_flags2_vrf, ip_route_flags2_vrf_cmd, - "ip route A.B.C.D/M " VRF_CMD_STR, + "ip route A.B.C.D/M vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1392,7 +1392,7 @@ DEFUN (ip_route_flags2_vrf, DEFUN (ip_route_flags2_tag_vrf, ip_route_flags2_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1413,7 +1413,7 @@ DEFUN (ip_route_flags2_tag_vrf, /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask_vrf, ip_route_mask_vrf_cmd, - "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1432,7 +1432,7 @@ DEFUN (ip_route_mask_vrf, DEFUN (ip_route_mask_tag_vrf, ip_route_mask_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1455,7 +1455,7 @@ DEFUN (ip_route_mask_tag_vrf, DEFUN (ip_route_mask_flags_vrf, ip_route_mask_flags_vrf_cmd, - "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1476,7 +1476,7 @@ DEFUN (ip_route_mask_flags_vrf, DEFUN (ip_route_mask_flags_tag_vrf, ip_route_mask_flags_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1501,7 +1501,7 @@ DEFUN (ip_route_mask_flags_tag_vrf, DEFUN (ip_route_mask_flags2_vrf, ip_route_mask_flags2_vrf_cmd, - "ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1519,7 +1519,7 @@ DEFUN (ip_route_mask_flags2_vrf, DEFUN (ip_route_mask_flags2_tag_vrf, ip_route_mask_flags2_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1541,7 +1541,7 @@ DEFUN (ip_route_mask_flags2_tag_vrf, /* Distance option value. */ DEFUN (ip_route_distance_vrf, ip_route_distance_vrf_cmd, - "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1560,7 +1560,7 @@ DEFUN (ip_route_distance_vrf, DEFUN (ip_route_tag_distance_vrf, ip_route_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1583,7 +1583,7 @@ DEFUN (ip_route_tag_distance_vrf, DEFUN (ip_route_flags_distance_vrf, ip_route_flags_distance_vrf_cmd, - "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1604,7 +1604,7 @@ DEFUN (ip_route_flags_distance_vrf, DEFUN (ip_route_flags_tag_distance_vrf, ip_route_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1628,7 +1628,7 @@ DEFUN (ip_route_flags_tag_distance_vrf, DEFUN (ip_route_flags_distance2_vrf, ip_route_flags_distance2_vrf_cmd, - "ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1646,7 +1646,7 @@ DEFUN (ip_route_flags_distance2_vrf, DEFUN (ip_route_flags_tag_distance2_vrf, ip_route_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1667,7 +1667,7 @@ DEFUN (ip_route_flags_tag_distance2_vrf, DEFUN (ip_route_mask_distance_vrf, ip_route_mask_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1688,7 +1688,7 @@ DEFUN (ip_route_mask_distance_vrf, DEFUN (ip_route_mask_tag_distance_vrf, ip_route_mask_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1712,7 +1712,7 @@ DEFUN (ip_route_mask_tag_distance_vrf, DEFUN (ip_route_mask_flags_tag_distance_vrf, ip_route_mask_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1739,7 +1739,7 @@ DEFUN (ip_route_mask_flags_tag_distance_vrf, DEFUN (ip_route_mask_flags_distance_vrf, ip_route_mask_flags_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1762,7 +1762,7 @@ DEFUN (ip_route_mask_flags_distance_vrf, DEFUN (ip_route_mask_flags_distance2_vrf, ip_route_mask_flags_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1782,7 +1782,7 @@ DEFUN (ip_route_mask_flags_distance2_vrf, DEFUN (ip_route_mask_flags_tag_distance2_vrf, ip_route_mask_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -1805,7 +1805,7 @@ DEFUN (ip_route_mask_flags_tag_distance2_vrf, DEFUN (no_ip_route_vrf, no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, + "no ip route A.B.C.D/M vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1823,7 +1823,7 @@ DEFUN (no_ip_route_vrf, DEFUN (no_ip_route_flags_vrf, no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, + "no ip route A.B.C.D/M vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1843,7 +1843,7 @@ DEFUN (no_ip_route_flags_vrf, DEFUN (no_ip_route_tag_vrf, no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1864,7 +1864,7 @@ DEFUN (no_ip_route_tag_vrf, DEFUN (no_ip_route_flags_tag_vrf, no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1887,7 +1887,7 @@ DEFUN (no_ip_route_flags_tag_vrf, DEFUN (no_ip_route_flags2_vrf, no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, + "no ip route A.B.C.D/M vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1904,7 +1904,7 @@ DEFUN (no_ip_route_flags2_vrf, DEFUN (no_ip_route_flags2_tag_vrf, no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1924,7 +1924,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, DEFUN (no_ip_route_mask_vrf, no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1944,7 +1944,7 @@ DEFUN (no_ip_route_mask_vrf, DEFUN (no_ip_route_mask_flags_vrf, no_ip_route_mask_flags_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1966,7 +1966,7 @@ DEFUN (no_ip_route_mask_flags_vrf, DEFUN (no_ip_route_mask_tag_vrf, no_ip_route_mask_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -1989,7 +1989,7 @@ DEFUN (no_ip_route_mask_tag_vrf, DEFUN (no_ip_route_mask_flags_tag_vrf, no_ip_route_mask_flags_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2014,7 +2014,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, DEFUN (no_ip_route_mask_flags2_vrf, no_ip_route_mask_flags2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2033,7 +2033,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, DEFUN (no_ip_route_mask_flags2_tag_vrf, no_ip_route_mask_flags2_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2056,7 +2056,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, DEFUN (no_ip_route_distance_vrf, no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2076,7 +2076,7 @@ DEFUN (no_ip_route_distance_vrf, DEFUN (no_ip_route_tag_distance_vrf, no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2099,7 +2099,7 @@ DEFUN (no_ip_route_tag_distance_vrf, DEFUN (no_ip_route_flags_distance_vrf, no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2121,7 +2121,7 @@ DEFUN (no_ip_route_flags_distance_vrf, DEFUN (no_ip_route_flags_tag_distance_vrf, no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2146,7 +2146,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, DEFUN (no_ip_route_flags_distance2_vrf, no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2165,7 +2165,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, DEFUN (no_ip_route_flags_tag_distance2_vrf, no_ip_route_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2187,7 +2187,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, DEFUN (no_ip_route_mask_distance_vrf, no_ip_route_mask_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2209,7 +2209,7 @@ DEFUN (no_ip_route_mask_distance_vrf, DEFUN (no_ip_route_mask_tag_distance_vrf, no_ip_route_mask_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2234,7 +2234,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance_vrf, no_ip_route_mask_flags_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2258,7 +2258,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, DEFUN (no_ip_route_mask_flags_tag_distance_vrf, no_ip_route_mask_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2285,7 +2285,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance2_vrf, no_ip_route_mask_flags_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2306,7 +2306,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, no_ip_route_mask_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -2840,7 +2840,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route " VRF_CMD_STR " [json]", + "show ip route vrf NAME [json]", SHOW_STR IP_STR "IP routing table\n" @@ -2876,7 +2876,7 @@ DEFUN (show_ip_nht, DEFUN (show_ip_nht_vrf_all, show_ip_nht_vrf_all_cmd, - "show ip nht " VRF_ALL_CMD_STR, + "show ip nht vrf all", SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -2916,7 +2916,7 @@ DEFUN (show_ipv6_nht, DEFUN (show_ipv6_nht_vrf_all, show_ipv6_nht_vrf_all_cmd, - "show ipv6 nht " VRF_ALL_CMD_STR, + "show ipv6 nht vrf all", SHOW_STR IP_STR "IPv6 nexthop tracking table\n" @@ -3144,7 +3144,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route [vrf NAME] ", SHOW_STR IP_STR "IP routing table\n" @@ -3534,7 +3534,7 @@ DEFUN (show_ip_route_summary_prefix, DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, - "show ip route " VRF_ALL_CMD_STR, + "show ip route vrf all", SHOW_STR IP_STR "IP routing table\n" @@ -3579,7 +3579,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ip route vrf all tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -3633,7 +3633,7 @@ DEFUN (show_ip_route_vrf_all_tag, DEFUN (show_ip_route_vrf_all_prefix_longer, show_ip_route_vrf_all_prefix_longer_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes", + "show ip route vrf all A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" @@ -3691,7 +3691,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route " VRF_ALL_CMD_STR " supernets-only", + "show ip route vrf all supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -3745,7 +3745,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route vrf all ", SHOW_STR IP_STR "IP routing table\n" @@ -3800,7 +3800,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D", + "show ip route vrf all A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -3842,7 +3842,7 @@ DEFUN (show_ip_route_vrf_all_addr, DEFUN (show_ip_route_vrf_all_prefix, show_ip_route_vrf_all_prefix_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M", + "show ip route vrf all A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -3889,7 +3889,7 @@ DEFUN (show_ip_route_vrf_all_prefix, DEFUN (show_ip_route_vrf_all_summary, show_ip_route_vrf_all_summary_cmd, - "show ip route " VRF_ALL_CMD_STR " summary ", + "show ip route vrf all summary ", SHOW_STR IP_STR "IP routing table\n" @@ -3908,7 +3908,7 @@ DEFUN (show_ip_route_vrf_all_summary, DEFUN (show_ip_route_vrf_all_summary_prefix, show_ip_route_vrf_all_summary_prefix_cmd, - "show ip route " VRF_ALL_CMD_STR " summary prefix", + "show ip route vrf all summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -4718,7 +4718,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, DEFUN (ipv6_route_vrf, ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M " VRF_CMD_STR, + "ipv6 route X:X::X:X/M vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4734,7 +4734,7 @@ DEFUN (ipv6_route_vrf, DEFUN (ipv6_route_tag_vrf, ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4753,7 +4753,7 @@ DEFUN (ipv6_route_tag_vrf, DEFUN (ipv6_route_flags_vrf, ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M " VRF_CMD_STR, + "ipv6 route X:X::X:X/M vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4772,7 +4772,7 @@ DEFUN (ipv6_route_flags_vrf, DEFUN (ipv6_route_flags_tag_vrf, ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4794,7 +4794,7 @@ DEFUN (ipv6_route_flags_tag_vrf, DEFUN (ipv6_route_ifname_vrf, ipv6_route_ifname_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4810,7 +4810,7 @@ DEFUN (ipv6_route_ifname_vrf, } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4830,7 +4830,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, DEFUN (ipv6_route_ifname_flags_vrf, ipv6_route_ifname_flags_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4850,7 +4850,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, DEFUN (ipv6_route_ifname_flags_tag_vrf, ipv6_route_ifname_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4873,7 +4873,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, DEFUN (ipv6_route_pref_vrf, ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4891,7 +4891,7 @@ DEFUN (ipv6_route_pref_vrf, DEFUN (ipv6_route_pref_tag_vrf, ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4912,7 +4912,7 @@ DEFUN (ipv6_route_pref_tag_vrf, DEFUN (ipv6_route_flags_pref_vrf, ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4933,7 +4933,7 @@ DEFUN (ipv6_route_flags_pref_vrf, DEFUN (ipv6_route_flags_pref_tag_vrf, ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4957,7 +4957,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, DEFUN (ipv6_route_ifname_pref_vrf, ipv6_route_ifname_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4976,7 +4976,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, DEFUN (ipv6_route_ifname_pref_tag_vrf, ipv6_route_ifname_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4998,7 +4998,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, DEFUN (ipv6_route_ifname_flags_pref_vrf, ipv6_route_ifname_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -5020,7 +5020,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -5045,7 +5045,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5062,7 +5062,7 @@ DEFUN (no_ipv6_route_vrf, DEFUN (no_ipv6_route_tag_vrf, no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5082,7 +5082,7 @@ DEFUN (no_ipv6_route_tag_vrf, DEFUN (no_ipv6_route_flags_vrf, no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5102,7 +5102,7 @@ DEFUN (no_ipv6_route_flags_vrf, DEFUN (no_ipv6_route_flags_tag_vrf, no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5125,7 +5125,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, DEFUN (no_ipv6_route_ifname_vrf, no_ipv6_route_ifname_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5143,7 +5143,7 @@ DEFUN (no_ipv6_route_ifname_vrf, DEFUN (no_ipv6_route_ifname_tag_vrf, no_ipv6_route_ifname_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5164,7 +5164,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_vrf, no_ipv6_route_ifname_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5185,7 +5185,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, DEFUN (no_ipv6_route_ifname_flags_tag_vrf, no_ipv6_route_ifname_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5209,7 +5209,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, DEFUN (no_ipv6_route_pref_vrf, no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5228,7 +5228,7 @@ DEFUN (no_ipv6_route_pref_vrf, DEFUN (no_ipv6_route_pref_tag_vrf, no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5250,7 +5250,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, DEFUN (no_ipv6_route_flags_pref_vrf, no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5273,7 +5273,7 @@ DEFUN (no_ipv6_route_flags_pref_vrf, DEFUN (no_ipv6_route_flags_pref_tag_vrf, no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5299,7 +5299,7 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_pref_vrf, no_ipv6_route_ifname_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5319,7 +5319,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, DEFUN (no_ipv6_route_ifname_pref_tag_vrf, no_ipv6_route_ifname_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5342,7 +5342,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_vrf, no_ipv6_route_ifname_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5365,7 +5365,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, no_ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", NO_STR IP_STR "Establish static routes\n" @@ -5391,7 +5391,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " [json]", + * "show ipv6 route vrf NAME [json]", * SHOW_STR * IP_STR * "IPv6 routing table\n" @@ -5597,7 +5597,7 @@ DEFUN (show_ipv6_route_prefix_longer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, + * "show ipv6 route " VRF_CMD_STR " ", * SHOW_STR * IP_STR * "IP routing table\n" @@ -5607,7 +5607,7 @@ DEFUN (show_ipv6_route_prefix_longer, */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route ", SHOW_STR IP_STR "IP routing table\n" @@ -5846,7 +5846,7 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route " VRF_ALL_CMD_STR, + "show ipv6 route vrf all", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5891,7 +5891,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ipv6 route vrf all tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5946,7 +5946,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes", + "show ipv6 route vrf all X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6004,7 +6004,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route vrf all ", SHOW_STR IP_STR "IP routing table\n" @@ -6059,7 +6059,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X", + "show ipv6 route vrf all X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6101,7 +6101,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, DEFUN (show_ipv6_route_vrf_all_prefix, show_ipv6_route_vrf_all_prefix_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M", + "show ipv6 route vrf all X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6148,7 +6148,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, DEFUN (show_ipv6_route_vrf_all_summary, show_ipv6_route_vrf_all_summary_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " summary", + "show ipv6 route vrf all summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6167,7 +6167,7 @@ DEFUN (show_ipv6_route_vrf_all_summary, DEFUN (show_ipv6_mroute_vrf_all, show_ipv6_mroute_vrf_all_cmd, - "show ipv6 mroute " VRF_ALL_CMD_STR, + "show ipv6 mroute vrf all", SHOW_STR IP_STR "IPv6 Multicast routing table\n" @@ -6203,7 +6203,7 @@ DEFUN (show_ipv6_mroute_vrf_all, DEFUN (show_ipv6_route_vrf_all_summary_prefix, show_ipv6_route_vrf_all_summary_prefix_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " summary prefix", + "show ipv6 route vrf all summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" From 3ce54f781213b28bea95449f294ffc07630c9412 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sun, 25 Sep 2016 14:22:48 +0000 Subject: [PATCH 142/280] Expand #defines in command strings Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Reviewed-by: Don Slice Reviewed-by: Sam Tannous Ticket: --- bgpd/bgp_bfd.c | 2 +- bgpd/bgp_vty.c | 58 ++++++++++++++++++++-------------------- lib/command.c | 6 ++--- tools/argv_translator.py | 6 +++-- zebra/zebra_vty.c | 2 +- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index bb8f4ceeea..72ea3c60ae 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -640,7 +640,7 @@ DEFUN_HIDDEN (neighbor_bfd_type, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE, + * "no neighbor bfd (2-255) (50-60000) (50-60000)", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f1411ea5eb..4dcba02c24 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2910,7 +2910,7 @@ DEFUN (neighbor_peer_group, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", + * "no neighbor remote-as ((1-4294967295)|internal|external)", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR @@ -3171,14 +3171,14 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, + * "no neighbor local-as (1-4294967295)", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "Specify a local-as number\n" * "AS number used as local AS\n" * - * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", + * "no neighbor local-as (1-4294967295) no-prepend", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -3186,7 +3186,7 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, * "AS number used as local AS\n" * "Do not prepend local-as to updates from ebgp peers\n" * - * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", + * "no neighbor local-as (1-4294967295) no-prepend replace-as", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -3281,7 +3281,7 @@ DEFUN (neighbor_password, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "password LINE", + * "no neighbor password LINE", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4130,7 +4130,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", + * "neighbor attribute-unchanged med next-hop as-path", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4138,7 +4138,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, * "Nexthop attribute\n" * "As-path attribute\n" * - * NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", + * "neighbor attribute-unchanged med as-path next-hop", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4146,7 +4146,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, * "As-path attribute\n" * "Nexthop attribute\n" * - * NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", + * "neighbor attribute-unchanged as-path next-hop med", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4154,7 +4154,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, * "Nexthop attribute\n" * "Med attribute\n" * - * NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", + * "neighbor attribute-unchanged next-hop as-path med", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4162,7 +4162,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, * "As-path attribute\n" * "Med attribute\n" * - * NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", + * "neighbor attribute-unchanged as-path med next-hop", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4170,7 +4170,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, * "Med attribute\n" * "Nexthop attribute\n" * - * NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", + * "neighbor attribute-unchanged next-hop med as-path", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "BGP attribute is propagated unchanged to this neighbor\n" @@ -4297,7 +4297,7 @@ DEFUN (neighbor_attr_unchanged4, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", + * "no neighbor attribute-unchanged next-hop med as-path", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4306,7 +4306,7 @@ DEFUN (neighbor_attr_unchanged4, * "Med attribute\n" * "As-path attribute\n" * - * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", + * "no neighbor attribute-unchanged as-path med next-hop", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4315,7 +4315,7 @@ DEFUN (neighbor_attr_unchanged4, * "Med attribute\n" * "Nexthop attribute\n" * - * NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", + * "no neighbor attribute-unchanged med as-path next-hop", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4324,7 +4324,7 @@ DEFUN (neighbor_attr_unchanged4, * "As-path attribute\n" * "Nexthop attribute\n" * - * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", + * "no neighbor attribute-unchanged next-hop as-path med", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4333,7 +4333,7 @@ DEFUN (neighbor_attr_unchanged4, * "As-path attribute\n" * "Med attribute\n" * - * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", + * "no neighbor attribute-unchanged as-path next-hop med", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4342,7 +4342,7 @@ DEFUN (neighbor_attr_unchanged4, * "Nexthop attribute\n" * "Med attribute\n" * - * NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", + * "no neighbor attribute-unchanged med next-hop as-path", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4534,7 +4534,7 @@ DEFUN (neighbor_ebgp_multihop_ttl, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), + * "no neighbor ebgp-multihop (1-255)", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4558,7 +4558,7 @@ DEFUN (no_neighbor_ebgp_multihop, /* disable-connected-check */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NEIGHBOR_CMD2 "enforce-multihop", + * "neighbor enforce-multihop", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "Enforce EBGP neighbors perform multihop\n" @@ -4577,7 +4577,7 @@ DEFUN (neighbor_disable_connected_check, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "enforce-multihop", + * "no neighbor enforce-multihop", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4630,7 +4630,7 @@ DEFUN (neighbor_description, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "description .LINE", + * "no neighbor description .LINE", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -4773,7 +4773,7 @@ DEFUN (neighbor_default_originate_rmap, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "default-originate route-map WORD", + * "no neighbor default-originate route-map WORD", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5779,14 +5779,14 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", + * "no neighbor maximum-prefix <1-4294967295>", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "Maximum number of prefix accept from this peer\n" * "maximum no. of prefix limit\n" * - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", + * "no neighbor maximum-prefix <1-4294967295> <1-100> restart <1-65535>", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5796,7 +5796,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, * "Restart bgp connection after limit is exceeded\n" * "Restart interval in minutes" * - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", + * "no neighbor maximum-prefix <1-4294967295> warning-only", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5804,7 +5804,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, * "maximum no. of prefix limit\n" * "Only give warning message when limit is exceeded\n" * - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", + * "no neighbor maximum-prefix <1-4294967295> restart <1-65535>", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5813,7 +5813,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, * "Restart bgp connection after limit is exceeded\n" * "Restart interval in minutes" * - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", + * "no neighbor maximum-prefix <1-4294967295> <1-100> warning-only", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5822,7 +5822,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, * "Threshold value (%) at which to generate a warning msg\n" * "Only give warning message when limit is exceeded\n" * - * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", + * "no neighbor maximum-prefix <1-4294967295> <1-100>", * NO_STR * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 @@ -5853,7 +5853,7 @@ DEFUN (no_neighbor_maximum_prefix, /* "neighbor allowas-in" */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * NEIGHBOR_CMD2 "allowas-in <1-10>", + * "neighbor allowas-in <1-10>", * NEIGHBOR_STR * NEIGHBOR_ADDR_STR2 * "Accept as-path with my AS present in it\n" diff --git a/lib/command.c b/lib/command.c index 6fb265f97a..10448ef6fb 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1814,7 +1814,7 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) DEFUN (config_log_file, config_log_file_cmd, - "log file FILENAME [" LOG_LEVELS "]", + "log file FILENAME [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Logging to file\n" "Logging filename\n" @@ -1855,7 +1855,7 @@ DEFUN (no_config_log_file, DEFUN (config_log_syslog, config_log_syslog_cmd, - "log syslog [" LOG_LEVELS "]", + "log syslog [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) @@ -1893,7 +1893,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [] [" LOG_LEVELS "]", + "no log syslog [] [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Cancel logging to syslog\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 8a4a0b8cf2..4845c08d0a 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -520,6 +520,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '') line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '') line = line.replace('" LOG_FACILITIES "', '') + line = line.replace('" LOG_LEVELS "', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)') # endswith line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",') @@ -551,6 +552,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' ",') line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' ",') line = line.replace('" LOG_FACILITIES,', ' ",') + line = line.replace('" LOG_LEVELS,', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range ') @@ -562,6 +564,7 @@ def expand_command_string(line): line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') + line = line.replace('LOG_LEVELS "', '"(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging) ') # solo line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor ",') @@ -720,7 +723,6 @@ DEFUN (no_bgp_maxmed_onstartup, new_command_string_expanded = expand_command_string(new_command_string) lines = [] - # dwalton lines.append("DEFUN (%s,\n" % self.name) lines.append(" %s,\n" % self.name_cmd) # lines.append(new_command_string) @@ -868,7 +870,7 @@ def update_argvs(filename): if line.strip() == '*/': state = None fh.write(line) - elif line.strip().startswith('* "'): + elif line.strip().startswith('* ') and not line.strip().startswith('* '): # dwalton new_line = expand_command_string(line[3:]) # chop the leading " * " fh.write(" * %s" % new_line) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 878af09ee0..005c9370b5 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -5597,7 +5597,7 @@ DEFUN (show_ipv6_route_prefix_longer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " ", + * "show ipv6 route vrf NAME ", * SHOW_STR * IP_STR * "IP routing table\n" From 199d90a10eea7115c2854821ed11a229d72d1f23 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sun, 25 Sep 2016 16:49:39 +0000 Subject: [PATCH 143/280] Expand #defines in command strings Signed-off-by: Daniel Walton --- bgpd/bgp_bfd.c | 4 ++-- bgpd/bgp_vty.c | 3 --- bgpd/bgp_vty.h | 4 ---- lib/bfd.h | 5 ----- lib/command.c | 16 ++++++++-------- lib/command.h | 11 ----------- lib/if.c | 6 +++--- lib/log.h | 4 ---- lib/vrf.h | 4 ---- ospfd/ospf_vty.c | 5 ----- pimd/pim_cmd.h | 6 ------ pimd/pim_vty.c | 8 +++----- tools/argv_translator.py | 6 +++--- vtysh/vtysh.c | 20 ++++++++++---------- 14 files changed, 29 insertions(+), 73 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 72ea3c60ae..b2863736ce 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -610,7 +610,7 @@ DEFUN (neighbor_bfd_param, DEFUN_HIDDEN (neighbor_bfd_type, neighbor_bfd_type_cmd, - NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE, + "neighbor bfd (multihop|singlehop)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" @@ -675,7 +675,7 @@ DEFUN (no_neighbor_bfd, DEFUN_HIDDEN (no_neighbor_bfd_type, no_neighbor_bfd_type_cmd, - NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE, + "no neighbor bfd (multihop|singlehop)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4dcba02c24..ff5fc48f62 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4689,9 +4689,6 @@ peer_update_source_vty (struct vty *vty, const char *peer_str, return CMD_SUCCESS; } -#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" -#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" -#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" #define BGP_UPDATE_SOURCE_HELP_STR \ "IPv4 address\n" \ "IPv6 address\n" \ diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 573e8c7072..382af0984f 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -23,11 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA struct bgp; -#define CMD_AS_RANGE "<1-4294967295>" -#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>" -#define BGP_INSTANCE_CMD "(view|vrf) WORD" #define BGP_INSTANCE_HELP_STR "BGP view\nBGP VRF\nView/VRF name\n" -#define BGP_INSTANCE_ALL_CMD "(view|vrf) all" #define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n" extern void bgp_vty_init (void); diff --git a/lib/bfd.h b/lib/bfd.h index bbe96b07b4..e636e4426f 100644 --- a/lib/bfd.h +++ b/lib/bfd.h @@ -26,11 +26,6 @@ #include "lib/json.h" -#define BFD_CMD_DETECT_MULT_RANGE "<2-255> " -#define BFD_CMD_MIN_RX_RANGE "<50-60000> " -#define BFD_CMD_MIN_TX_RANGE "<50-60000>" -#define BFD_CMD_TYPE "(multihop|singlehop)" - #define BFD_DEF_MIN_RX 300 #define BFD_MIN_MIN_RX 50 #define BFD_MAX_MIN_RX 60000 diff --git a/lib/command.c b/lib/command.c index 10448ef6fb..22416ea73f 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1621,7 +1621,7 @@ DEFUN_HIDDEN (do_echo, DEFUN (config_logmsg, config_logmsg_cmd, - "logmsg "LOG_LEVELS" MESSAGE...", + "logmsg MESSAGE...", "Send a message to enabled logging destinations\n" LOG_LEVEL_DESC "The message to send\n") @@ -1694,7 +1694,7 @@ DEFUN (show_logging, DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout ["LOG_LEVELS"]", + "log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1715,7 +1715,7 @@ DEFUN (config_log_stdout, DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, - "no log stdout ["LOG_LEVELS"]", + "no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Cancel logging to stdout\n" @@ -1727,7 +1727,7 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, - "log monitor ["LOG_LEVELS"]", + "log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1748,7 +1748,7 @@ DEFUN (config_log_monitor, DEFUN (no_config_log_monitor, no_config_log_monitor_cmd, - "no log monitor ["LOG_LEVELS"]", + "no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Disable terminal line (monitor) logging\n" @@ -1878,7 +1878,7 @@ DEFUN (config_log_syslog, DEFUN_DEPRECATED (config_log_syslog_facility, config_log_syslog_facility_cmd, - "log syslog facility "LOG_FACILITIES, + "log syslog facility (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)", "Logging control\n" "Logging goes to syslog\n" "(Deprecated) Facility parameter for syslog messages\n" @@ -1932,7 +1932,7 @@ DEFUN (no_config_log_facility, DEFUN_DEPRECATED (config_log_trap, config_log_trap_cmd, - "log trap " LOG_LEVELS, + "log trap ", "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC) @@ -1952,7 +1952,7 @@ DEFUN_DEPRECATED (config_log_trap, DEFUN_DEPRECATED (no_config_log_trap, no_config_log_trap_cmd, - "no log trap [" LOG_LEVELS "]", + "no log trap [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Permit all logging information\n" diff --git a/lib/command.h b/lib/command.h index eef4b558af..edbe69b71d 100644 --- a/lib/command.h +++ b/lib/command.h @@ -319,7 +319,6 @@ struct cmd_element */ #define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s) #define CMD_CREATE_STR_HELPER(s) #s -#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">" /* Common descriptions. */ #define SHOW_STR "Show running system information\n" @@ -372,28 +371,18 @@ struct cmd_element /* IPv4 only machine should not accept IPv6 address for peer's IP address. So we replace VTY command string like below. */ #ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor " -#define NO_NEIGHBOR_CMD "no neighbor " #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" #else -#define NEIGHBOR_CMD "neighbor A.B.C.D " -#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " #define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ /* Dynamic neighbor (listen range) configuration */ #ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range " #define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" #else -#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " #define LISTEN_RANGE_ADDR_STR "Neighbor address\n" #endif /* HAVE_IPV6 */ diff --git a/lib/if.c b/lib/if.c index a0083933f8..3afba9879b 100644 --- a/lib/if.c +++ b/lib/if.c @@ -750,7 +750,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME ["VRF_CMD_STR"]", + "interface IFNAME [vrf NAME]", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -795,7 +795,7 @@ DEFUN (interface, DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME [VRF_CMD_STR]", + "no interface IFNAME [vrf NAME]", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -894,7 +894,7 @@ DEFUN_NOSH (no_vrf, /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address [VRF_CMD_STR]", + "show address [vrf NAME]", SHOW_STR "address\n" VRF_CMD_HELP_STR) diff --git a/lib/log.h b/lib/log.h index 951fa124c8..b5edc75f16 100644 --- a/lib/log.h +++ b/lib/log.h @@ -192,8 +192,6 @@ struct timestamp_control { /* Defines for use in command construction: */ -#define LOG_LEVELS "(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)" - #define LOG_LEVEL_DESC \ "System is unusable\n" \ "Immediate action needed\n" \ @@ -204,8 +202,6 @@ struct timestamp_control { "Informational messages\n" \ "Debugging messages\n" -#define LOG_FACILITIES "(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)" - #define LOG_FACILITY_DESC \ "Kernel\n" \ "User process\n" \ diff --git a/lib/vrf.h b/lib/vrf.h index dcc115563d..e0fd25b9b2 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -50,11 +50,7 @@ enum { /* * The command strings */ - -#define VRF_CMD_STR "vrf NAME" #define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n" - -#define VRF_ALL_CMD_STR "vrf all" #define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n" /* diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index b022261d2d..c834b11864 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -5757,11 +5757,6 @@ show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" -#define OSPF_LSA_TYPES_CMD_STR \ - "asbr-summary|external|network|router|summary" \ - OSPF_LSA_TYPE_NSSA_CMD_STR \ - OSPF_LSA_TYPE_OPAQUE_CMD_STR - #define OSPF_LSA_TYPES_DESC \ "ASBR summary link states\n" \ "External link states\n" \ diff --git a/pimd/pim_cmd.h b/pimd/pim_cmd.h index 26191cd0b6..53df562ab9 100644 --- a/pimd/pim_cmd.h +++ b/pimd/pim_cmd.h @@ -60,12 +60,6 @@ #define MROUTE_STR "IP multicast routing table\n" #define RIB_STR "IP unicast routing table\n" -#define PIM_CMD_NO "no" -#define PIM_CMD_IP_MULTICAST_ROUTING "ip multicast-routing" -#define PIM_CMD_IP_IGMP_QUERY_INTERVAL "ip igmp query-interval" -#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "ip igmp query-max-response-time" -#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "ip igmp query-max-response-time-dsec" - void pim_cmd_init(void); #endif /* PIM_CMD_H */ diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index f1c8930856..bc0f2c7e58 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -98,7 +98,7 @@ int pim_global_config_write(struct vty *vty) char buffer[32]; if (PIM_MROUTE_IS_ENABLED) { - vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE); + vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE); ++writes; } if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) { @@ -170,8 +170,7 @@ int pim_interface_config_write(struct vty *vty) /* IF ip igmp query-interval */ if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) { - vty_out(vty, " %s %d%s", - PIM_CMD_IP_IGMP_QUERY_INTERVAL, + vty_out(vty, " ip igmp query-interval %d%s", pim_ifp->igmp_default_query_interval, VTY_NEWLINE); ++writes; @@ -180,8 +179,7 @@ int pim_interface_config_write(struct vty *vty) /* IF ip igmp query-max-response-time */ if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) { - vty_out(vty, " %s %d%s", - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC, + vty_out(vty, " ip igmp query-max-response-time-dsec %d%s", pim_ifp->igmp_query_max_response_time_dsec, VTY_NEWLINE); ++writes; diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 4845c08d0a..8ee4cd8cc7 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -520,7 +520,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '') line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '') line = line.replace('" LOG_FACILITIES "', '') - line = line.replace('" LOG_LEVELS "', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)') + line = line.replace('" LOG_LEVELS "', ' ') # endswith line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",') @@ -552,7 +552,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' ",') line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' ",') line = line.replace('" LOG_FACILITIES,', ' ",') - line = line.replace('" LOG_LEVELS,', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",') + line = line.replace('" LOG_LEVELS,', ' ",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range ') @@ -564,7 +564,7 @@ def expand_command_string(line): line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') - line = line.replace('LOG_LEVELS "', '"(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging) ') + line = line.replace('LOG_LEVELS "', '" ') # solo line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor ",') diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index dd4131b701..05fb038184 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1084,7 +1084,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_BGPD, router_bgp, router_bgp_cmd, - "router bgp " CMD_AS_RANGE, + "router bgp (1-4294967295)", ROUTER_STR BGP_STR AS_STR) @@ -1103,7 +1103,7 @@ ALIAS_SH (VTYSH_BGPD, ALIAS_SH (VTYSH_BGPD, router_bgp, router_bgp_view_cmd, - "router bgp " CMD_AS_RANGE " (view|vrf) WORD", + "router bgp (1-4294967295) (view|vrf) WORD", ROUTER_STR BGP_STR AS_STR @@ -1616,7 +1616,7 @@ DEFUNSH (VTYSH_INTERFACE, ALIAS_SH (VTYSH_ZEBRA, vtysh_interface, vtysh_interface_vrf_cmd, - "interface IFNAME " VRF_CMD_STR, + "interface IFNAME vrf NAME", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -1631,7 +1631,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D, DEFSH (VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, - "no interface IFNAME " VRF_CMD_STR, + "no interface IFNAME vrf NAME", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -1867,7 +1867,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_stdout_level, vtysh_log_stdout_level_cmd, - "log stdout "LOG_LEVELS, + "log stdout ", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1901,7 +1901,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_file_level, vtysh_log_file_level_cmd, - "log file FILENAME "LOG_LEVELS, + "log file FILENAME ", "Logging control\n" "Logging to file\n" "Logging filename\n" @@ -1945,7 +1945,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_monitor_level, vtysh_log_monitor_level_cmd, - "log monitor "LOG_LEVELS, + "log monitor ", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1978,7 +1978,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_syslog_level, vtysh_log_syslog_level_cmd, - "log syslog "LOG_LEVELS, + "log syslog ", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) @@ -2001,7 +2001,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_facility, vtysh_log_facility_cmd, - "log facility "LOG_FACILITIES, + "log facility ", "Logging control\n" "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) @@ -2026,7 +2026,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH_DEPRECATED (VTYSH_ALL, vtysh_log_trap, vtysh_log_trap_cmd, - "log trap "LOG_LEVELS, + "log trap ", "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC) From b09b5ae03367d724c909222f988d60cab740a621 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 00:47:13 +0000 Subject: [PATCH 144/280] bgpd: combine "clear bgp, clear ip bgp" commands into one DEFUN Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 2893 +++--------------------------------------------- 1 file changed, 183 insertions(+), 2710 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index ff5fc48f62..4788cd230a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -559,7 +559,7 @@ bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, static void bgp_clear_star_soft_in (struct vty *vty, const char *name) { - bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all, + bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_IN, NULL); @@ -6220,133 +6220,212 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp *", - * CLEAR_STR - * BGP_STR - * "Clear all peers\n" - * - * "clear bgp WORD ipv6 *", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * - * "clear bgp ipv6 *", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - */ +// dwalton +/* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear ip bgp [ WORD] *", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []", CLEAR_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Clear all peers\n") + "Clear all peers\n" + "BGP neighbor address to clear\n" + "BGP IPv6 neighbor to clear\n" + "BGP neighbor on interface to clear\n" + "Clear peers with the AS number\n" + "Clear all external peers\n" + "Clear all members of peer-group\n" + "BGP peer-group name\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + BGP_SOFT_STR + BGP_SOFT_STR + BGP_SOFT_IN_STR + BGP_SOFT_STR + BGP_SOFT_OUT_STR + BGP_SOFT_IN_STR + "Push out prefix-list ORF and do inbound soft reconfig\n" + BGP_SOFT_IN_STR + BGP_SOFT_OUT_STR) { + int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; + int idx_clr_sort = 5; + int idx_soft_in_out = argc - 1; + int idx_afi; + int idx_safi; char *vrf = NULL; + afi_t afi; + safi_t safi; + enum clear_sort clr_sort; + enum bgp_clear_type clr_type; + char *clr_arg = NULL; + + /* + * If the user does "clear ip bgp" then we default the afi safi to ipv4 unicast. + * If the user does "clear bgp" then we default the afi safi to ipv6 unicast. + * This may be over-written later in the command if they explicitly + * specify an afi safi. + */ + if (strmatch(argv[idx_ip]->text, "ip")) + { + afi = AFI_IP; + safi = SAFI_UNICAST; + } + else + { + afi = AFI_IP6; + safi = SAFI_UNICAST; + idx_view_vrf--; + idx_vrf--; + idx_clr_sort--; + } if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); -} - -/* - * CHECK ME need ipv6 equivalent - */ -DEFUN (clear_ip_bgp_peer, - clear_ip_bgp_peer_cmd, - "clear [ip] bgp [ WORD] ", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor IP address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - "Clear all members of peer-group\n" - "BGP peer-group name\n") -{ - int idx_ip = 1; - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_peer = 5; - char *vrf = NULL; - enum clear_sort clearer; - - if (!strmatch(argv[idx_ip]->text, "ip")) - { - idx_view_vrf--; - idx_vrf--; - idx_peer--; - } - - if (argv[idx_view_vrf]->type == WORD_TKN) - vrf = argv[idx_vrf]->arg; else - idx_peer -= 2; + idx_clr_sort -= 2; - /* peer-group WORD */ - if (argv[idx_peer]->type == WORD_TKN) + /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external> */ + if (strmatch(argv[idx_clr_sort]->text, "*")) { - clearer = clear_group; - idx_peer += 1; + clr_sort = clear_all; + } + else if (argv[idx_clr_sort]->type == IPV4_TKN) + { + clr_sort = clear_peer; + clr_arg = argv[idx_clr_sort]->arg; + } + else if (argv[idx_clr_sort]->type == IPV6_TKN) + { + clr_sort = clear_peer; + clr_arg = argv[idx_clr_sort]->arg; + } + else if (argv[idx_clr_sort]->type == RANGE_TKN) + { + clr_sort = clear_as; + clr_arg = argv[idx_clr_sort]->arg; + } + else if (strmatch(argv[idx_clr_sort]->text, "external")) + { + clr_sort = clear_external; + } + else if (strmatch(argv[idx_clr_sort]->text, "peer-group")) + { + clr_sort = clear_group; + clr_arg = argv[idx_clr_sort + 1]->arg; + + if (! peer_group_lookup (vty->index, clr_arg)) + { + vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + else if (argv[idx_clr_sort]->type == WORD_TKN) + { + if (peer_lookup_by_conf_if (vty->index, argv[idx_clr_sort]->arg)) + { + clr_sort = clear_peer; + clr_arg = argv[idx_clr_sort]->arg; + } + else + { + vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + + /* soft, soft in, or soft out */ + if (strmatch(argv[idx_soft_in_out]->text, "in")) + { + clr_type = BGP_CLEAR_SOFT_IN; + + if (strmatch(argv[idx_soft_in_out-1]->text, "soft")) + { + idx_afi = idx_soft_in_out - 3; + idx_safi = idx_soft_in_out - 2; + } + else + { + idx_afi = idx_soft_in_out - 2; + idx_safi = idx_soft_in_out - 1; + } + } + else if (strmatch(argv[idx_soft_in_out]->text, "out")) + { + clr_type = BGP_CLEAR_SOFT_OUT; + + if (strmatch(argv[idx_soft_in_out-1]->text, "soft")) + { + idx_afi = idx_soft_in_out - 3; + idx_safi = idx_soft_in_out - 2; + } + else + { + idx_afi = idx_soft_in_out - 2; + idx_safi = idx_soft_in_out - 1; + } + } + else if (strmatch(argv[idx_soft_in_out]->text, "soft")) + { + clr_type = BGP_CLEAR_SOFT_BOTH; + idx_afi = idx_soft_in_out - 2; + idx_safi = idx_soft_in_out - 1; + } + else if (strmatch(argv[idx_soft_in_out]->text, "prefix-filter")) + { + clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; + idx_afi = idx_soft_in_out - 3; + idx_safi = idx_soft_in_out - 2; } else { - clearer = clear_peer; + clr_type = BGP_CLEAR_SOFT_NONE; + idx_afi = idx_soft_in_out - 1; + idx_safi = idx_soft_in_out; } - return bgp_clear_vty (vty, vrf, 0, 0, clearer, BGP_CLEAR_SOFT_NONE, argv[idx_peer]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp WORD ipv6 external", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * - * "clear bgp ipv6 external", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - */ -DEFUN (clear_ip_bgp_external, - clear_ip_bgp_external_cmd, - "clear [ip] bgp [ WORD] external", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n") -{ - int idx_ip = 1; - int idx_view_vrf = 3; - int idx_vrf = 4; - char *vrf = NULL; - - if (!strmatch(argv[idx_ip]->text, "ip")) + /* afi safi */ + if (strmatch(argv[idx_afi]->text, "ipv4")) { - idx_view_vrf--; - idx_vrf--; + afi = AFI_IP; + + if (strmatch(argv[idx_safi]->text, "unicast")) + safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "ipv6")) + { + afi = AFI_IP6; + + if (strmatch(argv[idx_safi]->text, "unicast")) + safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "encap")) + { + afi = AFI_IP; + safi = SAFI_ENCAP; + } + else if (strmatch(argv[idx_afi]->text, "vpnv4")) + { + afi = AFI_IP; + safi = SAFI_MPLS_VPN; } - if (argv[idx_view_vrf]->type == WORD_TKN) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); + return bgp_clear_vty (vty, vrf, afi, safi, clr_sort, clr_type, clr_arg); } DEFUN (clear_ip_bgp_prefix, @@ -6380,177 +6459,6 @@ DEFUN (clear_ip_bgp_prefix, return bgp_clear_prefix (vty, vrf, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * need ipv6 options - * - * "clear bgp ipv6 (1-4294967295)", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * - * "clear bgp WORD ipv6 (1-4294967295)", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - */ -DEFUN (clear_ip_bgp_as, - clear_ip_bgp_as_cmd, - "clear [ip] bgp [ WORD] (1-4294967295)", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n") -{ - int idx_ip = 1; - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_number = 3; - char *vrf = NULL; - - if (!strmatch(argv[idx_ip]->text, "ip")) - { - idx_view_vrf--; - idx_vrf--; - idx_number--; - } - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_number -= 2; - - return bgp_clear_vty (vty, vrf, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[idx_number]->arg); -} - -/* Outbound soft-reconfiguration */ -DEFUN (clear_ip_bgp_all_soft_out, - clear_ip_bgp_all_soft_out_cmd, - "clear ip bgp [ WORD] * [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_all_ipv4_soft_out, - clear_ip_bgp_all_ipv4_soft_out_cmd, - "clear ip bgp * ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, - clear_ip_bgp_instance_all_ipv4_soft_out_cmd, - "clear ip bgp WORD * ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 3; - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); - - return bgp_clear_vty (vty, argv[idx_view_vrf]->arg, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_all_vpnv4_soft_out, - clear_ip_bgp_all_vpnv4_soft_out_cmd, - "clear ip bgp * vpnv4 unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_all_encap_soft_out, - clear_ip_bgp_all_encap_soft_out_cmd, - "clear ip bgp * encap unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n" - "Soft reconfig outbound update\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); -} - -/* neither 'ipv6' or 'soft' do anything here */ -DEFUN (clear_bgp_all_soft_out, - clear_bgp_all_soft_out_cmd, - "clear bgp [ WORD] [ipv6] * [soft] out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - IPV6_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_OUT, NULL); -} - - DEFUN (clear_bgp_ipv6_safi_prefix, clear_bgp_ipv6_safi_prefix_cmd, "clear bgp ipv6 prefix X:X::X:X/M", @@ -6589,2338 +6497,6 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL); } -DEFUN (clear_ip_bgp_peer_soft_out, - clear_ip_bgp_peer_soft_out_cmd, - "clear ip bgp [ WORD] [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_ipv4_word = 5; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_ipv4_word -= 2; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_ipv4_soft_out, - clear_ip_bgp_peer_ipv4_soft_out_cmd, - "clear ip bgp ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_ipv4_word = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, - clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, - "clear ip bgp WORD ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_word = 4; - int idx_ipv4_word = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); -} - -/* NOTE: WORD peers have not been tested for vpnv4 */ -DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, - clear_ip_bgp_peer_vpnv4_soft_out_cmd, - "clear ip bgp vpnv4 unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_ipv4_word = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_encap_soft_out, - clear_ip_bgp_peer_encap_soft_out_cmd, - "clear ip bgp A.B.C.D encap unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n" - "Soft reconfig outbound update\n") -{ - int idx_ipv4 = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_ipv4]->arg); -} - -DEFUN (clear_bgp_peer_soft_out, - clear_bgp_peer_soft_out_cmd, - "clear bgp [ WORD] [ipv6] [soft] out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - IPV6_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_ipv6 = 4; - int idx_peer = 5; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - { - idx_peer -= 2; - idx_ipv6 -= 2; - } - - if (! strmatch(argv[idx_ipv6]->text, "ipv6")) - idx_peer--; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_OUT, argv[idx_peer]->arg); -} - -DEFUN (clear_ip_bgp_peer_group_soft_out, - clear_ip_bgp_peer_group_soft_out_cmd, - "clear ip bgp [ WORD] peer-group WORD [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_word = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_word -= 2; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, - clear_ip_bgp_peer_group_ipv4_soft_out_cmd, - "clear ip bgp peer-group WORD ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_word = 4; - int idx_safi = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, - clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, - "clear ip bgp WORD peer-group WORD ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_word = 4; - int idx_word_2 = 6; - int idx_safi = 8; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word_2]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word_2]->arg); -} - -DEFUN (clear_bgp_peer_group_soft_out, - clear_bgp_peer_group_soft_out_cmd, - "clear bgp [ WORD] [ipv6] peer-group WORD [soft] out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_ipv6 = 4; - int idx_word = 6; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - { - idx_ipv6 -= 2; - idx_word -= 2; - } - - if (!strmatch(argv[idx_ipv6]->text, "ipv6")) - idx_word--; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_OUT, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_external_soft_out, - clear_ip_bgp_external_soft_out_cmd, - "clear ip bgp [ WORD] external [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_external_ipv4_soft_out, - clear_ip_bgp_external_ipv4_soft_out_cmd, - "clear ip bgp external ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, - clear_ip_bgp_instance_external_ipv4_soft_out_cmd, - "clear ip bgp WORD external ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_bgp_external_soft_out, - clear_bgp_external_soft_out_cmd, - "clear bgp [ WORD] [ipv6] external [soft] out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_OUT, NULL); -} - -DEFUN (clear_ip_bgp_as_soft_out, - clear_ip_bgp_as_soft_out_cmd, - "clear ip bgp [ WORD] (1-4294967295) [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_asn = 5; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_asn -= 2; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_asn]->arg); -} - -DEFUN (clear_ip_bgp_as_ipv4_soft_out, - clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp (1-4294967295) ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_number = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, - clear_ip_bgp_instance_as_ipv4_soft_out_cmd, - "clear ip bgp WORD (1-4294967295) ipv4 [soft] out", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_word = 4; - int idx_number = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_vpnv4_soft_out, - clear_ip_bgp_as_vpnv4_soft_out_cmd, - "clear ip bgp (1-4294967295) vpnv4 unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_encap_soft_out, - clear_ip_bgp_as_encap_soft_out_cmd, - "clear ip bgp (1-4294967295) encap unicast [soft] out", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Soft reconfig\n" - "Soft reconfig outbound update\n") -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_number]->arg); -} - -DEFUN (clear_bgp_as_soft_out, - clear_bgp_as_soft_out_cmd, - "clear bgp [ WORD] [ipv6] (1-4294967295) [soft] out", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - IPV6_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_OUT_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_asn = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_asn -= 2; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_OUT, argv[idx_asn]->arg); -} - - -/* Inbound soft-reconfiguration */ -DEFUN (clear_ip_bgp_all_soft_in, - clear_ip_bgp_all_soft_in_cmd, - "clear ip bgp [ WORD] * [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - - -DEFUN (clear_ip_bgp_all_in_prefix_filter, - clear_ip_bgp_all_in_prefix_filter_cmd, - "clear ip bgp [ WORD] * in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_view_vrf = 3; - int idx_vrf = 4; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - -DEFUN (clear_ip_bgp_all_ipv4_soft_in, - clear_ip_bgp_all_ipv4_soft_in_cmd, - "clear ip bgp * ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - -DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, - clear_ip_bgp_instance_all_ipv4_soft_in_cmd, - "clear ip bgp WORD * ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - - - -DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, - clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, - "clear ip bgp * ipv4 in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - -DEFUN (clear_ip_bgp_all_vpnv4_soft_in, - clear_ip_bgp_all_vpnv4_soft_in_cmd, - "clear ip bgp * vpnv4 unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - -DEFUN (clear_ip_bgp_all_encap_soft_in, - clear_ip_bgp_all_encap_soft_in_cmd, - "clear ip bgp * encap unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n" - "Soft reconfig inbound update\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - -DEFUN (clear_bgp_all_soft_in, - clear_bgp_all_soft_in_cmd, - "clear bgp [ WORD] [ipv6] * [soft] in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - // dwalton - int idx_view_vrf = 2; - int idx_vrf = 3; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN, NULL); -} - -DEFUN (clear_bgp_all_in_prefix_filter, - clear_bgp_all_in_prefix_filter_cmd, - "clear bgp [ipv6] * in prefix-filter", - CLEAR_STR - BGP_STR - IPV6_STR - "Clear all peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - -DEFUN (clear_ip_bgp_peer_soft_in, - clear_ip_bgp_peer_soft_in_cmd, - "clear ip bgp [ WORD] [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_ipv4_word = 3; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_ipv4_word -= 2; - - return bgp_clear_vty (vty, vrf, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); -} - - -DEFUN (clear_ip_bgp_peer_in_prefix_filter, - clear_ip_bgp_peer_in_prefix_filter_cmd, - "clear ip bgp in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR - "Push out the existing ORF prefix-list\n") -{ - int idx_ipv4_word = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_ipv4_soft_in, - clear_ip_bgp_peer_ipv4_soft_in_cmd, - "clear ip bgp ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_ipv4_word = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, - clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, - "clear ip bgp WORD ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_ipv4_word = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); -} - - - -DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, - clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, - "clear ip bgp ipv4 in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR - "Push out the existing ORF prefix-list\n") -{ - int idx_ipv4_word = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, - clear_ip_bgp_peer_vpnv4_soft_in_cmd, - "clear ip bgp vpnv4 unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_ipv4_word = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_encap_soft_in, - clear_ip_bgp_peer_encap_soft_in_cmd, - "clear ip bgp A.B.C.D encap unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n" - "Soft reconfig inbound update\n") -{ - int idx_ipv4 = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_ipv4]->arg); -} - -DEFUN (clear_bgp_peer_soft_in, - clear_bgp_peer_soft_in_cmd, - "clear bgp [ WORD] [ipv6] [soft] in", - CLEAR_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_view_vrf = 2; - int idx_vrf = 3; - int idx_ipv6 = 4; - int idx_peer = 5; - char *vrf = NULL; - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - { - idx_ipv6 -= 2; - idx_peer -= 2; - } - - if (!strmatch(argv[idx_ipv6]->text, "ipv6")) - idx_peer--; - - return bgp_clear_vty (vty, vrf, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN, argv[idx_peer]->arg); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_IN_STR - * "Push out the existing ORF prefix-list\n" - * - */ -DEFUN (clear_bgp_peer_in_prefix_filter, - clear_bgp_peer_in_prefix_filter_cmd, - "clear bgp in prefix-filter", - CLEAR_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_IN_STR - "Push out the existing ORF prefix-list\n") -{ - int idx_peer = 2; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_peer]->arg); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD peer-group WORD soft in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear ip bgp peer-group WORD in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp WORD peer-group WORD in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_ip_bgp_peer_group_soft_in, - clear_ip_bgp_peer_group_soft_in_cmd, - "clear ip bgp peer-group WORD soft in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); -} - - - - -DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, - clear_ip_bgp_peer_group_in_prefix_filter_cmd, - "clear ip bgp peer-group WORD in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_word = 4; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, - clear_ip_bgp_peer_group_ipv4_soft_in_cmd, - "clear ip bgp peer-group WORD ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_safi = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, - clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, - "clear ip bgp WORD peer-group WORD ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_word_2 = 6; - int idx_safi = 8; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word_2]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word_2]->arg); -} - - - -DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, - clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, - "clear ip bgp peer-group WORD ipv4 in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_word = 4; - int idx_safi = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 peer-group WORD in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 peer-group WORD soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp WORD peer-group WORD soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp peer-group WORD in", - * CLEAR_STR - * BGP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD peer-group WORD in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 peer-group WORD soft in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 peer-group WORD in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_bgp_peer_group_soft_in, - clear_bgp_peer_group_soft_in_cmd, - "clear bgp peer-group WORD soft in", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN, argv[idx_word]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 peer-group WORD in prefix-filter", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_IN_STR - * "Push out prefix-list ORF and do inbound soft reconfig\n" - * - */ -DEFUN (clear_bgp_peer_group_in_prefix_filter, - clear_bgp_peer_group_in_prefix_filter_cmd, - "clear bgp peer-group WORD in prefix-filter", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_word = 3; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_word]->arg); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp external in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp WORD external in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp WORD external soft in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_ip_bgp_external_soft_in, - clear_ip_bgp_external_soft_in_cmd, - "clear ip bgp external soft in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); -} - - - - -DEFUN (clear_ip_bgp_external_in_prefix_filter, - clear_ip_bgp_external_in_prefix_filter_cmd, - "clear ip bgp external in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - -DEFUN (clear_ip_bgp_external_ipv4_soft_in, - clear_ip_bgp_external_ipv4_soft_in_cmd, - "clear ip bgp external ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); -} - -DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, - clear_ip_bgp_instance_external_ipv4_soft_in_cmd, - "clear ip bgp WORD external ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); -} - - - -DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, - clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, - "clear ip bgp external ipv4 in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp WORD external in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 external soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp WORD external soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 external WORD in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 external soft in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 external WORD in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - * "clear bgp external in", - * CLEAR_STR - * BGP_STR - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_bgp_external_soft_in, - clear_bgp_external_soft_in_cmd, - "clear bgp external soft in", - CLEAR_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 external in prefix-filter", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_IN_STR - * "Push out prefix-list ORF and do inbound soft reconfig\n" - * - */ -DEFUN (clear_bgp_external_in_prefix_filter, - clear_bgp_external_in_prefix_filter_cmd, - "clear bgp external in prefix-filter", - CLEAR_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp (1-4294967295) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp WORD (1-4294967295) in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear ip bgp WORD (1-4294967295) soft in", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_ip_bgp_as_soft_in, - clear_ip_bgp_as_soft_in_cmd, - "clear ip bgp (1-4294967295) soft in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_number = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_in_prefix_filter, - clear_ip_bgp_as_in_prefix_filter_cmd, - "clear ip bgp (1-4294967295) in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_ipv4_soft_in, - clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp (1-4294967295) ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_number = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, - clear_ip_bgp_instance_as_ipv4_soft_in_cmd, - "clear ip bgp WORD (1-4294967295) ipv4 [soft] in", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_word = 4; - int idx_number = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, - clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, - "clear ip bgp (1-4294967295) ipv4 in prefix-filter", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_number = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_vpnv4_soft_in, - clear_ip_bgp_as_vpnv4_soft_in_cmd, - "clear ip bgp (1-4294967295) vpnv4 unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_encap_soft_in, - clear_ip_bgp_as_encap_soft_in_cmd, - "clear ip bgp (1-4294967295) encap unicast [soft] in", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family modifier\n" - "Soft reconfig\n" - "Soft reconfig inbound update\n") -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (1-4294967295) in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD (1-4294967295) in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 (1-4294967295) in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear bgp ipv6 (1-4294967295) soft in", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp WORD (1-4294967295) soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - * "clear bgp (1-4294967295) in", - * CLEAR_STR - * BGP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * - * "clear bgp WORD ipv6 (1-4294967295) soft in", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * BGP_SOFT_IN_STR - * - */ -DEFUN (clear_bgp_as_soft_in, - clear_bgp_as_soft_in_cmd, - "clear bgp (1-4294967295) soft in", - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR - BGP_SOFT_IN_STR) -{ - int idx_number = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN, argv[idx_number]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (1-4294967295) in prefix-filter", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_IN_STR - * "Push out prefix-list ORF and do inbound soft reconfig\n" - * - */ -DEFUN (clear_bgp_as_in_prefix_filter, - clear_bgp_as_in_prefix_filter_cmd, - "clear bgp (1-4294967295) in prefix-filter", - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_IN_STR - "Push out prefix-list ORF and do inbound soft reconfig\n") -{ - int idx_number = 2; - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[idx_number]->arg); -} - - -/* Both soft-reconfiguration */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD * soft", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_ip_bgp_all_soft, - clear_ip_bgp_all_soft_cmd, - "clear ip bgp * soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -DEFUN (clear_ip_bgp_all_ipv4_soft, - clear_ip_bgp_all_ipv4_soft_cmd, - "clear ip bgp * ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -DEFUN (clear_ip_bgp_instance_all_ipv4_soft, - clear_ip_bgp_instance_all_ipv4_soft_cmd, - "clear ip bgp WORD * ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -DEFUN (clear_ip_bgp_all_vpnv4_soft, - clear_ip_bgp_all_vpnv4_soft_cmd, - "clear ip bgp * vpnv4 unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, - BGP_CLEAR_SOFT_BOTH, argv[0]); -} - -DEFUN (clear_ip_bgp_all_encap_soft, - clear_ip_bgp_all_encap_soft_cmd, - "clear ip bgp * encap unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all peers\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n") -{ - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, - BGP_CLEAR_SOFT_BOTH, argv[0]); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 * soft", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * - * "clear bgp WORD * soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all peers\n" - * BGP_SOFT_STR - * - * "clear bgp WORD ipv6 * soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all peers\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_bgp_all_soft, - clear_bgp_all_soft_cmd, - "clear bgp * soft", - CLEAR_STR - BGP_STR - "Clear all peers\n" - BGP_SOFT_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD (A.B.C.D|WORD) soft", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_ip_bgp_peer_soft, - clear_ip_bgp_peer_soft_cmd, - "clear ip bgp soft", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) -{ - int idx_ipv4_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); -} - - -DEFUN (clear_ip_bgp_peer_ipv4_soft, - clear_ip_bgp_peer_ipv4_soft_cmd, - "clear ip bgp ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_ipv4_word = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, - clear_ip_bgp_instance_peer_ipv4_soft_cmd, - "clear ip bgp WORD ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_ipv4_word = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_vpnv4_soft, - clear_ip_bgp_peer_vpnv4_soft_cmd, - "clear ip bgp vpnv4 unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP neighbor on interface to clear\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_ipv4_word = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4_word]->arg); -} - -DEFUN (clear_ip_bgp_peer_encap_soft, - clear_ip_bgp_peer_encap_soft_cmd, - "clear ip bgp A.B.C.D encap unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "BGP neighbor address to clear\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n") -{ - int idx_ipv4 = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_ipv4]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * - * "clear bgp WORD ipv6 (A.B.C.D|X:X::X:X|WORD) soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * - * "clear bgp WORD (A.B.C.D|X:X::X:X|WORD) soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "BGP neighbor address to clear\n" - * "BGP IPv6 neighbor to clear\n" - * "BGP neighbor on interface to clear\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_bgp_peer_soft, - clear_bgp_peer_soft_cmd, - "clear bgp soft", - CLEAR_STR - BGP_STR - "BGP neighbor address to clear\n" - "BGP IPv6 neighbor to clear\n" - "BGP neighbor on interface to clear\n" - BGP_SOFT_STR) -{ - int idx_peer = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, - BGP_CLEAR_SOFT_BOTH, argv[idx_peer]->arg); -} - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD peer-group WORD soft", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_ip_bgp_peer_group_soft, - clear_ip_bgp_peer_group_soft_cmd, - "clear ip bgp peer-group WORD soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); -} - - -DEFUN (clear_ip_bgp_peer_group_ipv4_soft, - clear_ip_bgp_peer_group_ipv4_soft_cmd, - "clear ip bgp peer-group WORD ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_safi = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); -} - -DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, - clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, - "clear ip bgp WORD peer-group WORD ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_word_2 = 6; - int idx_safi = 8; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word_2]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word_2]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp WORD ipv6 peer-group WORD soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * - * "clear bgp WORD peer-group WORD soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * - * "clear bgp ipv6 peer-group WORD soft", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all members of peer-group\n" - * "BGP peer-group name\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_bgp_peer_group_soft, - clear_bgp_peer_group_soft_cmd, - "clear bgp peer-group WORD soft", - CLEAR_STR - BGP_STR - "Clear all members of peer-group\n" - "BGP peer-group name\n" - BGP_SOFT_STR) -{ - int idx_word = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, - BGP_CLEAR_SOFT_BOTH, argv[idx_word]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD external soft", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_ip_bgp_external_soft, - clear_ip_bgp_external_soft_cmd, - "clear ip bgp external soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); -} - - -DEFUN (clear_ip_bgp_external_ipv4_soft, - clear_ip_bgp_external_ipv4_soft_cmd, - "clear ip bgp external ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR) -{ - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -DEFUN (clear_ip_bgp_instance_external_ipv4_soft, - clear_ip_bgp_instance_external_ipv4_soft_cmd, - "clear ip bgp WORD external ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear all external peers\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp WORD external soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear all external peers\n" - * BGP_SOFT_STR - * - * "clear bgp WORD ipv6 external soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * - * "clear bgp ipv6 external soft", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear all external peers\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_bgp_external_soft, - clear_bgp_external_soft_cmd, - "clear bgp external soft", - CLEAR_STR - BGP_STR - "Clear all external peers\n" - BGP_SOFT_STR) -{ - if (argc == 2) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, - BGP_CLEAR_SOFT_BOTH, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear ip bgp WORD (1-4294967295) soft", - * CLEAR_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_ip_bgp_as_soft, - clear_ip_bgp_as_soft_cmd, - "clear ip bgp (1-4294967295) soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR) -{ - int idx_number = 3; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - - -DEFUN (clear_ip_bgp_as_ipv4_soft, - clear_ip_bgp_as_ipv4_soft_cmd, - "clear ip bgp (1-4294967295) ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_number = 3; - int idx_safi = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); - - return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_instance_as_ipv4_soft, - clear_ip_bgp_instance_as_ipv4_soft_cmd, - "clear ip bgp WORD (1-4294967295) ipv4 soft", - CLEAR_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_word = 4; - int idx_number = 5; - int idx_safi = 7; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_clear_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); - - return bgp_clear_vty (vty, argv[idx_word]->arg,AFI_IP, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_vpnv4_soft, - clear_ip_bgp_as_vpnv4_soft_cmd, - "clear ip bgp (1-4294967295) vpnv4 unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family Modifier\n" - BGP_SOFT_STR) -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - -DEFUN (clear_ip_bgp_as_encap_soft, - clear_ip_bgp_as_encap_soft_cmd, - "clear ip bgp (1-4294967295) encap unicast soft", - CLEAR_STR - IP_STR - BGP_STR - "Clear peers with the AS number\n" - "Address family\n" - "Address Family Modifier\n" - "Soft reconfig\n") -{ - int idx_number = 3; - return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "clear bgp ipv6 (1-4294967295) soft", - * CLEAR_STR - * BGP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * - * "clear bgp WORD ipv6 (1-4294967295) soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * - * "clear bgp WORD (1-4294967295) soft", - * CLEAR_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Clear peers with the AS number\n" - * BGP_SOFT_STR - * - */ -DEFUN (clear_bgp_as_soft, - clear_bgp_as_soft_cmd, - "clear bgp (1-4294967295) soft", - CLEAR_STR - BGP_STR - "Clear peers with the AS number\n" - BGP_SOFT_STR) -{ - int idx_number = 2; - if (argc == 3) - return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[2]); - - return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, - BGP_CLEAR_SOFT_BOTH, argv[idx_number]->arg); -} - - - - DEFUN (show_bgp_views, show_bgp_views_cmd, "show bgp views", @@ -14401,115 +11977,12 @@ bgp_vty_init (void) /* "clear ip bgp commands" */ install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); - - - /* "clear ip bgp neighbor soft in" */ - install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); /* clear ip bgp prefix */ install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); - /* "clear ip bgp neighbor soft out" */ - install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); - - /* "clear ip bgp neighbor soft" */ - install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); - install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); - install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); - /* "show ip bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); From c7178fe784367b44122ea646b90fe5e67e6daf65 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 26 Sep 2016 01:06:40 +0000 Subject: [PATCH 145/280] bgpd: minor grammar corrections Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4788cd230a..b7e24ddcd1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -625,7 +625,7 @@ DEFUN (bgp_config_type, DEFUN (no_bgp_config_type, no_bgp_config_type_cmd, - "no bgp config-type [cisco|zebra]", + "no bgp config-type []", NO_STR BGP_STR "Display configuration type\n" @@ -920,7 +920,7 @@ DEFUN (bgp_cluster_id, DEFUN (no_bgp_cluster_id, no_bgp_cluster_id_cmd, - "no bgp cluster-id [A.B.C.D|(1-4294967295)]", + "no bgp cluster-id []", NO_STR BGP_STR "Configure Route-Reflector Cluster-id\n" @@ -1958,7 +1958,7 @@ DEFUN (no_bgp_bestpath_aspath_confed, /* "bgp bestpath as-path multipath-relax" configuration. */ DEFUN (bgp_bestpath_aspath_multipath_relax, bgp_bestpath_aspath_multipath_relax_cmd, - "bgp bestpath as-path multipath-relax [as-set|no-as-set]", + "bgp bestpath as-path multipath-relax []", "BGP specific commands\n" "Change the default bestpath selection\n" "AS-path attribute\n" @@ -1986,7 +1986,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, DEFUN (no_bgp_bestpath_aspath_multipath_relax, no_bgp_bestpath_aspath_multipath_relax_cmd, - "no bgp bestpath as-path multipath-relax [as-set|no-as-set]", + "no bgp bestpath as-path multipath-relax []", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" @@ -4709,7 +4709,7 @@ DEFUN (neighbor_update_source, DEFUN (no_neighbor_update_source, no_neighbor_update_source_cmd, - "no neighbor update-source [A.B.C.D|X:X::X:X|WORD]", + "no neighbor update-source []", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -6224,7 +6224,7 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR From 74ca3d330b14a17218a82566931a061e94adaddf Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 01:12:24 +0000 Subject: [PATCH 146/280] bgpd: combine "show ip bgp summary" commands into one DEFUN Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 420 ++++++++++--------------------------------------- 1 file changed, 84 insertions(+), 336 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index b7e24ddcd1..ae56fd05d3 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6220,7 +6220,6 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } -// dwalton /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, @@ -7176,30 +7175,98 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show ip bgp summary [json]", - SHOW_STR - IP_STR - BGP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); -} - -DEFUN (show_ip_bgp_instance_summary, - show_ip_bgp_instance_summary_cmd, - "show ip bgp WORD summary [json]", + "show [ip] bgp [ WORD] [] summary [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - int idx_word = 4; + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + char *vrf = NULL; + afi_t afi; + safi_t safi; u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, uj); + + /* + * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast. + * If the user does "show bgp" then we default the afi safi to ipv6 unicast. + * This may be over-written later in the command if they explicitly + * specify an afi safi. + */ + if (strmatch(argv[idx_ip]->text, "ip")) + { + afi = AFI_IP; + safi = SAFI_UNICAST; + } + else + { + afi = AFI_IP6; + safi = SAFI_UNICAST; + idx_view_vrf--; + idx_vrf--; + } + + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + if (uj) + { + idx_afi = argc - 3; + idx_safi = argc - 2; + } + else + { + idx_afi = argc - 2; + idx_safi = argc - 1; + } + + /* afi safi */ + if (strmatch(argv[idx_afi]->text, "ipv4")) + { + afi = AFI_IP; + + if (strmatch(argv[idx_safi]->text, "unicast")) + safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "ipv6")) + { + afi = AFI_IP6; + + if (strmatch(argv[idx_safi]->text, "unicast")) + safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "encap")) + { + afi = AFI_IP; + safi = SAFI_ENCAP; + } + else if (strmatch(argv[idx_afi]->text, "vpnv4")) + { + afi = AFI_IP; + safi = SAFI_MPLS_VPN; + } + + return bgp_show_summary_vty (vty, vrf, afi, safi, uj); } DEFUN (show_ip_bgp_instance_all_summary, @@ -7218,274 +7285,6 @@ DEFUN (show_ip_bgp_instance_all_summary, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) summary [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Summary of BGP neighbor status\n" - * - */ -DEFUN (show_ip_bgp_ipv4_summary, - show_ip_bgp_ipv4_summary_cmd, - "show ip bgp ipv4 summary [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); - - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); -} - - -DEFUN (show_bgp_ipv4_vpn_summary, - show_bgp_ipv4_vpn_summary_cmd, - "show bgp ipv4 vpn summary [json]", - SHOW_STR - BGP_STR - "IPv4\n" - "Display VPN NLRI specific information\n" - "Summary of BGP neighbor status\n" - JSON_STR) -{ - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json (argc, argv)); -} - -/* `show ip bgp summary' commands. */ -DEFUN (show_bgp_ipv6_vpn_summary, - show_bgp_ipv6_vpn_summary_cmd, - "show bgp ipv6 vpn summary [json]", - SHOW_STR - BGP_STR - "IPv6\n" - "Display VPN NLRI specific information\n" - "Summary of BGP neighbor status\n" - JSON_STR) -{ - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN, use_json (argc, argv)); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp view WORD ipv4 (unicast|multicast) summary [json]", - * SHOW_STR - * BGP_STR - * "BGP view\n" - * "View name\n" - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Summary of BGP neighbor status\n" - * - */ -DEFUN (show_ip_bgp_instance_ipv4_summary, - show_ip_bgp_instance_ipv4_summary_cmd, - "show ip bgp view WORD ipv4 summary [json]", - SHOW_STR - IP_STR - BGP_STR - "BGP view\n" - "View name\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_safi = 6; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, uj); - else - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, uj); -} - - -DEFUN (show_ip_bgp_vpnv4_all_summary, - show_ip_bgp_vpnv4_all_summary_cmd, - "show ip bgp vpnv4 all summary [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); -} - -DEFUN (show_ip_bgp_vpnv4_rd_summary, - show_ip_bgp_vpnv4_rd_summary_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_ext_community = 5; - int ret; - struct prefix_rd prd; - u_char uj = use_json(argc, argv); - - ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 summary [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Summary of BGP neighbor status\n" - * - */ -DEFUN (show_bgp_summary, - show_bgp_summary_cmd, - "show bgp summary [json]", - SHOW_STR - BGP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 summary [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Summary of BGP neighbor status\n" - * - */ -DEFUN (show_bgp_instance_summary, - show_bgp_instance_summary_cmd, - "show bgp WORD summary [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); -} - -DEFUN (show_bgp_instance_all_summary, - show_bgp_instance_all_summary_cmd, - "show bgp all summary [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_ALL_HELP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - - bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); - return CMD_SUCCESS; -} - - - -DEFUN (show_bgp_ipv6_safi_summary, - show_bgp_ipv6_safi_summary_cmd, - "show bgp ipv6 summary [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); - - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); -} - -DEFUN (show_bgp_instance_ipv6_safi_summary, - show_bgp_instance_ipv6_safi_summary_cmd, - "show bgp WORD ipv6 summary [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_safi = 5; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, uj); - - return bgp_show_summary_vty (vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, uj); -} - -/* old command */ -DEFUN (show_ipv6_bgp_summary, - show_ipv6_bgp_summary_cmd, - "show ipv6 bgp summary [json]", - SHOW_STR - IPV6_STR - BGP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_summary, - show_ipv6_mbgp_summary_cmd, - "show ipv6 mbgp summary [json]", - SHOW_STR - IPV6_STR - MBGP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); -} -#endif /* HAVE_IPV6 */ - const char * afi_safi_print (afi_t afi, safi_t safi) { @@ -12007,19 +11806,7 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); -#ifdef HAVE_IPV6 - install_element (VIEW_NODE, &show_bgp_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); -#endif /* HAVE_IPV6 */ install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); @@ -12043,19 +11830,7 @@ bgp_vty_init (void) install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); -#ifdef HAVE_IPV6 - install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); -#endif /* HAVE_IPV6 */ install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); @@ -12079,25 +11854,7 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); -#ifdef HAVE_IPV6 - install_element (ENABLE_NODE, &show_bgp_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); -#endif /* HAVE_IPV6 */ - - install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd); /* "show ip bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); @@ -12113,15 +11870,6 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); -#ifdef HAVE_IPV6 - - /* Old commands. */ - install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); -#endif /* HAVE_IPV6 */ - /* "show ip bgp peer-group" commands. */ install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); From 5bf159563c128a4110341949962e5258db3b309c Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 04:59:47 +0000 Subject: [PATCH 147/280] bgpd: bgp_vty.c compiles now Signed-off-by: Daniel Walton --- bgpd/bgp_bfd.c | 44 +- bgpd/bgp_encap.c | 74 ++- bgpd/bgp_encap_tlv.c | 1 + bgpd/bgp_vty.c | 1109 ++++++++++-------------------------------- 4 files changed, 323 insertions(+), 905 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index b2863736ce..7bc902ef92 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -560,10 +560,11 @@ DEFUN (neighbor_bfd, NEIGHBOR_ADDR_STR2 "Enables BFD support\n") { + int idx_peer = 1; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -586,17 +587,21 @@ DEFUN (neighbor_bfd_param, "Required min receive interval\n" "Desired min transmit interval\n") { + int idx_peer = 1; + int idx_number_1 = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; struct peer *peer; u_int32_t rx_val; u_int32_t tx_val; u_int8_t dm_val; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (!peer) return CMD_WARNING; - if ((ret = bfd_validate_param (vty, argv[1], argv[2], argv[3], &dm_val, + if ((ret = bfd_validate_param (vty, argv[idx_number_1]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg, &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) return ret; @@ -616,17 +621,19 @@ DEFUN_HIDDEN (neighbor_bfd_type, "Enables BFD support\n" "Session type\n") { + int idx_peer = 1; + int idx_hop = 3; struct peer *peer; enum bfd_sess_type type; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (!peer) return CMD_WARNING; - if (!strcmp(argv[1], "singlehop")) + if (!strcmp(argv[idx_hop]->arg, "singlehop")) type = BFD_TYPE_SINGLEHOP; - else if (!strcmp(argv[1], "multihop")) + else if (!strcmp(argv[idx_hop]->arg, "multihop")) type = BFD_TYPE_MULTIHOP; else return CMD_WARNING; @@ -638,30 +645,22 @@ DEFUN_HIDDEN (neighbor_bfd_type, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor bfd (2-255) (50-60000) (50-60000)", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Disables BFD support\n" - * "Detect Multiplier\n" - * "Required min receive interval\n" - * "Desired min transmit interval\n" - * - */ DEFUN (no_neighbor_bfd, no_neighbor_bfd_cmd, - "no neighbor bfd", + "no neighbor bfd [(2-255) (50-60000) (50-60000)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Disables BFD support\n") + "Disables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") { + int idx_peer = 2; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; @@ -682,10 +681,11 @@ DEFUN_HIDDEN (no_neighbor_bfd_type, "Disables BFD support\n" "Session type\n") { + int idx_peer = 2; struct peer *peer; int ret; - peer = peer_and_group_lookup_vty (vty, argv[0]); + peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); if (! peer) return CMD_WARNING; diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 0c7657f8bb..f739e81b67 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -257,7 +257,10 @@ DEFUN (encap_network, "BGP tag\n" "tag value\n") { - return bgp_static_set_safi (SAFI_ENCAP, vty, argv[0], argv[1], argv[2], NULL); + int idx_ipv4 = 1; + int idx_rd = 3; + int idx_word = 5; + return bgp_static_set_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, NULL); } /* For testing purpose, static route of ENCAP. */ @@ -272,7 +275,10 @@ DEFUN (no_encap_network, "BGP tag\n" "tag value\n") { - return bgp_static_unset_safi (SAFI_ENCAP, vty, argv[0], argv[1], argv[2]); + int idx_ipv4 = 2; + int idx_rd = 4; + int idx_word = 6; + return bgp_static_unset_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg); } static int @@ -534,10 +540,11 @@ DEFUN (show_bgp_ipv4_encap_rd, "Display information for a route distinguisher\n" "ENCAP Route Distinguisher\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -557,10 +564,11 @@ DEFUN (show_bgp_ipv6_encap_rd, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -606,10 +614,11 @@ DEFUN (show_bgp_ipv4_encap_rd_tags, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -629,10 +638,11 @@ DEFUN (show_bgp_ipv6_encap_rd_tags, "ENCAP Route Distinguisher\n" "Display BGP tags for prefixes\n") { + int idx_rd = 5; int ret; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -653,13 +663,14 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_peer = 5; union sockunion *su; struct peer *peer; - su = sockunion_str2su (argv[0]); + su = sockunion_str2su (argv[idx_peer]->arg); if (su == NULL) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -684,13 +695,14 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_peer = 5; union sockunion *su; struct peer *peer; - su = sockunion_str2su (argv[0]); + su = sockunion_str2su (argv[idx_peer]->arg); if (su == NULL) { - vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -719,22 +731,24 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; union sockunion *su; struct peer *peer; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - su = sockunion_str2su (argv[1]); + su = sockunion_str2su (argv[idx_peer]->arg); if (su == NULL) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -762,22 +776,24 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, "Neighbor to display information about\n" "Display routes learned from neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; union sockunion *su; struct peer *peer; struct prefix_rd prd; - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); return CMD_WARNING; } - su = sockunion_str2su (argv[1]); + su = sockunion_str2su (argv[idx_peer]->arg); if (su == NULL) { - vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } @@ -803,14 +819,15 @@ DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_peer = 5; int ret; struct peer *peer; union sockunion su; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -834,14 +851,15 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_peer = 5; int ret; struct peer *peer; union sockunion su; - ret = str2sockunion (argv[0], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -869,15 +887,17 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -887,7 +907,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); @@ -911,15 +931,17 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n") { + int idx_rd = 5; + int idx_peer = 7; int ret; struct peer *peer; struct prefix_rd prd; union sockunion su; - ret = str2sockunion (argv[1], &su); + ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); + vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; } peer = peer_lookup (NULL, &su); @@ -929,7 +951,7 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, return CMD_WARNING; } - ret = str2prefix_rd (argv[0], &prd); + ret = str2prefix_rd (argv[idx_rd]->arg, &prd); if (! ret) { vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); diff --git a/bgpd/bgp_encap_tlv.c b/bgpd/bgp_encap_tlv.c index 347b4b3ce7..87aa0ceac5 100644 --- a/bgpd/bgp_encap_tlv.c +++ b/bgpd/bgp_encap_tlv.c @@ -19,6 +19,7 @@ #include +#include "command.h" #include "memory.h" #include "prefix.h" #include "vty.h" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index ae56fd05d3..2fd75baeff 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6220,6 +6220,40 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } +static void +bgp_get_argv_afi_safi (struct cmd_token **argv, int idx_afi, int idx_safi, + afi_t *afi, safi_t *safi) +{ + if (strmatch(argv[idx_afi]->text, "ipv4")) + { + *afi = AFI_IP; + + if (strmatch(argv[idx_safi]->text, "unicast")) + *safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + *safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "ipv6")) + { + *afi = AFI_IP6; + + if (strmatch(argv[idx_safi]->text, "unicast")) + *safi = SAFI_UNICAST; + else if (strmatch(argv[idx_safi]->text, "multicast")) + *safi = SAFI_MULTICAST; + } + else if (strmatch(argv[idx_afi]->text, "encap")) + { + *afi = AFI_IP; + *safi = SAFI_ENCAP; + } + else if (strmatch(argv[idx_afi]->text, "vpnv4")) + { + *afi = AFI_IP; + *safi = SAFI_MPLS_VPN; + } +} + /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, @@ -6266,7 +6300,7 @@ DEFUN (clear_ip_bgp_all, char *vrf = NULL; afi_t afi; safi_t safi; - enum clear_sort clr_sort; + enum clear_sort clr_sort = clear_peer; enum bgp_clear_type clr_type; char *clr_arg = NULL; @@ -6395,34 +6429,7 @@ DEFUN (clear_ip_bgp_all, } /* afi safi */ - if (strmatch(argv[idx_afi]->text, "ipv4")) - { - afi = AFI_IP; - - if (strmatch(argv[idx_safi]->text, "unicast")) - safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - safi = SAFI_MULTICAST; - } - else if (strmatch(argv[idx_afi]->text, "ipv6")) - { - afi = AFI_IP6; - - if (strmatch(argv[idx_safi]->text, "unicast")) - safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - safi = SAFI_MULTICAST; - } - else if (strmatch(argv[idx_afi]->text, "encap")) - { - afi = AFI_IP; - safi = SAFI_ENCAP; - } - else if (strmatch(argv[idx_afi]->text, "vpnv4")) - { - afi = AFI_IP; - safi = SAFI_MPLS_VPN; - } + bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); return bgp_clear_vty (vty, vrf, afi, safi, clr_sort, clr_type, clr_arg); } @@ -7237,34 +7244,7 @@ DEFUN (show_ip_bgp_summary, } /* afi safi */ - if (strmatch(argv[idx_afi]->text, "ipv4")) - { - afi = AFI_IP; - - if (strmatch(argv[idx_safi]->text, "unicast")) - safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - safi = SAFI_MULTICAST; - } - else if (strmatch(argv[idx_afi]->text, "ipv6")) - { - afi = AFI_IP6; - - if (strmatch(argv[idx_safi]->text, "unicast")) - safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - safi = SAFI_MULTICAST; - } - else if (strmatch(argv[idx_afi]->text, "encap")) - { - afi = AFI_IP; - safi = SAFI_ENCAP; - } - else if (strmatch(argv[idx_afi]->text, "vpnv4")) - { - afi = AFI_IP; - safi = SAFI_MPLS_VPN; - } + bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); return bgp_show_summary_vty (vty, vrf, afi, safi, uj); } @@ -9009,14 +8989,14 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, static int bgp_show_neighbor_vty (struct vty *vty, const char *name, - enum show_type type, const char *ip_str, u_char use_json, - json_object *json) + enum show_type type, const char *ip_str, u_char use_json) { int ret; struct bgp *bgp; union sockunion su; + json_object *json = NULL; - if (use_json && (json == NULL)) + if (use_json) json = json_object_new_object(); if (name) @@ -9115,184 +9095,61 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) } /* "show ip bgp neighbors" commands. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display VPNv4 NLRI specific information\n" - * "Display information for a route distinguisher\n" - * "VPN Route Distinguisher\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - * "show bgp neighbors [json]", - * SHOW_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - * "show ip bgp vpnv4 all neighbors [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display VPNv4 NLRI specific information\n" - * "Display information about all VPNv4 NLRIs\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - * "show ip bgp ipv4 (unicast|multicast) neighbors [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - * "show bgp ipv6 neighbors [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - */ DEFUN (show_ip_bgp_neighbors, show_ip_bgp_neighbors_cmd, - "show ip bgp neighbors [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - - return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); -} - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "JavaScript Object Notation\n" - * - * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display VPNv4 NLRI specific information\n" - * "Display information about all VPNv4 NLRIs\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "JavaScript Object Notation\n" - * - * "show ip bgp vpnv4 all neighbors A.B.C.D [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display VPNv4 NLRI specific information\n" - * "Display information about all VPNv4 NLRIs\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "JavaScript Object Notation\n" - * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "JavaScript Object Notation\n" - * - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", - * SHOW_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_neighbors_peer, - show_ip_bgp_neighbors_peer_cmd, - "show ip bgp neighbors [json]", + "show [ip] bgp [ WORD] [] neighbors [] [json]", SHOW_STR IP_STR BGP_STR + BGP_INSTANCE_ALL_HELP_STR + "Address family\n" + "Address family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" "Neighbor on bgp configured interface\n" "JavaScript Object Notation\n") { + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_peer; + char *vrf = NULL; + char *sh_arg = NULL; + enum show_type sh_type; + u_char uj = use_json(argc, argv); - return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); -} + if (!strmatch(argv[idx_ip]->text, "ip")) + { + idx_view_vrf--; + idx_vrf--; + } + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + if (uj) + idx_peer = argc - 2; + else + idx_peer = argc - 1; + if (strmatch(argv[idx_peer]->text, "neighbors")) + { + sh_type = show_all; + } + else + { + sh_type = show_peer; + sh_arg = argv[idx_peer]->arg; + } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD neighbors [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - * "show bgp WORD ipv6 neighbors [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_instance_neighbors, - show_ip_bgp_instance_neighbors_cmd, - "show ip bgp WORD neighbors [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - u_char uj = use_json(argc, argv); - - return bgp_show_neighbor_vty (vty, argv[idx_word]->arg, show_all, NULL, uj, NULL); + return bgp_show_neighbor_vty (vty, vrf, sh_type, sh_arg, uj); } DEFUN (show_ip_bgp_instance_all_neighbors, show_ip_bgp_instance_all_neighbors_cmd, - "show ip bgp all neighbors [json]", + "show [ip] bgp all neighbors [json]", SHOW_STR IP_STR BGP_STR @@ -9306,54 +9163,6 @@ DEFUN (show_ip_bgp_instance_all_neighbors, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "JavaScript Object Notation\n" - * - * "show bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_instance_neighbors_peer, - show_ip_bgp_instance_neighbors_peer_cmd, - "show ip bgp WORD neighbors [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_peer = 6; - u_char uj = use_json(argc, argv); - - return bgp_show_neighbor_vty (vty, argv[idx_word]->arg, show_peer, argv[idx_peer]->arg, uj, NULL); -} - - - /* Show BGP's AS paths internal data. There are both `show ip bgp paths' and `show ip mbgp paths'. Those functions results are the same.*/ @@ -9464,26 +9273,72 @@ bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show ip bgp update-groups", - SHOW_STR - IP_STR - BGP_STR - "Detailed info about dynamic update groups\n") -{ - return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); -} - -DEFUN (show_ip_bgp_instance_updgrps, - show_ip_bgp_instance_updgrps_cmd, - "show ip bgp WORD update-groups", + "show [ip] bgp [ WORD] [] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Detailed info about dynamic update groups\n") + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Detailed info about dynamic update groups\n" + "Specific subgroup to display detailed info for\n") { - int idx_word = 4; - return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0)); + int idx_ip = 1; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + int idx_subgroup_id = argc - 1; + char *vrf = NULL; + afi_t afi; + safi_t safi; + uint64_t subgrp_id = 0; + + /* + * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast. + * If the user does "show bgp" then we default the afi safi to ipv6 unicast. + * This may be over-written later in the command if they explicitly + * specify an afi safi. + */ + if (strmatch(argv[idx_ip]->text, "ip")) + { + afi = AFI_IP; + safi = SAFI_UNICAST; + } + else + { + afi = AFI_IP6; + safi = SAFI_UNICAST; + idx_view_vrf--; + idx_vrf--; + } + + if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) + vrf = argv[idx_vrf]->arg; + + if (strmatch(argv[idx_subgroup_id]->text, "update-groups")) + { + idx_afi = idx_subgroup_id - 2; + idx_safi = idx_subgroup_id - 1; + } + else + { + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); + idx_afi = idx_subgroup_id - 3; + idx_safi = idx_subgroup_id - 2; + } + + bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); + + return (bgp_show_update_groups(vty, vrf, afi, safi, subgrp_id)); } DEFUN (show_ip_bgp_instance_all_updgrps, @@ -9499,28 +9354,6 @@ DEFUN (show_ip_bgp_instance_all_updgrps, return CMD_SUCCESS; } -DEFUN (show_bgp_ipv6_updgrps, - show_bgp_ipv6_updgrps_cmd, - "show bgp update-groups", - SHOW_STR - BGP_STR - "Detailed info about v6 dynamic update groups\n") -{ - return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); -} - -DEFUN (show_bgp_instance_ipv6_updgrps, - show_bgp_instance_ipv6_updgrps_cmd, - "show bgp WORD update-groups", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed info about v6 dynamic update groups\n") -{ - int idx_word = 3; - return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, 0)); -} - DEFUN (show_bgp_instance_all_ipv6_updgrps, show_bgp_instance_all_ipv6_updgrps_cmd, "show bgp all update-groups", @@ -9533,113 +9366,6 @@ DEFUN (show_bgp_instance_all_ipv6_updgrps, return CMD_SUCCESS; } -DEFUN (show_bgp_updgrps, - show_bgp_updgrps_cmd, - "show bgp update-groups", - SHOW_STR - BGP_STR - "Address family\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed info about dynamic update groups\n") -{ - int idx_afi = 2; - int idx_safi = 3; - afi_t afi; - safi_t safi; - - afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); -} - -DEFUN (show_ip_bgp_updgrps_s, - show_ip_bgp_updgrps_s_cmd, - "show ip bgp update-groups SUBGROUP-ID", - SHOW_STR - IP_STR - BGP_STR - "Detailed info about dynamic update groups\n" - "Specific subgroup to display detailed info for\n") -{ - uint64_t subgrp_id; - - VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); - return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); -} - -DEFUN (show_ip_bgp_instance_updgrps_s, - show_ip_bgp_instance_updgrps_s_cmd, - "show ip bgp WORD update-groups SUBGROUP-ID", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed info about dynamic update groups\n" - "Specific subgroup to display detailed info for\n") -{ - int idx_word = 4; - uint64_t subgrp_id; - - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return (bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, subgrp_id)); -} - -DEFUN (show_bgp_ipv6_updgrps_s, - show_bgp_ipv6_updgrps_s_cmd, - "show bgp update-groups SUBGROUP-ID", - SHOW_STR - BGP_STR - "Detailed info about v6 dynamic update groups\n" - "Specific subgroup to display detailed info for\n") -{ - uint64_t subgrp_id; - - VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); - return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id)); -} - -DEFUN (show_bgp_instance_ipv6_updgrps_s, - show_bgp_instance_ipv6_updgrps_s_cmd, - "show bgp WORD update-groups SUBGROUP-ID", - SHOW_STR - BGP_STR - "Detailed info about v6 dynamic update groups\n" - "Specific subgroup to display detailed info for\n") -{ - int idx_word = 3; - uint64_t subgrp_id; - - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return(bgp_show_update_groups(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, subgrp_id)); -} - -DEFUN (show_bgp_updgrps_s, - show_bgp_updgrps_s_cmd, - "show bgp update-groups SUBGROUP-ID", - SHOW_STR - BGP_STR - "Address family\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed info about v6 dynamic update groups\n" - "Specific subgroup to display detailed info for") -{ - int idx_afi = 2; - int idx_safi = 3; - afi_t afi; - safi_t safi; - uint64_t subgrp_id; - - afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - - VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); - return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); -} - DEFUN (show_bgp_updgrps_stats, show_bgp_updgrps_stats_cmd, "show bgp update-groups statistics", @@ -9807,12 +9533,13 @@ DEFUN (show_ip_bgp_updgrps_adj_s, "Packet queue\n") { + int idx_subgroup_id = 4; int idx_type = 5; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } @@ -9830,13 +9557,14 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, "Packet queue\n") { - int idx_word = 4; + int idx_vrf = 4; + int idx_subgroup_id = 6; int idx_type = 7; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } @@ -9858,16 +9586,17 @@ DEFUN (show_bgp_updgrps_afi_adj_s, { int idx_afi = 2; int idx_safi = 3; + int idx_subgroup_id = 5; int idx_type = 6; afi_t afi; safi_t safi; uint64_t subgrp_id; - afi = (strcmp(argv[idx_afi]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); + afi = (strmatch(argv[idx_afi]->text, "ipv4")) ? AFI_IP : AFI_IP6; + safi = (strmatch(argv[idx_safi]->text, "unicast")) ? SAFI_UNICAST : SAFI_MULTICAST; + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } @@ -9882,12 +9611,13 @@ DEFUN (show_bgp_updgrps_adj_s, "Announced routes\n" "Packet queue\n") { + int idx_subgroup_id = 3; int idx_type = 4; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } @@ -9903,13 +9633,14 @@ DEFUN (show_bgp_instance_updgrps_adj_s, "Announced routes\n" "Packet queue\n") { - int idx_word = 3; + int idx_vrf = 3; + int idx_subgroup_id = 5; int idx_type = 6; uint64_t subgrp_id; - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_type]->arg); + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); + show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id); return CMD_SUCCESS; } @@ -11785,17 +11516,8 @@ bgp_vty_init (void) /* "show ip bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); - install_element (VIEW_NODE, &show_bgp_updgrps_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); - install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); - install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); - install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); @@ -11809,17 +11531,8 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); - install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); @@ -11833,17 +11546,8 @@ bgp_vty_init (void) install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); - install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); - install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); @@ -11858,17 +11562,9 @@ bgp_vty_init (void) /* "show ip bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); /* "show ip bgp peer-group" commands. */ install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); @@ -11994,43 +11690,55 @@ community_list_perror (struct vty *vty, int ret) } } -/* VTY interface for community_set() function. */ +/* "community-list" keyword help string. */ +#define COMMUNITY_LIST_STR "Add a community list entry\n" + static int -community_list_set_vty (struct vty *vty, int argc, const char **argv, - int style, int reject_all_digit_name) +community_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, + int style) { - int ret; + int idx_number = 2; + int idx_name = 3; + int idx_permit_deny = 4; + int idx_aa_nn = 5; int direct; + int ret; char *str; + char *name; /* Check the list type. */ - if (strncmp (argv[1], "p", 1) == 0) + if (strmatch(argv[idx_permit_deny]->text, "permit")) direct = COMMUNITY_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) + else direct = COMMUNITY_DENY; + + if (argv[idx_number]->type == RANGE_TKN) + { + name = argv[idx_number]->arg; + idx_permit_deny--; + idx_aa_nn--; + } else { - vty_out (vty, "%% Matching condition must be permit or deny%s", - VTY_NEWLINE); - return CMD_WARNING; - } + name = argv[idx_name]->arg; - /* All digit name check. */ - if (reject_all_digit_name && all_digit (argv[0])) - { - vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); - return CMD_WARNING; + /* All digit name check. */ + if (all_digit (name)) + { + vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); + return CMD_WARNING; + } } /* Concat community string argument. */ - if (argc > 1) - str = argv_concat (argv, argc, 2); + if (argc > idx_aa_nn) + str = argv_concat (argv, argc, idx_aa_nn); else str = NULL; /* When community_list_set() return nevetive value, it means malformed community string. */ - ret = community_list_set (bgp_clist, argv[0], str, direct, style); + ret = community_list_set (bgp_clist, name, str, direct, style); /* Free temporary community list string allocated by argv_concat(). */ @@ -12047,18 +11755,18 @@ community_list_set_vty (struct vty *vty, int argc, const char **argv, return CMD_SUCCESS; } -/* Communiyt-list entry delete. */ static int -community_list_unset_vty (struct vty *vty, int argc, const char **argv, - int style, int delete_all) +community_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, + int style) { + /* CHECK ME dwalton finish this int ret; int direct = 0; char *str = NULL; if (argc > 1) { - /* Check the list direct. */ + // Check the list direct. if (strncmp (argv[1], "p", 1) == 0) direct = COMMUNITY_PERMIT; else if (strncmp (argv[1], "d", 1) == 0) @@ -12070,15 +11778,14 @@ community_list_unset_vty (struct vty *vty, int argc, const char **argv, return CMD_WARNING; } - /* Concat community string argument. */ + // Concat community string argument. str = argv_concat (argv, argc, 2); } - /* Unset community list. */ + // Unset community list ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); - /* Free temporary community list string allocated by - argv_concat(). */ + // Free temporary community list string allocated by argv_concat(). if (str) XFREE (MTYPE_TMP, str); @@ -12087,220 +11794,73 @@ community_list_unset_vty (struct vty *vty, int argc, const char **argv, community_list_perror (vty, ret); return CMD_WARNING; } + * */ return CMD_SUCCESS; } -/* "community-list" keyword help string. */ -#define COMMUNITY_LIST_STR "Add a community list entry\n" - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip community-list <1-99> (deny|permit)", - * IP_STR - * COMMUNITY_LIST_STR - * "Community list number (standard)\n" - * "Specify community to reject\n" - * "Specify community to accept\n" - * - */ +/* ip community-list standard */ DEFUN (ip_community_list_standard, ip_community_list_standard_cmd, - "ip community-list (1-99) .AA:NN", + "ip community-list <(1-99)|standard WORD> [.AA:NN]", IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n" - COMMUNITY_VAL_STR) -{ - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); -} - - -DEFUN (ip_community_list_expanded, - ip_community_list_expanded_cmd, - "ip community-list (100-500) .LINE", - IP_STR - COMMUNITY_LIST_STR - "Community list number (expanded)\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip community-list standard WORD (deny|permit)", - * IP_STR - * COMMUNITY_LIST_STR - * "Add a standard community-list entry\n" - * "Community list name\n" - * "Specify community to reject\n" - * "Specify community to accept\n" - * - */ -DEFUN (ip_community_list_name_standard, - ip_community_list_name_standard_cmd, - "ip community-list standard WORD .AA:NN", - IP_STR - COMMUNITY_LIST_STR - "Add a standard community-list entry\n" + "Add an standard community-list entry\n" "Community list name\n" "Specify community to reject\n" "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); -} - - -DEFUN (ip_community_list_name_expanded, - ip_community_list_name_expanded_cmd, - "ip community-list expanded WORD .LINE", - IP_STR - COMMUNITY_LIST_STR - "Add an expanded community-list entry\n" - "Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); + return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } DEFUN (no_ip_community_list_standard_all, no_ip_community_list_standard_all_cmd, - "no ip community-list (1-99)", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Community list number (standard)\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); -} - -DEFUN (no_ip_community_list_standard_direction, - no_ip_community_list_standard_direction_cmd, - "no ip community-list (1-99) ", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); -} - - -DEFUN (no_ip_community_list_expanded_all, - no_ip_community_list_expanded_all_cmd, - "no ip community-list (100-500)", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Community list number (expanded)\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); -} - -DEFUN (no_ip_community_list_name_standard_all, - no_ip_community_list_name_standard_all_cmd, - "no ip community-list standard WORD", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Add a standard community-list entry\n" - "Community list name\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); -} - -DEFUN (no_ip_community_list_name_expanded_all, - no_ip_community_list_name_expanded_all_cmd, - "no ip community-list expanded WORD", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Add an expanded community-list entry\n" - "Community list name\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); -} - -DEFUN (no_ip_community_list_standard, - no_ip_community_list_standard_cmd, - "no ip community-list (1-99) .AA:NN", + "no ip community-list <(1-99)|standard WORD> [ [.AA:NN]]", NO_STR IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" + "Add an standard community-list entry\n" + "Community list name\n" "Specify community to reject\n" "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); + return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } -DEFUN (no_ip_community_list_expanded, - no_ip_community_list_expanded_cmd, - "no ip community-list (100-500) .LINE", +/* ip community-list expanded */ +DEFUN (ip_community_list_expanded_all, + ip_community_list_expanded_all_cmd, + "ip community-list <(100-500)|expanded WORD> [ [.LINE]]", + IP_STR + COMMUNITY_LIST_STR + "Community list number (expanded)\n" + "Add an expanded community-list entry\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + COMMUNITY_VAL_STR) +{ + return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); +} + +DEFUN (no_ip_community_list_expanded_all, + no_ip_community_list_expanded_all_cmd, + "no ip community-list <(100-500)|expanded WORD> [ [.LINE]]", NO_STR IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); -} - -DEFUN (no_ip_community_list_name_standard, - no_ip_community_list_name_standard_cmd, - "no ip community-list standard WORD .AA:NN", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Specify a standard community-list\n" + "Add an expanded community-list entry\n" "Community list name\n" "Specify community to reject\n" "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); -} - -DEFUN (no_ip_community_list_name_standard_brief, - no_ip_community_list_name_standard_brief_cmd, - "no ip community-list standard WORD ", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Specify a standard community-list\n" - "Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); -} - -DEFUN (no_ip_community_list_name_expanded, - no_ip_community_list_name_expanded_cmd, - "no ip community-list expanded WORD .LINE", - NO_STR - IP_STR - COMMUNITY_LIST_STR - "Specify an expanded community-list\n" - "Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); + return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); } static void @@ -12384,13 +11944,14 @@ DEFUN (show_ip_community_list_arg, static int extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style, int reject_all_digit_name) + int style) { + /* CHECK ME dwalton finish this int ret; int direct; char *str; - /* Check the list type. */ + // Check the list type. if (strncmp (argv[1], "p", 1) == 0) direct = COMMUNITY_PERMIT; else if (strncmp (argv[1], "d", 1) == 0) @@ -12402,14 +11963,14 @@ extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, return CMD_WARNING; } - /* All digit name check. */ + // All digit name check. if (reject_all_digit_name && all_digit (argv[0])) { vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); return CMD_WARNING; } - /* Concat community string argument. */ + // Concat community string argument. if (argc > 1) str = argv_concat (argv, argc, 2); else @@ -12417,8 +11978,7 @@ extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); - /* Free temporary community list string allocated by - argv_concat(). */ + // Free temporary community list string allocated by argv_concat(). if (str) XFREE (MTYPE_TMP, str); @@ -12427,20 +11987,22 @@ extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, community_list_perror (vty, ret); return CMD_WARNING; } + */ return CMD_SUCCESS; } static int extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style, int delete_all) + int style) { + /* CHECK ME dwalton finish this int ret; int direct = 0; char *str = NULL; if (argc > 1) { - /* Check the list direct. */ + // Check the list direct if (strncmp (argv[1], "p", 1) == 0) direct = COMMUNITY_PERMIT; else if (strncmp (argv[1], "d", 1) == 0) @@ -12452,15 +12014,14 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, return CMD_WARNING; } - /* Concat community string argument. */ + // Concat community string argument. str = argv_concat (argv, argc, 2); } - /* Unset community list. */ - ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); + // Unset community list. + ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, EXTCOMMUNITY_LIST_STANDARD, delete_all); - /* Free temporary community list string allocated by - argv_concat(). */ + // Free temporary community list string allocated by argv_concat(). if (str) XFREE (MTYPE_TMP, str); @@ -12470,6 +12031,7 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, return CMD_WARNING; } + */ return CMD_SUCCESS; } @@ -12477,212 +12039,66 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip extcommunity-list <1-99> (deny|permit)", - * IP_STR - * EXTCOMMUNITY_LIST_STR - * "Extended Community list number (standard)\n" - * "Specify community to reject\n" - * "Specify community to accept\n" - * - */ DEFUN (ip_extcommunity_list_standard, ip_extcommunity_list_standard_cmd, - "ip extcommunity-list (1-99) .AA:NN", + "ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n" - EXTCOMMUNITY_VAL_STR) -{ - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); -} - - -DEFUN (ip_extcommunity_list_expanded, - ip_extcommunity_list_expanded_cmd, - "ip extcommunity-list (100-500) .LINE", - IP_STR - EXTCOMMUNITY_LIST_STR - "Extended Community list number (expanded)\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip extcommunity-list standard WORD (deny|permit)", - * IP_STR - * EXTCOMMUNITY_LIST_STR - * "Specify standard extcommunity-list\n" - * "Extended Community list name\n" - * "Specify community to reject\n" - * "Specify community to accept\n" - * - */ -DEFUN (ip_extcommunity_list_name_standard, - ip_extcommunity_list_name_standard_cmd, - "ip extcommunity-list standard WORD .AA:NN", - IP_STR - EXTCOMMUNITY_LIST_STR "Specify standard extcommunity-list\n" - "Extended Community list name\n" + "Community list name\n" "Specify community to reject\n" "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); + return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); } - DEFUN (ip_extcommunity_list_name_expanded, ip_extcommunity_list_name_expanded_cmd, - "ip extcommunity-list expanded WORD .LINE", + "ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", IP_STR EXTCOMMUNITY_LIST_STR + "Extended Community list number (expanded)\n" "Specify expanded extcommunity-list\n" "Extended Community list name\n" "Specify community to reject\n" "Specify community to accept\n" "An ordered list as a regular-expression\n") { - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); + return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } DEFUN (no_ip_extcommunity_list_standard_all, no_ip_extcommunity_list_standard_all_cmd, - "no ip extcommunity-list (1-99)", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Extended Community list number (standard)\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); -} - -DEFUN (no_ip_extcommunity_list_standard_direction, - no_ip_extcommunity_list_standard_direction_cmd, - "no ip extcommunity-list (1-99) ", + "no ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", NO_STR IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" + "Specify standard extcommunity-list\n" + "Community list name\n" "Specify community to reject\n" - "Specify community to accept\n") + "Specify community to accept\n" + EXTCOMMUNITY_VAL_STR) { - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); + return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } DEFUN (no_ip_extcommunity_list_expanded_all, no_ip_extcommunity_list_expanded_all_cmd, - "no ip extcommunity-list (100-500)", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Extended Community list number (expanded)\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); -} - -DEFUN (no_ip_extcommunity_list_name_standard_all, - no_ip_extcommunity_list_name_standard_all_cmd, - "no ip extcommunity-list standard WORD", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Specify standard extcommunity-list\n" - "Extended Community list name\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); -} - -DEFUN (no_ip_extcommunity_list_name_expanded_all, - no_ip_extcommunity_list_name_expanded_all_cmd, - "no ip extcommunity-list expanded WORD", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Specify expanded extcommunity-list\n" - "Extended Community list name\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); -} - -DEFUN (no_ip_extcommunity_list_standard, - no_ip_extcommunity_list_standard_cmd, - "no ip extcommunity-list (1-99) .AA:NN", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Extended Community list number (standard)\n" - "Specify community to reject\n" - "Specify community to accept\n" - EXTCOMMUNITY_VAL_STR) -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); -} - -DEFUN (no_ip_extcommunity_list_expanded, - no_ip_extcommunity_list_expanded_cmd, - "no ip extcommunity-list (100-500) .LINE", + "no ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", NO_STR IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" - "Specify community to reject\n" - "Specify community to accept\n" - "An ordered list as a regular-expression\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); -} - -DEFUN (no_ip_extcommunity_list_name_standard, - no_ip_extcommunity_list_name_standard_cmd, - "no ip extcommunity-list standard WORD .AA:NN", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Specify standard extcommunity-list\n" - "Extended Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n" - EXTCOMMUNITY_VAL_STR) -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); -} - -DEFUN (no_ip_extcommunity_list_name_standard_brief, - no_ip_extcommunity_list_name_standard_brief_cmd, - "no ip extcommunity-list standard WORD ", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR - "Specify standard extcommunity-list\n" - "Extended Community list name\n" - "Specify community to reject\n" - "Specify community to accept\n") -{ - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); -} - -DEFUN (no_ip_extcommunity_list_name_expanded, - no_ip_extcommunity_list_name_expanded_cmd, - "no ip extcommunity-list expanded WORD .LINE", - NO_STR - IP_STR - EXTCOMMUNITY_LIST_STR "Specify expanded extcommunity-list\n" - "Community list name\n" + "Extended Community list name\n" "Specify community to reject\n" "Specify community to accept\n" "An ordered list as a regular-expression\n") { - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); + return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } static void @@ -12853,19 +12269,8 @@ community_list_vty (void) /* Community-list. */ install_element (CONFIG_NODE, &ip_community_list_standard_cmd); - install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); - install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); - install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); - install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); install_element (VIEW_NODE, &show_ip_community_list_cmd); install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); install_element (ENABLE_NODE, &show_ip_community_list_cmd); @@ -12873,21 +12278,11 @@ community_list_vty (void) /* Extcommunity-list. */ install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); - install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); - install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); - install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); -T } +} From a636c635ae5e79cd877535b4ac013033fe7f32de Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 18:08:45 +0000 Subject: [PATCH 148/280] bgpd: collaps show ip bgp, show ip bgp x.x.x.x, etc calls Signed-off-by: Daniel Walton --- bgpd/bgp_debug.c | 8 - bgpd/bgp_route.c | 4904 +++------------------------------------------- bgpd/bgp_vty.c | 391 ++-- bgpd/bgp_vty.h | 8 + ospfd/ospf_vty.c | 2 + 5 files changed, 425 insertions(+), 4888 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 817a8e00a4..39f723a6a4 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1554,14 +1554,6 @@ DEFUN (debug_bgp_allow_martians, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug bgp allow-martians", - * UNDEBUG_STR - * BGP_STR - * "BGP allow martian next hops\n" - * - */ DEFUN (no_debug_bgp_allow_martians, no_debug_bgp_allow_martians_cmd, "no debug bgp allow-martians", diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 14aaf7eebb..6145b31755 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -60,7 +60,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_mpath.h" #include "bgpd/bgp_nht.h" #include "bgpd/bgp_updgrp.h" -#include "bgpd/bgp_vty.h" /* Extern from bgp_dump.c */ extern const char *bgp_origin_str[]; @@ -4459,64 +4458,32 @@ DEFUN (bgp_network_mask_natural_backdoor, NULL, 1); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no network A.B.C.D/M route-map WORD", - * NO_STR - * "Specify a network to announce via BGP\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "Route-map to modify the attributes\n" - * "Name of the route map\n" - * - * "no network A.B.C.D/M backdoor", - * NO_STR - * "Specify a network to announce via BGP\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "Specify a BGP backdoor route\n" - * - */ DEFUN (no_bgp_network, no_bgp_network_cmd, - "no network A.B.C.D/M", + "no network A.B.C.D/M []", NO_STR "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n") + "IP prefix /, e.g., 35.0.0.0/8\n" + "Specify a BGP backdoor route\n" + "Route-map to modify the attributes\n" + "Name of the route map\n") { int idx_ipv4_prefixlen = 2; return bgp_static_unset (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty)); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no network A.B.C.D mask A.B.C.D backdoor", - * NO_STR - * "Specify a network to announce via BGP\n" - * "Network number\n" - * "Network mask\n" - * "Network mask\n" - * "Specify a BGP backdoor route\n" - * - * "no network A.B.C.D mask A.B.C.D route-map WORD", - * NO_STR - * "Specify a network to announce via BGP\n" - * "Network number\n" - * "Network mask\n" - * "Network mask\n" - * "Route-map to modify the attributes\n" - * "Name of the route map\n" - * - */ DEFUN (no_bgp_network_mask, no_bgp_network_mask_cmd, - "no network A.B.C.D mask A.B.C.D", + "no network A.B.C.D mask A.B.C.D []", NO_STR "Specify a network to announce via BGP\n" "Network number\n" "Network mask\n" - "Network mask\n") + "Network mask\n" + "Specify a BGP backdoor route\n" + "Route-map to modify the attributes\n" + "Name of the route map\n") { int idx_ipv4 = 2; int idx_ipv4_2 = 4; @@ -4534,30 +4501,15 @@ DEFUN (no_bgp_network_mask, bgp_node_safi (vty)); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no network A.B.C.D backdoor", - * NO_STR - * "Specify a network to announce via BGP\n" - * "Network number\n" - * "Specify a BGP backdoor route\n" - * - * "no network A.B.C.D route-map WORD", - * NO_STR - * "Specify a network to announce via BGP\n" - * "Network number\n" - * "Route-map to modify the attributes\n" - * "Name of the route map\n" - * - */ DEFUN (no_bgp_network_mask_natural, no_bgp_network_mask_natural_cmd, - "no network A.B.C.D", + "no network A.B.C.D []", NO_STR "Specify a network to announce via BGP\n" - "Network number\n") + "Network number\n" + "Specify a BGP backdoor route\n" + "Route-map to modify the attributes\n" + "Name of the route map\n") { int idx_ipv4 = 2; int ret; @@ -4574,18 +4526,6 @@ DEFUN (no_bgp_network_mask_natural, bgp_node_safi (vty)); } - - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ipv6 bgp network X:X::X:X/M", - * IPV6_STR - * BGP_STR - * "Specify a network to announce via BGP\n" - * "IPv6 prefix /, e.g., 3ffe::/16\n" - * - */ DEFUN (ipv6_bgp_network, ipv6_bgp_network_cmd, "network X:X::X:X/M", @@ -4611,38 +4551,19 @@ DEFUN (ipv6_bgp_network_route_map, bgp_node_safi (vty), argv[idx_word]->arg, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no network X:X::X:X/M route-map WORD", - * NO_STR - * "Specify a network to announce via BGP\n" - * "IPv6 prefix /\n" - * "Route-map to modify the attributes\n" - * "Name of the route map\n" - * - * "no ipv6 bgp network X:X::X:X/M", - * NO_STR - * IPV6_STR - * BGP_STR - * "Specify a network to announce via BGP\n" - * "IPv6 prefix /, e.g., 3ffe::/16\n" - * - */ DEFUN (no_ipv6_bgp_network, no_ipv6_bgp_network_cmd, - "no network X:X::X:X/M", + "no network X:X::X:X/M [route-map WORD]", NO_STR "Specify a network to announce via BGP\n" - "IPv6 prefix /\n") + "IPv6 prefix /\n" + "Route-map to modify the attributes\n" + "Name of the route map\n") { int idx_ipv6_prefixlen = 2; return bgp_static_unset (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, bgp_node_safi(vty)); } - - -#endif /* HAVE_IPV6 */ - /* Aggreagete address: advertise-map Set condition to advertise attribute @@ -5352,48 +5273,31 @@ DEFUN (aggregate_address_mask_as_set, 0, AGGREGATE_AS_SET); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "aggregate-address A.B.C.D/M summary-only as-set", - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Filter more specific routes from updates\n" - * "Generate AS set path information\n" - * - */ DEFUN (aggregate_address_as_set_summary, aggregate_address_as_set_summary_cmd, - "aggregate-address A.B.C.D/M as-set summary-only", + "aggregate-address A.B.C.D/M ", "Configure BGP aggregate entries\n" "Aggregate prefix\n" "Generate AS set path information\n" - "Filter more specific routes from updates\n") + "Filter more specific routes from updates\n" + "Filter more specific routes from updates\n" + "Generate AS set path information\n") { int idx_ipv4_prefixlen = 1; return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "aggregate-address A.B.C.D A.B.C.D summary-only as-set", - * "Configure BGP aggregate entries\n" - * "Aggregate address\n" - * "Aggregate mask\n" - * "Filter more specific routes from updates\n" - * "Generate AS set path information\n" - * - */ DEFUN (aggregate_address_mask_as_set_summary, aggregate_address_mask_as_set_summary_cmd, - "aggregate-address A.B.C.D A.B.C.D as-set summary-only", + "aggregate-address A.B.C.D A.B.C.D ", "Configure BGP aggregate entries\n" "Aggregate address\n" "Aggregate mask\n" "Generate AS set path information\n" - "Filter more specific routes from updates\n") + "Filter more specific routes from updates\n" + "Filter more specific routes from updates\n" + "Generate AS set path information\n") { int idx_ipv4 = 1; int idx_ipv4_2 = 2; @@ -5412,91 +5316,28 @@ DEFUN (aggregate_address_mask_as_set_summary, AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no aggregate-address A.B.C.D/M summary-only", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Filter more specific routes from updates\n" - * - * "no aggregate-address A.B.C.D/M as-set summary-only", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Generate AS set path information\n" - * "Filter more specific routes from updates\n" - * - * "no aggregate-address A.B.C.D/M summary-only as-set", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Filter more specific routes from updates\n" - * "Generate AS set path information\n" - * - * "no aggregate-address A.B.C.D/M as-set", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Generate AS set path information\n" - * - */ DEFUN (no_aggregate_address, no_aggregate_address_cmd, - "no aggregate-address A.B.C.D/M", + "no aggregate-address A.B.C.D/M [as-set] [summary-only]", NO_STR "Configure BGP aggregate entries\n" - "Aggregate prefix\n") + "Aggregate prefix\n" + "Generate AS set path information\n" + "Filter more specific routes from updates\n") { int idx_ipv4_prefixlen = 2; return bgp_aggregate_unset (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty)); } - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no aggregate-address A.B.C.D A.B.C.D summary-only as-set", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate address\n" - * "Aggregate mask\n" - * "Filter more specific routes from updates\n" - * "Generate AS set path information\n" - * - * "no aggregate-address A.B.C.D A.B.C.D as-set summary-only", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate address\n" - * "Aggregate mask\n" - * "Generate AS set path information\n" - * "Filter more specific routes from updates\n" - * - * "no aggregate-address A.B.C.D A.B.C.D summary-only", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate address\n" - * "Aggregate mask\n" - * "Filter more specific routes from updates\n" - * - * "no aggregate-address A.B.C.D A.B.C.D as-set", - * NO_STR - * "Configure BGP aggregate entries\n" - * "Aggregate address\n" - * "Aggregate mask\n" - * "Generate AS set path information\n" - * - */ DEFUN (no_aggregate_address_mask, no_aggregate_address_mask_cmd, - "no aggregate-address A.B.C.D A.B.C.D", + "no aggregate-address A.B.C.D A.B.C.D [as-set] [summary-only]", NO_STR "Configure BGP aggregate entries\n" "Aggregate address\n" - "Aggregate mask\n") + "Aggregate mask\n" + "Generate AS set path information\n" + "Filter more specific routes from updates\n") { int idx_ipv4 = 2; int idx_ipv4_2 = 3; @@ -5514,20 +5355,6 @@ DEFUN (no_aggregate_address_mask, return bgp_aggregate_unset (vty, prefix_str, AFI_IP, bgp_node_safi (vty)); } - - - - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ipv6 bgp aggregate-address X:X::X:X/M", - * IPV6_STR - * BGP_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * - */ DEFUN (ipv6_aggregate_address, ipv6_aggregate_address_cmd, "aggregate-address X:X::X:X/M", @@ -5538,16 +5365,6 @@ DEFUN (ipv6_aggregate_address, return bgp_aggregate_set (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ipv6 bgp aggregate-address X:X::X:X/M summary-only", - * IPV6_STR - * BGP_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Filter more specific routes from updates\n" - * - */ DEFUN (ipv6_aggregate_address_summary_only, ipv6_aggregate_address_summary_only_cmd, "aggregate-address X:X::X:X/M summary-only", @@ -5560,16 +5377,6 @@ DEFUN (ipv6_aggregate_address_summary_only, AGGREGATE_SUMMARY_ONLY, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 bgp aggregate-address X:X::X:X/M", - * NO_STR - * IPV6_STR - * BGP_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * - */ DEFUN (no_ipv6_aggregate_address, no_ipv6_aggregate_address_cmd, "no aggregate-address X:X::X:X/M", @@ -5581,17 +5388,6 @@ DEFUN (no_ipv6_aggregate_address, return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 bgp aggregate-address X:X::X:X/M summary-only", - * NO_STR - * IPV6_STR - * BGP_STR - * "Configure BGP aggregate entries\n" - * "Aggregate prefix\n" - * "Filter more specific routes from updates\n" - * - */ DEFUN (no_ipv6_aggregate_address_summary_only, no_ipv6_aggregate_address_summary_only_cmd, "no aggregate-address X:X::X:X/M summary-only", @@ -5604,11 +5400,6 @@ DEFUN (no_ipv6_aggregate_address_summary_only, return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); } - - - -#endif /* HAVE_IPV6 */ - /* Redistribute route treatment. */ void bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *nexthop, @@ -7326,14 +7117,6 @@ enum bgp_show_type bgp_show_type_community_list, bgp_show_type_community_list_exact, bgp_show_type_flap_statistics, - bgp_show_type_flap_address, - bgp_show_type_flap_prefix, - bgp_show_type_flap_cidr_only, - bgp_show_type_flap_regexp, - bgp_show_type_flap_filter_list, - bgp_show_type_flap_prefix_list, - bgp_show_type_flap_prefix_longer, - bgp_show_type_flap_route_map, bgp_show_type_flap_neighbor, bgp_show_type_dampend_paths, bgp_show_type_damp_neighbor @@ -7359,6 +7142,12 @@ static int bgp_show_prefix_longer (struct vty *vty, const char *name, const char *prefix, afi_t afi, safi_t safi, enum bgp_show_type type); +static int +bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, + safi_t safi, enum bgp_show_type type); +static int +bgp_show_community (struct vty *vty, const char *view_name, int argc, + struct cmd_token **argv, int exact, afi_t afi, safi_t safi); static int bgp_show_table (struct vty *vty, struct bgp_table *table, @@ -7403,14 +7192,6 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, for (ri = rn->info; ri; ri = ri->next) { if (type == bgp_show_type_flap_statistics - || type == bgp_show_type_flap_address - || type == bgp_show_type_flap_prefix - || type == bgp_show_type_flap_cidr_only - || type == bgp_show_type_flap_regexp - || type == bgp_show_type_flap_filter_list - || type == bgp_show_type_flap_prefix_list - || type == bgp_show_type_flap_prefix_longer - || type == bgp_show_type_flap_route_map || type == bgp_show_type_flap_neighbor || type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) @@ -7418,32 +7199,28 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, if (!(ri->extra && ri->extra->damp_info)) continue; } - if (type == bgp_show_type_regexp - || type == bgp_show_type_flap_regexp) + if (type == bgp_show_type_regexp) { regex_t *regex = output_arg; if (bgp_regexec (regex, ri->attr->aspath) == REG_NOMATCH) continue; } - if (type == bgp_show_type_prefix_list - || type == bgp_show_type_flap_prefix_list) + if (type == bgp_show_type_prefix_list) { struct prefix_list *plist = output_arg; if (prefix_list_apply (plist, &rn->p) != PREFIX_PERMIT) continue; } - if (type == bgp_show_type_filter_list - || type == bgp_show_type_flap_filter_list) + if (type == bgp_show_type_filter_list) { struct as_list *as_list = output_arg; if (as_list_apply (as_list, ri->attr->aspath) != AS_FILTER_PERMIT) continue; } - if (type == bgp_show_type_route_map - || type == bgp_show_type_flap_route_map) + if (type == bgp_show_type_route_map) { struct route_map *rmap = output_arg; struct bgp_info binfo; @@ -7470,8 +7247,7 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su)) continue; } - if (type == bgp_show_type_cidr_only - || type == bgp_show_type_flap_cidr_only) + if (type == bgp_show_type_cidr_only) { u_int32_t destination; @@ -7483,8 +7259,7 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, if (IN_CLASSA (destination) && rn->p.prefixlen == 8) continue; } - if (type == bgp_show_type_prefix_longer - || type == bgp_show_type_flap_prefix_longer) + if (type == bgp_show_type_prefix_longer) { struct prefix *p = output_arg; @@ -7526,18 +7301,6 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, if (! community_list_exact_match (ri->attr->community, list)) continue; } - if (type == bgp_show_type_flap_address - || type == bgp_show_type_flap_prefix) - { - struct prefix *p = output_arg; - - if (! prefix_match (&rn->p, p)) - continue; - - if (type == bgp_show_type_flap_prefix) - if (p->prefixlen != rn->p.prefixlen) - continue; - } if (type == bgp_show_type_dampend_paths || type == bgp_show_type_damp_neighbor) { @@ -7555,14 +7318,6 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, || type == bgp_show_type_damp_neighbor) vty_out (vty, BGP_SHOW_DAMP_HEADER, VTY_NEWLINE); else if (type == bgp_show_type_flap_statistics - || type == bgp_show_type_flap_address - || type == bgp_show_type_flap_prefix - || type == bgp_show_type_flap_cidr_only - || type == bgp_show_type_flap_regexp - || type == bgp_show_type_flap_filter_list - || type == bgp_show_type_flap_prefix_list - || type == bgp_show_type_flap_prefix_longer - || type == bgp_show_type_flap_route_map || type == bgp_show_type_flap_neighbor) vty_out (vty, BGP_SHOW_FLAP_HEADER, VTY_NEWLINE); else @@ -7574,14 +7329,6 @@ bgp_show_table (struct vty *vty, struct bgp_table *table, || type == bgp_show_type_damp_neighbor) damp_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST, use_json, json_paths); else if (type == bgp_show_type_flap_statistics - || type == bgp_show_type_flap_address - || type == bgp_show_type_flap_prefix - || type == bgp_show_type_flap_cidr_only - || type == bgp_show_type_flap_regexp - || type == bgp_show_type_flap_filter_list - || type == bgp_show_type_flap_prefix_list - || type == bgp_show_type_flap_prefix_longer - || type == bgp_show_type_flap_route_map || type == bgp_show_type_flap_neighbor) flap_route_vty_out (vty, &rn->p, ri, display, SAFI_UNICAST, use_json, json_paths); else @@ -7983,486 +7730,204 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, } /* BGP route print out function. */ -DEFUN (show_ip_bgp, - show_ip_bgp_cmd, - "show ip bgp [json]", - SHOW_STR - IP_STR - BGP_STR - "JavaScript Object Notation\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv)); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "JavaScript Object Notation\n" - * - */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show ip bgp ipv4 [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, bgp_show_type_normal, - NULL, uj); - - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, uj); -} - - -DEFUN (show_ip_bgp_route, - show_ip_bgp_route_cmd, - "show ip bgp A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4 = 3; - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_route_pathtype, - show_ip_bgp_route_pathtype_cmd, - "show ip bgp A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4 = 3; - int idx_bestpath = 4; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - -DEFUN (show_bgp_ipv4_safi_route_pathtype, - show_bgp_ipv4_safi_route_pathtype_cmd, - "show bgp ipv4 A.B.C.D [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - int idx_ipv4 = 4; - int idx_bestpath = 5; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); - else - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - -DEFUN (show_bgp_ipv4_prefix, - show_bgp_ipv4_prefix_cmd, - "show bgp ipv4 A.B.C.D/M [json]", - SHOW_STR - BGP_STR - IP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - JSON_STR) -{ - int idx_ipv4_prefixlen = 3; - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_bgp_ipv6_route, - show_bgp_ipv6_route_cmd, - "show bgp ipv6 X:X::X:X [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Network in the BGP routing table to display\n" - JSON_STR) -{ - int idx_ipv6 = 3; - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_bgp_ipv6_prefix, - show_bgp_ipv6_prefix_cmd, - "show bgp ipv6 X:X::X:X/M [json]", - SHOW_STR - BGP_STR - IP_STR - "IPv6 prefix /\n" - JSON_STR) -{ - int idx_ipv6_prefixlen = 3; - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv)); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Network in the BGP routing table to display\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_ipv4_route, - show_ip_bgp_ipv4_route_cmd, - "show ip bgp ipv4 A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_ipv4 = 5; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); -} - - -DEFUN (show_ip_bgp_vpnv4_all_route, - show_ip_bgp_vpnv4_all_route_cmd, - "show ip bgp vpnv4 all A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4 = 5; - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_bgp_ipv4_vpn_route, - show_bgp_ipv4_vpn_route_cmd, - "show bgp ipv4 vpn A.B.C.D [json]", - SHOW_STR - BGP_STR - "Address Family\n" - "Display VPN NLRI specific information\n" - "Network in the BGP routing table to display\n" - JSON_STR) -{ - int idx_ipv4 = 4; - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_bgp_ipv6_vpn_route, - show_bgp_ipv6_vpn_route_cmd, - "show bgp ipv6 vpn X:X::X:X [json]", - SHOW_STR - BGP_STR - "Address Family\n" - "Display VPN NLRI specific information\n" - "Network in the BGP routing table to display\n" - JSON_STR) -{ - int idx_ipv6 = 4; - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_bgp_ipv4_vpn_rd_route, - show_bgp_ipv4_vpn_rd_route_cmd, - "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn A.B.C.D [json]", - SHOW_STR - BGP_STR - IP_STR - "Display VPN NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "Network in the BGP routing table to display\n" - JSON_STR) -{ - int idx_ext_community = 5; - int idx_ipv4 = 6; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_bgp_ipv6_vpn_rd_route, - show_bgp_ipv6_vpn_rd_route_cmd, - "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn X:X::X:X [json]", - SHOW_STR - BGP_STR - "Address Family\n" - "Display VPN NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "Network in the BGP routing table to display\n" - JSON_STR) -{ - int idx_ext_community = 5; - int idx_ipv6 = 6; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv)); -} - -DEFUN (show_ip_bgp_vpnv4_rd_route, - show_ip_bgp_vpnv4_rd_route_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ext_community = 5; - int idx_ipv4 = 6; - int ret; - struct prefix_rd prd; - u_char uj= use_json(argc, argv); - - ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_route (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj); -} - -DEFUN (show_ip_bgp_prefix, - show_ip_bgp_prefix_cmd, - "show ip bgp A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4_prefixlen = 3; - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_prefix_pathtype, - show_ip_bgp_prefix_pathtype_cmd, - "show ip bgp A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_bestpath = 4; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D/M [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_ipv4_prefix, - show_ip_bgp_ipv4_prefix_cmd, - "show ip bgp ipv4 A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_ipv4_prefixlen = 5; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath) [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "Display only the bestpath\n" - * "Display only multipaths\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_ipv4_prefix_pathtype, - show_ip_bgp_ipv4_prefix_pathtype_cmd, - "show ip bgp ipv4 A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_ipv4_prefixlen = 5; - int idx_bestpath = 6; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); - else - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - - -DEFUN (show_ip_bgp_vpnv4_all_prefix, - show_ip_bgp_vpnv4_all_prefix_cmd, - "show ip bgp vpnv4 all A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information about all VPNv4 NLRIs\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") -{ - int idx_ipv4_prefixlen = 5; - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_vpnv4_rd_prefix, - show_ip_bgp_vpnv4_rd_prefix_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - "Display VPNv4 NLRI specific information\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") -{ - int idx_ext_community = 5; - int idx_ipv4_prefixlen = 6; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_view, - show_ip_bgp_instance_cmd, - "show ip bgp WORD [json]", + "show [ip] bgp [ WORD] [] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Display only routes with non-natural netmasks\n" + "Display routes matching the communities\n" + "Display detailed information about dampening\n" + "Display flap statistics of routes\n" + "Display paths suppressed due to dampening\n" + "Display routes matching the AS path regular expression\n" + "A regular-expression to match the BGP AS paths\n" + "Display routes matching the route-map\n" + "A route-map to match on\n" + "Display routes conforming to the prefix-list\n" + "prefix-list name\n" + "Display routes conforming to the filter-list\n" + "Regular expression access list name\n" + "Display routes matching the communities\n" + COMMUNITY_AANN_STR + "Do not send outside local AS (well-known community)\n" + "Do not advertise to any peer (well-known community)\n" + "Do not export to next AS (well-known community)\n" + "Exact match of the communities\n" + "Display routes matching the community-list\n" + "community-list number\n" + "community-list name\n" + "Exact match of the communities\n" + "IPv4 prefix /, e.g., 35.0.0.0/8\n" + "IPv6 prefix /\n" + "Display route and more specific routes\n" "JavaScript Object Notation\n") { - int idx_word = 4; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + int idx_sh_type; + int exact_match = 0; + char *vrf = NULL; + afi_t afi; + safi_t safi; + enum bgp_show_type sh_type = bgp_show_type_normal; struct bgp *bgp; + u_char uj = use_json(argc, argv); - /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[idx_word]->arg); + // dwalton reference + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_sh_type); + + bgp = bgp_lookup_by_name (vrf); if (bgp == NULL) - { - vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); - return CMD_WARNING; - } + { + vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE); + return CMD_WARNING; + } - return bgp_show (vty, bgp, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv)); + // "show [ip] bgp [ WORD] [] + // [cidr-only|<[dampening] >|regexp .LINE|prefix-list WORD|filter-list WORD| + // community []|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes] [json]", + if (strmatch(argv[idx_sh_type]->text, "cidr-only")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); + + else if (strmatch(argv[idx_sh_type]->text, "dampening")) + { + if (strmatch(argv[idx_sh_type + 1]->text, "dampened-paths")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); + + else if (strmatch(argv[idx_sh_type + 1]->text, "flap-statistics")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); + } + + else if (strmatch(argv[idx_sh_type]->text, "dampened-paths")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); + + else if (strmatch(argv[idx_sh_type]->text, "flap-statistics")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); + + else if (strmatch(argv[idx_sh_type]->text, "regexp")) + return bgp_show_regexp (vty, argc, argv, afi, safi, bgp_show_type_regexp); + + else if (strmatch(argv[idx_sh_type]->text, "prefix-list")) + return bgp_show_prefix_list (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_prefix_list); + + else if (strmatch(argv[idx_sh_type]->text, "filter-list")) + return bgp_show_filter_list (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_filter_list); + + else if (strmatch(argv[idx_sh_type]->text, "route-map")) + return bgp_show_route_map (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_route_map); + + else if (strmatch(argv[idx_sh_type]->text, "community")) + /* show a specific community */ + if (argv[idx_sh_type + 1]->type == VARIABLE_TKN || + strmatch(argv[idx_sh_type + 1]->text, "local-AS") || + strmatch(argv[idx_sh_type + 1]->text, "no-advertise") || + strmatch(argv[idx_sh_type + 1]->text, "no-export")) + { + if (strmatch(argv[idx_sh_type + 2]->text, "exact_match")) + exact_match = 1; + return bgp_show_community (vty, vrf, argc, argv, exact_match, afi, safi); + } + /* show all communities */ + else + return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, uj); + + else if (strmatch(argv[idx_sh_type]->text, "community-list")) + { + if (strmatch(argv[idx_sh_type + 2]->text, "exact_match")) + exact_match = 1; + return bgp_show_community_list (vty, vrf, argv[idx_sh_type + 1]->arg, exact_match, afi, safi); + } + + /* prefix-longer */ + else if (argv[idx_sh_type]->type == IPV4_TKN || argv[idx_sh_type]->type == IPV6_TKN) + return bgp_show_prefix_longer (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_prefix_longer); + + return bgp_show (vty, bgp, afi, safi, sh_type, NULL, uj); +} + +DEFUN (show_ip_bgp_route, + show_ip_bgp_route_cmd, + "show [ip] bgp [ WORD] [] [bestpath|multipath] [json]", + SHOW_STR + IP_STR + BGP_STR + BGP_INSTANCE_HELP_STR + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Display information for a route distinguisher\n" + "VPN Route Distinguisher\n" + "Address family\n" + "Address Family modifier\n" + "Network in the BGP routing table to display\n" + "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv6 prefix /\n" + "Display only the bestpath\n" + "Display only multipaths\n" + "JavaScript Object Notation\n") +{ + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + int idx_prefix; + int idx_path_type; + int prefix_check = 0; + char *vrf = NULL; + afi_t afi; + safi_t safi; + enum bgp_path_type path_type; + struct prefix_rd prd; + struct prefix_rd *prd_ptr = NULL; + u_char uj = use_json(argc, argv); + + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_prefix); + + if (strmatch(argv[idx_afi]->text, "encap") && strmatch(argv[idx_safi + 1]->text, "rd")) + { + str2prefix_rd (argv[idx_safi + 2]->arg, &prd); + prd_ptr = &prd; + } + + if (argv[idx_prefix]->type == IPV4_TKN || argv[idx_prefix]->type == IPV6_TKN) + prefix_check = 0; + else if (argv[idx_prefix]->type == IPV4_PREFIX_TKN || argv[idx_prefix]->type == IPV6_PREFIX_TKN) + prefix_check = 1; + + idx_path_type = idx_prefix + 1; + + if (strmatch(argv[idx_path_type]->text, "bestpath")) + path_type = BGP_PATH_BESTPATH; + else if (strmatch(argv[idx_path_type]->text, "bestpath")) + path_type = BGP_PATH_MULTIPATH; + else + path_type = BGP_PATH_ALL; + + return bgp_show_route (vty, vrf, argv[idx_prefix]->arg, afi, safi, prd_ptr, prefix_check, path_type, uj); } DEFUN (show_ip_bgp_instance_all, @@ -8476,396 +7941,11 @@ DEFUN (show_ip_bgp_instance_all, { u_char uj = use_json(argc, argv); + /* CHECK ME we need to revisit all of the bgp_show_all_ commands */ bgp_show_all_instances_routes_vty (vty, AFI_IP, SAFI_UNICAST, uj); return CMD_SUCCESS; } -DEFUN (show_ip_bgp_instance_route, - show_ip_bgp_instance_route_cmd, - "show ip bgp WORD A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_ipv4 = 5; - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_instance_route_pathtype, - show_ip_bgp_instance_route_pathtype_cmd, - "show ip bgp WORD A.B.C.D [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_ipv4 = 5; - int idx_bestpath = 6; - u_char uj = use_json(argc, argv); - - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - -DEFUN (show_ip_bgp_instance_prefix, - show_ip_bgp_instance_prefix_cmd, - "show ip bgp WORD A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_ipv4_prefixlen = 5; - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_ip_bgp_instance_prefix_pathtype, - show_ip_bgp_instance_prefix_pathtype_cmd, - "show ip bgp WORD A.B.C.D/M [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_ipv4_prefixlen = 5; - int idx_bestpath = 6; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp, - show_bgp_cmd, - "show bgp [json]", - SHOW_STR - BGP_STR - "JavaScript Object Notation\n") -{ - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, - NULL, use_json(argc, argv)); -} - - -DEFUN (show_bgp_ipv6_safi, - show_bgp_ipv6_safi_cmd, - "show bgp ipv6 [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, - NULL, uj); - - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL, uj); -} - -static void -bgp_show_ipv6_bgp_deprecate_warning (struct vty *vty) -{ - vty_out (vty, "WARNING: The 'show ipv6 bgp' parse tree will be deprecated in our" - " next release%sPlese use 'show bgp ipv6' instead%s%s", - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); -} - -/* old command */ -DEFUN (show_ipv6_bgp, - show_ipv6_bgp_cmd, - "show ipv6 bgp [json]", - SHOW_STR - IP_STR - BGP_STR - "JavaScript Object Notation\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, - NULL, use_json(argc, argv)); -} - -DEFUN (show_bgp_route, - show_bgp_route_cmd, - "show bgp X:X::X:X [json]", - SHOW_STR - BGP_STR - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6 = 2; - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_bgp_ipv6_safi_route, - show_bgp_ipv6_safi_route_cmd, - "show bgp ipv6 X:X::X:X [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - int idx_ipv6 = 4; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, uj); - - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, uj); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 X:X::X:X (bestpath|multipath) [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Network in the BGP routing table to display\n" - * "Display only the bestpath\n" - * "Display only multipaths\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_route_pathtype, - show_bgp_route_pathtype_cmd, - "show bgp X:X::X:X [json]", - SHOW_STR - BGP_STR - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6 = 2; - int idx_bestpath = 3; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - - -DEFUN (show_bgp_ipv6_safi_route_pathtype, - show_bgp_ipv6_safi_route_pathtype_cmd, - "show bgp ipv6 X:X::X:X [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - int idx_ipv6 = 4; - int idx_bestpath = 5; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); - else - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - -/* old command */ -DEFUN (show_ipv6_bgp_route, - show_ipv6_bgp_route_cmd, - "show ipv6 bgp X:X::X:X [json]", - SHOW_STR - IP_STR - BGP_STR - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6 = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_bgp_prefix, - show_bgp_prefix_cmd, - "show bgp X:X::X:X/M [json]", - SHOW_STR - BGP_STR - "IPv6 prefix /\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6_prefixlen = 2; - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - -DEFUN (show_bgp_ipv6_safi_prefix, - show_bgp_ipv6_safi_prefix_cmd, - "show bgp ipv6 X:X::X:X/M [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - int idx_ipv6_prefixlen = 4; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, uj); - - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, uj); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 X:X::X:X/M (bestpath|multipath) [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "IPv6 prefix /\n" - * "Display only the bestpath\n" - * "Display only multipaths\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_prefix_pathtype, - show_bgp_prefix_pathtype_cmd, - "show bgp X:X::X:X/M [json]", - SHOW_STR - BGP_STR - "IPv6 prefix /\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_bestpath = 3; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - - -DEFUN (show_bgp_ipv6_safi_prefix_pathtype, - show_bgp_ipv6_safi_prefix_pathtype_cmd, - "show bgp ipv6 X:X::X:X/M [json]", - SHOW_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 3; - int idx_ipv6_prefixlen = 4; - int idx_bestpath = 5; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); - else - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - -/* old command */ -DEFUN (show_ipv6_bgp_prefix, - show_ipv6_bgp_prefix_cmd, - "show ipv6 bgp X:X::X:X/M [json]", - SHOW_STR - IP_STR - BGP_STR - "IPv6 prefix /, e.g., 3ffe::/16\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6_prefixlen = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_view, - show_bgp_instance_cmd, - "show bgp WORD [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "JavaScript Object Notation\n") -{ - int idx_word = 3; - struct bgp *bgp; - - /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[idx_word]->arg); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show (vty, bgp, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv)); -} - DEFUN (show_bgp_instance_all, show_bgp_instance_all_cmd, "show bgp all [json]", @@ -8880,311 +7960,6 @@ DEFUN (show_bgp_instance_all, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 X:X::X:X [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Network in the BGP routing table to display\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_route, - show_bgp_instance_route_cmd, - "show bgp WORD X:X::X:X [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Network in the BGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_ipv6 = 4; - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 X:X::X:X (bestpath|multipath) [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Network in the BGP routing table to display\n" - * "Display only the bestpath\n" - * "Display only multipaths\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_route_pathtype, - show_bgp_instance_route_pathtype_cmd, - "show bgp WORD X:X::X:X [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Network in the BGP routing table to display\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_ipv6 = 4; - int idx_bestpath = 5; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6]->arg, AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 X:X::X:X/M [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "IPv6 prefix /\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_prefix, - show_bgp_instance_prefix_cmd, - "show bgp WORD X:X::X:X/M [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IPv6 prefix /\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 X:X::X:X/M (bestpath|multipath) [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "IPv6 prefix /\n" - * "Display only the bestpath\n" - * "Display only multipaths\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_prefix_pathtype, - show_bgp_instance_prefix_pathtype_cmd, - "show bgp WORD X:X::X:X/M [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IPv6 prefix /\n" - "Display only the bestpath\n" - "Display only multipaths\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - int idx_bestpath = 5; - u_char uj = use_json(argc, argv); - if (strncmp (argv[idx_bestpath]->arg, "b", 1) == 0) - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH, uj); - else - return bgp_show_route (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 prefix-list WORD", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Display routes conforming to the prefix-list\n" - * "IPv6 prefix-list name\n" - * - */ -DEFUN (show_bgp_instance_prefix_list, - show_bgp_instance_prefix_list_cmd, - "show bgp WORD prefix-list WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes conforming to the prefix-list\n" - "IPv6 prefix-list name\n") -{ - int idx_word = 3; - int idx_word_2 = 5; - return bgp_show_prefix_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 filter-list WORD", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Display routes conforming to the filter-list\n" - * "Regular expression access list name\n" - * - */ -DEFUN (show_bgp_instance_filter_list, - show_bgp_instance_filter_list_cmd, - "show bgp WORD filter-list WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 3; - int idx_word_2 = 5; - return bgp_show_filter_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_filter_list); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 route-map WORD", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Display routes matching the route-map\n" - * "A route-map to match on\n" - * - */ -DEFUN (show_bgp_instance_route_map, - show_bgp_instance_route_map_cmd, - "show bgp WORD route-map WORD", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_word = 3; - int idx_word_2 = 5; - return bgp_show_route_map (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_route_map); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 community-list (<1-500>|WORD)", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Display routes matching the community-list\n" - * "community-list number\n" - * "community-list name\n" - * - */ -DEFUN (show_bgp_instance_community_list, - show_bgp_instance_community_list_cmd, - "show bgp WORD community-list <(1-500)|WORD>", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") -{ - int idx_word = 3; - int idx_comm_list = 5; - return bgp_show_community_list (vty, argv[idx_word]->arg, argv[idx_comm_list]->arg, 0, AFI_IP6, SAFI_UNICAST); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 X:X::X:X/M longer-prefixes", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "IPv6 prefix /\n" - * "Display route and more specific routes\n" - * - */ -DEFUN (show_bgp_instance_prefix_longer, - show_bgp_instance_prefix_longer_cmd, - "show bgp WORD X:X::X:X/M longer-prefixes", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IPv6 prefix /\n" - "Display route and more specific routes\n") -{ - int idx_word = 3; - int idx_ipv6_prefixlen = 4; - return bgp_show_prefix_longer (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - - -/* old command */ -DEFUN (show_ipv6_mbgp, - show_ipv6_mbgp_cmd, - "show ipv6 mbgp [json]", - SHOW_STR - IP_STR - MBGP_STR - "JavaScript Object Notation\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, bgp_show_type_normal, - NULL, use_json(argc, argv)); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_route, - show_ipv6_mbgp_route_cmd, - "show ipv6 mbgp X:X::X:X [json]", - SHOW_STR - IP_STR - MBGP_STR - "Network in the MBGP routing table to display\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6 = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[idx_ipv6]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_prefix, - show_ipv6_mbgp_prefix_cmd, - "show ipv6 mbgp X:X::X:X/M [json]", - SHOW_STR - IP_STR - MBGP_STR - "IPv6 prefix /, e.g., 3ffe::/16\n" - "JavaScript Object Notation\n") -{ - int idx_ipv6_prefixlen = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_route (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); -} -#endif - - static int bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, safi_t safi, enum bgp_show_type type) @@ -9230,122 +8005,6 @@ bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, return rc; } -DEFUN (show_ip_bgp_regexp, - show_ip_bgp_regexp_cmd, - "show ip bgp regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -{ - return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_UNICAST, - bgp_show_type_regexp); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics regexp .LINE", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Display routes matching the AS path regular expression\n" - * "A regular-expression to match the BGP AS paths\n" - * - */ -DEFUN (show_ip_bgp_flap_regexp, - show_ip_bgp_flap_regexp_cmd, - "show ip bgp flap-statistics regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -{ - return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_regexp); -} - - -DEFUN (show_ip_bgp_ipv4_regexp, - show_ip_bgp_ipv4_regexp_cmd, - "show ip bgp ipv4 regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -{ - int idx_safi = 4; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_MULTICAST, - bgp_show_type_regexp); - - return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_UNICAST, - bgp_show_type_regexp); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 regexp .LINE", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the AS path regular expression\n" - * "A regular-expression to match the BGP AS paths\n" - * - */ -DEFUN (show_bgp_regexp, - show_bgp_regexp_cmd, - "show bgp regexp .LINE", - SHOW_STR - BGP_STR - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -{ - return bgp_show_regexp (vty, argc, argv, AFI_IP6, SAFI_UNICAST, - bgp_show_type_regexp); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_regexp, - show_ipv6_bgp_regexp_cmd, - "show ipv6 bgp regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_regexp (vty, argc, argv, AFI_IP6, SAFI_UNICAST, - bgp_show_type_regexp); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_regexp, - show_ipv6_mbgp_regexp_cmd, - "show ipv6 mbgp regexp .LINE", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the MBGP AS paths\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_regexp (vty, argc, argv, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_regexp); -} -#endif /* HAVE_IPV6 */ - static int bgp_show_prefix_list (struct vty *vty, const char *name, const char *prefix_list_str, afi_t afi, @@ -9371,144 +8030,6 @@ bgp_show_prefix_list (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, plist, 0); } -DEFUN (show_ip_bgp_prefix_list, - show_ip_bgp_prefix_list_cmd, - "show ip bgp prefix-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display routes conforming to the prefix-list\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - -DEFUN (show_ip_bgp_instance_prefix_list, - show_ip_bgp_instance_prefix_list_cmd, - "show ip bgp WORD prefix-list WORD", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes conforming to the prefix-list\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - int idx_word_2 = 6; - return bgp_show_prefix_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics prefix-list WORD", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Display routes conforming to the prefix-list\n" - * "IP prefix-list name\n" - * - */ -DEFUN (show_ip_bgp_flap_prefix_list, - show_ip_bgp_flap_prefix_list_cmd, - "show ip bgp flap-statistics prefix-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Display routes conforming to the prefix-list\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_prefix_list); -} - - -DEFUN (show_ip_bgp_ipv4_prefix_list, - show_ip_bgp_ipv4_prefix_list_cmd, - "show ip bgp ipv4 prefix-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes conforming to the prefix-list\n" - "IP prefix-list name\n") -{ - int idx_safi = 4; - int idx_word = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, - bgp_show_type_prefix_list); - - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 prefix-list WORD", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes conforming to the prefix-list\n" - * "IPv6 prefix-list name\n" - * - */ -DEFUN (show_bgp_prefix_list, - show_bgp_prefix_list_cmd, - "show bgp prefix-list WORD", - SHOW_STR - BGP_STR - "Display routes conforming to the prefix-list\n" - "IPv6 prefix-list name\n") -{ - int idx_word = 3; - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_prefix_list, - show_ipv6_bgp_prefix_list_cmd, - "show ipv6 bgp prefix-list WORD", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the prefix-list\n" - "IPv6 prefix-list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_list); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_prefix_list, - show_ipv6_mbgp_prefix_list_cmd, - "show ipv6 mbgp prefix-list WORD", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the prefix-list\n" - "IPv6 prefix-list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_prefix_list); -} -#endif /* HAVE_IPV6 */ - static int bgp_show_filter_list (struct vty *vty, const char *name, const char *filter, afi_t afi, @@ -9533,144 +8054,6 @@ bgp_show_filter_list (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, as_list, 0); } -DEFUN (show_ip_bgp_filter_list, - show_ip_bgp_filter_list_cmd, - "show ip bgp filter-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 4; - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_filter_list); -} - -DEFUN (show_ip_bgp_instance_filter_list, - show_ip_bgp_instance_filter_list_cmd, - "show ip bgp WORD filter-list WORD", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 4; - int idx_word_2 = 6; - return bgp_show_filter_list (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_filter_list); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics filter-list WORD", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Display routes conforming to the filter-list\n" - * "Regular expression access list name\n" - * - */ -DEFUN (show_ip_bgp_flap_filter_list, - show_ip_bgp_flap_filter_list_cmd, - "show ip bgp flap-statistics filter-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 5; - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_filter_list); -} - - -DEFUN (show_ip_bgp_ipv4_filter_list, - show_ip_bgp_ipv4_filter_list_cmd, - "show ip bgp ipv4 filter-list WORD", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_safi = 4; - int idx_word = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, - bgp_show_type_filter_list); - - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_filter_list); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 filter-list WORD", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes conforming to the filter-list\n" - * "Regular expression access list name\n" - * - */ -DEFUN (show_bgp_filter_list, - show_bgp_filter_list_cmd, - "show bgp filter-list WORD", - SHOW_STR - BGP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 3; - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_filter_list); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_filter_list, - show_ipv6_bgp_filter_list_cmd, - "show ipv6 bgp filter-list WORD", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_filter_list); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_filter_list, - show_ipv6_mbgp_filter_list_cmd, - "show ipv6 mbgp filter-list WORD", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_filter_list (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_filter_list); -} -#endif /* HAVE_IPV6 */ - DEFUN (show_ip_bgp_dampening_info, show_ip_bgp_dampening_params_cmd, "show ip bgp dampening parameters", @@ -9703,49 +8086,6 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST); } - -DEFUN (show_ip_bgp_ipv4_dampening_flap_stats, - show_ip_bgp_ipv4_dampening_flap_stats_cmd, - "show ip bgp ipv4 dampening flap-statistics", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display detailed information about dampening\n" - "Display flap statistics of routes\n") -{ - int idx_safi = 4; - if (strncmp(argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_flap_statistics, NULL, 0); - - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_flap_statistics, NULL, 0); -} - -DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths, - show_ip_bgp_ipv4_dampening_dampd_paths_cmd, - "show ip bgp ipv4 dampening dampened-paths", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display detailed information about dampening\n" - "Display paths suppressed due to dampening\n") -{ - int idx_safi = 4; - if (strncmp(argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_dampend_paths, NULL, 0); - - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_dampend_paths, NULL, 0); -} - static int bgp_show_route_map (struct vty *vty, const char *name, const char *rmap_str, afi_t afi, @@ -9756,6 +8096,8 @@ bgp_show_route_map (struct vty *vty, const char *name, if (name && !(bgp = bgp_lookup_by_name(name))) { + + vty_out (vty, "%% No such BGP instance exists%s", VTY_NEWLINE); return CMD_WARNING; } @@ -9771,250 +8113,6 @@ bgp_show_route_map (struct vty *vty, const char *name, return bgp_show (vty, bgp, afi, safi, type, rmap, 0); } -DEFUN (show_ip_bgp_route_map, - show_ip_bgp_route_map_cmd, - "show ip bgp route-map WORD", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_word = 4; - return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_route_map); -} - -DEFUN (show_ip_bgp_instance_route_map, - show_ip_bgp_instance_route_map_cmd, - "show ip bgp WORD route-map WORD", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_word = 4; - int idx_word_2 = 6; - return bgp_show_route_map (vty, argv[idx_word]->arg, argv[idx_word_2]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_route_map); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics route-map WORD", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Display routes matching the route-map\n" - * "A route-map to match on\n" - * - */ -DEFUN (show_ip_bgp_flap_route_map, - show_ip_bgp_flap_route_map_cmd, - "show ip bgp flap-statistics route-map WORD", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_word = 5; - return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_route_map); -} - - -DEFUN (show_ip_bgp_ipv4_route_map, - show_ip_bgp_ipv4_route_map_cmd, - "show ip bgp ipv4 route-map WORD", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_safi = 4; - int idx_word = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_MULTICAST, - bgp_show_type_route_map); - - return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_route_map); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 route-map WORD", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the route-map\n" - * "A route-map to match on\n" - * - */ -DEFUN (show_bgp_route_map, - show_bgp_route_map_cmd, - "show bgp route-map WORD", - SHOW_STR - BGP_STR - "Display routes matching the route-map\n" - "A route-map to match on\n") -{ - int idx_word = 3; - return bgp_show_route_map (vty, NULL, argv[idx_word]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_route_map); -} - - -DEFUN (show_ip_bgp_cidr_only, - show_ip_bgp_cidr_only_cmd, - "show ip bgp cidr-only", - SHOW_STR - IP_STR - BGP_STR - "Display only routes with non-natural netmasks\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_cidr_only, NULL, 0); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics cidr-only", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Display only routes with non-natural netmasks\n" - * - */ -DEFUN (show_ip_bgp_flap_cidr_only, - show_ip_bgp_flap_cidr_only_cmd, - "show ip bgp flap-statistics cidr-only", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Display only routes with non-natural netmasks\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_cidr_only, NULL, 0); -} - - -DEFUN (show_ip_bgp_ipv4_cidr_only, - show_ip_bgp_ipv4_cidr_only_cmd, - "show ip bgp ipv4 cidr-only", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display only routes with non-natural netmasks\n") -{ - int idx_safi = 4; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_cidr_only, NULL, 0); - - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_cidr_only, NULL, 0); -} - -DEFUN (show_ip_bgp_community_all, - show_ip_bgp_community_all_cmd, - "show ip bgp community", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_community_all, NULL, 0); -} - -DEFUN (show_ip_bgp_ipv4_community_all, - show_ip_bgp_ipv4_community_all_cmd, - "show ip bgp ipv4 community", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n") -{ - int idx_safi = 4; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST, - bgp_show_type_community_all, NULL, 0); - - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_community_all, NULL, 0); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 community", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * - */ -DEFUN (show_bgp_community_all, - show_bgp_community_all_cmd, - "show bgp community", - SHOW_STR - BGP_STR - "Display routes matching the communities\n") -{ - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, - bgp_show_type_community_all, NULL, 0); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_community_all, - show_ipv6_bgp_community_all_cmd, - "show ipv6 bgp community", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, - bgp_show_type_community_all, NULL, 0); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_community_all, - show_ipv6_mbgp_community_all_cmd, - "show ipv6 mbgp community", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_community_all, NULL, 0); -} -#endif /* HAVE_IPV6 */ - static int bgp_show_community (struct vty *vty, const char *view_name, int argc, struct cmd_token **argv, int exact, afi_t afi, safi_t safi) @@ -10078,1093 +8176,6 @@ bgp_show_community (struct vty *vty, const char *view_name, int argc, bgp_show_type_community), com, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_ip_bgp_community, - show_ip_bgp_community_cmd, - "show ip bgp community ", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); -} - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_ip_bgp_ipv4_community, - show_ip_bgp_ipv4_community_cmd, - "show ip bgp ipv4 community ", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - int idx_safi = 4; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_MULTICAST); - - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST); -} - - - - -DEFUN (show_bgp_instance_afi_safi_community_all, - show_bgp_instance_afi_safi_community_all_cmd, - "show bgp WORD community", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n") -{ - int idx_word = 3; - int idx_afi = 4; - int idx_safi = 5; - int afi; - int safi; - struct bgp *bgp; - - /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[idx_word]->arg); - if (bgp == NULL) - { - vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Address family\n" - * "Address family modifier\n" - * "Address family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Address family\n" - * "Address family modifier\n" - * "Address family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Address family\n" - * "Address family modifier\n" - * "Address family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_bgp_instance_afi_safi_community, - show_bgp_instance_afi_safi_community_cmd, - "show bgp WORD community ", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family modifier\n" - "Address family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - int idx_word = 3; - int idx_afi = 4; - int idx_safi = 5; - int afi; - int safi; - - afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - return bgp_show_community (vty, argv[idx_word]->arg, argc, argv, 0, afi, safi); -} - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - */ -DEFUN (show_ip_bgp_community_exact, - show_ip_bgp_community_exact_cmd, - "show ip bgp community exact-match", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -{ - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); -} - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - */ -DEFUN (show_ip_bgp_ipv4_community_exact, - show_ip_bgp_ipv4_community_exact_cmd, - "show ip bgp ipv4 community exact-match", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -{ - int idx_safi = 4; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_MULTICAST); - - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST); -} - - - - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_bgp_community, - show_bgp_community_cmd, - "show bgp community ", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_UNICAST); -} - - - - - - - - -/* old command */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_ipv6_bgp_community, - show_ipv6_bgp_community_cmd, - "show ipv6 bgp community ", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_UNICAST); -} - -/* old command */ - -/* old command */ - -/* old command */ - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - */ -DEFUN (show_bgp_community_exact, - show_bgp_community_exact_cmd, - "show bgp community exact-match", - SHOW_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -{ - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_UNICAST); -} - - - - - - - - -/* old command */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - */ -DEFUN (show_ipv6_bgp_community_exact, - show_ipv6_bgp_community_exact_cmd, - "show ipv6 bgp community exact-match", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_UNICAST); -} - -/* old command */ - -/* old command */ - -/* old command */ - -/* old command */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * - */ -DEFUN (show_ipv6_mbgp_community, - show_ipv6_mbgp_community_cmd, - "show ipv6 mbgp community ", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP6, SAFI_MULTICAST); -} - -/* old command */ - -/* old command */ - -/* old command */ - -/* old command */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - * "show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match", - * SHOW_STR - * IPV6_STR - * MBGP_STR - * "Display routes matching the communities\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * COMMUNITY_AANN_STR - * "Do not send outside local AS (well-known community)\n" - * "Do not advertise to any peer (well-known community)\n" - * "Do not export to next AS (well-known community)\n" - * "Exact match of the communities" - * - */ -DEFUN (show_ipv6_mbgp_community_exact, - show_ipv6_mbgp_community_exact_cmd, - "show ipv6 mbgp community exact-match", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the communities\n" - COMMUNITY_AANN_STR - "Do not send outside local AS (well-known community)\n" - "Do not advertise to any peer (well-known community)\n" - "Do not export to next AS (well-known community)\n" - "Exact match of the communities") -{ - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP6, SAFI_MULTICAST); -} - -/* old command */ - -/* old command */ - -/* old command */ -#endif /* HAVE_IPV6 */ - static int bgp_show_community_list (struct vty *vty, const char *name, const char *com, int exact, @@ -11192,210 +8203,6 @@ bgp_show_community_list (struct vty *vty, const char *name, bgp_show_type_community_list), list, 0); } -DEFUN (show_ip_bgp_community_list, - show_ip_bgp_community_list_cmd, - "show ip bgp community-list <(1-500)|WORD>", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") -{ - int idx_comm_list = 4; - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_instance_community_list, - show_ip_bgp_instance_community_list_cmd, - "show ip bgp WORD community-list <(1-500)|WORD>", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") -{ - int idx_word = 4; - int idx_comm_list = 6; - return bgp_show_community_list (vty, argv[idx_word]->arg, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_ipv4_community_list, - show_ip_bgp_ipv4_community_list_cmd, - "show ip bgp ipv4 community-list <(1-500)|WORD>", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") -{ - int idx_safi = 4; - int idx_comm_list = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_MULTICAST); - - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_community_list_exact, - show_ip_bgp_community_list_exact_cmd, - "show ip bgp community-list <(1-500)|WORD> exact-match", - SHOW_STR - IP_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n" - "Exact match of the communities\n") -{ - int idx_comm_list = 4; - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_UNICAST); -} - -DEFUN (show_ip_bgp_ipv4_community_list_exact, - show_ip_bgp_ipv4_community_list_exact_cmd, - "show ip bgp ipv4 community-list <(1-500)|WORD> exact-match", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n" - "Exact match of the communities\n") -{ - int idx_safi = 4; - int idx_comm_list = 6; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_MULTICAST); - - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP, SAFI_UNICAST); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 community-list (<1-500>|WORD)", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the community-list\n" - * "community-list number\n" - * "community-list name\n" - * - */ -DEFUN (show_bgp_community_list, - show_bgp_community_list_cmd, - "show bgp community-list <(1-500)|WORD>", - SHOW_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n") -{ - int idx_comm_list = 3; - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 0, AFI_IP6, SAFI_UNICAST); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_community_list, - show_ipv6_bgp_community_list_cmd, - "show ipv6 bgp community-list WORD", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 0, AFI_IP6, SAFI_UNICAST); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_community_list, - show_ipv6_mbgp_community_list_cmd, - "show ipv6 mbgp community-list WORD", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the community-list\n" - "community-list name\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 0, AFI_IP6, SAFI_MULTICAST); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 community-list (<1-500>|WORD) exact-match", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Display routes matching the community-list\n" - * "community-list number\n" - * "community-list name\n" - * "Exact match of the communities\n" - * - */ -DEFUN (show_bgp_community_list_exact, - show_bgp_community_list_exact_cmd, - "show bgp community-list <(1-500)|WORD> exact-match", - SHOW_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list number\n" - "community-list name\n" - "Exact match of the communities\n") -{ - int idx_comm_list = 3; - return bgp_show_community_list (vty, NULL, argv[idx_comm_list]->arg, 1, AFI_IP6, SAFI_UNICAST); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_community_list_exact, - show_ipv6_bgp_community_list_exact_cmd, - "show ipv6 bgp community-list WORD exact-match", - SHOW_STR - IPV6_STR - BGP_STR - "Display routes matching the community-list\n" - "community-list name\n" - "Exact match of the communities\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 1, AFI_IP6, SAFI_UNICAST); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_community_list_exact, - show_ipv6_mbgp_community_list_exact_cmd, - "show ipv6 mbgp community-list WORD exact-match", - SHOW_STR - IPV6_STR - MBGP_STR - "Display routes matching the community-list\n" - "community-list name\n" - "Exact match of the communities\n") -{ - int idx_word = 4; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_community_list (vty, NULL, argv[idx_word]->arg, 1, AFI_IP6, SAFI_MULTICAST); -} -#endif /* HAVE_IPV6 */ - static int bgp_show_prefix_longer (struct vty *vty, const char *name, const char *prefix, afi_t afi, @@ -11425,196 +8232,6 @@ bgp_show_prefix_longer (struct vty *vty, const char *name, return ret; } -DEFUN (show_ip_bgp_prefix_longer, - show_ip_bgp_prefix_longer_cmd, - "show ip bgp A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - BGP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display route and more specific routes\n") -{ - int idx_ipv4_prefixlen = 3; - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - -DEFUN (show_ip_bgp_instance_prefix_longer, - show_ip_bgp_instance_prefix_longer_cmd, - "show ip bgp WORD A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display route and more specific routes\n") -{ - int idx_word = 4; - int idx_ipv4_prefixlen = 5; - return bgp_show_prefix_longer (vty, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics A.B.C.D/M longer-prefixes", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * "Display route and more specific routes\n" - * - */ -DEFUN (show_ip_bgp_flap_prefix_longer, - show_ip_bgp_flap_prefix_longer_cmd, - "show ip bgp flap-statistics A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display route and more specific routes\n") -{ - int idx_ipv4_prefixlen = 4; - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_prefix_longer); -} - - -DEFUN (show_ip_bgp_ipv4_prefix_longer, - show_ip_bgp_ipv4_prefix_longer_cmd, - "show ip bgp ipv4 A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "Display route and more specific routes\n") -{ - int idx_safi = 4; - int idx_ipv4_prefixlen = 5; - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_MULTICAST, - bgp_show_type_prefix_longer); - - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics A.B.C.D", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "Network in the BGP routing table to display\n" - * - */ -DEFUN (show_ip_bgp_flap_address, - show_ip_bgp_flap_address_cmd, - "show ip bgp flap-statistics A.B.C.D", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "Network in the BGP routing table to display\n") -{ - int idx_ipv4 = 4; - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_address); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics A.B.C.D/M", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * "IP prefix /, e.g., 35.0.0.0/8\n" - * - */ -DEFUN (show_ip_bgp_flap_prefix, - show_ip_bgp_flap_prefix_cmd, - "show ip bgp flap-statistics A.B.C.D/M", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n" - "IP prefix /, e.g., 35.0.0.0/8\n") -{ - int idx_ipv4_prefixlen = 4; - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_prefix); -} - - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 X:X::X:X/M longer-prefixes", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "IPv6 prefix /\n" - * "Display route and more specific routes\n" - * - */ -DEFUN (show_bgp_prefix_longer, - show_bgp_prefix_longer_cmd, - "show bgp X:X::X:X/M longer-prefixes", - SHOW_STR - BGP_STR - "IPv6 prefix /\n" - "Display route and more specific routes\n") -{ - int idx_ipv6_prefixlen = 2; - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - - -/* old command */ -DEFUN (show_ipv6_bgp_prefix_longer, - show_ipv6_bgp_prefix_longer_cmd, - "show ipv6 bgp X:X::X:X/M longer-prefixes", - SHOW_STR - IPV6_STR - BGP_STR - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Display route and more specific routes\n") -{ - int idx_ipv6_prefixlen = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, - bgp_show_type_prefix_longer); -} - -/* old command */ -DEFUN (show_ipv6_mbgp_prefix_longer, - show_ipv6_mbgp_prefix_longer_cmd, - "show ipv6 mbgp X:X::X:X/M longer-prefixes", - SHOW_STR - IPV6_STR - MBGP_STR - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Display route and more specific routes\n") -{ - int idx_ipv6_prefixlen = 3; - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_prefix_longer (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_prefix_longer); -} -#endif /* HAVE_IPV6 */ - static struct peer * peer_lookup_in_view (struct vty *vty, const char *view_name, const char *ip_str, u_char use_json) @@ -12638,507 +9255,78 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "JavaScript Object Notation\n" - * - */ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show ip bgp WORD neighbors advertised-routes [json]", + "show [ip] bgp [] WORD [] neighbors [] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" + "Display the received routes from neighbor\n" + "Route-map to modify the attributes\n" + "Name of the route map\n" "Display the routes advertised to a BGP neighbor\n" + "Route-map to modify the attributes\n" + "Name of the route map\n" "JavaScript Object Notation\n") { - int idx_word = 4; - int idx_peer = 6; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi = 5; + int idx_safi = 6; + int idx_peer; + int idx_adv_recv; + int idx_rmap; + int rcvd = 0; + char *vrf = NULL; + char *rmap_name = NULL; struct peer *peer; + afi_t afi; + safi_t safi; u_char uj = use_json(argc, argv); - if (argc == 4 || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - else - peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer); + + peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj); if (! peer) - return CMD_WARNING; + { + vty_out (vty, "No such neighbor%s", VTY_NEWLINE); + return CMD_WARNING; + } - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL, uj); + idx_adv_recv = idx_peer + 1; + idx_rmap = idx_adv_recv + 2; + + if (argc > idx_adv_recv) + { + if (strmatch(argv[idx_adv_recv]->text, "received-routes")) + rcvd = 1; + else if (strmatch(argv[idx_adv_recv]->text, "advertised-routes")) + rcvd = 0; + + if (argc > idx_rmap) + rmap_name = argv[idx_rmap]->arg; + } + + return peer_adj_routes (vty, peer, afi, safi, rcvd, rmap_name, uj); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_neighbor_advertised_route, - show_ip_bgp_neighbor_advertised_route_cmd, - "show ip bgp neighbors advertised-routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") - -{ - int idx_peer = 4; - int idx_json = 6; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - - if (! peer) - return CMD_WARNING; - - if ((argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0) - || (argc == 3)) - rmap_name = argv[idx_json]->arg; - - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "Route-map to control what is displayed\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route, - show_ip_bgp_ipv4_neighbor_advertised_route_cmd, - "show ip bgp ipv4 neighbors advertised-routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_peer = 6; - int idx_json = 8; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - if ((argc == 4) || (argc == 3 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) - rmap_name = argv[idx_json]->arg; - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, rmap_name, uj); - else - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj); -} - - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_advertised_route, - show_bgp_instance_neighbor_advertised_route_cmd, - "show bgp WORD neighbors advertised-routes [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_peer = 5; - struct peer *peer; - u_char uj = use_json(argc, argv); - - if (argc == 4 || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - else - peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); - - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "JavaScript Object Notation\n" - * - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes [json]", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the routes advertised to a BGP neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_neighbor_advertised_route, - show_bgp_neighbor_advertised_route_cmd, - "show bgp neighbors advertised-routes [json]", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") - -{ - int idx_peer = 3; - int idx_json = 5; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - - if (!peer) - return CMD_WARNING; - - if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) - rmap_name = argv[idx_json]->arg; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, rmap_name, uj); -} - - -/* old command */ - -/* old command */ -DEFUN (ipv6_mbgp_neighbor_advertised_route, - ipv6_mbgp_neighbor_advertised_route_cmd, - "show ipv6 mbgp neighbors advertised-routes [json]", - SHOW_STR - IPV6_STR - MBGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Neighbor on bgp configured interface\n" - "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - bgp_show_ipv6_bgp_deprecate_warning(vty); - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0, NULL, uj); -} -#endif /* HAVE_IPV6 */ - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_received_routes, - show_bgp_instance_neighbor_received_routes_cmd, - "show bgp WORD neighbors received-routes [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_peer = 5; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, NULL, uj); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_instance_neighbor_received_routes, - show_ip_bgp_instance_neighbor_received_routes_cmd, - "show ip bgp WORD neighbors received-routes [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_peer = 6; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_neighbor_received_routes, - show_ip_bgp_neighbor_received_routes_cmd, - "show ip bgp neighbors received-routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") - -{ - int idx_peer = 4; - int idx_json = 6; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - - if (! peer) - return CMD_WARNING; - - if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) - rmap_name = argv[idx_json]->arg; - - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); -} - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD [json]", - * SHOW_STR - * IP_STR - * BGP_STR - * "Address family\n" - * "Address Family modifier\n" - * "Address Family modifier\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_ip_bgp_ipv4_neighbor_received_routes, - show_ip_bgp_ipv4_neighbor_received_routes_cmd, - "show ip bgp ipv4 neighbors received-routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_peer = 6; - int idx_json = 8; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - if (argc == 4 || (argc == 3 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) - rmap_name = argv[idx_json]->arg; - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, rmap_name, uj); - else - return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj); -} - - -DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes, - show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd, - "show bgp WORD neighbors [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family modifier\n" - "Address family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the advertised routes to neighbor\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_afi = 4; - int idx_safi = 5; - int idx_peer = 7; - int idx_adv_rcvd_routes = 8; - int afi; - int safi; - int in; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - - if (! peer) - return CMD_WARNING; - - afi = (strncmp (argv[idx_afi]->arg, "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP; - safi = (strncmp (argv[idx_safi]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; - in = (strncmp (argv[idx_adv_rcvd_routes]->arg, "r", 1) == 0) ? 1 : 0; - - return peer_adj_routes (vty, peer, afi, safi, in, NULL, uj); -} DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, @@ -13347,61 +9535,6 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, return CMD_SUCCESS; } #ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes [json]", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the received routes from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_neighbor_received_routes, - show_bgp_neighbor_received_routes_cmd, - "show bgp neighbors received-routes [json]", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 3; - int idx_json = 5; - struct peer *peer; - const char *rmap_name = NULL; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - - if (! peer) - return CMD_WARNING; - - if (argc == 3 || (argc == 2 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0)) - rmap_name = argv[idx_json]->arg; - - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, rmap_name, uj); -} - - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", @@ -13417,6 +9550,7 @@ DEFUN (show_bgp_neighbor_received_routes, * "JavaScript Object Notation\n" * */ +/* CHECK ME do we even support ORF for ipv6? */ DEFUN (show_bgp_neighbor_received_prefix_filter, show_bgp_neighbor_received_prefix_filter_cmd, "show bgp neighbors received prefix-filter [json]", @@ -13504,35 +9638,6 @@ DEFUN (show_bgp_neighbor_received_prefix_filter, return CMD_SUCCESS; } - -/* old command */ - -/* old command */ -DEFUN (ipv6_mbgp_neighbor_received_routes, - ipv6_mbgp_neighbor_received_routes_cmd, - "show ipv6 mbgp neighbors received-routes [json]", - SHOW_STR - IPV6_STR - MBGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the received routes from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - bgp_show_ipv6_bgp_deprecate_warning(vty); - return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL, uj); -} - /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", @@ -14031,42 +10136,6 @@ DEFUN (show_bgp_neighbor_routes, return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, bgp_show_type_neighbor, uj); } - - - -/* old command */ - -/* old command */ -DEFUN (ipv6_mbgp_neighbor_routes, - ipv6_mbgp_neighbor_routes_cmd, - "show ipv6 mbgp neighbors routes [json]", - SHOW_STR - IPV6_STR - MBGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - bgp_show_ipv6_bgp_deprecate_warning(vty); - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_MULTICAST, - bgp_show_type_neighbor, uj); -} - - - - - #endif /* HAVE_IPV6 */ struct bgp_table *bgp_distance_table; @@ -14279,17 +10348,9 @@ DEFUN (bgp_distance, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no distance bgp", - * NO_STR - * "Define an administrative distance\n" - * "BGP distance\n" - * - */ DEFUN (no_bgp_distance, no_bgp_distance_cmd, - "no distance bgp (1-255) (1-255) (1-255)", + "no distance bgp [(1-255) (1-255) (1-255)]", NO_STR "Define an administrative distance\n" "BGP distance\n" @@ -14424,29 +10485,9 @@ DEFUN (bgp_damp_set, half, reuse, suppress, max); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp dampening <1-45>", - * NO_STR - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * "Half-life time for the penalty\n" - * - * "no bgp dampening <1-45> <1-20000> <1-20000> <1-255>", - * NO_STR - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * "Half-life time for the penalty\n" - * "Value to start reusing a route\n" - * "Value to start suppressing a route\n" - * "Maximum duration to suppress a stable route\n" - * - */ DEFUN (bgp_damp_unset, bgp_damp_unset_cmd, - "no bgp dampening", + "no bgp dampening [<1-45> [<1-20000> <1-20000> <1-255>]]", NO_STR "BGP Specific commands\n" "Enable route-flap dampening\n") @@ -14457,54 +10498,6 @@ DEFUN (bgp_damp_unset, return bgp_damp_disable (bgp, bgp_node_afi (vty), bgp_node_safi (vty)); } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening dampened-paths", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display paths suppressed due to dampening\n" - * - */ -DEFUN (show_ip_bgp_dampened_paths, - show_ip_bgp_dampened_paths_cmd, - "show ip bgp dampened-paths", - SHOW_STR - IP_STR - BGP_STR - "Display paths suppressed due to dampening\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_dampend_paths, - NULL, 0); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip bgp dampening flap-statistics", - * SHOW_STR - * IP_STR - * BGP_STR - * "Display detailed information about dampening\n" - * "Display flap statistics of routes\n" - * - */ -DEFUN (show_ip_bgp_flap_statistics, - show_ip_bgp_flap_statistics_cmd, - "show ip bgp flap-statistics", - SHOW_STR - IP_STR - BGP_STR - "Display flap statistics of routes\n") -{ - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_statistics, NULL, 0); -} - - /* Display specified route of BGP table. */ static int bgp_clear_damp_route (struct vty *vty, const char *view_name, @@ -14923,63 +10916,11 @@ bgp_route_init (void) install_element (BGP_IPV4M_NODE, &no_aggregate_address_cmd); install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_cmd); - install_element (VIEW_NODE, &show_ip_bgp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_route_pathtype_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_ip_bgp_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_regexp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_filter_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_filter_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_filter_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_route_map_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_route_map_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_map_cmd); - install_element (VIEW_NODE, &show_ip_bgp_cidr_only_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_cidr_only_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community_all_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_all_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community_all_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_community_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_community_list_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_community_list_exact_cmd); - install_element (VIEW_NODE, &show_ip_bgp_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); - install_element (VIEW_NODE, &show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); @@ -14987,137 +10928,27 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); - install_element (VIEW_NODE, &show_ip_bgp_dampened_paths_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_dampd_paths_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_flap_stats_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_address_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_cidr_only_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_regexp_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_filter_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_list_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_bgp_flap_route_map_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_damp_cmd); /* Restricted node: VIEW_NODE - (set of dangerous commands) */ install_element (RESTRICTED_NODE, &show_ip_bgp_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_route_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_prefix_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community_all_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_all_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cmd); install_element (ENABLE_NODE, &show_ip_bgp_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_regexp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_regexp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_filter_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_filter_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_filter_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_route_map_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_route_map_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_route_map_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_cidr_only_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cidr_only_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community_all_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_all_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community_all_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_community_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_community_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampening_params_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_dampened_paths_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_dampd_paths_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_flap_stats_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_statistics_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_address_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_cidr_only_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_regexp_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_filter_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_flap_route_map_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_vpn_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_route_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_vpn_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_route_cmd); - /* BGP dampening clear commands */ install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_dampening_prefix_cmd); @@ -15151,45 +10982,9 @@ bgp_route_init (void) /* Old config IPv6 BGP commands. */ - install_element (VIEW_NODE, &show_bgp_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_cmd); - install_element (VIEW_NODE, &show_bgp_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_route_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_cmd); - install_element (VIEW_NODE, &show_bgp_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_regexp_cmd); - install_element (VIEW_NODE, &show_bgp_prefix_list_cmd); - install_element (VIEW_NODE, &show_bgp_filter_list_cmd); - install_element (VIEW_NODE, &show_bgp_route_map_cmd); - install_element (VIEW_NODE, &show_bgp_community_all_cmd); - install_element (VIEW_NODE, &show_bgp_community_cmd); - install_element (VIEW_NODE, &show_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_bgp_community_list_cmd); - install_element (VIEW_NODE, &show_bgp_community_list_exact_cmd); - install_element (VIEW_NODE, &show_bgp_prefix_longer_cmd); - install_element (VIEW_NODE, &show_bgp_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_bgp_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_bgp_instance_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_cmd); - install_element (VIEW_NODE, &show_bgp_instance_route_cmd); - install_element (VIEW_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_instance_prefix_cmd); - install_element (VIEW_NODE, &show_bgp_instance_prefix_pathtype_cmd); - install_element (VIEW_NODE, &show_bgp_instance_prefix_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_filter_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_route_map_cmd); - install_element (VIEW_NODE, &show_bgp_instance_community_list_cmd); - install_element (VIEW_NODE, &show_bgp_instance_prefix_longer_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_advertised_route_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_routes_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_flap_cmd); @@ -15198,62 +10993,11 @@ bgp_route_init (void) /* Restricted: * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) */ - install_element (RESTRICTED_NODE, &show_bgp_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_cmd); - install_element (RESTRICTED_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community_cmd); - install_element (RESTRICTED_NODE, &show_bgp_community_exact_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_route_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (RESTRICTED_NODE, &show_bgp_instance_prefix_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_cmd); - install_element (ENABLE_NODE, &show_bgp_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_route_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_route_cmd); - install_element (ENABLE_NODE, &show_bgp_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_ipv6_safi_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_regexp_cmd); - install_element (ENABLE_NODE, &show_bgp_prefix_list_cmd); - install_element (ENABLE_NODE, &show_bgp_filter_list_cmd); - install_element (ENABLE_NODE, &show_bgp_route_map_cmd); - install_element (ENABLE_NODE, &show_bgp_community_all_cmd); - install_element (ENABLE_NODE, &show_bgp_community_cmd); - install_element (ENABLE_NODE, &show_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_community_list_cmd); - install_element (ENABLE_NODE, &show_bgp_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_bgp_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_route_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_route_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_prefix_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_prefix_pathtype_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_prefix_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_filter_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_route_map_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_community_list_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_routes_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_flap_cmd); @@ -15261,73 +11005,7 @@ bgp_route_init (void) /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); - //install_element (ENABLE_NODE, &show_bgp_statistics_vpnv4_cmd); install_element (ENABLE_NODE, &show_bgp_statistics_view_cmd); - //install_element (ENABLE_NODE, &show_bgp_statistics_view_vpnv4_cmd); - - /* old command */ - install_element (VIEW_NODE, &show_ipv6_bgp_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_route_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_regexp_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_prefix_list_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_filter_list_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community_all_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community_list_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_community_list_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_bgp_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_route_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_regexp_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_prefix_list_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_filter_list_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community_all_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community_list_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_community_list_exact_cmd); - install_element (VIEW_NODE, &show_ipv6_mbgp_prefix_longer_cmd); - - /* old command */ - install_element (ENABLE_NODE, &show_ipv6_bgp_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_route_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_regexp_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_filter_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community_all_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_bgp_prefix_longer_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_route_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_prefix_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_regexp_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_prefix_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_filter_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community_all_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_community_list_exact_cmd); - install_element (ENABLE_NODE, &show_ipv6_mbgp_prefix_longer_cmd); - - /* old command */ - install_element (VIEW_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); - install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_advertised_route_cmd); - - /* old command */ - install_element (VIEW_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); - install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_received_routes_cmd); - - /* old command */ - install_element (VIEW_NODE, &ipv6_mbgp_neighbor_routes_cmd); - install_element (ENABLE_NODE, &ipv6_mbgp_neighbor_routes_cmd); #endif /* HAVE_IPV6 */ install_element (BGP_NODE, &bgp_distance_cmd); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 2fd75baeff..5b965f3f93 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2908,19 +2908,9 @@ DEFUN (neighbor_peer_group, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor remote-as ((1-4294967295)|internal|external)", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR - * "Specify a BGP neighbor\n" - * AS_STR - * - */ DEFUN (no_neighbor, no_neighbor_cmd, - "no neighbor ", + "no neighbor [remote-as <(1-4294967295)|internal|external>]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2) @@ -3168,41 +3158,16 @@ DEFUN (neighbor_local_as_no_prepend_replace_as, return bgp_vty_return (vty, ret); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor local-as (1-4294967295)", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Specify a local-as number\n" - * "AS number used as local AS\n" - * - * "no neighbor local-as (1-4294967295) no-prepend", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Specify a local-as number\n" - * "AS number used as local AS\n" - * "Do not prepend local-as to updates from ebgp peers\n" - * - * "no neighbor local-as (1-4294967295) no-prepend replace-as", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Specify a local-as number\n" - * "AS number used as local AS\n" - * "Do not prepend local-as to updates from ebgp peers\n" - * "Do not prepend local-as to updates from ibgp peers\n" - * - */ DEFUN (no_neighbor_local_as, no_neighbor_local_as_cmd, - "no neighbor local-as", + "no neighbor local-as [(1-4294967295) [no-prepend [replace-as]]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n") + "Specify a local-as number\n" + "AS number used as local AS\n" + "Do not prepend local-as to updates from ebgp peers\n" + "Do not prepend local-as to updates from ibgp peers\n") { int idx_peer = 2; struct peer *peer; @@ -3279,19 +3244,9 @@ DEFUN (neighbor_password, return bgp_vty_return (vty, ret); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor password LINE", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Set a password\n" - * "The password\n" - * - */ DEFUN (no_neighbor_password, no_neighbor_password_cmd, - "no neighbor password", + "no neighbor password [LINE]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4532,23 +4487,14 @@ DEFUN (neighbor_ebgp_multihop_ttl, return peer_ebgp_multihop_set_vty (vty, argv[idx_peer]->arg, argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor ebgp-multihop (1-255)", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Allow EBGP neighbors not on directly connected networks\n" - * "maximum hop count\n" - * - */ DEFUN (no_neighbor_ebgp_multihop, no_neighbor_ebgp_multihop_cmd, - "no neighbor ebgp-multihop", + "no neighbor ebgp-multihop [(1-255)]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Allow EBGP neighbors not on directly connected networks\n") + "Allow EBGP neighbors not on directly connected networks\n" + "maximum hop count\n") { int idx_peer = 2; return peer_ebgp_multihop_unset_vty (vty, argv[idx_peer]->arg); @@ -4556,50 +4502,31 @@ DEFUN (no_neighbor_ebgp_multihop, /* disable-connected-check */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor enforce-multihop", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Enforce EBGP neighbors perform multihop\n" - * - */ DEFUN (neighbor_disable_connected_check, neighbor_disable_connected_check_cmd, - "neighbor disable-connected-check", + "neighbor ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "one-hop away EBGP peer using loopback address\n") + "one-hop away EBGP peer using loopback address\n" + "Enforce EBGP neighbors perform multihop\n") { int idx_peer = 1; return peer_flag_set_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor enforce-multihop", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Enforce EBGP neighbors perform multihop\n" - * - */ DEFUN (no_neighbor_disable_connected_check, no_neighbor_disable_connected_check_cmd, - "no neighbor disable-connected-check", + "no neighbor ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "one-hop away EBGP peer using loopback address\n") + "one-hop away EBGP peer using loopback address\n" + "Enforce EBGP neighbors perform multihop\n") { int idx_peer = 2; return peer_flag_unset_vty (vty, argv[idx_peer]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); } -/* Enforce multihop. */ - -/* Enforce multihop. */ - DEFUN (neighbor_description, neighbor_description_cmd, "neighbor description .LINE", @@ -4628,23 +4555,17 @@ DEFUN (neighbor_description, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor description .LINE", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Neighbor specific description\n" - * "Up to 80 characters describing this neighbor\n" - * - */ +/* CHECK ME quentin mentioned something about LINE vs .LINE vs LINE... but + * I don't remember what. We need to check all LINE and AA:NN + * */ DEFUN (no_neighbor_description, no_neighbor_description_cmd, - "no neighbor description", + "no neighbor description [LINE]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Neighbor specific description\n") + "Neighbor specific description\n" + "Up to 80 characters describing this neighbor\n") { int idx_peer = 2; struct peer *peer; @@ -4768,24 +4689,15 @@ DEFUN (neighbor_default_originate_rmap, bgp_node_safi (vty), argv[idx_word]->arg, 1); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor default-originate route-map WORD", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Originate default route to this neighbor\n" - * "Route-map to specify criteria to originate default\n" - * "route-map name\n" - * - */ DEFUN (no_neighbor_default_originate, no_neighbor_default_originate_cmd, - "no neighbor default-originate", + "no neighbor default-originate [route-map WORD]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Originate default route to this neighbor\n") + "Originate default route to this neighbor\n" + "Route-map to specify criteria to originate default\n" + "route-map name\n") { int idx_peer = 2; return peer_default_originate_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -5842,11 +5754,6 @@ DEFUN (no_neighbor_maximum_prefix, } - - - - - /* "neighbor allowas-in" */ /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN @@ -6220,10 +6127,62 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } -static void -bgp_get_argv_afi_safi (struct cmd_token **argv, int idx_afi, int idx_safi, - afi_t *afi, safi_t *safi) +char * +bgp_get_argv_vrf (int argc, struct cmd_token **argv, afi_t *afi, safi_t *safi, + int *idx_view_vrf, int *idx_vrf, int *idx_next_token) { + /* + * The DEFUN that calls this MUST begin with one of the following + * clear [ip] bgp [ WORD] + * show [ip] bgp [ WORD] + * + * We will do the following + * - set the afi/safi + * - decrement the idx_view_vrf and idx_vrf pointers if needed + * - return a pointer to the vrf name + */ + int idx_ip = 1; + + /* + * If the user does " ip bgp" then we default the afi safi to ipv4 unicast. + * If the user does " bgp" then we default the afi safi to ipv6 unicast. + * This may be over-written later in the command if they explicitly + * specify an afi safi. + */ + if (strmatch(argv[idx_ip]->text, "ip")) + { + *afi = AFI_IP; + *safi = SAFI_UNICAST; + } + else + { + *afi = AFI_IP6; + *safi = SAFI_UNICAST; + *idx_view_vrf = *idx_view_vrf - 1; + *idx_vrf = *idx_vrf - 1; + } + + if (argc > *idx_vrf) + if (strmatch(argv[*idx_view_vrf]->text, "view") || strmatch(argv[*idx_view_vrf]->text, "vrf")) + { + *idx_next_token = *idx_vrf + 1; + return argv[*idx_vrf]->arg; + } + + *idx_next_token = *idx_view_vrf; + return NULL; +} + +void +bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, + int idx_afi, int idx_safi, + afi_t *afi, safi_t *safi, + int *idx_next_token) +{ + /* + * The DEFUN that calls this must use + * + */ if (strmatch(argv[idx_afi]->text, "ipv4")) { *afi = AFI_IP; @@ -6232,6 +6191,9 @@ bgp_get_argv_afi_safi (struct cmd_token **argv, int idx_afi, int idx_safi, *safi = SAFI_UNICAST; else if (strmatch(argv[idx_safi]->text, "multicast")) *safi = SAFI_MULTICAST; + + if (idx_next_token) + *idx_next_token = idx_safi + 1; } else if (strmatch(argv[idx_afi]->text, "ipv6")) { @@ -6241,17 +6203,31 @@ bgp_get_argv_afi_safi (struct cmd_token **argv, int idx_afi, int idx_safi, *safi = SAFI_UNICAST; else if (strmatch(argv[idx_safi]->text, "multicast")) *safi = SAFI_MULTICAST; + + if (idx_next_token) + *idx_next_token = idx_safi + 1; } else if (strmatch(argv[idx_afi]->text, "encap")) { *afi = AFI_IP; *safi = SAFI_ENCAP; + + if (idx_next_token) + *idx_next_token = idx_safi + 1; } else if (strmatch(argv[idx_afi]->text, "vpnv4")) { *afi = AFI_IP; + + if (idx_next_token) + *idx_next_token = idx_safi + 1; *safi = SAFI_MPLS_VPN; } + else + { + if (idx_next_token) + *idx_next_token = idx_afi; + } } /* one clear bgp command to rule them all */ @@ -6290,11 +6266,10 @@ DEFUN (clear_ip_bgp_all, BGP_SOFT_IN_STR BGP_SOFT_OUT_STR) { - int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; int idx_clr_sort = 5; - int idx_soft_in_out = argc - 1; + int idx_soft_in_out; int idx_afi; int idx_safi; char *vrf = NULL; @@ -6304,30 +6279,8 @@ DEFUN (clear_ip_bgp_all, enum bgp_clear_type clr_type; char *clr_arg = NULL; - /* - * If the user does "clear ip bgp" then we default the afi safi to ipv4 unicast. - * If the user does "clear bgp" then we default the afi safi to ipv6 unicast. - * This may be over-written later in the command if they explicitly - * specify an afi safi. - */ - if (strmatch(argv[idx_ip]->text, "ip")) - { - afi = AFI_IP; - safi = SAFI_UNICAST; - } - else - { - afi = AFI_IP6; - safi = SAFI_UNICAST; - idx_view_vrf--; - idx_vrf--; - idx_clr_sort--; - } - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_clr_sort -= 2; + // dwalton + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_clr_sort); /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external> */ if (strmatch(argv[idx_clr_sort]->text, "*")) @@ -6356,7 +6309,8 @@ DEFUN (clear_ip_bgp_all, else if (strmatch(argv[idx_clr_sort]->text, "peer-group")) { clr_sort = clear_group; - clr_arg = argv[idx_clr_sort + 1]->arg; + idx_clr_sort++; + clr_arg = argv[idx_clr_sort]->arg; if (! peer_group_lookup (vty->index, clr_arg)) { @@ -6378,58 +6332,22 @@ DEFUN (clear_ip_bgp_all, } } + /* afi safi */ + idx_afi = idx_clr_sort + 1; + idx_safi = idx_clr_sort + 2; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_soft_in_out); + /* soft, soft in, or soft out */ if (strmatch(argv[idx_soft_in_out]->text, "in")) - { - clr_type = BGP_CLEAR_SOFT_IN; - - if (strmatch(argv[idx_soft_in_out-1]->text, "soft")) - { - idx_afi = idx_soft_in_out - 3; - idx_safi = idx_soft_in_out - 2; - } - else - { - idx_afi = idx_soft_in_out - 2; - idx_safi = idx_soft_in_out - 1; - } - } + clr_type = BGP_CLEAR_SOFT_IN; else if (strmatch(argv[idx_soft_in_out]->text, "out")) - { - clr_type = BGP_CLEAR_SOFT_OUT; - - if (strmatch(argv[idx_soft_in_out-1]->text, "soft")) - { - idx_afi = idx_soft_in_out - 3; - idx_safi = idx_soft_in_out - 2; - } - else - { - idx_afi = idx_soft_in_out - 2; - idx_safi = idx_soft_in_out - 1; - } - } + clr_type = BGP_CLEAR_SOFT_OUT; else if (strmatch(argv[idx_soft_in_out]->text, "soft")) - { - clr_type = BGP_CLEAR_SOFT_BOTH; - idx_afi = idx_soft_in_out - 2; - idx_safi = idx_soft_in_out - 1; - } + clr_type = BGP_CLEAR_SOFT_BOTH; else if (strmatch(argv[idx_soft_in_out]->text, "prefix-filter")) - { - clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; - idx_afi = idx_soft_in_out - 3; - idx_safi = idx_soft_in_out - 2; - } + clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; else - { - clr_type = BGP_CLEAR_SOFT_NONE; - idx_afi = idx_soft_in_out - 1; - idx_safi = idx_soft_in_out; - } - - /* afi safi */ - bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); + clr_type = BGP_CLEAR_SOFT_NONE; return bgp_clear_vty (vty, vrf, afi, safi, clr_sort, clr_type, clr_arg); } @@ -7200,7 +7118,6 @@ DEFUN (show_ip_bgp_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -7210,41 +7127,9 @@ DEFUN (show_ip_bgp_summary, safi_t safi; u_char uj = use_json(argc, argv); - /* - * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast. - * If the user does "show bgp" then we default the afi safi to ipv6 unicast. - * This may be over-written later in the command if they explicitly - * specify an afi safi. - */ - if (strmatch(argv[idx_ip]->text, "ip")) - { - afi = AFI_IP; - safi = SAFI_UNICAST; - } - else - { - afi = AFI_IP6; - safi = SAFI_UNICAST; - idx_view_vrf--; - idx_vrf--; - } - - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - if (uj) - { - idx_afi = argc - 3; - idx_safi = argc - 2; - } - else - { - idx_afi = argc - 2; - idx_safi = argc - 1; - } - - /* afi safi */ - bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, NULL); return bgp_show_summary_vty (vty, vrf, afi, safi, uj); } @@ -9291,52 +9176,24 @@ DEFUN (show_ip_bgp_updgrps, "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") { - int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; int idx_safi; - int idx_subgroup_id = argc - 1; + int idx_updgrp; + int idx_subgroup_id; char *vrf = NULL; afi_t afi; safi_t safi; uint64_t subgrp_id = 0; - /* - * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast. - * If the user does "show bgp" then we default the afi safi to ipv6 unicast. - * This may be over-written later in the command if they explicitly - * specify an afi safi. - */ - if (strmatch(argv[idx_ip]->text, "ip")) - { - afi = AFI_IP; - safi = SAFI_UNICAST; - } - else - { - afi = AFI_IP6; - safi = SAFI_UNICAST; - idx_view_vrf--; - idx_vrf--; - } + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_updgrp); + idx_subgroup_id = idx_updgrp + 1; - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - - if (strmatch(argv[idx_subgroup_id]->text, "update-groups")) - { - idx_afi = idx_subgroup_id - 2; - idx_safi = idx_subgroup_id - 1; - } - else - { - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); - idx_afi = idx_subgroup_id - 3; - idx_safi = idx_subgroup_id - 2; - } - - bgp_get_argv_afi_safi (argv, idx_afi, idx_safi, &afi, &safi); + if (! strmatch(argv[idx_subgroup_id]->text, "update-groups")) + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); return (bgp_show_update_groups(vty, vrf, afi, safi, subgrp_id)); } diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 382af0984f..936d66131f 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -33,6 +33,14 @@ extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp); extern int bgp_vty_return (struct vty *vty, int ret); +extern char *bgp_get_argv_vrf (int argc, struct cmd_token **argv, + afi_t *afi, safi_t *safi, + int *idx_view_vrf, int *idx_vrf, + int *idx_next_token); +extern void bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, + int idx_afi, int idx_safi, + afi_t *afi, safi_t *safi, + int *idx_next_token); extern struct peer * peer_and_group_lookup_vty (struct vty *vty, const char *peer_str); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index c834b11864..09947f49e5 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9103,6 +9103,8 @@ DEFUN (no_ospf_max_metric_router_lsa_shutdown, return CMD_SUCCESS; } +static void +config_write_stub_router (struct vty *vty, struct ospf *ospf) { struct listnode *ln; struct ospf_area *area; From 2525cf394a39ce13441c65fcccb1bd78840dc55e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 18:44:58 +0000 Subject: [PATCH 149/280] bgpd: compress bgp_show_neighbor_route() calls Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 432 ++++++++--------------------------------------- 1 file changed, 73 insertions(+), 359 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6145b31755..68b1a006a5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7788,7 +7788,6 @@ DEFUN (show_ip_bgp_ipv4, struct bgp *bgp; u_char uj = use_json(argc, argv); - // dwalton reference vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); idx_safi = idx_afi + 1; bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_sh_type); @@ -9774,369 +9773,102 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show ip bgp neighbors routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST, - bgp_show_type_neighbor, uj); -} - -DEFUN (show_ip_bgp_instance_neighbor_routes, - show_ip_bgp_instance_neighbor_routes_cmd, - "show ip bgp WORD neighbors routes [json]", + "show [ip] bgp [ WORD] [] neighbors [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 4; - int idx_peer = 6; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST, - bgp_show_type_neighbor, uj); -} - -DEFUN (show_ip_bgp_neighbor_flap, - show_ip_bgp_neighbor_flap_cmd, - "show ip bgp neighbors flap-statistics [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display flap statistics of the routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST, - bgp_show_type_flap_neighbor, uj); -} - -DEFUN (show_ip_bgp_neighbor_damp, - show_ip_bgp_neighbor_damp_cmd, - "show ip bgp neighbors dampened-routes [json]", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST, - bgp_show_type_damp_neighbor, uj); -} - -DEFUN (show_ip_bgp_ipv4_neighbor_routes, - show_ip_bgp_ipv4_neighbor_routes_cmd, - "show ip bgp ipv4 neighbors routes [json]", - SHOW_STR - IP_STR - BGP_STR "Address family\n" "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" + "Address Family modifier\n" + "Address family\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" "Neighbor on bgp configured interface\n" "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_peer = 6; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_MULTICAST, - bgp_show_type_neighbor, uj); - - return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST, - bgp_show_type_neighbor, uj); -} - -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_routes, - show_bgp_instance_neighbor_routes_cmd, - "show bgp WORD neighbors routes [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_peer = 5; - struct peer *peer; - u_char uj = use_json(argc, argv); - - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, - bgp_show_type_neighbor, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", - * SHOW_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the dampened routes received from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the dampened routes received from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) dampened-routes [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display the dampened routes received from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_damp, - show_bgp_instance_neighbor_damp_cmd, - "show bgp WORD neighbors dampened-routes [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" "Display the dampened routes received from neighbor\n" - "JavaScript Object Notation\n") -{ - int idx_word = 3; - int idx_peer = 5; - int idx_json = 7; - struct peer *peer; - u_char uj = use_json(argc, argv); - - if ((argc == 4 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") == 0) - || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - else - peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); - - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, - bgp_show_type_damp_neighbor, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", - * SHOW_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display flap statistics of the routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display flap statistics of the routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) flap-statistics [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display flap statistics of the routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_flap, - show_bgp_instance_neighbor_flap_cmd, - "show bgp WORD neighbors flap-statistics [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { - int idx_word = 3; - int idx_peer = 5; - int idx_json = 7; - struct peer *peer; - u_char uj = use_json(argc, argv); + /* +bgp_show_neighbor_route (struct vty *vty, + struct peer *peer, + afi_t afi, + safi_t safi, + enum bgp_show_type type, + u_char use_json) - if ((argc == 4 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") == 0) - || (argc == 3 && argv[idx_peer]->arg && strcmp(argv[idx_peer]->arg, "json") != 0)) - peer = peer_lookup_in_view (vty, argv[idx_word]->arg, argv[idx_peer]->arg, uj); - else - peer = peer_lookup_in_view (vty, NULL, argv[idx_word]->arg, uj); - - if (! peer) - return CMD_WARNING; - - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, - bgp_show_type_flap_neighbor, uj); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", - * SHOW_STR - * IPV6_STR - * BGP_STR - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) routes [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display routes learned from neighbor\n" - * "JavaScript Object Notation\n" - * - */ -DEFUN (show_bgp_neighbor_routes, - show_bgp_neighbor_routes_cmd, - "show bgp neighbors routes [json]", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") +enum bgp_show_type { - int idx_peer = 3; + bgp_show_type_normal, + bgp_show_type_regexp, + bgp_show_type_prefix_list, + bgp_show_type_filter_list, + bgp_show_type_route_map, + bgp_show_type_neighbor, + bgp_show_type_cidr_only, + bgp_show_type_prefix_longer, + bgp_show_type_community_all, + bgp_show_type_community, + bgp_show_type_community_exact, + bgp_show_type_community_list, + bgp_show_type_community_list_exact, + bgp_show_type_flap_statistics, + bgp_show_type_flap_neighbor, + bgp_show_type_dampend_paths, + bgp_show_type_damp_neighbor +}; + + routes - bgp_show_type_neighbor + flap-statics - bgp_show_type_flap_neighbor + dampened-routes - bgp_show_type_damp_neighbor, + */ + // dwalton here now + + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + int idx_peer; + int idx_sh_type; + char *vrf = NULL; + afi_t afi; + safi_t safi; struct peer *peer; + enum bgp_show_type sh_type = bgp_show_type_neighbor; u_char uj = use_json(argc, argv); - peer = peer_lookup_in_view (vty, NULL, argv[idx_peer]->arg, uj); - if (! peer) - return CMD_WARNING; + vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer); - return bgp_show_neighbor_route (vty, peer, AFI_IP6, SAFI_UNICAST, - bgp_show_type_neighbor, uj); + peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj); + if (! peer) + { + vty_out (vty, "No such neighbor%s", VTY_NEWLINE); + return CMD_WARNING; + } + + idx_sh_type = idx_peer + 1; + + if (strmatch(argv[idx_sh_type]->text, "routes")) + sh_type = bgp_show_type_neighbor; + + else if (strmatch(argv[idx_sh_type]->text, "dampened-routes")) + sh_type = bgp_show_type_damp_neighbor; + + else if (strmatch(argv[idx_sh_type]->text, "flap-statistics")) + sh_type = bgp_show_type_flap_neighbor; + + return bgp_show_neighbor_route (vty, peer, afi, safi, sh_type, uj); } -#endif /* HAVE_IPV6 */ struct bgp_table *bgp_distance_table; @@ -10922,14 +10654,10 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_flap_cmd); - install_element (VIEW_NODE, &show_ip_bgp_neighbor_damp_cmd); /* Restricted node: VIEW_NODE - (set of dangerous commands) */ install_element (RESTRICTED_NODE, &show_ip_bgp_route_cmd); @@ -10940,14 +10668,10 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_routes_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampening_params_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd); /* BGP dampening clear commands */ install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); @@ -10980,28 +10704,18 @@ bgp_route_init (void) install_element (BGP_IPV6M_NODE, &no_ipv6_bgp_network_cmd); /* Old config IPv6 BGP commands. */ - - - install_element (VIEW_NODE, &show_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_flap_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_damp_cmd); /* Restricted: * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) */ install_element (RESTRICTED_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_flap_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_damp_cmd); /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); From 39573b33cbb40e1db42de3d680598831a74d4f44 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 20:56:20 +0000 Subject: [PATCH 150/280] bgpd: compress "show ip bgp neighbor received prefix-list" Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 446 ++++------------------------------------------- bgpd/bgp_vty.c | 1 - 2 files changed, 31 insertions(+), 416 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 68b1a006a5..d5dc37a03c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9326,339 +9326,16 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, return peer_adj_routes (vty, peer, afi, safi, rcvd, rmap_name, uj); } - DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, - "show ip bgp neighbors received prefix-filter [json]", + "show [ip] bgp [ WORD] [ [unicast]] neighbors received prefix-filter [json]", SHOW_STR IP_STR BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display information received from a BGP neighbor\n" - "Display the prefixlist filter\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 4; - char name[BUFSIZ]; - union sockunion su; - struct peer *peer; - int count, ret; - u_char uj = use_json(argc, argv); - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_object *json_sub = NULL; - json_no = json_object_new_object(); - json_sub = json_object_new_object(); - json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); - json_object_object_add(json_no, "detail", json_sub); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - peer = peer_lookup (NULL, &su); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_string_add(json_no, "warning", "Peer not found"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No peer%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_UNICAST); - count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); - if (count) - { - if (!uj) - vty_out (vty, "Address family: IPv4 Unicast%s", VTY_NEWLINE); - prefix_bgp_show_prefix_list (vty, AFI_IP, name, uj); - } - else - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_boolean_true_add(json_no, "noFuntionalOutput"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No functional output%s", VTY_NEWLINE); - } - - return CMD_SUCCESS; -} - -DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter, - show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd, - "show ip bgp ipv4 neighbors received prefix-filter [json]", - SHOW_STR - IP_STR - BGP_STR - "Address family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display information received from a BGP neighbor\n" - "Display the prefixlist filter\n" - "JavaScript Object Notation\n") -{ - int idx_safi = 4; - int idx_peer = 6; - char name[BUFSIZ]; - union sockunion su; - struct peer *peer; - int count, ret; - u_char uj = use_json(argc, argv); - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_object *json_sub = NULL; - json_no = json_object_new_object(); - json_sub = json_object_new_object(); - json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); - json_object_object_add(json_no, "detail", json_sub); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - peer = peer_lookup (NULL, &su); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_string_add(json_no, "warning", "Peer not found"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No peer%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - if (strncmp (argv[idx_safi]->arg, "m", 1) == 0) - { - sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_MULTICAST); - count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); - if (count) - { - if (!uj) - vty_out (vty, "Address family: IPv4 Multicast%s", VTY_NEWLINE); - prefix_bgp_show_prefix_list (vty, AFI_IP, name, uj); - } - else - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_boolean_true_add(json_no, "noFuntionalOutput"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No functional output%s", VTY_NEWLINE); - } - } - else - { - sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_UNICAST); - count = prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj); - if (count) - { - if (!uj) - vty_out (vty, "Address family: IPv4 Unicast%s", VTY_NEWLINE); - prefix_bgp_show_prefix_list (vty, AFI_IP, name, uj); - } - else - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_boolean_true_add(json_no, "noFuntionalOutput"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No functional output%s", VTY_NEWLINE); - } - } - - return CMD_SUCCESS; -} -#ifdef HAVE_IPV6 -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", - * SHOW_STR - * BGP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display information received from a BGP neighbor\n" - * "Display the prefixlist filter\n" - * "JavaScript Object Notation\n" - * - */ -/* CHECK ME do we even support ORF for ipv6? */ -DEFUN (show_bgp_neighbor_received_prefix_filter, - show_bgp_neighbor_received_prefix_filter_cmd, - "show bgp neighbors received prefix-filter [json]", - SHOW_STR - BGP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "Display information received from a BGP neighbor\n" - "Display the prefixlist filter\n" - "JavaScript Object Notation\n") -{ - int idx_peer = 3; - char name[BUFSIZ]; - union sockunion su; - struct peer *peer; - int count, ret; - u_char uj = use_json(argc, argv); - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_object *json_sub = NULL; - json_no = json_object_new_object(); - json_sub = json_object_new_object(); - json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); - json_object_object_add(json_no, "detail", json_sub); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - } - else - { - peer = peer_lookup (NULL, &su); - if (! peer) - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_string_add(json_no, "warning", "No Peer"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No peer%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - sprintf (name, "%s.%d.%d", peer->host, AFI_IP6, SAFI_UNICAST); - count = prefix_bgp_show_prefix_list (NULL, AFI_IP6, name, uj); - if (count) - { - if (!uj) - vty_out (vty, "Address family: IPv6 Unicast%s", VTY_NEWLINE); - prefix_bgp_show_prefix_list (vty, AFI_IP6, name, uj); - } - else - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_boolean_true_add(json_no, "noFuntionalOutput"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "No functional output%s", VTY_NEWLINE); - } - - return CMD_SUCCESS; -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show bgp WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter [json]", - * SHOW_STR - * BGP_STR - * BGP_INSTANCE_HELP_STR - * "Address family\n" - * "Detailed information on TCP and BGP neighbor connections\n" - * "Neighbor to display information about\n" - * "Neighbor to display information about\n" - * "Neighbor on bgp configured interface\n" - * "Display information received from a BGP neighbor\n" - * "Display the prefixlist filter\n" - * "JavaScript Object NOtation\n" - * - */ -DEFUN (show_bgp_instance_neighbor_received_prefix_filter, - show_bgp_instance_neighbor_received_prefix_filter_cmd, - "show bgp WORD neighbors received prefix-filter [json]", - SHOW_STR - BGP_STR BGP_INSTANCE_HELP_STR + "Address family\n" + "Address family\n" + "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -9667,50 +9344,33 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { - int idx_word = 3; - int idx_peer = 5; + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + int idx_neighbors; + int idx_peer; + afi_t afi; + safi_t safi; char name[BUFSIZ]; union sockunion su; struct peer *peer; - struct bgp *bgp; int count, ret; u_char uj = use_json(argc, argv); - /* BGP structure lookup. */ - bgp = bgp_lookup_by_name (argv[idx_word]->arg); - if (bgp == NULL) - { - if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_string_add(json_no, "warning", "Can't find BGP view"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } - else - vty_out (vty, "Can't find BGP instance %s%s", argv[idx_word]->arg, VTY_NEWLINE); - return CMD_WARNING; - } + bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_neighbors); + idx_peer = idx_neighbors + 1; ret = str2sockunion (argv[idx_peer]->arg, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (bgp, argv[idx_peer]->arg); + peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); if (! peer) { if (uj) - { - json_object *json_no = NULL; - json_object *json_sub = NULL; - json_no = json_object_new_object(); - json_sub = json_object_new_object(); - json_object_string_add(json_no, "warning", "Malformed address or name"); - json_object_string_add(json_sub, "warningCause", argv[idx_peer]->arg); - json_object_object_add(json_no, "detail", json_sub); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } + vty_out (vty, "{}%s", VTY_NEWLINE); else vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); return CMD_WARNING; @@ -9718,36 +9378,35 @@ DEFUN (show_bgp_instance_neighbor_received_prefix_filter, } else { - peer = peer_lookup (bgp, &su); + peer = peer_lookup (NULL, &su); if (! peer) { if (uj) - { - json_object *json_no = NULL; - json_no = json_object_new_object(); - json_object_boolean_true_add(json_no, "noPeer"); - vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE); - json_object_free(json_no); - } + vty_out (vty, "{}%s", VTY_NEWLINE); else vty_out (vty, "No peer%s", VTY_NEWLINE); return CMD_WARNING; } - } - sprintf (name, "%s.%d.%d", peer->host, AFI_IP6, SAFI_UNICAST); - count = prefix_bgp_show_prefix_list (NULL, AFI_IP6, name, uj); + sprintf (name, "%s.%d.%d", peer->host, afi, safi); + count = prefix_bgp_show_prefix_list (NULL, afi, name, uj); if (count) { if (!uj) - vty_out (vty, "Address family: IPv6 Unicast%s", VTY_NEWLINE); - prefix_bgp_show_prefix_list (vty, AFI_IP6, name, uj); + vty_out (vty, "Address family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE); + prefix_bgp_show_prefix_list (vty, afi, name, uj); + } + else + { + if (uj) + vty_out (vty, "{}%s", VTY_NEWLINE); + else + vty_out (vty, "No functional output%s", VTY_NEWLINE); } return CMD_SUCCESS; } -#endif /* HAVE_IPV6 */ static int bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, @@ -9797,41 +9456,6 @@ DEFUN (show_ip_bgp_neighbor_routes, "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { - /* -bgp_show_neighbor_route (struct vty *vty, - struct peer *peer, - afi_t afi, - safi_t safi, - enum bgp_show_type type, - u_char use_json) - -enum bgp_show_type -{ - bgp_show_type_normal, - bgp_show_type_regexp, - bgp_show_type_prefix_list, - bgp_show_type_filter_list, - bgp_show_type_route_map, - bgp_show_type_neighbor, - bgp_show_type_cidr_only, - bgp_show_type_prefix_longer, - bgp_show_type_community_all, - bgp_show_type_community, - bgp_show_type_community_exact, - bgp_show_type_community_list, - bgp_show_type_community_list_exact, - bgp_show_type_flap_statistics, - bgp_show_type_flap_neighbor, - bgp_show_type_dampend_paths, - bgp_show_type_damp_neighbor -}; - - routes - bgp_show_type_neighbor - flap-statics - bgp_show_type_flap_neighbor - dampened-routes - bgp_show_type_damp_neighbor, - */ - // dwalton here now - int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -10655,7 +10279,6 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); @@ -10669,7 +10292,6 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_ip_bgp_dampening_params_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); @@ -10704,18 +10326,12 @@ bgp_route_init (void) install_element (BGP_IPV6M_NODE, &no_ipv6_bgp_network_cmd); /* Old config IPv6 BGP commands. */ - install_element (VIEW_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_cmd); - install_element (VIEW_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); /* Restricted: * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) */ - install_element (RESTRICTED_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); - - install_element (ENABLE_NODE, &show_bgp_neighbor_received_prefix_filter_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_cmd); - install_element (ENABLE_NODE, &show_bgp_instance_neighbor_received_prefix_filter_cmd); /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5b965f3f93..2b2731a890 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6279,7 +6279,6 @@ DEFUN (clear_ip_bgp_all, enum bgp_clear_type clr_type; char *clr_arg = NULL; - // dwalton vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_clr_sort); /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external> */ From 030721b7efef08e4706441172eaf4353a09bbbd3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 11:25:28 -0400 Subject: [PATCH 151/280] zebra: Refactore "ip route XXXXXX" commands Convert all 'ip route XXXX' commands to use the new syntax and collapse all functions that we can easily do. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 1225 ++++++++------------------------------------- 1 file changed, 203 insertions(+), 1022 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 005c9370b5..97fc6d2abe 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -337,26 +337,39 @@ DEFUN (show_ip_rpf_addr, return CMD_SUCCESS; } +static void +zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], + int idx_curr, char **tag, + char **distance, char **vrf) +{ + if (argc > idx_curr) + { + if (strmatch (argv[idx_curr]->text, "tag")) + { + *tag = argv[idx_curr]->arg; + idx_curr++; + } + + if (strmatch (argv[idx_curr]->text, "vrf")) + { + *distance = NULL; + *vrf = argv[idx_curr]->arg; + } + else + { + *distance = argv[idx_curr]->arg; + *vrf = argv[++idx_curr]->arg; + } + } + + return; +} + + /* Static route configuration. */ DEFUN (ip_route, ip_route_cmd, - "ip route A.B.C.D/M ", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -DEFUN (ip_route_tag, - ip_route_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -364,36 +377,29 @@ DEFUN (ip_route_tag, "IP gateway interface name\n" "Null interface\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname_null = 3; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname_null]->arg, + NULL, + tag, distance, vrf); } DEFUN (ip_route_flags, ip_route_flags_cmd, - "ip route A.B.C.D/M ", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_flags_tag, - ip_route_flags_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -402,73 +408,60 @@ DEFUN (ip_route_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname = 3; int idx_reject_blackhole = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (ip_route_flags2, ip_route_flags2_cmd, - "ip route A.B.C.D/M ", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_flags2_tag, - ip_route_flags2_tag_cmd, - "ip route A.B.C.D/M tag (1-65535)", + "ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 2; int idx_reject_blackhole = 3; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4_prefixlen]->arg, + NULL, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask, ip_route_mask_cmd, - "ip route A.B.C.D A.B.C.D ", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -DEFUN (ip_route_mask_tag, - ip_route_mask_tag_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -477,40 +470,29 @@ DEFUN (ip_route_mask_tag, "IP gateway interface name\n" "Null interface\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname_null = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname_null]->arg, + NULL, tag, distance, vrf); } DEFUN (ip_route_mask_flags, ip_route_mask_flags_cmd, - "ip route A.B.C.D A.B.C.D ", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_mask_flags_tag, - ip_route_mask_flags_tag_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -520,38 +502,32 @@ DEFUN (ip_route_mask_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") - + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } + DEFUN (ip_route_mask_flags2, ip_route_mask_flags2_cmd, - "ip route A.B.C.D A.B.C.D ", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, - NULL, NULL); -} - -DEFUN (ip_route_mask_flags2_tag, - ip_route_mask_flags2_tag_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535)", + "ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -559,267 +535,25 @@ DEFUN (ip_route_mask_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - NULL, NULL); -} - -/* Distance option value. */ -DEFUN (ip_route_distance, - ip_route_distance_cmd, - "ip route A.B.C.D/M (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_tag_distance, - ip_route_tag_distance_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n") - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_number_2 = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_flags_distance, - ip_route_flags_distance_cmd, - "ip route A.B.C.D/M (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_flags_tag_distance, - ip_route_flags_tag_distance_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_flags_distance2, - ip_route_flags_distance2_cmd, - "ip route A.B.C.D/M (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_flags_tag_distance2, - ip_route_flags_tag_distance2_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_number_2 = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_mask_distance, - ip_route_mask_distance_cmd, - "ip route A.B.C.D A.B.C.D (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_mask_tag_distance, - ip_route_mask_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (ip_route_mask_flags_tag_distance, - ip_route_mask_flags_tag_distance_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Set tag for this route\n" "Tag value\n" "Distance value for this route\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - - -DEFUN (ip_route_mask_flags_distance, - ip_route_mask_flags_distance_cmd, - "ip route A.B.C.D A.B.C.D (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (ip_route_mask_flags_distance2, - ip_route_mask_flags_distance2_cmd, - "ip route A.B.C.D A.B.C.D (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") + VRF_CMD_HELP_STR) { int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} + int idx_curr = 5; + char *tag, *distance, *vrf; -DEFUN (ip_route_mask_flags_tag_distance2, - ip_route_mask_flags_tag_distance2_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } /* @@ -887,8 +621,6 @@ DEFUN (no_ip_route_tag, NULL, NULL); } - - DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, "no ip route A.B.C.D/M ", @@ -1294,518 +1026,9 @@ DEFUN (no_ip_route_mask_flags_tag_distance2, argv[idx_number_2]->arg, NULL); } -/* Static route configuration. */ -DEFUN (ip_route_vrf, - ip_route_vrf_cmd, - "ip route A.B.C.D/M vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_name = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_tag_vrf, - ip_route_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_vrf, - ip_route_flags_vrf_cmd, - "ip route A.B.C.D/M vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_vrf, - ip_route_flags_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags2_vrf, - ip_route_flags2_vrf_cmd, - "ip route A.B.C.D/M vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_name = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags2_tag_vrf, - ip_route_flags2_tag_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -/* Mask as A.B.C.D format. */ -DEFUN (ip_route_mask_vrf, - ip_route_mask_vrf_cmd, - "ip route A.B.C.D A.B.C.D vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_tag_vrf, - ip_route_mask_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_vrf, - ip_route_mask_flags_vrf_cmd, - "ip route A.B.C.D A.B.C.D vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_tag_vrf, - ip_route_mask_flags_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags2_vrf, - ip_route_mask_flags2_vrf_cmd, - "ip route A.B.C.D A.B.C.D vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags2_tag_vrf, - ip_route_mask_flags2_tag_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -/* Distance option value. */ -DEFUN (ip_route_distance_vrf, - ip_route_distance_vrf_cmd, - "ip route A.B.C.D/M (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_tag_distance_vrf, - ip_route_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) - -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname_null = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_distance_vrf, - ip_route_flags_distance_vrf_cmd, - "ip route A.B.C.D/M (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_distance_vrf, - ip_route_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_distance2_vrf, - ip_route_flags_distance2_vrf_cmd, - "ip route A.B.C.D/M (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_flags_tag_distance2_vrf, - ip_route_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 2; - int idx_reject_blackhole = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_distance_vrf, - ip_route_mask_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_tag_distance_vrf, - ip_route_mask_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_tag_distance_vrf, - ip_route_mask_flags_tag_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - - -DEFUN (ip_route_mask_flags_distance_vrf, - ip_route_mask_flags_distance_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_distance2_vrf, - ip_route_mask_flags_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ip_route_mask_flags_tag_distance2_vrf, - ip_route_mask_flags_tag_distance2_vrf_cmd, - "ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this route\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - DEFUN (no_ip_route_vrf, no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1823,7 +1046,7 @@ DEFUN (no_ip_route_vrf, DEFUN (no_ip_route_flags_vrf, no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1843,7 +1066,7 @@ DEFUN (no_ip_route_flags_vrf, DEFUN (no_ip_route_tag_vrf, no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1864,7 +1087,7 @@ DEFUN (no_ip_route_tag_vrf, DEFUN (no_ip_route_flags_tag_vrf, no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1887,7 +1110,7 @@ DEFUN (no_ip_route_flags_tag_vrf, DEFUN (no_ip_route_flags2_vrf, no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M vrf NAME", + "no ip route A.B.C.D/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1904,7 +1127,7 @@ DEFUN (no_ip_route_flags2_vrf, DEFUN (no_ip_route_flags2_tag_vrf, no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1924,7 +1147,7 @@ DEFUN (no_ip_route_flags2_tag_vrf, DEFUN (no_ip_route_mask_vrf, no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1944,7 +1167,7 @@ DEFUN (no_ip_route_mask_vrf, DEFUN (no_ip_route_mask_flags_vrf, no_ip_route_mask_flags_vrf_cmd, - "no ip route A.B.C.D A.B.C.D vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1966,7 +1189,7 @@ DEFUN (no_ip_route_mask_flags_vrf, DEFUN (no_ip_route_mask_tag_vrf, no_ip_route_mask_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -1989,7 +1212,7 @@ DEFUN (no_ip_route_mask_tag_vrf, DEFUN (no_ip_route_mask_flags_tag_vrf, no_ip_route_mask_flags_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2014,7 +1237,7 @@ DEFUN (no_ip_route_mask_flags_tag_vrf, DEFUN (no_ip_route_mask_flags2_vrf, no_ip_route_mask_flags2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D vrf NAME", + "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2033,7 +1256,7 @@ DEFUN (no_ip_route_mask_flags2_vrf, DEFUN (no_ip_route_mask_flags2_tag_vrf, no_ip_route_mask_flags2_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2056,7 +1279,7 @@ DEFUN (no_ip_route_mask_flags2_tag_vrf, DEFUN (no_ip_route_distance_vrf, no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2076,7 +1299,7 @@ DEFUN (no_ip_route_distance_vrf, DEFUN (no_ip_route_tag_distance_vrf, no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2099,7 +1322,7 @@ DEFUN (no_ip_route_tag_distance_vrf, DEFUN (no_ip_route_flags_distance_vrf, no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2121,7 +1344,7 @@ DEFUN (no_ip_route_flags_distance_vrf, DEFUN (no_ip_route_flags_tag_distance_vrf, no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2146,7 +1369,7 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, DEFUN (no_ip_route_flags_distance2_vrf, no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (1-255) vrf NAME", + "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2165,7 +1388,7 @@ DEFUN (no_ip_route_flags_distance2_vrf, DEFUN (no_ip_route_flags_tag_distance2_vrf, no_ip_route_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2187,7 +1410,7 @@ DEFUN (no_ip_route_flags_tag_distance2_vrf, DEFUN (no_ip_route_mask_distance_vrf, no_ip_route_mask_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2209,7 +1432,7 @@ DEFUN (no_ip_route_mask_distance_vrf, DEFUN (no_ip_route_mask_tag_distance_vrf, no_ip_route_mask_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2234,7 +1457,7 @@ DEFUN (no_ip_route_mask_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance_vrf, no_ip_route_mask_flags_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2258,7 +1481,7 @@ DEFUN (no_ip_route_mask_flags_distance_vrf, DEFUN (no_ip_route_mask_flags_tag_distance_vrf, no_ip_route_mask_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2285,7 +1508,7 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, DEFUN (no_ip_route_mask_flags_distance2_vrf, no_ip_route_mask_flags_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2306,7 +1529,7 @@ DEFUN (no_ip_route_mask_flags_distance2_vrf, DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, no_ip_route_mask_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) vrf NAME", + "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -2840,7 +2063,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route vrf NAME [json]", + "show ip route " VRF_CMD_STR " [json]", SHOW_STR IP_STR "IP routing table\n" @@ -2876,7 +2099,7 @@ DEFUN (show_ip_nht, DEFUN (show_ip_nht_vrf_all, show_ip_nht_vrf_all_cmd, - "show ip nht vrf all", + "show ip nht " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -2916,7 +2139,7 @@ DEFUN (show_ipv6_nht, DEFUN (show_ipv6_nht_vrf_all, show_ipv6_nht_vrf_all_cmd, - "show ipv6 nht vrf all", + "show ipv6 nht " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 nexthop tracking table\n" @@ -3144,7 +2367,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route [vrf NAME] ", + "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -3534,7 +2757,7 @@ DEFUN (show_ip_route_summary_prefix, DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, - "show ip route vrf all", + "show ip route " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IP routing table\n" @@ -3579,7 +2802,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route vrf all tag (1-65535)", + "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -3633,7 +2856,7 @@ DEFUN (show_ip_route_vrf_all_tag, DEFUN (show_ip_route_vrf_all_prefix_longer, show_ip_route_vrf_all_prefix_longer_cmd, - "show ip route vrf all A.B.C.D/M longer-prefixes", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" @@ -3691,7 +2914,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route vrf all supernets-only", + "show ip route " VRF_ALL_CMD_STR " supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -3745,7 +2968,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route vrf all ", + "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -3800,7 +3023,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route vrf all A.B.C.D", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -3842,7 +3065,7 @@ DEFUN (show_ip_route_vrf_all_addr, DEFUN (show_ip_route_vrf_all_prefix, show_ip_route_vrf_all_prefix_cmd, - "show ip route vrf all A.B.C.D/M", + "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -3889,7 +3112,7 @@ DEFUN (show_ip_route_vrf_all_prefix, DEFUN (show_ip_route_vrf_all_summary, show_ip_route_vrf_all_summary_cmd, - "show ip route vrf all summary ", + "show ip route " VRF_ALL_CMD_STR " summary ", SHOW_STR IP_STR "IP routing table\n" @@ -3908,7 +3131,7 @@ DEFUN (show_ip_route_vrf_all_summary, DEFUN (show_ip_route_vrf_all_summary_prefix, show_ip_route_vrf_all_summary_prefix_cmd, - "show ip route vrf all summary prefix", + "show ip route " VRF_ALL_CMD_STR " summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -4718,7 +3941,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, DEFUN (ipv6_route_vrf, ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M vrf NAME", + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4734,7 +3957,7 @@ DEFUN (ipv6_route_vrf, DEFUN (ipv6_route_tag_vrf, ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4753,7 +3976,7 @@ DEFUN (ipv6_route_tag_vrf, DEFUN (ipv6_route_flags_vrf, ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M vrf NAME", + "ipv6 route X:X::X:X/M " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4772,7 +3995,7 @@ DEFUN (ipv6_route_flags_vrf, DEFUN (ipv6_route_flags_tag_vrf, ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4794,7 +4017,7 @@ DEFUN (ipv6_route_flags_tag_vrf, DEFUN (ipv6_route_ifname_vrf, ipv6_route_ifname_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4810,7 +4033,7 @@ DEFUN (ipv6_route_ifname_vrf, } DEFUN (ipv6_route_ifname_tag_vrf, ipv6_route_ifname_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4830,7 +4053,7 @@ DEFUN (ipv6_route_ifname_tag_vrf, DEFUN (ipv6_route_ifname_flags_vrf, ipv6_route_ifname_flags_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4850,7 +4073,7 @@ DEFUN (ipv6_route_ifname_flags_vrf, DEFUN (ipv6_route_ifname_flags_tag_vrf, ipv6_route_ifname_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4873,7 +4096,7 @@ DEFUN (ipv6_route_ifname_flags_tag_vrf, DEFUN (ipv6_route_pref_vrf, ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) vrf NAME", + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4891,7 +4114,7 @@ DEFUN (ipv6_route_pref_vrf, DEFUN (ipv6_route_pref_tag_vrf, ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4912,7 +4135,7 @@ DEFUN (ipv6_route_pref_tag_vrf, DEFUN (ipv6_route_flags_pref_vrf, ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) vrf NAME", + "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4933,7 +4156,7 @@ DEFUN (ipv6_route_flags_pref_vrf, DEFUN (ipv6_route_flags_pref_tag_vrf, ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4957,7 +4180,7 @@ DEFUN (ipv6_route_flags_pref_tag_vrf, DEFUN (ipv6_route_ifname_pref_vrf, ipv6_route_ifname_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4976,7 +4199,7 @@ DEFUN (ipv6_route_ifname_pref_vrf, DEFUN (ipv6_route_ifname_pref_tag_vrf, ipv6_route_ifname_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -4998,7 +4221,7 @@ DEFUN (ipv6_route_ifname_pref_tag_vrf, DEFUN (ipv6_route_ifname_flags_pref_vrf, ipv6_route_ifname_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -5020,7 +4243,7 @@ DEFUN (ipv6_route_ifname_flags_pref_vrf, DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -5045,7 +4268,7 @@ DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M vrf NAME", + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5062,7 +4285,7 @@ DEFUN (no_ipv6_route_vrf, DEFUN (no_ipv6_route_tag_vrf, no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5082,7 +4305,7 @@ DEFUN (no_ipv6_route_tag_vrf, DEFUN (no_ipv6_route_flags_vrf, no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M vrf NAME", + "no ipv6 route X:X::X:X/M " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5102,7 +4325,7 @@ DEFUN (no_ipv6_route_flags_vrf, DEFUN (no_ipv6_route_flags_tag_vrf, no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5125,7 +4348,7 @@ DEFUN (no_ipv6_route_flags_tag_vrf, DEFUN (no_ipv6_route_ifname_vrf, no_ipv6_route_ifname_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5143,7 +4366,7 @@ DEFUN (no_ipv6_route_ifname_vrf, DEFUN (no_ipv6_route_ifname_tag_vrf, no_ipv6_route_ifname_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5164,7 +4387,7 @@ DEFUN (no_ipv6_route_ifname_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_vrf, no_ipv6_route_ifname_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5185,7 +4408,7 @@ DEFUN (no_ipv6_route_ifname_flags_vrf, DEFUN (no_ipv6_route_ifname_flags_tag_vrf, no_ipv6_route_ifname_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5209,7 +4432,7 @@ DEFUN (no_ipv6_route_ifname_flags_tag_vrf, DEFUN (no_ipv6_route_pref_vrf, no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5228,7 +4451,7 @@ DEFUN (no_ipv6_route_pref_vrf, DEFUN (no_ipv6_route_pref_tag_vrf, no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5250,7 +4473,7 @@ DEFUN (no_ipv6_route_pref_tag_vrf, DEFUN (no_ipv6_route_flags_pref_vrf, no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5273,7 +4496,7 @@ DEFUN (no_ipv6_route_flags_pref_vrf, DEFUN (no_ipv6_route_flags_pref_tag_vrf, no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5299,7 +4522,7 @@ DEFUN (no_ipv6_route_flags_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_pref_vrf, no_ipv6_route_ifname_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5319,7 +4542,7 @@ DEFUN (no_ipv6_route_ifname_pref_vrf, DEFUN (no_ipv6_route_ifname_pref_tag_vrf, no_ipv6_route_ifname_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5342,7 +4565,7 @@ DEFUN (no_ipv6_route_ifname_pref_tag_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_vrf, no_ipv6_route_ifname_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5365,7 +4588,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_vrf, DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, no_ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) vrf NAME", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, NO_STR IP_STR "Establish static routes\n" @@ -5391,7 +4614,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route vrf NAME [json]", + * "show ipv6 route " VRF_CMD_STR " [json]", * SHOW_STR * IP_STR * "IPv6 routing table\n" @@ -5597,7 +4820,7 @@ DEFUN (show_ipv6_route_prefix_longer, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route vrf NAME ", + * "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, * SHOW_STR * IP_STR * "IP routing table\n" @@ -5607,7 +4830,7 @@ DEFUN (show_ipv6_route_prefix_longer, */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route ", + "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -5846,7 +5069,7 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route vrf all", + "show ipv6 route " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 routing table\n" @@ -5891,7 +5114,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route vrf all tag (1-65535)", + "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -5946,7 +5169,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route vrf all X:X::X:X/M longer-prefixes", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6004,7 +5227,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route vrf all ", + "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -6059,7 +5282,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, - "show ipv6 route vrf all X:X::X:X", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6101,7 +5324,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, DEFUN (show_ipv6_route_vrf_all_prefix, show_ipv6_route_vrf_all_prefix_cmd, - "show ipv6 route vrf all X:X::X:X/M", + "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6148,7 +5371,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, DEFUN (show_ipv6_route_vrf_all_summary, show_ipv6_route_vrf_all_summary_cmd, - "show ipv6 route vrf all summary", + "show ipv6 route " VRF_ALL_CMD_STR " summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6167,7 +5390,7 @@ DEFUN (show_ipv6_route_vrf_all_summary, DEFUN (show_ipv6_mroute_vrf_all, show_ipv6_mroute_vrf_all_cmd, - "show ipv6 mroute vrf all", + "show ipv6 mroute " VRF_ALL_CMD_STR, SHOW_STR IP_STR "IPv6 Multicast routing table\n" @@ -6203,7 +5426,7 @@ DEFUN (show_ipv6_mroute_vrf_all, DEFUN (show_ipv6_route_vrf_all_summary_prefix, show_ipv6_route_vrf_all_summary_prefix_cmd, - "show ipv6 route vrf all summary prefix", + "show ipv6 route " VRF_ALL_CMD_STR " summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" @@ -6540,17 +5763,11 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ip_multicast_mode_cmd); install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd); install_element (CONFIG_NODE, &ip_route_cmd); - install_element (CONFIG_NODE, &ip_route_tag_cmd); install_element (CONFIG_NODE, &ip_route_flags_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_cmd); install_element (CONFIG_NODE, &ip_route_flags2_cmd); - install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd); install_element (CONFIG_NODE, &ip_route_mask_cmd); - install_element (CONFIG_NODE, &ip_route_mask_tag_cmd); install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd); install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_cmd); install_element (CONFIG_NODE, &no_ip_route_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); @@ -6559,18 +5776,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd); - install_element (CONFIG_NODE, &ip_route_distance_cmd); - install_element (CONFIG_NODE, &ip_route_tag_distance_cmd); - install_element (CONFIG_NODE, &ip_route_flags_distance_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd); - install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd); - install_element (CONFIG_NODE, &ip_route_mask_distance_cmd); - install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd); install_element (CONFIG_NODE, &no_ip_route_distance_cmd); install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd); install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd); @@ -6625,18 +5830,6 @@ zebra_vty_init (void) /* Commands for VRF */ - install_element (CONFIG_NODE, &ip_route_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd); @@ -6649,18 +5842,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd); install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); From fb5b479d9d6bae7d80923f81fa214fe244a0a943 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 08:10:57 -0400 Subject: [PATCH 152/280] zebra: Fixup 'no ip route....' Rework the 'no ip route XXXX' commands to use the new cli and collapse all DEFUN's that we could into a much smaller set of commands. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 1032 ++++----------------------------------------- 1 file changed, 92 insertions(+), 940 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 97fc6d2abe..abdab53e40 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -556,54 +556,9 @@ DEFUN (ip_route_mask_flags2, tag, distance, vrf); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix (e.g. 10.0.0.0/8)\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * - */ DEFUN (no_ip_route, no_ip_route_cmd, - "no ip route A.B.C.D/M ", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix (e.g. 10.0.0.0/8)\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * "Tag of this route\n" - * "Tag value\n" - * - */ -DEFUN (no_ip_route_tag, - no_ip_route_tag_cmd, - "no ip route A.B.C.D/M tag (1-65535)", + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -612,33 +567,29 @@ DEFUN (no_ip_route_tag, "IP gateway interface name\n" "Null interface\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname_null = 4; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname_null]->arg, + NULL, + tag, distance, vrf); } DEFUN (no_ip_route_flags2, no_ip_route_flags2_cmd, - "no ip route A.B.C.D/M ", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4_prefixlen = 3; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, NULL, NULL, - NULL, NULL); -} - -DEFUN (no_ip_route_flags2_tag, - no_ip_route_flags2_tag_cmd, - "no ip route A.B.C.D/M tag (1-65535)", + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -646,66 +597,26 @@ DEFUN (no_ip_route_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, NULL, argv[idx_reject_blackhole]->arg, - NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, NULL, NULL, + tag, distance, vrf); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix\n" - * "IP destination prefix mask\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * - */ DEFUN (no_ip_route_mask, no_ip_route_mask_cmd, - "no ip route A.B.C.D A.B.C.D ", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - NULL, NULL); -} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>", - * NO_STR - * IP_STR - * "Establish static routes\n" - * "IP destination prefix\n" - * "IP destination prefix mask\n" - * "IP gateway address\n" - * "IP gateway interface name\n" - * "Emit an ICMP unreachable when matched\n" - * "Silently discard pkts when matched\n" - * "Tag of this route\n" - * "Tag value\n" - * - */ -DEFUN (no_ip_route_mask_tag, - no_ip_route_mask_tag_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535)", + "no ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -715,38 +626,30 @@ DEFUN (no_ip_route_mask_tag, "IP gateway interface name\n" "Null interface\n" "Tag of this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this route\n" + VRF_CMD_HELP_STR) { int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname_null = 5; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname_null]->arg, + NULL, + tag, distance, vrf); } - - DEFUN (no_ip_route_mask_flags2, no_ip_route_mask_flags2_cmd, - "no ip route A.B.C.D A.B.C.D ", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, NULL, - NULL, NULL); -} - -DEFUN (no_ip_route_mask_flags2_tag, - no_ip_route_mask_flags2_tag_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535)", + "no ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -755,596 +658,28 @@ DEFUN (no_ip_route_mask_flags2_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Tag of this route\n" - "Tag value\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, - NULL, NULL); -} - -DEFUN (no_ip_route_distance, - no_ip_route_distance_cmd, - "no ip route A.B.C.D/M (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_tag_distance, - no_ip_route_tag_distance_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_flags_distance, - no_ip_route_flags_distance_cmd, - "no ip route A.B.C.D/M (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_flags_tag_distance, - no_ip_route_flags_tag_distance_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_flags_distance2, - no_ip_route_flags_distance2_cmd, - "no ip route A.B.C.D/M (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_flags_tag_distance2, - no_ip_route_flags_tag_distance2_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_mask_distance, - no_ip_route_mask_distance_cmd, - "no ip route A.B.C.D A.B.C.D (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_mask_tag_distance, - no_ip_route_mask_tag_distance_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_mask_flags_distance, - no_ip_route_mask_flags_distance_cmd, - "no ip route A.B.C.D A.B.C.D (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_mask_flags_tag_distance, - no_ip_route_mask_flags_tag_distance_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_mask_flags_distance2, - no_ip_route_mask_flags_distance2_cmd, - "no ip route A.B.C.D A.B.C.D (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, - argv[idx_number]->arg, NULL); -} - -DEFUN (no_ip_route_mask_flags_tag_distance2, - no_ip_route_mask_flags_tag_distance2_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n") -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, - argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ip_route_vrf, - no_ip_route_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_vrf, - no_ip_route_flags_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_tag_vrf, - no_ip_route_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_vrf, - no_ip_route_flags_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags2_vrf, - no_ip_route_flags2_vrf_cmd, - "no ip route A.B.C.D/M " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags2_tag_vrf, - no_ip_route_flags2_tag_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_vrf, - no_ip_route_mask_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags_vrf, - no_ip_route_mask_flags_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_tag_vrf, - no_ip_route_mask_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags_tag_vrf, - no_ip_route_mask_flags_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags2_vrf, - no_ip_route_mask_flags2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags2_tag_vrf, - no_ip_route_mask_flags2_tag_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - - -DEFUN (no_ip_route_distance_vrf, - no_ip_route_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_tag_distance_vrf, - no_ip_route_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" "Tag value\n" "Distance value for this route\n" VRF_CMD_HELP_STR) { - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname_null = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_ipv4 = 3; + int idx_ipv4_2 = 4; + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + NULL, NULL, + tag, distance, vrf); } -DEFUN (no_ip_route_flags_distance_vrf, - no_ip_route_flags_distance_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_distance_vrf, - no_ip_route_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, +DEFUN (no_ip_route_flags, + no_ip_route_flags_cmd, + "no ip route A.B.C.D/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -1361,127 +696,23 @@ DEFUN (no_ip_route_flags_tag_distance_vrf, int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg,argv[idx_name]->arg); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4_prefixlen]->arg, + NULL, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } -DEFUN (no_ip_route_flags_distance2_vrf, - no_ip_route_flags_distance2_vrf_cmd, - "no ip route A.B.C.D/M (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_flags_tag_distance2_vrf, - no_ip_route_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D/M tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix (e.g. 10.0.0.0/8)\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4_prefixlen = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg , argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_distance_vrf, - no_ip_route_mask_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_tag_distance_vrf, - no_ip_route_mask_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Null interface\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname_null = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname_null]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags_distance_vrf, - no_ip_route_mask_flags_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "IP gateway address\n" - "IP gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_ipv4_ifname = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - int idx_name = 9; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags_tag_distance_vrf, - no_ip_route_mask_flags_tag_distance_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, +DEFUN (no_ip_route_mask_flags, + no_ip_route_mask_flags_cmd, + "no ip route A.B.C.D A.B.C.D [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -1500,56 +731,20 @@ DEFUN (no_ip_route_mask_flags_tag_distance_vrf, int idx_ipv4_2 = 4; int idx_ipv4_ifname = 5; int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - int idx_name = 11; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, argv[idx_ipv4_ifname]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_curr = 7; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, + argv[idx_ipv4]->arg, + argv[idx_ipv4_2]->arg, + argv[idx_ipv4_ifname]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } -DEFUN (no_ip_route_mask_flags_distance2_vrf, - no_ip_route_mask_flags_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ip_route_mask_flags_tag_distance2_vrf, - no_ip_route_mask_flags_tag_distance2_vrf_cmd, - "no ip route A.B.C.D A.B.C.D tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IP destination prefix\n" - "IP destination prefix mask\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Tag of this route\n" - "Tag value\n" - "Distance value for this route\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} /* New RIB. Detailed information for IPv4 route. */ static void @@ -5769,25 +4964,9 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ip_route_mask_flags_cmd); install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd); install_element (CONFIG_NODE, &no_ip_route_cmd); - install_element (CONFIG_NODE, &no_ip_route_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_flags2_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd); - install_element (CONFIG_NODE, &no_ip_route_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_routemap_cmd); install_element (CONFIG_NODE, &no_ip_zebra_import_table_cmd); @@ -5830,30 +5009,8 @@ zebra_vty_init (void) /* Commands for VRF */ - install_element (CONFIG_NODE, &no_ip_route_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd); - install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd); + install_element (CONFIG_NODE, &no_ip_route_flags_cmd); + install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_cmd); install_element (ENABLE_NODE, &show_ip_route_vrf_cmd); @@ -5877,7 +5034,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ip_route_vrf_all_summary_cmd); install_element (ENABLE_NODE, &show_ip_route_vrf_all_summary_prefix_cmd); -#ifdef HAVE_IPV6 install_element (CONFIG_NODE, &ipv6_route_cmd); install_element (CONFIG_NODE, &ipv6_route_flags_cmd); install_element (CONFIG_NODE, &ipv6_route_ifname_cmd); @@ -5969,8 +5125,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd); - - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd); @@ -5988,8 +5142,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_cmd); install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd); -#endif /* HAVE_IPV6 */ } From 96121d19fa270325a4d3860e130c3a5d0d057639 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 09:23:26 -0400 Subject: [PATCH 153/280] zebra: Refactor 'ipv6 route XXXX' for new cli Take existing code for 'ipv6 route XXX' and refactor to use the new cli. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 650 +++++----------------------------------------- 1 file changed, 63 insertions(+), 587 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index abdab53e40..ea911653fa 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2527,55 +2527,36 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, DEFUN (ipv6_route, ipv6_route_cmd, - "ipv6 route X:X::X:X/M ", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); -} - -DEFUN (ipv6_route_tag, - ipv6_route_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535)", + "ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 4; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, NULL, + tag, distance, vrf); } + DEFUN (ipv6_route_flags, ipv6_route_flags_cmd, - "ipv6 route X:X::X:X/M ", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (ipv6_route_flags_tag, - ipv6_route_flags_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535)", + "ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2583,144 +2564,62 @@ DEFUN (ipv6_route_flags_tag, "IPv6 gateway interface name\n" "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" + "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_reject_blackhole = 4; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (ipv6_route_ifname, ipv6_route_ifname_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, NULL); -} -DEFUN (ipv6_route_ifname_tag, - ipv6_route_ifname_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + NULL, + tag, distance, vrf); } DEFUN (ipv6_route_ifname_flags, ipv6_route_ifname_flags_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE ", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (ipv6_route_ifname_flags_tag, - ipv6_route_ifname_flags_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); -} - -DEFUN (ipv6_route_pref, - ipv6_route_pref_cmd, - "ipv6 route X:X::X:X/M (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 4; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_route_pref_tag, - ipv6_route_pref_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_number_2 = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ipv6_route_flags_pref, - ipv6_route_flags_pref_cmd, - "ipv6 route X:X::X:X/M (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_route_flags_pref_tag, - ipv6_route_flags_pref_tag_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255)", + "ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2730,94 +2629,25 @@ DEFUN (ipv6_route_flags_pref_tag, "Silently discard pkts when matched\n" "Set tag for this route\n" "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ipv6_route_ifname_pref, - ipv6_route_ifname_pref_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (ipv6_route_ifname_pref_tag, - ipv6_route_ifname_pref_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (ipv6_route_ifname_flags_pref, - ipv6_route_ifname_flags_pref_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n") + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; int idx_reject_blackhole = 5; - int idx_number = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} + int idx_curr = 6; + char *tag, *distance, *vrf; -DEFUN (ipv6_route_ifname_flags_pref_tag, - ipv6_route_ifname_flags_pref_tag_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 1, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (no_ipv6_route, @@ -3134,332 +2964,6 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag, return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); } -DEFUN (ipv6_route_vrf, - ipv6_route_vrf_cmd, - "ipv6 route X:X::X:X/M " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_name = 5; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_tag_vrf, - ipv6_route_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_vrf, - ipv6_route_flags_vrf_cmd, - "ipv6 route X:X::X:X/M " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_tag_vrf, - ipv6_route_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_vrf, - ipv6_route_ifname_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} -DEFUN (ipv6_route_ifname_tag_vrf, - ipv6_route_ifname_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_flags_vrf, - ipv6_route_ifname_flags_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_flags_tag_vrf, - ipv6_route_ifname_flags_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_pref_vrf, - ipv6_route_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 4; - int idx_name = 6; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_pref_tag_vrf, - ipv6_route_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_number = 5; - int idx_number_2 = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_pref_vrf, - ipv6_route_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_flags_pref_tag_vrf, - ipv6_route_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6_ifname = 3; - int idx_reject_blackhole = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_pref_vrf, - ipv6_route_ifname_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_pref_tag_vrf, - ipv6_route_ifname_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_flags_pref_vrf, - ipv6_route_ifname_flags_pref_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (ipv6_route_ifname_flags_pref_tag_vrf, - ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 2; - int idx_ipv6 = 3; - int idx_interface = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return static_ipv6_func (vty, 1, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} DEFUN (no_ipv6_route_vrf, no_ipv6_route_vrf_cmd, @@ -5042,22 +4546,10 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); - install_element (CONFIG_NODE, &ipv6_route_pref_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd); install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd); install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd); - install_element (CONFIG_NODE, &ipv6_route_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd); install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd); install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd); @@ -5092,30 +4584,14 @@ zebra_vty_init (void) /* Commands for VRF */ - install_element (CONFIG_NODE, &ipv6_route_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_vrf_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd); From 28dadafced1b918b9095d22ffc6a3bfe6349d6f7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 10:01:50 -0400 Subject: [PATCH 154/280] zebra: Refactor 'no ipv6 route XXXX' for new cli Refactor the 'no ipv6 route XXXX' commands to work under the new cli and to collapse the code to a much smaller set. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 688 ++++------------------------------------------ 1 file changed, 60 insertions(+), 628 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ea911653fa..121c0c0c04 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2406,7 +2406,6 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) return write; } -#ifdef HAVE_IPV6 /* General fucntion for IPv6 static route. */ static int static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, @@ -2652,22 +2651,7 @@ DEFUN (ipv6_route_ifname_flags, DEFUN (no_ipv6_route, no_ipv6_route_cmd, - "no ipv6 route X:X::X:X/M ", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_tag, - no_ipv6_route_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535)", + "no ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2675,35 +2659,28 @@ DEFUN (no_ipv6_route_tag, "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; - int idx_number = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, NULL, + tag, distance, vrf); } DEFUN (no_ipv6_route_flags, no_ipv6_route_flags_cmd, - "no ipv6 route X:X::X:X/M ", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_flags_tag, - no_ipv6_route_flags_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535)", + "no ipv6 route X:X::X:X/M [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2713,34 +2690,30 @@ DEFUN (no_ipv6_route_flags_tag, "Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_reject_blackhole = 5; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 5; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6_ifname]->arg, + NULL, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } DEFUN (no_ipv6_route_ifname, no_ipv6_route_ifname_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_ifname_tag, - no_ipv6_route_ifname_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2748,546 +2721,30 @@ DEFUN (no_ipv6_route_ifname_tag, "IPv6 gateway address\n" "IPv6 gateway interface name\n" "Set tag for this route\n" - "Tag value\n") + "Tag value\n" + "Distance value for this prefix\n" + VRF_CMD_HELP_STR) { int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, NULL); + int idx_curr = 6; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + NULL, + tag, distance, vrf); } DEFUN (no_ipv6_route_ifname_flags, no_ipv6_route_ifname_flags_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE ", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, NULL); -} - -DEFUN (no_ipv6_route_ifname_flags_tag, - no_ipv6_route_ifname_flags_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, NULL); -} - -DEFUN (no_ipv6_route_pref, - no_ipv6_route_pref_cmd, - "no ipv6 route X:X::X:X/M (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 5; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_pref_tag, - no_ipv6_route_pref_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_number_2 = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ipv6_route_flags_pref, - no_ipv6_route_flags_pref_cmd, - "no ipv6 route X:X::X:X/M (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_flags_pref_tag, - no_ipv6_route_flags_pref_tag_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ipv6_route_ifname_pref, - no_ipv6_route_ifname_pref_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_ifname_pref_tag, - no_ipv6_route_ifname_pref_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_number_2 = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - -DEFUN (no_ipv6_route_ifname_flags_pref, - no_ipv6_route_ifname_flags_pref_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, NULL); -} - -DEFUN (no_ipv6_route_ifname_flags_pref_tag, - no_ipv6_route_ifname_flags_pref_tag_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255)", - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n") -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, NULL); -} - - -DEFUN (no_ipv6_route_vrf, - no_ipv6_route_vrf_cmd, - "no ipv6 route X:X::X:X/M " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_name = 6; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_tag_vrf, - no_ipv6_route_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_vrf, - no_ipv6_route_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_tag_vrf, - no_ipv6_route_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_vrf, - no_ipv6_route_ifname_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_tag_vrf, - no_ipv6_route_ifname_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_flags_vrf, - no_ipv6_route_ifname_flags_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_flags_tag_vrf, - no_ipv6_route_ifname_flags_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_name = 10; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, NULL, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_pref_vrf, - no_ipv6_route_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 5; - int idx_name = 7; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_pref_tag_vrf, - no_ipv6_route_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_number = 6; - int idx_number_2 = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_pref_vrf, - no_ipv6_route_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 6; - int idx_name = 8; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_flags_pref_tag_vrf, - no_ipv6_route_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6_ifname = 4; - int idx_reject_blackhole = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - /* We do not care about argv[idx_reject_blackhole]->arg */ - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6_ifname]->arg, NULL, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_pref_vrf, - no_ipv6_route_ifname_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 6; - int idx_name = 8; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_pref_tag_vrf, - no_ipv6_route_ifname_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Set tag for this route\n" - "Tag value\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_number = 7; - int idx_number_2 = 8; - int idx_name = 10; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, NULL, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_flags_pref_vrf, - no_ipv6_route_ifname_flags_pref_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) " VRF_CMD_STR, - NO_STR - IP_STR - "Establish static routes\n" - "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" - "IPv6 gateway address\n" - "IPv6 gateway interface name\n" - "Emit an ICMP unreachable when matched\n" - "Silently discard pkts when matched\n" - "Distance value for this prefix\n" - VRF_CMD_HELP_STR) -{ - int idx_ipv6_prefixlen = 3; - int idx_ipv6 = 4; - int idx_interface = 5; - int idx_reject_blackhole = 6; - int idx_number = 7; - int idx_name = 9; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, NULL, argv[idx_number]->arg, argv[idx_name]->arg); -} - -DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, - no_ipv6_route_ifname_flags_pref_tag_vrf_cmd, - "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-65535) (1-255) " VRF_CMD_STR, + "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE [tag (1-65535)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -3305,10 +2762,18 @@ DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf, int idx_ipv6 = 4; int idx_interface = 5; int idx_reject_blackhole = 6; - int idx_number = 8; - int idx_number_2 = 9; - int idx_name = 11; - return static_ipv6_func (vty, 0, argv[idx_ipv6_prefixlen]->arg, argv[idx_ipv6]->arg, argv[idx_interface]->arg, argv[idx_reject_blackhole]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_name]->arg); + int idx_curr = 7; + char *tag, *distance, *vrf; + + tag = distance = vrf = NULL; + zebra_vty_ip_route_tdv_helper (argc, argv, idx_curr, &tag, &distance, &vrf); + + return static_ipv6_func (vty, 0, + argv[idx_ipv6_prefixlen]->arg, + argv[idx_ipv6]->arg, + argv[idx_interface]->arg, + argv[idx_reject_blackhole]->arg, + tag, distance, vrf); } /* @@ -4204,7 +3669,6 @@ static_config_ipv6 (struct vty *vty) } return write; } -#endif /* HAVE_IPV6 */ DEFUN (allow_external_route_update, allow_external_route_update_cmd, @@ -4261,9 +3725,7 @@ zebra_ip_config (struct vty *vty) write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); -#ifdef HAVE_IPV6 write += static_config_ipv6 (vty); -#endif /* HAVE_IPV6 */ write += zebra_import_table_config (vty); return write; @@ -4546,18 +4008,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd); install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd); install_element (CONFIG_NODE, &ip_nht_default_route_cmd); install_element (CONFIG_NODE, &no_ip_nht_default_route_cmd); install_element (CONFIG_NODE, &ipv6_nht_default_route_cmd); @@ -4583,24 +4033,6 @@ zebra_vty_init (void) install_element (ENABLE_NODE, &show_ipv6_mroute_cmd); /* Commands for VRF */ - - install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd); - install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd); From 5bebf56884d86291cdf95825a79aea420b6fe93f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 26 Sep 2016 11:51:10 -0400 Subject: [PATCH 155/280] zebra: Put back missing code When pulling forward the zebra_vty.c changes I accidently dropped these changes from earlier commits. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 121c0c0c04..a9f0e87017 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1258,7 +1258,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, DEFUN (show_ip_route_vrf, show_ip_route_vrf_cmd, - "show ip route " VRF_CMD_STR " [json]", + "show ip route vrf NAME [json]", SHOW_STR IP_STR "IP routing table\n" @@ -1294,7 +1294,7 @@ DEFUN (show_ip_nht, DEFUN (show_ip_nht_vrf_all, show_ip_nht_vrf_all_cmd, - "show ip nht " VRF_ALL_CMD_STR, + "show ip nht vrf all", SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -1334,7 +1334,7 @@ DEFUN (show_ipv6_nht, DEFUN (show_ipv6_nht_vrf_all, show_ipv6_nht_vrf_all_cmd, - "show ipv6 nht " VRF_ALL_CMD_STR, + "show ipv6 nht vrf all", SHOW_STR IP_STR "IPv6 nexthop tracking table\n" @@ -1952,7 +1952,7 @@ DEFUN (show_ip_route_summary_prefix, DEFUN (show_ip_route_vrf_all, show_ip_route_vrf_all_cmd, - "show ip route " VRF_ALL_CMD_STR, + "show ip route vrf all", SHOW_STR IP_STR "IP routing table\n" @@ -1997,7 +1997,7 @@ DEFUN (show_ip_route_vrf_all, DEFUN (show_ip_route_vrf_all_tag, show_ip_route_vrf_all_tag_cmd, - "show ip route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ip route vrf all tag (1-65535)", SHOW_STR IP_STR "IP routing table\n" @@ -2051,7 +2051,7 @@ DEFUN (show_ip_route_vrf_all_tag, DEFUN (show_ip_route_vrf_all_prefix_longer, show_ip_route_vrf_all_prefix_longer_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M longer-prefixes", + "show ip route vrf all A.B.C.D/M longer-prefixes", SHOW_STR IP_STR "IP routing table\n" @@ -2109,7 +2109,7 @@ DEFUN (show_ip_route_vrf_all_prefix_longer, DEFUN (show_ip_route_vrf_all_supernets, show_ip_route_vrf_all_supernets_cmd, - "show ip route " VRF_ALL_CMD_STR " supernets-only", + "show ip route vrf all supernets-only", SHOW_STR IP_STR "IP routing table\n" @@ -2163,7 +2163,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route vrf all " QUAGGA_IP_REDIST_STR_ZEBRA, SHOW_STR IP_STR "IP routing table\n" @@ -2218,7 +2218,7 @@ DEFUN (show_ip_route_vrf_all_protocol, DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D", + "show ip route vrf all A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -2260,7 +2260,7 @@ DEFUN (show_ip_route_vrf_all_addr, DEFUN (show_ip_route_vrf_all_prefix, show_ip_route_vrf_all_prefix_cmd, - "show ip route " VRF_ALL_CMD_STR " A.B.C.D/M", + "show ip route vrf all A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -2307,7 +2307,7 @@ DEFUN (show_ip_route_vrf_all_prefix, DEFUN (show_ip_route_vrf_all_summary, show_ip_route_vrf_all_summary_cmd, - "show ip route " VRF_ALL_CMD_STR " summary ", + "show ip route vrf all summary ", SHOW_STR IP_STR "IP routing table\n" @@ -2326,7 +2326,7 @@ DEFUN (show_ip_route_vrf_all_summary, DEFUN (show_ip_route_vrf_all_summary_prefix, show_ip_route_vrf_all_summary_prefix_cmd, - "show ip route " VRF_ALL_CMD_STR " summary prefix", + "show ip route vrf all summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -2994,11 +2994,11 @@ DEFUN (show_ipv6_route_prefix_longer, */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route ", SHOW_STR IP_STR "IP routing table\n" - QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) + QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { int idx_protocol = 3; int type; @@ -3233,7 +3233,7 @@ DEFUN (show_ipv6_mroute, DEFUN (show_ipv6_route_vrf_all, show_ipv6_route_vrf_all_cmd, - "show ipv6 route " VRF_ALL_CMD_STR, + "show ipv6 route vrf all", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3278,7 +3278,7 @@ DEFUN (show_ipv6_route_vrf_all, DEFUN (show_ipv6_route_vrf_all_tag, show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " tag (1-65535)", + "show ipv6 route vrf all tag (1-65535)", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3333,7 +3333,7 @@ DEFUN (show_ipv6_route_vrf_all_tag, DEFUN (show_ipv6_route_vrf_all_prefix_longer, show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M longer-prefixes", + "show ipv6 route vrf all X:X::X:X/M longer-prefixes", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3391,7 +3391,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix_longer, DEFUN (show_ipv6_route_vrf_all_protocol, show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, + "show ipv6 route vrf all ", SHOW_STR IP_STR "IP routing table\n" @@ -3446,7 +3446,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X", + "show ipv6 route vrf all X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3488,7 +3488,7 @@ DEFUN (show_ipv6_route_vrf_all_addr, DEFUN (show_ipv6_route_vrf_all_prefix, show_ipv6_route_vrf_all_prefix_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " X:X::X:X/M", + "show ipv6 route vrf all X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3535,7 +3535,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix, DEFUN (show_ipv6_route_vrf_all_summary, show_ipv6_route_vrf_all_summary_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " summary", + "show ipv6 route vrf all summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -3554,7 +3554,7 @@ DEFUN (show_ipv6_route_vrf_all_summary, DEFUN (show_ipv6_mroute_vrf_all, show_ipv6_mroute_vrf_all_cmd, - "show ipv6 mroute " VRF_ALL_CMD_STR, + "show ipv6 mroute vrf all", SHOW_STR IP_STR "IPv6 Multicast routing table\n" @@ -3590,7 +3590,7 @@ DEFUN (show_ipv6_mroute_vrf_all, DEFUN (show_ipv6_route_vrf_all_summary_prefix, show_ipv6_route_vrf_all_summary_prefix_cmd, - "show ipv6 route " VRF_ALL_CMD_STR " summary prefix", + "show ipv6 route vrf all summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" From 31500417e45002f3bbc7850d7b60d854a7333fea Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Mon, 26 Sep 2016 23:50:02 +0000 Subject: [PATCH 156/280] bgpd: fixed more CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 60 ++---- bgpd/bgp_vty.c | 551 ++++++++--------------------------------------- 2 files changed, 110 insertions(+), 501 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d5dc37a03c..712d9fda76 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,17 +7732,14 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7799,9 +7796,6 @@ DEFUN (show_ip_bgp_ipv4, return CMD_WARNING; } - // "show [ip] bgp [ WORD] [] - // [cidr-only|<[dampening] >|regexp .LINE|prefix-list WORD|filter-list WORD| - // community []|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes] [json]", if (strmatch(argv[idx_sh_type]->text, "cidr-only")) return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); @@ -7863,13 +7857,13 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [] [bestpath|multipath] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [bestpath|multipath] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" + "Address family\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7878,8 +7872,6 @@ DEFUN (show_ip_bgp_route, "Address Family modifier\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" - "Address family\n" - "Address Family modifier\n" "Network in the BGP routing table to display\n" "IP prefix /, e.g., 35.0.0.0/8\n" "IPv6 prefix /\n" @@ -9256,17 +9248,14 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [] WORD [] neighbors [] [json]", + "show [ip] bgp [] WORD [< [unicast]|ipv4 multicast>] neighbors [] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9432,17 +9421,14 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show [ip] bgp [ WORD] [] neighbors [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] neighbors [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9783,21 +9769,9 @@ DEFUN (no_bgp_distance_source_access_list, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "bgp dampening", - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * - * "bgp dampening <1-45>", - * "BGP Specific commands\n" - * "Enable route-flap dampening\n" - * "Half-life time for the penalty\n" - * - */ DEFUN (bgp_damp_set, bgp_damp_set_cmd, - "bgp dampening (1-45) (1-20000) (1-20000) (1-255)", + "bgp dampening [(1-45) [(1-20000) (1-20000) (1-255)]]", "BGP Specific commands\n" "Enable route-flap dampening\n" "Half-life time for the penalty\n" @@ -9805,26 +9779,26 @@ DEFUN (bgp_damp_set, "Value to start suppressing a route\n" "Maximum duration to suppress a stable route\n") { - int idx_number = 2; - int idx_number_2 = 3; - int idx_number_3 = 4; - int idx_number_4 = 5; + int idx_half_life = 2; + int idx_reuse = 3; + int idx_suppress = 4; + int idx_max_suppress = 5; struct bgp *bgp; int half = DEFAULT_HALF_LIFE * 60; int reuse = DEFAULT_REUSE; int suppress = DEFAULT_SUPPRESS; int max = 4 * half; - if (argc == 4) + if (argc == 6) { - half = atoi (argv[idx_number]->arg) * 60; - reuse = atoi (argv[idx_number_2]->arg); - suppress = atoi (argv[idx_number_3]->arg); - max = atoi (argv[idx_number_4]->arg) * 60; + half = atoi (argv[idx_half_life]->arg) * 60; + reuse = atoi (argv[idx_reuse]->arg); + suppress = atoi (argv[idx_suppress]->arg); + max = atoi (argv[idx_max_suppress]->arg) * 60; } - else if (argc == 1) + else if (argc == 3) { - half = atoi (argv[idx_number]->arg) * 60; + half = atoi (argv[idx_half_life]->arg) * 60; max = 4 * half; } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 2b2731a890..46072a8c6f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -656,28 +656,17 @@ DEFUN (no_auto_summary, } /* "router bgp" commands. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "router bgp", - * ROUTER_STR - * BGP_STR - * - * "router bgp (1-4294967295) (view|vrf) WORD", - * ROUTER_STR - * BGP_STR - * AS_STR - * "BGP view\nBGP VRF\n" - * "View/VRF name\n" - * - */ DEFUN (router_bgp, router_bgp_cmd, - "router bgp (1-4294967295)", + "router bgp [(1-4294967295) [ WORD]]", ROUTER_STR BGP_STR - AS_STR) + AS_STR + BGP_INSTANCE_HELP_STR) { - int idx_number = 2; + int idx_asn = 2; + int idx_view_vrf = 3; + int idx_vrf = 4; int ret; as_t as; struct bgp *bgp; @@ -685,7 +674,7 @@ DEFUN (router_bgp, enum bgp_instance_type inst_type; // "router bgp" without an ASN - if (argc < 1) + if (argc == 2) { //Pending: Make VRF option available for ASN less config bgp = bgp_get_default(); @@ -706,15 +695,16 @@ DEFUN (router_bgp, // "router bgp X" else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX); inst_type = BGP_INSTANCE_TYPE_DEFAULT; - if (argc == 3) + if (argc > 3) { - name = argv[4]->arg; - if (!strcmp(argv[3]->arg, "vrf")) + name = argv[idx_vrf]->arg; + + if (!strcmp(argv[idx_view_vrf]->text, "vrf")) inst_type = BGP_INSTANCE_TYPE_VRF; - else if (!strcmp(argv[3]->arg, "view")) + else if (!strcmp(argv[idx_view_vrf]->text, "view")) inst_type = BGP_INSTANCE_TYPE_VIEW; } @@ -745,38 +735,24 @@ DEFUN (router_bgp, } /* "no router bgp" commands. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no router bgp", - * NO_STR - * ROUTER_STR - * BGP_STR - * - * "no router bgp (1-4294967295) (view|vrf) WORD", - * NO_STR - * ROUTER_STR - * BGP_STR - * AS_STR - * "BGP view\nBGP VRF\n" - * "View/VRF name\n" - * - */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp (1-4294967295)", + "no router bgp [(1-4294967295) [ WORD]]", NO_STR ROUTER_STR BGP_STR - AS_STR) + AS_STR + BGP_INSTANCE_HELP_STR) { - int idx_number = 3; + int idx_asn = 3; + int idx_view_vrf = 4; + int idx_vrf = 5; as_t as; struct bgp *bgp; const char *name = NULL; - // "no router bgp" without an ASN - if (argc < 1) + if (argc == 3) { //Pending: Make VRF option available for ASN less config bgp = bgp_get_default(); @@ -795,10 +771,10 @@ DEFUN (no_router_bgp, } else { - VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX); + VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX); - if (argc == 3) - name = argv[5]->arg; + if (argc > 4) + name = argv[idx_vrf]->arg; /* Lookup bgp structure. */ bgp = bgp_lookup (as, name); @@ -844,31 +820,24 @@ DEFUN (bgp_router_id, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bgp router-id A.B.C.D", - * NO_STR - * BGP_STR - * "Override configured router identifier\n" - * "Manually configured router identifier\n" - * - */ DEFUN (no_bgp_router_id, no_bgp_router_id_cmd, - "no bgp router-id", + "no bgp router-id [A.B.C.D]", NO_STR BGP_STR - "Override configured router identifier\n") + "Override configured router identifier\n" + "Manually configured router identifier\n") { + int idx_router_id = 3; int ret; struct in_addr id; struct bgp *bgp; bgp = vty->index; - if (argc == 1) + if (argc > idx_router_id) { - ret = inet_aton (argv[3]->arg, &id); + ret = inet_aton (argv[idx_router_id]->arg, &id); if (! ret) { vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); @@ -2801,55 +2770,45 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, return bgp_vty_return (vty, ret); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor WORD interface peer-group WORD", - * NEIGHBOR_STR - * "Interface name or neighbor tag\n" - * "Enable BGP on interface\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (neighbor_interface_config, neighbor_interface_config_cmd, - "neighbor WORD interface", + "neighbor WORD interface [peer-group WORD]", NEIGHBOR_STR "Interface name or neighbor tag\n" - "Enable BGP on interface\n") + "Enable BGP on interface\n" + "Member of the peer-group\n" + "peer-group name\n") { int idx_word = 1; - if (argc == 2) + int idx_peer_group_word = 4; + + if (argc > idx_peer_group_word) return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, - argv[3]->arg, NULL); + argv[idx_peer_group_word]->arg, NULL); else return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, NULL, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor WORD interface v6only peer-group WORD", - * NEIGHBOR_STR - * "Interface name or neighbor tag\n" - * "Enable BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (neighbor_interface_config_v6only, neighbor_interface_config_v6only_cmd, - "neighbor WORD interface v6only", + "neighbor WORD interface v6only [peer-group WORD]", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - "Enable BGP with v6 link-local only\n") + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "peer-group name\n") { int idx_word = 1; + int idx_peer_group_word = 5; + + if (argc > idx_peer_group_word) + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, + argv[idx_peer_group_word]->arg, NULL); + return peer_conf_interface_get (vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, - argv[5]->arg, NULL); + NULL, NULL); } @@ -2967,56 +2926,17 @@ DEFUN (no_neighbor, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor WORD interface remote-as ((1-4294967295)|internal|external)", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * AS_STR - * - * "no neighbor WORD interface v6only peer-group WORD", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - * "no neighbor WORD interface v6only remote-as ((1-4294967295)|internal|external)", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * AS_STR - * - * "no neighbor WORD interface v6only", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Enable BGP with v6 link-local only\n" - * - * "no neighbor WORD interface peer-group WORD", - * NO_STR - * NEIGHBOR_STR - * "Interface name\n" - * "Configure BGP on interface\n" - * "Member of the peer-group\n" - * "peer-group name\n" - * - */ DEFUN (no_neighbor_interface_config, no_neighbor_interface_config_cmd, - "no neighbor WORD interface", + "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]", NO_STR NEIGHBOR_STR "Interface name\n" - "Configure BGP on interface\n") + "Configure BGP on interface\n" + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "peer-group name\n" + AS_STR) { int idx_word = 2; struct peer *peer; @@ -4083,57 +4003,6 @@ DEFUN (no_neighbor_nexthop_local_unchanged, PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor attribute-unchanged med next-hop as-path", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * - * "neighbor attribute-unchanged med as-path next-hop", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * - * "neighbor attribute-unchanged as-path next-hop med", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * - * "neighbor attribute-unchanged next-hop as-path med", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * "Med attribute\n" - * - * "neighbor attribute-unchanged as-path med next-hop", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * - * "neighbor attribute-unchanged next-hop med as-path", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * "As-path attribute\n" - * - */ DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, "neighbor attribute-unchanged", @@ -4244,76 +4113,16 @@ DEFUN (neighbor_attr_unchanged4, bgp_node_safi (vty), flags); } - - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor attribute-unchanged next-hop med as-path", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * "As-path attribute\n" - * - * "no neighbor attribute-unchanged as-path med next-hop", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * - * "no neighbor attribute-unchanged med as-path next-hop", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * - * "no neighbor attribute-unchanged next-hop as-path med", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * "Med attribute\n" - * - * "no neighbor attribute-unchanged as-path next-hop med", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "As-path attribute\n" - * "Nexthop attribute\n" - * "Med attribute\n" - * - * "no neighbor attribute-unchanged med next-hop as-path", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "BGP attribute is propagated unchanged to this neighbor\n" - * "Med attribute\n" - * "Nexthop attribute\n" - * "As-path attribute\n" - * - */ DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor attribute-unchanged", + "no neighbor attribute-unchanged [as-path] [next-hop] [med]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n") + "BGP attribute is propagated unchanged to this neighbor\n" + "As-path attribute\n" + "Med attribute\n" + "Nexthop attribute\n") { int idx_peer = 2; return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -4555,9 +4364,6 @@ DEFUN (neighbor_description, return CMD_SUCCESS; } -/* CHECK ME quentin mentioned something about LINE vs .LINE vs LINE... but - * I don't remember what. We need to check all LINE and AA:NN - * */ DEFUN (no_neighbor_description, no_neighbor_description_cmd, "no neighbor description [LINE]", @@ -5686,67 +5492,18 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, bgp_node_safi (vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 0, argv[idx_number_3]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor maximum-prefix <1-4294967295>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100> restart <1-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * "Restart bgp connection after limit is exceeded\n" - * "Restart interval in minutes" - * - * "no neighbor maximum-prefix <1-4294967295> warning-only", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Only give warning message when limit is exceeded\n" - * - * "no neighbor maximum-prefix <1-4294967295> restart <1-65535>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Restart bgp connection after limit is exceeded\n" - * "Restart interval in minutes" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100> warning-only", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * "Only give warning message when limit is exceeded\n" - * - * "no neighbor maximum-prefix <1-4294967295> <1-100>", - * NO_STR - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Maximum number of prefix accept from this peer\n" - * "maximum no. of prefix limit\n" - * "Threshold value (%) at which to generate a warning msg\n" - * - */ DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, - "no neighbor maximum-prefix", + "no neighbor maximum-prefix [<1-4294967295> [<1-100>] [restart <1-65535>] [warning-only]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n") + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Restart bgp connection after limit is exceeded\n" + "Restart interval in minutes" + "Only give warning message when limit is exceeded\n") { int idx_peer = 2; return peer_maximum_prefix_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -5755,23 +5512,16 @@ DEFUN (no_neighbor_maximum_prefix, /* "neighbor allowas-in" */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor allowas-in <1-10>", - * NEIGHBOR_STR - * NEIGHBOR_ADDR_STR2 - * "Accept as-path with my AS present in it\n" - * "Number of occurances of AS number\n" - * - */ DEFUN (neighbor_allowas_in, neighbor_allowas_in_cmd, - "neighbor allowas-in", + "neighbor allowas-in [(1-10)]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Accept as-path with my AS present in it\n") + "Accept as-path with my AS present in it\n" + "Number of occurances of AS number\n") { int idx_peer = 1; + int idx_number = 3; int ret; struct peer *peer; unsigned int allow_num; @@ -5780,10 +5530,10 @@ DEFUN (neighbor_allowas_in, if (! peer) return CMD_WARNING; - if (argc == 1) + if (argc <= idx_number) allow_num = 3; else - VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[3]->arg, 1, 10); + VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[idx_number]->arg, 1, 10); ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), allow_num); @@ -6233,7 +5983,7 @@ bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []|in [prefix-filter]|out>]", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [< [unicast]|ipv4 multicast>] []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -6247,11 +5997,8 @@ DEFUN (clear_ip_bgp_all, "Clear all members of peer-group\n" "BGP peer-group name\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7099,17 +6846,14 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show [ip] bgp [ WORD] [] summary [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] summary [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" - "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9157,7 +8901,7 @@ bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show [ip] bgp [ WORD] [] update-groups [SUBGROUP-ID]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR @@ -10001,57 +9745,18 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute (ospf|table) <1-65535> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * "Open Shortest Path First (OSPFv2)\n" - * "Non-main Kernel Routing Table\n" - * "Instance ID/Table ID\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - */ DEFUN (no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_cmd, - "no redistribute (1-65535)", + "no redistribute (1-65535) [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" "Non-main Kernel Routing Table\n" - "Instance ID/Table ID\n") + "Instance ID/Table ID\n" + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_ospf_table = 2; int idx_number = 3; @@ -10067,51 +9772,16 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); } - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * - */ DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute ", + "no redistribute [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" - QUAGGA_IP_REDIST_HELP_STR_BGPD) + QUAGGA_IP_REDIST_HELP_STR_BGPD + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_protocol = 2; int type; @@ -10125,10 +9795,6 @@ DEFUN (no_bgp_redistribute_ipv4, return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); } - - - - #ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, @@ -10264,47 +9930,16 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute route-map WORD metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * "Metric for redistributed routes\n" - * "Default metric\n" - * - * "no redistribute metric <0-4294967295> route-map WORD", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute metric <0-4294967295>", - * NO_STR - * "Redistribute information from another routing protocol\n" - * QUAGGA_IP6_REDIST_HELP_STR_BGPD - * "Metric for redistributed routes\n" - * "Default metric\n" - * - */ DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute ", + "no redistribute [metric <0-4294967295>] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" - QUAGGA_IP6_REDIST_HELP_STR_BGPD) + QUAGGA_IP6_REDIST_HELP_STR_BGPD + "Metric for redistributed routes\n" + "Default metric\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int idx_protocol = 2; int type; From e961923c7217b935027107cad30c35c3907c936f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 00:07:46 +0000 Subject: [PATCH 157/280] bgpd, etc: changed .LINE to LINE... Signed-off-by: Daniel Walton --- bgpd/bgp_filter.c | 4 ++-- bgpd/bgp_routemap.c | 4 ++-- bgpd/bgp_vty.c | 18 +++++++++--------- lib/filter.c | 4 ++-- lib/plist.c | 4 ++-- pimd/pim_cmd.c | 4 ++-- tests/heavy-thread.c | 2 +- tests/heavy-wq.c | 2 +- tests/heavy.c | 2 +- vtysh/vtysh.c | 2 +- zebra/zebra_vty.c | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 05d5eafae6..5af840810b 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -428,7 +428,7 @@ as_list_dup_check (struct as_list *aslist, struct as_filter *new) DEFUN (ip_as_path, ip_as_path_cmd, - "ip as-path access-list WORD .LINE", + "ip as-path access-list WORD LINE...", IP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" @@ -486,7 +486,7 @@ DEFUN (ip_as_path, DEFUN (no_ip_as_path, no_ip_as_path_cmd, - "no ip as-path access-list WORD .LINE", + "no ip as-path access-list WORD LINE...", NO_STR IP_STR "BGP autonomous system path filter\n" diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e1d8ca896d..dc90094f65 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3938,7 +3938,7 @@ DEFUN (no_set_aspath_exclude, DEFUN (set_community, set_community_cmd, - "set community .AA:NN", + "set community AA:NN...", SET_STR "BGP community attribute\n" COMMUNITY_VAL_STR) @@ -4047,7 +4047,7 @@ DEFUN (set_community_none, * "BGP community attribute\n" * "No community attribute\n" * - * "no set community .AA:NN", + * "no set community AA:NN...", * NO_STR * SET_STR * "BGP community attribute\n" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 46072a8c6f..1fcdede2db 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4338,7 +4338,7 @@ DEFUN (no_neighbor_disable_connected_check, DEFUN (neighbor_description, neighbor_description_cmd, - "neighbor description .LINE", + "neighbor description LINE...", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Neighbor specific description\n" @@ -11293,7 +11293,7 @@ community_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, /* ip community-list standard */ DEFUN (ip_community_list_standard, ip_community_list_standard_cmd, - "ip community-list <(1-99)|standard WORD> [.AA:NN]", + "ip community-list <(1-99)|standard WORD> AA:NN...", IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" @@ -11308,7 +11308,7 @@ DEFUN (ip_community_list_standard, DEFUN (no_ip_community_list_standard_all, no_ip_community_list_standard_all_cmd, - "no ip community-list <(1-99)|standard WORD> [ [.AA:NN]]", + "no ip community-list <(1-99)|standard WORD> AA:NN...", NO_STR IP_STR COMMUNITY_LIST_STR @@ -11325,7 +11325,7 @@ DEFUN (no_ip_community_list_standard_all, /* ip community-list expanded */ DEFUN (ip_community_list_expanded_all, ip_community_list_expanded_all_cmd, - "ip community-list <(100-500)|expanded WORD> [ [.LINE]]", + "ip community-list <(100-500)|expanded WORD> LINE...", IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" @@ -11340,7 +11340,7 @@ DEFUN (ip_community_list_expanded_all, DEFUN (no_ip_community_list_expanded_all, no_ip_community_list_expanded_all_cmd, - "no ip community-list <(100-500)|expanded WORD> [ [.LINE]]", + "no ip community-list <(100-500)|expanded WORD> LINE...", NO_STR IP_STR COMMUNITY_LIST_STR @@ -11532,7 +11532,7 @@ extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, DEFUN (ip_extcommunity_list_standard, ip_extcommunity_list_standard_cmd, - "ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", + "ip extcommunity-list <(1-99)|standard WORD> AA:NN...", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" @@ -11547,7 +11547,7 @@ DEFUN (ip_extcommunity_list_standard, DEFUN (ip_extcommunity_list_name_expanded, ip_extcommunity_list_name_expanded_cmd, - "ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", + "ip extcommunity-list <(100-500)|expanded WORD> LINE...", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" @@ -11562,7 +11562,7 @@ DEFUN (ip_extcommunity_list_name_expanded, DEFUN (no_ip_extcommunity_list_standard_all, no_ip_extcommunity_list_standard_all_cmd, - "no ip extcommunity-list <(1-99)|standard WORD> [.AA:NN]", + "no ip extcommunity-list <(1-99)|standard WORD> AA:NN...", NO_STR IP_STR EXTCOMMUNITY_LIST_STR @@ -11578,7 +11578,7 @@ DEFUN (no_ip_extcommunity_list_standard_all, DEFUN (no_ip_extcommunity_list_expanded_all, no_ip_extcommunity_list_expanded_all_cmd, - "no ip extcommunity-list <(100-500)|expanded WORD> [.LINE]", + "no ip extcommunity-list <(100-500)|expanded WORD> LINE...", NO_STR IP_STR EXTCOMMUNITY_LIST_STR diff --git a/lib/filter.c b/lib/filter.c index 40bf0a3395..11dd7cd1c9 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1470,7 +1470,7 @@ DEFUN (no_access_list_all, DEFUN (access_list_remark, access_list_remark_cmd, - "access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark .LINE", + "access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark LINE...", "Add an access list entry\n" "IP standard access list\n" "IP extended access list\n" @@ -1666,7 +1666,7 @@ DEFUN (no_ipv6_access_list_all, DEFUN (ipv6_access_list_remark, ipv6_access_list_remark_cmd, - "ipv6 access-list WORD remark .LINE", + "ipv6 access-list WORD remark LINE...", IPV6_STR "Add an access list entry\n" "IPv6 zebra access-list\n" diff --git a/lib/plist.c b/lib/plist.c index 5911d6cf7f..0d1cafde66 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1898,7 +1898,7 @@ DEFUN (no_ip_prefix_list_sequence_number, DEFUN (ip_prefix_list_description, ip_prefix_list_description_cmd, - "ip prefix-list WORD description .LINE", + "ip prefix-list WORD description LINE...", IP_STR PREFIX_LIST_STR "Name of a prefix list\n" @@ -2609,7 +2609,7 @@ DEFUN (no_ipv6_prefix_list_sequence_number, DEFUN (ipv6_prefix_list_description, ipv6_prefix_list_description_cmd, - "ipv6 prefix-list WORD description .LINE", + "ipv6 prefix-list WORD description LINE...", IPV6_STR PREFIX_LIST_STR "Name of a prefix list\n" diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 52302a6460..f1c2753526 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4160,7 +4160,7 @@ static struct igmp_sock *find_igmp_sock_by_fd(int fd) DEFUN (test_igmp_receive_report, test_igmp_receive_report_cmd, - "test igmp receive report (0-65535) A.B.C.D (1-6) .LINE", + "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...", "Test\n" "Test IGMP protocol\n" "Test IGMP message\n" @@ -4276,7 +4276,7 @@ static int hexval(uint8_t ch) DEFUN (test_pim_receive_dump, test_pim_receive_dump_cmd, - "test pim receive dump INTERFACE A.B.C.D .LINE", + "test pim receive dump INTERFACE A.B.C.D LINE...", "Test\n" "Test PIM protocol\n" "Test PIM message reception\n" diff --git a/tests/heavy-thread.c b/tests/heavy-thread.c index c2e71c17d6..c43fa76c0e 100644 --- a/tests/heavy-thread.c +++ b/tests/heavy-thread.c @@ -104,7 +104,7 @@ clear_something (struct thread *thread) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c index 2d15dc37bd..97371face1 100644 --- a/tests/heavy-wq.c +++ b/tests/heavy-wq.c @@ -140,7 +140,7 @@ clear_something (struct vty *vty, const char *str) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/tests/heavy.c b/tests/heavy.c index 9af46c88f7..6ba8d9aa6d 100644 --- a/tests/heavy.c +++ b/tests/heavy.c @@ -82,7 +82,7 @@ clear_something (struct vty *vty, const char *str) DEFUN (clear_foo, clear_foo_cmd, - "clear foo .LINE", + "clear foo LINE...", "clear command\n" "arbitrary string\n") { diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 05fb038184..e6aebd6b1a 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1700,7 +1700,7 @@ ALIAS (vtysh_exit_vrf, * and isisd. */ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD, interface_desc_cmd, - "description .LINE", + "description LINE...", "Interface specific description\n" "Characters describing this interface\n") diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index a9f0e87017..88036f44bd 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1562,7 +1562,7 @@ DEFUN (show_ip_route_supernets, DEFUN (show_ip_route_protocol, show_ip_route_protocol_cmd, - "show ip route [vrf NAME] " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route [vrf NAME] ", SHOW_STR IP_STR "IP routing table\n" @@ -2163,7 +2163,7 @@ DEFUN (show_ip_route_vrf_all_supernets, DEFUN (show_ip_route_vrf_all_protocol, show_ip_route_vrf_all_protocol_cmd, - "show ip route vrf all " QUAGGA_IP_REDIST_STR_ZEBRA, + "show ip route vrf all ", SHOW_STR IP_STR "IP routing table\n" From 55c727dd758cd69aa7e2760df6bca8fb5f3db4d9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 00:10:31 +0000 Subject: [PATCH 158/280] ripd, ripngd: cli refactor Signed-off-by: Quentin Young --- ripd/rip_interface.c | 196 ++++++++++++------------------------------- ripd/ripd.c | 41 ++------- ripngd/ripng_zebra.c | 53 ++++-------- ripngd/ripngd.c | 10 +-- 4 files changed, 79 insertions(+), 221 deletions(-) diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 036edeac8b..d6686399c2 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1398,26 +1398,16 @@ DEFUN (ip_rip_receive_version_2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip rip receive version (1|2)", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Advertisement reception\n" - * "Version control\n" - * "Version 1\n" - * "Version 2\n" - * - */ DEFUN (no_ip_rip_receive_version, no_ip_rip_receive_version_cmd, - "no ip rip receive version", + "no ip rip receive version [(1-1)|(2-2)]", NO_STR IP_STR "Routing Information Protocol\n" "Advertisement reception\n" - "Version control\n") + "Version control\n" + "Version 1\n" + "Version 2\n") { struct interface *ifp; struct rip_interface *ri; @@ -1503,26 +1493,16 @@ DEFUN (ip_rip_send_version_2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip rip send version (1|2)", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Advertisement transmission\n" - * "Version control\n" - * "Version 1\n" - * "Version 2\n" - * - */ DEFUN (no_ip_rip_send_version, no_ip_rip_send_version_cmd, - "no ip rip send version", + "no ip rip send version [(1-1)|(2-2)]", NO_STR IP_STR "Routing Information Protocol\n" "Advertisement transmission\n" - "Version control\n") + "Version control\n" + "Version 1\n" + "Version 2\n") { struct interface *ifp; struct rip_interface *ri; @@ -1535,31 +1515,21 @@ DEFUN (no_ip_rip_send_version, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", - * IP_STR - * "Routing Information Protocol\n" - * "Authentication control\n" - * "Authentication mode\n" - * "Keyed message digest\n" - * "Clear text authentication\n" - * "MD5 authentication data length\n" - * "RFC compatible\n" - * "Old ripd compatible\n" - * - */ DEFUN (ip_rip_authentication_mode, ip_rip_authentication_mode_cmd, - "ip rip authentication mode ", + "ip rip authentication mode [auth-length ]", IP_STR "Routing Information Protocol\n" "Authentication control\n" "Authentication mode\n" "Keyed message digest\n" - "Clear text authentication\n") + "Clear text authentication\n" + "MD5 authentication data length\n" + "RFC compatible\n" + "Old ripd compatible\n") { - int idx_encryption = 4; + char *cryptmode = argv[4]->text; + char *authlen = (argc > 5) ? argv[6]->text : NULL; struct interface *ifp; struct rip_interface *ri; int auth_type; @@ -1567,79 +1537,47 @@ DEFUN (ip_rip_authentication_mode, ifp = (struct interface *)vty->index; ri = ifp->info; - if ( (argc < 1) || (argc > 2) ) - { - vty_out (vty, "incorrect argument count%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (strncmp ("md5", argv[idx_encryption]->arg, strlen (argv[idx_encryption]->arg)) == 0) + if (strmatch ("md5", cryptmode)) auth_type = RIP_AUTH_MD5; - else if (strncmp ("text", argv[idx_encryption]->arg, strlen (argv[idx_encryption]->arg)) == 0) + else { + assert (strmatch ("text", cryptmode)); auth_type = RIP_AUTH_SIMPLE_PASSWORD; - else - { - vty_out (vty, "mode should be md5 or text%s", VTY_NEWLINE); - return CMD_WARNING; - } + } - if (argc == 1) - { - ri->auth_type = auth_type; - return CMD_SUCCESS; - } + ri->auth_type = auth_type; - if ( (argc == 2) && (auth_type != RIP_AUTH_MD5) ) + if (argc > 5) + { + if (auth_type != RIP_AUTH_MD5) { vty_out (vty, "auth length argument only valid for md5%s", VTY_NEWLINE); return CMD_WARNING; } + if (strmatch ("rfc", authlen)) + ri->md5_auth_len = RIP_AUTH_MD5_SIZE; + else + { + assert (strmatch ("old-ripd", authlen)); + ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; + } + } - if (strncmp ("r", argv[6]->arg, 1) == 0) - ri->md5_auth_len = RIP_AUTH_MD5_SIZE; - else if (strncmp ("o", argv[6]->arg, 1) == 0) - ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE; - else - return CMD_WARNING; - - ri->auth_type = auth_type; - return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip rip authentication mode (md5|text)", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Authentication control\n" - * "Authentication mode\n" - * "Keyed message digest\n" - * "Clear text authentication\n" - * - * "no ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Authentication control\n" - * "Authentication mode\n" - * "Keyed message digest\n" - * "Clear text authentication\n" - * "MD5 authentication data length\n" - * "RFC compatible\n" - * "Old ripd compatible\n" - * - */ DEFUN (no_ip_rip_authentication_mode, no_ip_rip_authentication_mode_cmd, - "no ip rip authentication mode", + "no ip rip authentication mode [ [auth-length ]]", NO_STR IP_STR "Routing Information Protocol\n" "Authentication control\n" - "Authentication mode\n") + "Authentication mode\n" + "Keyed message digest\n" + "Clear text authentication\n" + "MD5 authentication data length\n" + "RFC compatible\n" + "Old ripd compatible\n") { struct interface *ifp; struct rip_interface *ri; @@ -1653,8 +1591,6 @@ DEFUN (no_ip_rip_authentication_mode, return CMD_SUCCESS; } - - DEFUN (ip_rip_authentication_string, ip_rip_authentication_string_cmd, "ip rip authentication string LINE", @@ -1692,24 +1628,14 @@ DEFUN (ip_rip_authentication_string, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip rip authentication string LINE", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Authentication control\n" - * "Authentication string\n" - * "Authentication string\n" - * - */ DEFUN (no_ip_rip_authentication_string, no_ip_rip_authentication_string_cmd, - "no ip rip authentication string", + "no ip rip authentication string [LINE]", NO_STR IP_STR "Routing Information Protocol\n" "Authentication control\n" + "Authentication string\n" "Authentication string\n") { struct interface *ifp; @@ -1758,25 +1684,15 @@ DEFUN (ip_rip_authentication_key_chain, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip rip authentication key-chain LINE", - * NO_STR - * IP_STR - * "Routing Information Protocol\n" - * "Authentication control\n" - * "Authentication key-chain\n" - * "name of key-chain\n" - * - */ DEFUN (no_ip_rip_authentication_key_chain, no_ip_rip_authentication_key_chain_cmd, - "no ip rip authentication key-chain", + "no ip rip authentication key-chain [LINE]", NO_STR IP_STR "Routing Information Protocol\n" "Authentication control\n" - "Authentication key-chain\n") + "Authentication key-chain\n" + "name of key-chain\n") { struct interface *ifp; struct rip_interface *ri; @@ -1871,10 +1787,10 @@ DEFUN (no_ip_rip_split_horizon_poisoned_reverse, switch( ri->split_horizon ) { - case RIP_SPLIT_HORIZON_POISONED_REVERSE: - ri->split_horizon = RIP_SPLIT_HORIZON; - default: - break; + case RIP_SPLIT_HORIZON_POISONED_REVERSE: + ri->split_horizon = RIP_SPLIT_HORIZON; + default: + break; } return CMD_SUCCESS; @@ -1887,18 +1803,15 @@ DEFUN (rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - int idx_ifname = 1; - const char *ifname = argv[idx_ifname]->arg; - - if (!strcmp(ifname,"default")) { + if (argv[1]->type == WORD_TKN) { // user passed 'default' passive_default = 1; rip_passive_nondefault_clean(); return CMD_SUCCESS; } if (passive_default) - return rip_passive_nondefault_unset (vty, ifname); + return rip_passive_nondefault_unset (vty, argv[1]->arg); else - return rip_passive_nondefault_set (vty, ifname); + return rip_passive_nondefault_set (vty, argv[1]->arg); } DEFUN (no_rip_passive_interface, @@ -1909,18 +1822,15 @@ DEFUN (no_rip_passive_interface, "Interface name\n" "default for all interfaces\n") { - int idx_ifname = 2; - const char *ifname = argv[idx_ifname]->arg; - - if (!strcmp(ifname,"default")) { + if (argv[2]->type == WORD_TKN) { passive_default = 0; rip_passive_nondefault_clean(); return CMD_SUCCESS; } if (passive_default) - return rip_passive_nondefault_set (vty, ifname); + return rip_passive_nondefault_set (vty, argv[2]->arg); else - return rip_passive_nondefault_unset (vty, ifname); + return rip_passive_nondefault_unset (vty, argv[2]->arg); } /* Write rip configuration of each interface. */ diff --git a/ripd/ripd.c b/ripd/ripd.c index a7f35de276..c5d928ba6d 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2963,19 +2963,12 @@ DEFUN (rip_version, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no version <1-2>", - * NO_STR - * "Set routing protocol version\n" - * "version\n" - * - */ DEFUN (no_rip_version, no_rip_version_cmd, - "no version", + "no version [(1-2)]", NO_STR - "Set routing protocol version\n") + "Set routing protocol version\n" + "Version\n") { /* Set RIP version to the default. */ rip->version_send = RI_RIP_VERSION_2; @@ -3091,17 +3084,9 @@ DEFUN (rip_default_metric, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no default-metric <1-16>", - * NO_STR - * "Set a metric of redistribute routes\n" - * "Default metric\n" - * - */ DEFUN (no_rip_default_metric, no_rip_default_metric_cmd, - "no default-metric", + "no default-metric [(1-16)]", NO_STR "Set a metric of redistribute routes\n" "Default metric\n") @@ -3166,23 +3151,15 @@ DEFUN (rip_timers, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers basic <0-65535> <0-65535> <0-65535>", - * NO_STR - * "Adjust routing timers\n" - * "Basic routing protocol update timers\n" - * "Routing table update timer value in second. Default is 30.\n" - * "Routing information timeout timer. Default is 180.\n" - * "Garbage collection timer. Default is 120.\n" - * - */ DEFUN (no_rip_timers, no_rip_timers_cmd, - "no timers basic", + "no timers basic [(0-65535) (0-65535) (0-65535)]", NO_STR "Adjust routing timers\n" - "Basic routing protocol update timers\n") + "Basic routing protocol update timers\n" + "Routing table update timer value in second. Default is 30.\n" + "Routing information timeout timer. Default is 180.\n" + "Garbage collection timer. Default is 120.\n") { /* Set each timer value to the default. */ rip->update_time = RIP_UPDATE_TIMER_DEFAULT; diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 07c51ca6d2..c8527539f8 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -345,44 +345,23 @@ DEFUN (ripng_redistribute_type, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute metric <0-16> route-map WORD", - * NO_STR - * "Redistribute\n" - * QUAGGA_REDIST_HELP_STR_RIPNGD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - * "no redistribute metric <0-16>", - * NO_STR - * "Redistribute\n" - * QUAGGA_REDIST_HELP_STR_RIPNGD - * "Metric\n" - * "Metric value\n" - * - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute\n" - * QUAGGA_REDIST_HELP_STR_RIPNGD - * "Route map reference\n" - * "Pointer to route-map entries\n" - * - */ DEFUN (no_ripng_redistribute_type, no_ripng_redistribute_type_cmd, - "no redistribute ", + "no redistribute [metric (0-16)] [route-map WORD]", NO_STR "Redistribute\n" - QUAGGA_REDIST_HELP_STR_RIPNGD) + QUAGGA_REDIST_HELP_STR_RIPNGD + "Metric\n" + "Metric value\n" + "Route map reference\n" + "Pointer to route-map entries\n") { int type; - - type = proto_redistnum(AFI_IP6, argv[3]->arg); + type = proto_redistnum(AFI_IP6, argv[2]->text); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[2]->text, VTY_NEWLINE); return CMD_WARNING; } @@ -406,11 +385,11 @@ DEFUN (ripng_redistribute_type_metric, int metric; metric = atoi (argv[idx_number]->arg); - type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } @@ -433,15 +412,15 @@ DEFUN (ripng_redistribute_type_routemap, int idx_word = 3; int type; - type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } - ripng_redistribute_routemap_set (type, argv[idx_word]->arg); + ripng_redistribute_routemap_set (type, argv[idx_word]->text); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; @@ -464,17 +443,17 @@ DEFUN (ripng_redistribute_type_metric_routemap, int type; int metric; - type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); metric = atoi (argv[idx_number]->arg); if (type < 0) { - vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->arg, VTY_NEWLINE); + vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE); return CMD_WARNING; } ripng_redistribute_metric_set (type, metric); - ripng_redistribute_routemap_set (type, argv[idx_word]->arg); + ripng_redistribute_routemap_set (type, argv[idx_word]->text); zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT); return CMD_SUCCESS; } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index d3944c1c70..78a92a497e 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2405,17 +2405,9 @@ DEFUN (ripng_default_metric, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no default-metric <1-16>", - * NO_STR - * "Set a metric of redistribute routes\n" - * "Default metric\n" - * - */ DEFUN (no_ripng_default_metric, no_ripng_default_metric_cmd, - "no default-metric", + "no default-metric [(1-16)]", NO_STR "Set a metric of redistribute routes\n" "Default metric\n") From 80d3d26b364a5c28f2ad9a39204ef66f82ca1c3e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 00:26:41 +0000 Subject: [PATCH 159/280] pimd: removed undebug CHECK MEs Signed-off-by: Daniel Walton --- pimd/pim_cmd.c | 134 +++---------------------------------------------- 1 file changed, 8 insertions(+), 126 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index f1c2753526..b27088366f 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3551,25 +3551,17 @@ DEFUN (interface_no_ip_mroute_source, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip pim hello <1-180> <1-180>", - * IP_STR - * PIM_STR - * IFACE_PIM_HELLO_STR - * IFACE_PIM_HELLO_TIME_STR - * IFACE_PIM_HELLO_HOLD_STR - * - */ DEFUN (interface_ip_pim_hello, interface_ip_pim_hello_cmd, - "ip pim hello (1-180)", + "ip pim hello (1-180) [(1-180)]", IP_STR PIM_STR IFACE_PIM_HELLO_STR - IFACE_PIM_HELLO_TIME_STR) + IFACE_PIM_HELLO_TIME_STR + IFACE_PIM_HELLO_HOLD_STR) { - int idx_number = 3; + int idx_time = 3; + int idx_hold = 4; struct interface *ifp; struct pim_interface *pim_ifp; @@ -3581,10 +3573,10 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[idx_number]->arg, NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[idx_time]->arg, NULL, 10); - if (argc == 2) - pim_ifp->pim_default_holdtime = strtol(argv[4]->arg, NULL, 10); + if (argc > idx_hold) + pim_ifp->pim_default_holdtime = strtol(argv[idx_hold]->arg, NULL, 10); return CMD_SUCCESS; } @@ -3630,13 +3622,6 @@ DEFUN (debug_igmp, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug igmp", - * UNDEBUG_STR - * DEBUG_IGMP_STR - * - */ DEFUN (no_debug_igmp, no_debug_igmp_cmd, "no debug igmp", @@ -3662,14 +3647,6 @@ DEFUN (debug_igmp_events, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug igmp events", - * UNDEBUG_STR - * DEBUG_IGMP_STR - * DEBUG_IGMP_EVENTS_STR - * - */ DEFUN (no_debug_igmp_events, no_debug_igmp_events_cmd, "no debug igmp events", @@ -3694,14 +3671,6 @@ DEFUN (debug_igmp_packets, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug igmp packets", - * UNDEBUG_STR - * DEBUG_IGMP_STR - * DEBUG_IGMP_PACKETS_STR - * - */ DEFUN (no_debug_igmp_packets, no_debug_igmp_packets_cmd, "no debug igmp packets", @@ -3726,14 +3695,6 @@ DEFUN (debug_igmp_trace, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug igmp trace", - * UNDEBUG_STR - * DEBUG_IGMP_STR - * DEBUG_IGMP_TRACE_STR - * - */ DEFUN (no_debug_igmp_trace, no_debug_igmp_trace_cmd, "no debug igmp trace", @@ -3757,13 +3718,6 @@ DEFUN (debug_mroute, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug mroute", - * UNDEBUG_STR - * DEBUG_MROUTE_STR - * - */ DEFUN (no_debug_mroute, no_debug_mroute_cmd, "no debug mroute", @@ -3786,13 +3740,6 @@ DEFUN (debug_static, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug static", - * UNDEBUG_STR - * DEBUG_STATIC_STR - * - */ DEFUN (no_debug_static, no_debug_static_cmd, "no debug static", @@ -3817,13 +3764,6 @@ DEFUN (debug_pim, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim", - * UNDEBUG_STR - * DEBUG_PIM_STR - * - */ DEFUN (no_debug_pim, no_debug_pim_cmd, "no debug pim", @@ -3853,14 +3793,6 @@ DEFUN (debug_pim_events, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim events", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_EVENTS_STR - * - */ DEFUN (no_debug_pim_events, no_debug_pim_events_cmd, "no debug pim events", @@ -3909,14 +3841,6 @@ DEFUN (debug_pim_packets_filter, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim packets", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_PACKETS_STR - * - */ DEFUN (no_debug_pim_packets, no_debug_pim_packets_cmd, "no debug pim packets", @@ -3969,15 +3893,6 @@ DEFUN (debug_pim_packetdump_send, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim packet-dump send", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_PACKETDUMP_STR - * DEBUG_PIM_PACKETDUMP_SEND_STR - * - */ DEFUN (no_debug_pim_packetdump_send, no_debug_pim_packetdump_send_cmd, "no debug pim packet-dump send", @@ -4004,15 +3919,6 @@ DEFUN (debug_pim_packetdump_recv, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim packet-dump receive", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_PACKETDUMP_STR - * DEBUG_PIM_PACKETDUMP_RECV_STR - * - */ DEFUN (no_debug_pim_packetdump_recv, no_debug_pim_packetdump_recv_cmd, "no debug pim packet-dump receive", @@ -4038,14 +3944,6 @@ DEFUN (debug_pim_trace, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim trace", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_TRACE_STR - * - */ DEFUN (no_debug_pim_trace, no_debug_pim_trace_cmd, "no debug pim trace", @@ -4070,14 +3968,6 @@ DEFUN (debug_ssmpingd, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug ssmpingd", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_SSMPINGD_STR - * - */ DEFUN (no_debug_ssmpingd, no_debug_ssmpingd_cmd, "no debug ssmpingd", @@ -4102,14 +3992,6 @@ DEFUN (debug_pim_zebra, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "undebug pim zebra", - * UNDEBUG_STR - * DEBUG_PIM_STR - * DEBUG_PIM_ZEBRA_STR - * - */ DEFUN (no_debug_pim_zebra, no_debug_pim_zebra_cmd, "no debug pim zebra", From 7c17a8f2fdc66398f3f374e16cec3f82bb453ff7 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 00:31:28 +0000 Subject: [PATCH 160/280] bgpd: remove unused variable Signed-off-by: Daniel Walton --- bgpd/bgp_vty.c | 1 - 1 file changed, 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1fcdede2db..9491e09470 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -745,7 +745,6 @@ DEFUN (no_router_bgp, BGP_INSTANCE_HELP_STR) { int idx_asn = 3; - int idx_view_vrf = 4; int idx_vrf = 5; as_t as; struct bgp *bgp; From b44c509a14de08b4fc494c3be5fe3a392bfd6598 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 04:26:43 +0000 Subject: [PATCH 161/280] isisd: resolve CHECK MEs Signed-off-by: Daniel Walton --- isisd/isis_redist.c | 25 ++- isisd/isis_routemap.c | 88 ++------ isisd/isis_vty.c | 483 ++++++++++-------------------------------- isisd/isisd.c | 10 +- 4 files changed, 152 insertions(+), 454 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index a0ca5ad2c5..66a2d98252 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -561,10 +561,7 @@ DEFUN (isis_redistribute, int type; int level; unsigned long metric; - const char *routemap; - - if (argc < 5) - return CMD_WARNING; + const char *routemap = NULL; family = str2family(argv[idx_afi]->arg); if (family < 0) @@ -591,20 +588,21 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[idx_metric_rmap]->arg) + if (strmatch(argv[idx_metric_rmap]->text, "metric")) { char *endp; - metric = strtoul(argv[idx_metric_rmap]->arg, &endp, 10); + metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10); + routemap = NULL; + if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else { + routemap = argv[idx_metric_rmap + 1]->arg; metric = 0xffffffff; } - routemap = argv[4]; - isis_redist_set(area, level, family, type, metric, routemap, 0); return 0; } @@ -711,20 +709,21 @@ DEFUN (isis_default_originate, vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE); } - if (argv[3]) + if (strmatch(argv[idx_metric_rmap]->text, "metric")) { char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') + metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10); + routemap = NULL; + + if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else { + routemap = argv[idx_metric_rmap + 1]->arg; metric = 0xffffffff; } - routemap = argv[4]; - isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type); return 0; } diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index b9f6c7a555..a1f087548f 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -358,18 +358,10 @@ DEFUN (match_ip_address, return isis_route_match_add(vty, vty->index, "ip address", argv[idx_acl]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * - */ + DEFUN (no_match_ip_address, no_match_ip_address_val_cmd, - "no match ip address <(1-199)|(1300-2699)|WORD>", + "no match ip address [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR @@ -379,7 +371,7 @@ DEFUN (no_match_ip_address, "IP Access-list name\n") { int idx_acl = 4; - if (argc == 0) + if (argc <= idx_acl) return isis_route_match_delete(vty, vty->index, "ip address", NULL); return isis_route_match_delete(vty, vty->index, "ip address", argv[idx_acl]->arg); } @@ -400,29 +392,21 @@ DEFUN (match_ip_address_prefix_list, return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ + DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", + "no match ip address prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - if (argc == 0) + int idx_word = 5; + if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); + return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } @@ -440,18 +424,10 @@ DEFUN (match_ipv6_address, return isis_route_match_add(vty, vty->index, "ipv6 address", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ipv6 address", - * NO_STR - * MATCH_STR - * IPV6_STR - * "Match IPv6 address of route\n" - * - */ + DEFUN (no_match_ipv6_address, no_match_ipv6_address_val_cmd, - "no match ipv6 address WORD", + "no match ipv6 address [WORD]", NO_STR MATCH_STR IPV6_STR @@ -459,7 +435,7 @@ DEFUN (no_match_ipv6_address, "IPv6 access-list name\n") { int idx_word = 4; - if (argc == 0) + if (argc <= idx_word) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[idx_word]->arg); } @@ -480,29 +456,20 @@ DEFUN (match_ipv6_address_prefix_list, return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ipv6 address prefix-list WORD", - * NO_STR - * MATCH_STR - * IPV6_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ipv6_address_prefix_list, no_match_ipv6_address_prefix_list_cmd, - "no match ipv6 address prefix-list", + "no match ipv6 address prefix-list [WORD]", NO_STR MATCH_STR IPV6_STR "Match address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - if (argc == 0) + int idx_word = 5; + if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]); + return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); } @@ -522,31 +489,22 @@ DEFUN (set_metric, return isis_route_set_add(vty, vty->index, "metric", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric", - * NO_STR - * SET_STR - * "Metric vale for destination routing protocol\n"); - * - * void - * isis_route_map_init(void - * - */ DEFUN (no_set_metric, no_set_metric_val_cmd, - "no set metric (0-4294967295)", + "no set metric [(0-4294967295)]", NO_STR SET_STR "Metric value for destination routing protocol\n" "Metric value\n") { int idx_number = 3; - if (argc == 0) + if (argc <= idx_number) return isis_route_set_delete(vty, vty->index, "metric", NULL); return isis_route_set_delete(vty, vty->index, "metric", argv[idx_number]->arg); } +void +isis_route_map_init(void) { route_map_init(); route_map_init_vty(); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index aad8113fd5..a1970a9017 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -330,23 +330,15 @@ DEFUN (isis_passwd, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis password (md5|clear) WORD", - * NO_STR - * "IS-IS commands\n" - * "Configure the authentication password for a circuit\n" - * "HMAC-MD5 authentication\n" - * "Cleartext password\n" - * "Circuit password\n" - * - */ DEFUN (no_isis_passwd, no_isis_passwd_cmd, - "no isis password", + "no isis password [ WORD]", NO_STR "IS-IS commands\n" - "Configure the authentication password for a circuit\n") + "Configure the authentication password for a circuit\n" + "HMAC-MD5 authentication\n" + "Cleartext password\n" + "Circuit password\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -385,21 +377,13 @@ DEFUN (isis_priority, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis priority <0-127>", - * NO_STR - * "IS-IS commands\n" - * "Set priority for Designated Router election\n" - * "Priority value\n" - * - */ DEFUN (no_isis_priority, no_isis_priority_cmd, - "no isis priority", + "no isis priority [(0-127)]", NO_STR "IS-IS commands\n" - "Set priority for Designated Router election\n") + "Set priority for Designated Router election\n" + "Priority value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -439,22 +423,13 @@ DEFUN (isis_priority_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis priority <0-127> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set priority for Designated Router election\n" - * "Priority value\n" - * "Specify priority for level-1 routing\n" - * - */ DEFUN (no_isis_priority_l1, no_isis_priority_l1_cmd, - "no isis priority level-1", + "no isis priority [(0-127)] level-1", NO_STR "IS-IS commands\n" "Set priority for Designated Router election\n" + "Priority value\n" "Specify priority for level-1 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -494,22 +469,13 @@ DEFUN (isis_priority_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis priority <0-127> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set priority for Designated Router election\n" - * "Priority value\n" - * "Specify priority for level-2 routing\n" - * - */ DEFUN (no_isis_priority_l2, no_isis_priority_l2_cmd, - "no isis priority level-2", + "no isis priority [(0-127)] level-2", NO_STR "IS-IS commands\n" "Set priority for Designated Router election\n" + "Priority value\n" "Specify priority for level-2 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -563,21 +529,14 @@ DEFUN (isis_metric, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis metric <0-16777215>", - * NO_STR - * "IS-IS commands\n" - * "Set default metric for circuit\n" - * "Default metric value\n" - * - */ + DEFUN (no_isis_metric, no_isis_metric_cmd, - "no isis metric", + "no isis metric [(0-16777215)]", NO_STR "IS-IS commands\n" - "Set default metric for circuit\n") + "Set default metric for circuit\n" + "Default metric value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -629,22 +588,14 @@ DEFUN (isis_metric_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis metric <0-16777215> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set default metric for circuit\n" - * "Default metric value\n" - * "Specify metric for level-1 routing\n" - * - */ + DEFUN (no_isis_metric_l1, no_isis_metric_l1_cmd, - "no isis metric level-1", + "no isis metric [(0-16777215)] level-1", NO_STR "IS-IS commands\n" "Set default metric for circuit\n" + "Default metric value\n" "Specify metric for level-1 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -696,22 +647,14 @@ DEFUN (isis_metric_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis metric <0-16777215> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set default metric for circuit\n" - * "Default metric value\n" - * "Specify metric for level-2 routing\n" - * - */ + DEFUN (no_isis_metric_l2, no_isis_metric_l2_cmd, - "no isis metric level-2", + "no isis metric [(0-16777215)] level-2", NO_STR "IS-IS commands\n" "Set default metric for circuit\n" + "Default metric value\n" "Specify metric for level-2 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -752,22 +695,14 @@ DEFUN (isis_hello_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-interval <1-600>", - * NO_STR - * "IS-IS commands\n" - * "Set Hello interval\n" - * "Hello interval value\n" - * "Holdtime 1 second, interval depends on multiplier\n" - * - */ + DEFUN (no_isis_hello_interval, no_isis_hello_interval_cmd, - "no isis hello-interval", + "no isis hello-interval [(1-600)]", NO_STR "IS-IS commands\n" - "Set Hello interval\n") + "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -808,23 +743,14 @@ DEFUN (isis_hello_interval_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-interval <1-600> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set Hello interval\n" - * "Hello interval value\n" - * "Holdtime 1 second, interval depends on multiplier\n" - * "Specify hello-interval for level-1 IIHs\n" - * - */ + DEFUN (no_isis_hello_interval_l1, no_isis_hello_interval_l1_cmd, - "no isis hello-interval level-1", + "no isis hello-interval [(1-600)] level-1", NO_STR "IS-IS commands\n" "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-1 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -865,23 +791,14 @@ DEFUN (isis_hello_interval_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-interval <1-600> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set Hello interval\n" - * "Hello interval value\n" - * "Holdtime 1 second, interval depends on multiplier\n" - * "Specify hello-interval for level-2 IIHs\n" - * - */ + DEFUN (no_isis_hello_interval_l2, no_isis_hello_interval_l2_cmd, - "no isis hello-interval level-2", + "no isis hello-interval [(1-600)] level-2", NO_STR "IS-IS commands\n" "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-2 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -921,21 +838,14 @@ DEFUN (isis_hello_multiplier, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-multiplier <2-100>", - * NO_STR - * "IS-IS commands\n" - * "Set multiplier for Hello holding time\n" - * "Hello multiplier value\n" - * - */ + DEFUN (no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, - "no isis hello-multiplier", + "no isis hello-multiplier [(2-100)]", NO_STR "IS-IS commands\n" - "Set multiplier for Hello holding time\n") + "Set multiplier for Hello holding time\n" + "Hello multiplier value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -975,22 +885,14 @@ DEFUN (isis_hello_multiplier_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-multiplier <2-100> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set multiplier for Hello holding time\n" - * "Hello multiplier value\n" - * "Specify hello multiplier for level-1 IIHs\n" - * - */ + DEFUN (no_isis_hello_multiplier_l1, no_isis_hello_multiplier_l1_cmd, - "no isis hello-multiplier level-1", + "no isis hello-multiplier [(2-100)] level-1", NO_STR "IS-IS commands\n" "Set multiplier for Hello holding time\n" + "Hello multiplier value\n" "Specify hello multiplier for level-1 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1030,22 +932,14 @@ DEFUN (isis_hello_multiplier_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis hello-multiplier <2-100> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set multiplier for Hello holding time\n" - * "Hello multiplier value\n" - * "Specify hello multiplier for level-2 IIHs\n" - * - */ + DEFUN (no_isis_hello_multiplier_l2, no_isis_hello_multiplier_l2_cmd, - "no isis hello-multiplier level-2", + "no isis hello-multiplier [(2-100)] level-2", NO_STR "IS-IS commands\n" "Set multiplier for Hello holding time\n" + "Hello multiplier value\n" "Specify hello multiplier for level-2 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1120,21 +1014,14 @@ DEFUN (csnp_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis csnp-interval <1-600>", - * NO_STR - * "IS-IS commands\n" - * "Set CSNP interval in seconds\n" - * "CSNP interval value\n" - * - */ + DEFUN (no_csnp_interval, no_csnp_interval_cmd, - "no isis csnp-interval", + "no isis csnp-interval [(1-600)]", NO_STR "IS-IS commands\n" - "Set CSNP interval in seconds\n") + "Set CSNP interval in seconds\n" + "CSNP interval value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -1174,22 +1061,14 @@ DEFUN (csnp_interval_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis csnp-interval <1-600> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set CSNP interval in seconds\n" - * "CSNP interval value\n" - * "Specify interval for level-1 CSNPs\n" - * - */ + DEFUN (no_csnp_interval_l1, no_csnp_interval_l1_cmd, - "no isis csnp-interval level-1", + "no isis csnp-interval [(1-600)] level-1", NO_STR "IS-IS commands\n" "Set CSNP interval in seconds\n" + "CSNP interval value\n" "Specify interval for level-1 CSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1229,22 +1108,14 @@ DEFUN (csnp_interval_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis csnp-interval <1-600> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set CSNP interval in seconds\n" - * "CSNP interval value\n" - * "Specify interval for level-2 CSNPs\n" - * - */ + DEFUN (no_csnp_interval_l2, no_csnp_interval_l2_cmd, - "no isis csnp-interval level-2", + "no isis csnp-interval [(1-600)] level-2", NO_STR "IS-IS commands\n" "Set CSNP interval in seconds\n" + "CSNP interval value\n" "Specify interval for level-2 CSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1284,21 +1155,14 @@ DEFUN (psnp_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis psnp-interval <1-120>", - * NO_STR - * "IS-IS commands\n" - * "Set PSNP interval in seconds\n" - * "PSNP interval value\n" - * - */ + DEFUN (no_psnp_interval, no_psnp_interval_cmd, - "no isis psnp-interval", + "no isis psnp-interval [(1-120)]", NO_STR "IS-IS commands\n" - "Set PSNP interval in seconds\n") + "Set PSNP interval in seconds\n" + "PSNP interval value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -1338,22 +1202,14 @@ DEFUN (psnp_interval_l1, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis psnp-interval <1-120> level-1", - * NO_STR - * "IS-IS commands\n" - * "Set PSNP interval in seconds\n" - * "PSNP interval value\n" - * "Specify interval for level-1 PSNPs\n" - * - */ + DEFUN (no_psnp_interval_l1, no_psnp_interval_l1_cmd, - "no isis psnp-interval level-1", + "no isis psnp-interval [(1-120)] level-1", NO_STR "IS-IS commands\n" "Set PSNP interval in seconds\n" + "PSNP interval value\n" "Specify interval for level-1 PSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1393,22 +1249,14 @@ DEFUN (psnp_interval_l2, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no isis psnp-interval <1-120> level-2", - * NO_STR - * "IS-IS commands\n" - * "Set PSNP interval in seconds\n" - * "PSNP interval value\n" - * "Specify interval for level-2 PSNPs\n" - * - */ + DEFUN (no_psnp_interval_l2, no_psnp_interval_l2_cmd, - "no isis psnp-interval level-2", + "no isis psnp-interval [(1-120)] level-2", NO_STR "IS-IS commands\n" "Set PSNP interval in seconds\n" + "PSNP interval value\n" "Specify interval for level-2 PSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1631,19 +1479,13 @@ DEFUN (area_lsp_mtu, return area_lsp_mtu_set(vty, lsp_mtu); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-mtu <128-4352>", - * NO_STR - * "Configure the maximum size of generated LSPs\n" - * "Maximum size of generated LSPs\n" - * - */ + DEFUN (no_area_lsp_mtu, no_area_lsp_mtu_cmd, - "no lsp-mtu", + "no lsp-mtu [(128-4352)]", NO_STR - "Configure the maximum size of generated LSPs\n") + "Configure the maximum size of generated LSPs\n" + "Maximum size of generated LSPs\n") { return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU); } @@ -1758,19 +1600,12 @@ DEFUN (lsp_gen_interval, return set_lsp_gen_interval (vty, area, interval, level); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-gen-interval <1-120>", - * NO_STR - * "Minimum interval between regenerating same LSP\n" - * "Minimum interval in seconds\n" - * - */ DEFUN (no_lsp_gen_interval, no_lsp_gen_interval_cmd, - "no lsp-gen-interval", + "no lsp-gen-interval [(1-120)]", NO_STR - "Minimum interval between regenerating same LSP\n") + "Minimum interval between regenerating same LSP\n" + "Minimum interval in seconds\n") { struct isis_area *area; uint16_t interval; @@ -1801,18 +1636,9 @@ DEFUN (lsp_gen_interval_l1, return set_lsp_gen_interval (vty, area, interval, level); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-gen-interval level-1 <1-120>", - * NO_STR - * "Minimum interval between regenerating same LSP\n" - * "Set interval for level 1 only\n" - * "Minimum interval in seconds\n" - * - */ DEFUN (no_lsp_gen_interval_l1, no_lsp_gen_interval_l1_cmd, - "no lsp-gen-interval level-1", + "no lsp-gen-interval level-1 [(1-120)]", NO_STR "Minimum interval between regenerating same LSP\n" "Set interval for level 1 only\n") @@ -1846,21 +1672,13 @@ DEFUN (lsp_gen_interval_l2, return set_lsp_gen_interval (vty, area, interval, level); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-gen-interval level-2 <1-120>", - * NO_STR - * "Minimum interval between regenerating same LSP\n" - * "Set interval for level 2 only\n" - * "Minimum interval in seconds\n" - * - */ DEFUN (no_lsp_gen_interval_l2, no_lsp_gen_interval_l2_cmd, - "no lsp-gen-interval level-2", + "no lsp-gen-interval level-2 [(1-120)]", NO_STR "Minimum interval between regenerating same LSP\n" - "Set interval for level 2 only\n") + "Set interval for level 2 only\n" + "Minimum interval in seconds\n") { struct isis_area *area; uint16_t interval; @@ -1891,31 +1709,15 @@ DEFUN (spf_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no spf-interval level-2 <1-120>", - * NO_STR - * "Minimum interval between SPF calculations\n" - * "Set interval for level 2 only\n" - * "Minimum interval between consecutive SPFs in seconds\n" - * - * "no spf-interval <1-120>", - * NO_STR - * "Minimum interval between SPF calculations\n" - * "Minimum interval between consecutive SPFs in seconds\n" - * - * "no spf-interval level-1 <1-120>", - * NO_STR - * "Minimum interval between SPF calculations\n" - * "Set interval for level 1 only\n" - * "Minimum interval between consecutive SPFs in seconds\n" - * - */ + DEFUN (no_spf_interval, no_spf_interval_cmd, - "no spf-interval", + "no spf-interval [[] (1-120)]", NO_STR - "Minimum interval between SPF calculations\n") + "Minimum interval between SPF calculations\n" + "Set interval for level 1 only\n" + "Set interval for level 2 only\n" + "Minimum interval between consecutive SPFs in seconds\n") { struct isis_area *area; @@ -2060,18 +1862,12 @@ DEFUN (max_lsp_lifetime, return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no max-lsp-lifetime <350-65535>", - * NO_STR - * "Maximum LSP lifetime\n" - * "LSP lifetime in seconds\n" - * - */ + DEFUN (no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, - "no max-lsp-lifetime", + "no max-lsp-lifetime [(350-65535)]", NO_STR + "Maximum LSP lifetime\n" "LSP lifetime in seconds\n") { return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, @@ -2089,17 +1885,10 @@ DEFUN (max_lsp_lifetime_l1, return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no max-lsp-lifetime level-1 <350-65535>", - * NO_STR - * "Maximum LSP lifetime for Level 1 only\n" - * "LSP lifetime for Level 1 only in seconds\n" - * - */ + DEFUN (no_max_lsp_lifetime_l1, no_max_lsp_lifetime_l1_cmd, - "no max-lsp-lifetime level-1", + "no max-lsp-lifetime level-1 [(350-65535)]", NO_STR "LSP lifetime for Level 1 only in seconds\n") { @@ -2117,17 +1906,10 @@ DEFUN (max_lsp_lifetime_l2, return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no max-lsp-lifetime level-2 <350-65535>", - * NO_STR - * "Maximum LSP lifetime for Level 2 only\n" - * "LSP lifetime for Level 2 only in seconds\n" - * - */ + DEFUN (no_max_lsp_lifetime_l2, no_max_lsp_lifetime_l2_cmd, - "no max-lsp-lifetime level-2", + "no max-lsp-lifetime level-2 [(350-65535)]", NO_STR "LSP lifetime for Level 2 only in seconds\n") { @@ -2189,18 +1971,12 @@ DEFUN (lsp_refresh_interval, return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-refresh-interval <1-65235>", - * NO_STR - * "LSP refresh interval\n" - * "LSP refresh interval in seconds\n" - * - */ + DEFUN (no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, - "no lsp-refresh-interval", + "no lsp-refresh-interval [(1-65235)]", NO_STR + "LSP refresh interval\n" "LSP refresh interval in seconds\n") { return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, @@ -2218,18 +1994,12 @@ DEFUN (lsp_refresh_interval_l1, return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-refresh-interval level-1 <1-65235>", - * NO_STR - * "LSP refresh interval for Level 1 only\n" - * "LSP refresh interval for Level 1 only in seconds\n" - * - */ + DEFUN (no_lsp_refresh_interval_l1, no_lsp_refresh_interval_l1_cmd, - "no lsp-refresh-interval level-1", + "no lsp-refresh-interval level-1 [(1-65235)]", NO_STR + "LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only in seconds\n") { return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, @@ -2247,18 +2017,12 @@ DEFUN (lsp_refresh_interval_l2, return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no lsp-refresh-interval level-2 <1-65235>", - * NO_STR - * "LSP refresh interval for Level 2 only\n" - * "LSP refresh interval for Level 2 only in seconds\n" - * - */ + DEFUN (no_lsp_refresh_interval_l2, no_lsp_refresh_interval_l2_cmd, - "no lsp-refresh-interval level-2", + "no lsp-refresh-interval level-2 [(1-65235)]", NO_STR + "LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only in seconds\n") { return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, @@ -2290,36 +2054,29 @@ area_passwd_set(struct vty *vty, int level, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "(area-password|domain-password) md5 WORD authenticate snp (send-only|validate)", - * "Configure the authentication password for an area\n" - * "Set the authentication password for a routing domain\n" - * "Authentication type\n" - * "Level-wide password\n" - * "Authentication\n" - * "SNP PDUs\n" - * "Send but do not check PDUs on receiving\n" - * "Send and check PDUs on receiving\n" - * - */ + DEFUN (area_passwd_md5, area_passwd_md5_cmd, - " md5 WORD", + " md5 WORD [authenticate snp ]", "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n" "Authentication type\n" - "Level-wide password\n") + "Level-wide password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") { int idx_password = 0; int idx_word = 2; + int idx_type = 5; u_char snp_auth = 0; - int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; - if (argc > 2) + if (argc > 3) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strmatch(argv[idx_type]->text, "validate")) snp_auth |= SNP_AUTH_RECV; } @@ -2328,36 +2085,28 @@ DEFUN (area_passwd_md5, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "(area-password|domain-password) clear WORD authenticate snp (send-only|validate)", - * "Configure the authentication password for an area\n" - * "Set the authentication password for a routing domain\n" - * "Authentication type\n" - * "Area password\n" - * "Authentication\n" - * "SNP PDUs\n" - * "Send but do not check PDUs on receiving\n" - * "Send and check PDUs on receiving\n" - * - */ DEFUN (area_passwd_clear, area_passwd_clear_cmd, - " clear WORD", + " clear WORD [authenticate snp ]", "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n" "Authentication type\n" - "Area password\n") + "Area password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") { int idx_password = 0; int idx_word = 2; + int idx_type = 5; u_char snp_auth = 0; - int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; - if (argc > 2) + if (argc > 3) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strmatch(argv[idx_type]->arg, "validate")) snp_auth |= SNP_AUTH_RECV; } diff --git a/isisd/isisd.c b/isisd/isisd.c index b1c21b55c9..ffe17b3643 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1989,17 +1989,9 @@ DEFUN (topology_baseis, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no topology base-is", - * NO_STR - * "Topology generation for IS-IS\n" - * "A Network IS Base for this topology\n" - * - */ DEFUN (no_topology_baseis, no_topology_baseis_cmd, - "no topology base-is WORD", + "no topology base-is [WORD]", NO_STR "Topology generation for IS-IS\n" "A Network IS Base for this topology\n" From 4c9bd27548055e6f0642dcbd3549ccb9a11f32bc Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 05:05:12 +0000 Subject: [PATCH 162/280] bgpd: fixed some bgp_routemap CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_routemap.c | 465 ++++++++++++++++---------------------------- 1 file changed, 168 insertions(+), 297 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index dc90094f65..3e0a0752f0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3016,30 +3016,22 @@ DEFUN (match_peer_local, RMAP_EVENT_MATCH_DELETED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match peer local", - * NO_STR - * MATCH_STR - * "Match peer address\n" - * "Static or Redistributed routes\n" - * - * "no match peer (A.B.C.D|X:X::X:X)", - * NO_STR - * MATCH_STR - * "Match peer address\n" - * "IP address of peer\n" - * "IPv6 address of peer\n" - * - */ DEFUN (no_match_peer, no_match_peer_cmd, - "no match peer", + "no match peer []", NO_STR MATCH_STR - "Match peer address\n") + "Match peer address\n" + "Static or Redistributed routes\n" + "IP address of peer\n" + "IPv6 address of peer\n") { - return bgp_route_match_delete (vty, vty->index, "peer", argv[3]->arg, + int idx_peer = 3; + + if (argc <= idx_peer) + return bgp_route_match_delete (vty, vty->index, "peer", NULL, + RMAP_EVENT_MATCH_DELETED); + return bgp_route_match_delete (vty, vty->index, "peer", argv[idx_peer]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3060,27 +3052,23 @@ DEFUN (match_ip_address, RMAP_EVENT_FILTER_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ + DEFUN (no_match_ip_address, no_match_ip_address_cmd, - "no match ip address", + "no match ip address [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match address of route\n") + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - return bgp_route_match_delete (vty, vty->index, "ip address", argv[4]->arg, + int idx_word = 4; + if (argc <= idx_word) + return bgp_route_match_delete (vty, vty->index, "ip address", NULL, + RMAP_EVENT_FILTER_DELETED); + return bgp_route_match_delete (vty, vty->index, "ip address", argv[idx_word]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -3100,33 +3088,28 @@ DEFUN (match_ip_next_hop, RMAP_EVENT_FILTER_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ + DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD]", NO_STR MATCH_STR IP_STR - "Match next-hop address of route\n") + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg, + int idx_word = 4; + if (argc <= idx_word) + return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL, + RMAP_EVENT_FILTER_DELETED); + return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[idx_word]->arg, RMAP_EVENT_FILTER_DELETED); } -/* match probability { */ - +/* match probability */ DEFUN (match_probability, match_probability_cmd, "match probability (0-100)", @@ -3139,29 +3122,24 @@ DEFUN (match_probability, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match probability <1-99>", - * NO_STR - * MATCH_STR - * "Match portion of routes defined by percentage value\n" - * "Percentage of routes\n" - * - */ + DEFUN (no_match_probability, no_match_probability_cmd, - "no match probability", + "no match probability [(1-99)]", NO_STR MATCH_STR - "Match portion of routes defined by percentage value\n") + "Match portion of routes defined by percentage value\n" + "Percentage of routes\n") { - return bgp_route_match_delete (vty, vty->index, "probability", argv[2]->arg, + int idx_number = 3; + if (argc <= idx_number) + return bgp_route_match_delete (vty, vty->index, "probability", NULL, + RMAP_EVENT_MATCH_DELETED); + return bgp_route_match_delete (vty, vty->index, "probability", argv[idx_number]->arg, RMAP_EVENT_MATCH_DELETED); } -/* } */ - DEFUN (match_ip_route_source, match_ip_route_source_cmd, "match ip route-source <(1-199)|(1300-2699)|WORD>", @@ -3177,28 +3155,24 @@ DEFUN (match_ip_route_source, RMAP_EVENT_FILTER_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip route-source (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match advertising source address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP standard access-list name\n" - * - */ + DEFUN (no_match_ip_route_source, no_match_ip_route_source_cmd, - "no match ip route-source", + "no match ip route-source [(1-199)|(1300-2699)|WORD]", NO_STR MATCH_STR IP_STR - "Match advertising source address of route\n") + "Match advertising source address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP standard access-list name\n") { + int idx_number = 4; + if (argc <= idx_number) + return bgp_route_match_delete (vty, vty->index, "ip route-source", + NULL, RMAP_EVENT_FILTER_DELETED); return bgp_route_match_delete (vty, vty->index, "ip route-source", - argv[4]->arg, RMAP_EVENT_FILTER_DELETED); + argv[idx_number]->arg, RMAP_EVENT_FILTER_DELETED); } @@ -3216,28 +3190,23 @@ DEFUN (match_ip_address_prefix_list, argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ + DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", + "no match ip address prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { + int idx_word = 5; + if (argc <= idx_word) + return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", + NULL, RMAP_EVENT_PLIST_DELETED); return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", - argv[5]->arg, RMAP_EVENT_PLIST_DELETED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); } @@ -3255,28 +3224,22 @@ DEFUN (match_ip_next_hop_prefix_list, argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list", + "no match ip next-hop prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match next-hop address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { + int idx_word = 5; + if (argc <= idx_word) + return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", + NULL, RMAP_EVENT_PLIST_DELETED); return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argv[5]->arg, RMAP_EVENT_PLIST_DELETED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); } @@ -3294,28 +3257,23 @@ DEFUN (match_ip_route_source_prefix_list, argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip route-source prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match advertising source address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ + DEFUN (no_match_ip_route_source_prefix_list, no_match_ip_route_source_prefix_list_cmd, - "no match ip route-source prefix-list", + "no match ip route-source prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match advertising source address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { + int idx_word = 5; + if (argc <= idx_word) + return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list", + NULL, RMAP_EVENT_PLIST_DELETED); return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list", - argv[5]->arg, RMAP_EVENT_PLIST_DELETED); + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); } @@ -3331,24 +3289,21 @@ DEFUN (match_metric, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match metric <0-4294967295>", - * NO_STR - * MATCH_STR - * "Match metric of route\n" - * "Metric value\n" - * - */ + DEFUN (no_match_metric, no_match_metric_cmd, - "no match metric", + "no match metric [(0-4294967295)]", NO_STR MATCH_STR - "Match metric of route\n") + "Match metric of route\n" + "Metric value\n") { + int idx_number = 3; + if (argc <= idx_number) + return bgp_route_match_delete (vty, vty->index, "metric", + NULL, RMAP_EVENT_MATCH_DELETED); return bgp_route_match_delete (vty, vty->index, "metric", - argv[3]->arg, + argv[idx_number]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3365,24 +3320,21 @@ DEFUN (match_local_pref, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match local-preference <0-4294967295>", - * NO_STR - * MATCH_STR - * "Match local preference of route\n" - * "Local preference value\n" - * - */ + DEFUN (no_match_local_pref, no_match_local_pref_cmd, - "no match local-preference", + "no match local-preference [(0-4294967295)]", NO_STR MATCH_STR - "Match local preference of route\n") + "Match local preference of route\n" + "Local preference value\n") { + int idx_localpref = 3; + if (argc <= idx_localpref) + return bgp_route_match_delete (vty, vty->index, "local-preference", + NULL, RMAP_EVENT_MATCH_DELETED); return bgp_route_match_delete (vty, vty->index, "local-preference", - argv[3]->arg, + argv[idx_localpref]->arg, RMAP_EVENT_MATCH_DELETED); } @@ -3428,32 +3380,16 @@ DEFUN (match_community_exact, return ret; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match community (<1-99>|<100-500>|WORD)", - * NO_STR - * MATCH_STR - * "Match BGP community list\n" - * "Community-list number (standard)\n" - * "Community-list number (expanded)\n" - * "Community-list name\n" - * - * "no match community (<1-99>|<100-500>|WORD) exact-match", - * NO_STR - * MATCH_STR - * "Match BGP community list\n" - * "Community-list number (standard)\n" - * "Community-list number (expanded)\n" - * "Community-list name\n" - * "Do exact matching of communities\n" - * - */ DEFUN (no_match_community, no_match_community_cmd, - "no match community", + "no match community [<(1-99)|(100-500)|WORD> [exact-match]]", NO_STR MATCH_STR - "Match BGP community list\n") + "Match BGP community list\n" + "Community-list number (standard)\n" + "Community-list number (expanded)\n" + "Community-list name\n" + "Do exact matching of communities\n") { return bgp_route_match_delete (vty, vty->index, "community", NULL, RMAP_EVENT_CLIST_DELETED); @@ -3475,23 +3411,16 @@ DEFUN (match_ecommunity, RMAP_EVENT_ECLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match extcommunity (<1-99>|<100-500>|WORD)", - * NO_STR - * MATCH_STR - * "Match BGP/VPN extended community list\n" - * "Extended community-list number (standard)\n" - * "Extended community-list number (expanded)\n" - * "Extended community-list name\n" - * - */ + DEFUN (no_match_ecommunity, no_match_ecommunity_cmd, - "no match extcommunity", + "no match extcommunity [<(1-99)|(100-500)|WORD>]", NO_STR MATCH_STR - "Match BGP/VPN extended community list\n") + "Match BGP/VPN extended community list\n" + "Extended community-list number (standard)\n" + "Extended community-list number (expanded)\n" + "Extended community-list name\n") { return bgp_route_match_delete (vty, vty->index, "extcommunity", NULL, RMAP_EVENT_ECLIST_DELETED); @@ -3510,21 +3439,14 @@ DEFUN (match_aspath, RMAP_EVENT_ASLIST_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match as-path WORD", - * NO_STR - * MATCH_STR - * "Match BGP AS path list\n" - * "AS path access-list name\n" - * - */ + DEFUN (no_match_aspath, no_match_aspath_cmd, - "no match as-path", + "no match as-path [WORD]", NO_STR MATCH_STR - "Match BGP AS path list\n") + "Match BGP AS path list\n" + "AS path access-list name\n") { return bgp_route_match_delete (vty, vty->index, "as-path", NULL, RMAP_EVENT_ASLIST_DELETED); @@ -3554,23 +3476,16 @@ DEFUN (match_origin, return CMD_WARNING; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match origin (egp|igp|incomplete)", - * NO_STR - * MATCH_STR - * "BGP origin code\n" - * "remote EGP\n" - * "local IGP\n" - * "unknown heritage\n" - * - */ + DEFUN (no_match_origin, no_match_origin_cmd, - "no match origin", + "no match origin []", NO_STR MATCH_STR - "BGP origin code\n") + "BGP origin code\n" + "remote EGP\n" + "local IGP\n" + "unknown heritage\n") { return bgp_route_match_delete (vty, vty->index, "origin", NULL, RMAP_EVENT_MATCH_DELETED); @@ -3589,21 +3504,14 @@ DEFUN (match_interface, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * NO_STR - * MATCH_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ + DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface", + "no match interface [WORD]", NO_STR MATCH_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { return bgp_route_match_delete (vty, vty->index, "interface", argv[3]->arg, RMAP_EVENT_MATCH_DELETED); @@ -3622,28 +3530,20 @@ DEFUN (match_tag, RMAP_EVENT_MATCH_ADDED); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match tag <1-65535>", - * NO_STR - * MATCH_STR - * "Match tag of route\n" - * "Tag value\n" - * - */ + DEFUN (no_match_tag, no_match_tag_cmd, - "no match tag", + "no match tag [(1-65535)]", NO_STR MATCH_STR - "Match tag of route\n") + "Match tag of route\n" + "Tag value\n") { return bgp_route_match_delete (vty, vty->index, "tag", argv[3]->arg, RMAP_EVENT_MATCH_DELETED); } - DEFUN (set_ip_nexthop, set_ip_nexthop_cmd, "set ip next-hop A.B.C.D", @@ -3695,31 +3595,20 @@ DEFUN (set_ip_nexthop_unchanged, return bgp_route_set_add (vty, vty->index, "ip next-hop", "unchanged"); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set ip next-hop peer-address", - * NO_STR - * SET_STR - * IP_STR - * "Next hop address\n" - * "Use peer address (for BGP only)\n" - * - * "no set ip next-hop A.B.C.D", - * NO_STR - * SET_STR - * IP_STR - * "Next hop address\n" - * "IP address of next hop\n" - * - */ + DEFUN (no_set_ip_nexthop, no_set_ip_nexthop_cmd, - "no set ip next-hop", + "no set ip next-hop []", NO_STR SET_STR - "Next hop address\n") + "Next hop address\n" + "Use peer address (for BGP only)\n" + "IP address of next hop\n") { - return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); + int idx_peer = 4; + if (argc <= idx_peer) + return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); + return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[idx_peer]->arg); } @@ -3751,24 +3640,18 @@ DEFUN (set_metric, } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric <0-4294967295>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Metric value\n" - * - */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric", + "no set metric [(0-4294967295)]", NO_STR SET_STR - "Metric value for destination routing protocol\n") + "Metric value for destination routing protocol\n" + "Metric value\n") { - return bgp_route_set_delete (vty, vty->index, "metric", argv[3]->arg); + int idx_number = 3; + if (argc <= idx_number) + return bgp_route_set_delete (vty, vty->index, "metric", NULL); + return bgp_route_set_delete (vty, vty->index, "metric", argv[idx_number]->arg); } @@ -3783,23 +3666,19 @@ DEFUN (set_local_pref, return bgp_route_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set local-preference <0-4294967295>", - * NO_STR - * SET_STR - * "BGP local preference path attribute\n" - * "Preference value\n" - * - */ + DEFUN (no_set_local_pref, no_set_local_pref_cmd, - "no set local-preference", + "no set local-preference [(0-4294967295)]", NO_STR SET_STR - "BGP local preference path attribute\n") + "BGP local preference path attribute\n" + "Preference value\n") { - return bgp_route_set_delete (vty, vty->index, "local-preference", argv[3]->arg); + int idx_localpref = 3; + if (argc <= idx_localpref) + return bgp_route_set_delete (vty, vty->index, "local-preference", NULL); + return bgp_route_set_delete (vty, vty->index, "local-preference", argv[idx_localpref]->arg); } @@ -3814,23 +3693,19 @@ DEFUN (set_weight, return bgp_route_set_add (vty, vty->index, "weight", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set weight <0-4294967295>", - * NO_STR - * SET_STR - * "BGP weight for routing table\n" - * "Weight value\n" - * - */ + DEFUN (no_set_weight, no_set_weight_cmd, - "no set weight", + "no set weight [(0-4294967295)]", NO_STR SET_STR - "BGP weight for routing table\n") + "BGP weight for routing table\n" + "Weight value\n") { - return bgp_route_set_delete (vty, vty->index, "weight", argv[3]->arg); + int idx_weight = 3; + if (argc <= idx_weight) + return bgp_route_set_delete (vty, vty->index, "weight", NULL); + return bgp_route_set_delete (vty, vty->index, "weight", argv[idx_weight]->arg); } @@ -4647,23 +4522,19 @@ DEFUN (set_originator_id, return bgp_route_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set originator-id A.B.C.D", - * NO_STR - * SET_STR - * "BGP originator ID attribute\n" - * "IP address of originator\n" - * - */ + DEFUN (no_set_originator_id, no_set_originator_id_cmd, - "no set originator-id", + "no set originator-id [A.B.C.D]", NO_STR SET_STR - "BGP originator ID attribute\n") + "BGP originator ID attribute\n" + "IP address of originator\n") { - return bgp_route_set_delete (vty, vty->index, "originator-id", argv[3]->arg); + int idx_id = 3; + if (argc < idx_id) + return bgp_route_set_delete (vty, vty->index, "originator-id", NULL); + return bgp_route_set_delete (vty, vty->index, "originator-id", argv[idx_id]->arg); } From a4b2b61027a55c71397bc9e544c4fe92858dd745 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Tue, 27 Sep 2016 13:24:19 +0000 Subject: [PATCH 163/280] bgpd: fixed some bgp_routemap CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_routemap.c | 233 ++++++++++++-------------------------------- 1 file changed, 62 insertions(+), 171 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 3e0a0752f0..230bebe3a1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3709,23 +3709,15 @@ DEFUN (no_set_weight, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "set as-path prepend (last-as) <1-10>", - * SET_STR - * "Transform BGP AS_PATH attribute\n" - * "Prepend to the as-path\n" - * "Use the peer's AS-number\n" - * "Number of times to insert" - * - */ DEFUN (set_aspath_prepend, set_aspath_prepend_cmd, - "set as-path prepend . (1-4294967295)", + "set as-path prepend <(1-4294967295)...|last-as <1-10>", SET_STR "Transform BGP AS_PATH attribute\n" "Prepend to the as-path\n" - "AS number\n") + "AS number\n" + "Use the peer's AS-number\n" + "Number of times to insert") { int ret; char *str; @@ -3738,23 +3730,14 @@ DEFUN (set_aspath_prepend, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set as-path prepend . (1-4294967295)", - * NO_STR - * SET_STR - * "Transform BGP AS_PATH attribute\n" - * "Prepend to the as-path\n" - * "AS number\n" - * - */ DEFUN (no_set_aspath_prepend, no_set_aspath_prepend_cmd, - "no set as-path prepend", + "no set as-path prepend [(1-4294967295)]", NO_STR SET_STR "Transform BGP AS_PATH attribute\n" - "Prepend to the as-path\n") + "Prepend to the as-path\n" + "AS number\n") { int ret; char *str; @@ -3768,7 +3751,7 @@ DEFUN (no_set_aspath_prepend, DEFUN (set_aspath_exclude, set_aspath_exclude_cmd, - "set as-path exclude . (1-4294967295)", + "set as-path exclude (1-4294967295)...", SET_STR "Transform BGP AS-path attribute\n" "Exclude from the as-path\n" @@ -3783,23 +3766,14 @@ DEFUN (set_aspath_exclude, return ret; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set as-path exclude . (1-4294967295)", - * NO_STR - * SET_STR - * "Transform BGP AS_PATH attribute\n" - * "Exclude from the as-path\n" - * "AS number\n" - * - */ DEFUN (no_set_aspath_exclude, no_set_aspath_exclude_cmd, - "no set as-path exclude", + "no set as-path exclude (1-4294967295)...", NO_STR SET_STR "Transform BGP AS_PATH attribute\n" - "Exclude from the as-path\n") + "Exclude from the as-path\n" + "AS number\n") { int ret; char *str; @@ -3914,24 +3888,9 @@ DEFUN (set_community_none, return bgp_route_set_add (vty, vty->index, "community", "none"); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set community none", - * NO_STR - * SET_STR - * "BGP community attribute\n" - * "No community attribute\n" - * - * "no set community AA:NN...", - * NO_STR - * SET_STR - * "BGP community attribute\n" - * COMMUNITY_VAL_STR - * - */ DEFUN (no_set_community, no_set_community_cmd, - "no set community", + "no set community AA:NN...", NO_STR SET_STR "BGP community attribute\n") @@ -3964,21 +3923,9 @@ DEFUN (set_community_delete, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set comm-list (<1-99>|<100-500>|WORD) delete", - * NO_STR - * SET_STR - * "set BGP community list (for deletion)\n" - * "Community-list number (standard)\n" - * "Community-list number (expanded)\n" - * "Community-list name\n" - * "Delete matching communities\n" - * - */ DEFUN (no_set_community_delete, no_set_community_delete_cmd, - "no set comm-list", + "no set comm-list [<(1-99)|(100-500)|WORD> delete]", NO_STR SET_STR "set BGP community list (for deletion)\n") @@ -3989,7 +3936,7 @@ DEFUN (no_set_community_delete, DEFUN (set_ecommunity_rt, set_ecommunity_rt_cmd, - "set extcommunity rt .ASN:nn_or_IP-address:nn", + "set extcommunity rt ASN:nn_or_IP-address:nn...", SET_STR "BGP extended community attribute\n" "Route Target extended community\n" @@ -4005,19 +3952,9 @@ DEFUN (set_ecommunity_rt, return ret; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set extcommunity rt .ASN:nn_or_IP-address:nn", - * NO_STR - * SET_STR - * "BGP extended community attribute\n" - * "Route Target extended community\n" - * "VPN extended community\n" - * - */ DEFUN (no_set_ecommunity_rt, no_set_ecommunity_rt_cmd, - "no set extcommunity rt", + "no set extcommunity rt ASN:nn_or_IP-address:nn...", NO_STR SET_STR "BGP extended community attribute\n" @@ -4029,7 +3966,7 @@ DEFUN (no_set_ecommunity_rt, DEFUN (set_ecommunity_soo, set_ecommunity_soo_cmd, - "set extcommunity soo .ASN:nn_or_IP-address:nn", + "set extcommunity soo ASN:nn_or_IP-address:nn...", SET_STR "BGP extended community attribute\n" "Site-of-Origin extended community\n" @@ -4044,19 +3981,10 @@ DEFUN (set_ecommunity_soo, return ret; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set extcommunity soo .ASN:nn_or_IP-address:nn", - * NO_STR - * SET_STR - * "BGP extended community attribute\n" - * "Site-of-Origin extended community\n" - * "VPN extended community\n" - * - */ + DEFUN (no_set_ecommunity_soo, no_set_ecommunity_soo_cmd, - "no set extcommunity soo", + "no set extcommunity soo ASN:nn_or_IP-address:nn...", NO_STR SET_STR "BGP extended community attribute\n" @@ -4086,20 +4014,10 @@ DEFUN (set_origin, return CMD_WARNING; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set origin (egp|igp|incomplete)", - * NO_STR - * SET_STR - * "BGP origin code\n" - * "remote EGP\n" - * "local IGP\n" - * "unknown heritage\n" - * - */ + DEFUN (no_set_origin, no_set_origin_cmd, - "no set origin", + "no set origin []", NO_STR SET_STR "BGP origin code\n") @@ -4161,33 +4079,27 @@ DEFUN (set_aggregator_as, return ret; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set aggregator as (1-4294967295) A.B.C.D", - * NO_STR - * SET_STR - * "BGP aggregator attribute\n" - * "AS number of aggregator\n" - * "AS number\n" - * "IP address of aggregator\n" - * - */ + DEFUN (no_set_aggregator_as, no_set_aggregator_as_cmd, - "no set aggregator as", + "no set aggregator as [(1-4294967295) A.B.C.D]", NO_STR SET_STR "BGP aggregator attribute\n" - "AS number of aggregator\n") + "AS number of aggregator\n" + "AS number\n" + "IP address of aggregator\n") { + int idx_asn = 4; + int idx_ip = 5; int ret; struct in_addr address; char *argstr; - if (argv == 0) + if (argc <= idx_asn) return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL); - ret = inet_aton (argv[5]->arg, &address); + ret = inet_aton (argv[idx_ip]->arg, &address); if (ret == 0) { vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE); @@ -4195,9 +4107,9 @@ DEFUN (no_set_aggregator_as, } argstr = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, - strlen (argv[4]->arg) + strlen (argv[5]->arg) + 2); + strlen (argv[idx_asn]->arg) + strlen (argv[idx_ip]->arg) + 2); - sprintf (argstr, "%s %s", argv[4]->arg, argv[5]->arg); + sprintf (argstr, "%s %s", argv[idx_asn]->arg, argv[idx_ip]->arg); ret = bgp_route_set_delete (vty, vty->index, "aggregator as", argstr); @@ -4218,23 +4130,19 @@ DEFUN (set_tag, return bgp_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set tag <1-65535>", - * NO_STR - * SET_STR - * "Tag value for routing protocol\n" - * "Tag value\n" - * - */ + DEFUN (no_set_tag, no_set_tag_cmd, - "no set tag", + "no set tag [(1-65535)]", NO_STR SET_STR - "Tag value for routing protocol\n") + "Tag value for routing protocol\n" + "Tag value\n") { - return bgp_route_set_delete (vty, vty->index, "tag", argv[3]->arg); + int idx_number = 3; + if (argc <= idx_number) + return bgp_route_set_delete (vty, vty->index, "tag", NULL); + return bgp_route_set_delete (vty, vty->index, "tag", argv[idx_number]->arg); } @@ -4400,27 +4308,21 @@ DEFUN (set_ipv6_nexthop_global, return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set ipv6 next-hop global X:X::X:X", - * NO_STR - * SET_STR - * IPV6_STR - * "IPv6 next-hop address\n" - * "IPv6 global address\n" - * "IPv6 address of next hop\n" - * - */ + DEFUN (no_set_ipv6_nexthop_global, no_set_ipv6_nexthop_global_cmd, - "no set ipv6 next-hop global", + "no set ipv6 next-hop global X:X::X:X", NO_STR SET_STR IPV6_STR "IPv6 next-hop address\n" - "IPv6 global address\n") + "IPv6 global address\n" + "IPv6 address of next hop\n") { - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[5]->arg); + int idx_ipv6 = 5; + if (argc <= idx_ipv6) + return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); + return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); } @@ -4452,26 +4354,20 @@ DEFUN (set_ipv6_nexthop_local, return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set ipv6 next-hop local X:X::X:X", - * NO_STR - * SET_STR - * IPV6_STR - * "IPv6 next-hop address\n" - * "IPv6 local address\n" - * "IPv6 address of next hop\n" - * - */ + DEFUN (no_set_ipv6_nexthop_local, no_set_ipv6_nexthop_local_cmd, - "no set ipv6 next-hop local", + "no set ipv6 next-hop local [X:X::X:X]", NO_STR SET_STR IPV6_STR "IPv6 next-hop address\n" - "IPv6 local address\n") + "IPv6 local address\n" + "IPv6 address of next hop\n") { + int idx_ipv6 = 5; + if (argc <= idx_ipv6) + return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); } @@ -4489,25 +4385,20 @@ DEFUN (set_vpnv4_nexthop, return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set vpnv4 next-hop A.B.C.D", - * NO_STR - * SET_STR - * "VPNv4 information\n" - * "VPNv4 next-hop address\n" - * "IP address of next hop\n" - * - */ + DEFUN (no_set_vpnv4_nexthop, no_set_vpnv4_nexthop_cmd, - "no set vpnv4 next-hop", + "no set vpnv4 next-hop [A.B.C.D]", NO_STR SET_STR "VPNv4 information\n" - "VPNv4 next-hop address\n") + "VPNv4 next-hop address\n" + "IP address of next hop\n") { - return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[4]->arg); + int idx_ipv4 = 4; + if (argc <= idx_ipv4) + return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); + return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); } From 0157c327715ca367d13b7f02b2981f3484ccdeeb Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 17:14:07 +0000 Subject: [PATCH 164/280] lib: reformat vty.h Signed-off-by: Quentin Young --- lib/vty.h | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/vty.h b/lib/vty.h index 599882a382..fe051f053a 100644 --- a/lib/vty.h +++ b/lib/vty.h @@ -29,7 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #define VTY_MAXHIST 20 /* VTY struct. */ -struct vty +struct vty { /* File descripter of this vty. */ int fd; @@ -231,33 +231,33 @@ do { \ VTY_GET_INTEGER_RANGE_HEART(NAME,tmpl,STR,MIN,MAX); \ } while (0) -#define VTY_GET_INTEGER(NAME,V,STR) \ +#define VTY_GET_INTEGER(NAME,V,STR) \ VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX) -#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \ -do { \ - int retv; \ - retv = inet_aton ((STR), &(V)); \ - if (!retv) \ - { \ - vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ - return CMD_WARNING; \ - } \ +#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \ +do { \ + int retv; \ + retv = inet_aton ((STR), &(V)); \ + if (!retv) \ + { \ + vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ + return CMD_WARNING; \ + } \ } while (0) -#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \ -do { \ - int retv; \ - retv = str2prefix_ipv4 ((STR), &(V)); \ - if (retv <= 0) \ - { \ - vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ - return CMD_WARNING; \ - } \ +#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \ +do { \ + int retv; \ + retv = str2prefix_ipv4 ((STR), &(V)); \ + if (retv <= 0) \ + { \ + vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \ + return CMD_WARNING; \ + } \ } while (0) -#define VTY_WARN_EXPERIMENTAL() \ -do { \ +#define VTY_WARN_EXPERIMENTAL() \ +do { \ vty_out (vty, "%% WARNING: this command is experimental. Both its name and" \ " parameters may%s%% change in a future version of Quagga," \ " possibly breaking your configuration!%s", \ @@ -280,7 +280,7 @@ extern void vty_time_print (struct vty *, int); extern void vty_serv_sock (const char *, unsigned short, const char *); extern void vty_close (struct vty *); extern char *vty_get_cwd (void); -extern void vty_log (const char *level, const char *proto, +extern void vty_log (const char *level, const char *proto, const char *fmt, struct timestamp_control *, va_list); extern int vty_config_lock (struct vty *); extern int vty_config_unlock (struct vty *); From 8b5768257654160bdf58db1c78b9d7c7cd04a088 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 17:48:05 +0000 Subject: [PATCH 165/280] ripd: resolve rip_routemap.c CHECK ME's Signed-off-by: Quentin Young --- ripd/rip_routemap.c | 217 +++++++++++++------------------------------- 1 file changed, 62 insertions(+), 155 deletions(-) diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e16f2d941b..ecff6e766d 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -746,23 +746,16 @@ DEFUN (match_metric, return rip_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match metric <0-4294967295>", - * NO_STR - * MATCH_STR - * "Match metric of route\n" - * "Metric value\n" - * - */ DEFUN (no_match_metric, no_match_metric_cmd, - "no match metric", + "no match metric [(0-4294967295)]", NO_STR MATCH_STR - "Match metric of route\n") + "Match metric of route\n" + "Metric value\n") { - return rip_route_match_delete (vty, vty->index, "metric", argv[3]->arg); + char *mval = (argc == 4) ? argc[3]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "metric", mval); } @@ -777,26 +770,18 @@ DEFUN (match_interface, return rip_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * NO_STR - * MATCH_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface", + "no match interface [INTERFACE]", NO_STR MATCH_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { - return rip_route_match_delete (vty, vty->index, "interface", argv[3]->arg); + char *iface = (argc == 4) ? argv[3]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "interface", iface); } - DEFUN (match_ip_next_hop, match_ip_next_hop_cmd, "match ip next-hop <(1-199)|(1300-2699)|WORD>", @@ -811,30 +796,21 @@ DEFUN (match_ip_next_hop, return rip_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match next-hop address of route\n") + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - return rip_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "ip next-hop", al); } - DEFUN (match_ip_next_hop_prefix_list, match_ip_next_hop_prefix_list_cmd, "match ip next-hop prefix-list WORD", @@ -848,27 +824,18 @@ DEFUN (match_ip_next_hop_prefix_list, return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list", + "no match ip next-hop prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match next-hop address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", argv[5]->arg); + char *plist = (argc == 6) ? argv[5]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist); } @@ -887,27 +854,19 @@ DEFUN (match_ip_address, return rip_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP Access-list name\n" - * - */ DEFUN (no_match_ip_address, no_match_ip_address_cmd, - "no match ip address", + "no match ip address [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match address of route\n") + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") { - return rip_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "ip address", al); } @@ -924,27 +883,18 @@ DEFUN (match_ip_address_prefix_list, return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", + "no match ip address prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", argv[5]->arg); + char *plist = (argc == 6) ? argv[5]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist); } @@ -959,75 +909,48 @@ DEFUN (match_tag, return rip_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match tag <1-65535>", - * NO_STR - * MATCH_STR - * "Match tag of route\n" - * "Metric value\n" - * - */ DEFUN (no_match_tag, no_match_tag_cmd, - "no match tag", + "no match tag [(1-65535)]", NO_STR MATCH_STR - "Match tag of route\n") + "Match tag of route\n" + "Metric value\n") { - return rip_route_match_delete (vty, vty->index, "tag", argv[3]->arg); + char *mval = (argc == 4) ? argv[3]->arg : NULL; + return rip_route_match_delete (vty, vty->index, "tag", mval); } /* set functions */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "set metric <+/-metric>", - * SET_STR - * "Metric value for destination routing protocol\n" - * "Add or subtract metric\n" - * - */ DEFUN (set_metric, set_metric_cmd, - "set metric (0-4294967295)", + "set metric <(0-4294967295)|+metric|-metric>", SET_STR "Metric value for destination routing protocol\n" - "Metric value\n") + "Metric value\n" + "Add metric\n" + "Subtract metric\n") { - int idx_number = 2; - return rip_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); + char *metric = argv[2]->type == WORD_TKN ? argv[2]->text : argv[2]->arg; + return rip_route_set_add (vty, vty->index, "metric", metric); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric <+/-metric>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Add or subtract metric\n" - * - * "no set metric <0-4294967295>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Metric value\n" - * - */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric", + "no set metric <(0-4294967295)|+metric|-metric>", NO_STR SET_STR - "Metric value for destination routing protocol\n") + "Metric value for destination routing protocol\n" + "Metric value\n" + "Add metric\n" + "Subtract metric\n") { - return rip_route_set_delete (vty, vty->index, "metric", argv[3]->arg); + char *metric = argv[3]->type == WORD_TKN ? argv[3]->text : argv[3]->arg; + return rip_route_set_delete (vty, vty->index, "metric", metric); } - - DEFUN (set_ip_nexthop, set_ip_nexthop_cmd, "set ip next-hop A.B.C.D", @@ -1057,25 +980,17 @@ DEFUN (set_ip_nexthop, return rip_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set ip next-hop A.B.C.D", - * NO_STR - * SET_STR - * IP_STR - * "Next hop address\n" - * "IP address of next hop\n" - * - */ DEFUN (no_set_ip_nexthop, no_set_ip_nexthop_cmd, - "no set ip next-hop", + "no set ip next-hop [A.B.C.D]", NO_STR SET_STR IP_STR - "Next hop address\n") + "Next hop address\n" + "IP address of next hop\n") { - return rip_route_set_delete (vty, vty->index, "ip next-hop", argv[4]->arg); + char *addr = (argc == 5) ? argv[4]->arg : NULL; + return rip_route_set_delete (vty, vty->index, "ip next-hop", addr); } @@ -1090,26 +1005,18 @@ DEFUN (set_tag, return rip_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set tag <1-65535>", - * NO_STR - * SET_STR - * "Tag value for routing protocol\n" - * "Tag value\n" - * - */ DEFUN (no_set_tag, no_set_tag_cmd, - "no set tag", + "no set tag [(1-65535)]", NO_STR SET_STR - "Tag value for routing protocol\n") + "Tag value for routing protocol\n" + "Tag value\n") { - return rip_route_set_delete (vty, vty->index, "tag", argv[3]->arg); + char *tag = (argc == 4) ? argv[3]->arg : NULL; + return rip_route_set_delete (vty, vty->index, "tag", tag); } - void rip_route_map_reset () { From 4f026db15ae98fa8c3f1e8c7ff6cf16bdd1085fd Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 17:51:06 +0000 Subject: [PATCH 166/280] ripd: argv not argc Signed-off-by: Quentin Young --- ripd/rip_routemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index ecff6e766d..e1017cfb27 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -754,7 +754,7 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { - char *mval = (argc == 4) ? argc[3]->arg : NULL; + char *mval = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "metric", mval); } From 481af2edcbc0585d4831a04443b5a081b0078370 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 21:02:42 +0000 Subject: [PATCH 167/280] ripngd: dispose of some CHECK ME's for ripng Signed-off-by: Quentin Young --- ripngd/ripng_interface.c | 16 ++---- ripngd/ripng_routemap.c | 104 +++++++++++---------------------------- 2 files changed, 33 insertions(+), 87 deletions(-) diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 9c434c8dfb..4081968122 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -1040,23 +1040,14 @@ DEFUN (ipv6_ripng_split_horizon_poisoned_reverse, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 ripng split-horizon poisoned-reverse", - * NO_STR - * IPV6_STR - * "Routing Information Protocol\n" - * "Perform split horizon\n" - * "With poisoned-reverse\n" - * - */ DEFUN (no_ipv6_ripng_split_horizon, no_ipv6_ripng_split_horizon_cmd, - "no ipv6 ripng split-horizon", + "no ipv6 ripng split-horizon [poisoned-reverse]", NO_STR IPV6_STR "Routing Information Protocol\n" - "Perform split horizon\n") + "Perform split horizon\n" + "With poisoned-reverse\n") { struct interface *ifp; struct ripng_interface *ri; @@ -1068,7 +1059,6 @@ DEFUN (no_ipv6_ripng_split_horizon, return CMD_SUCCESS; } - DEFUN (ripng_passive_interface, ripng_passive_interface_cmd, "passive-interface IFNAME", diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 9e2c35b38e..6ecf084660 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -511,23 +511,16 @@ DEFUN (match_metric, return ripng_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match metric <0-4294967295>", - * NO_STR - * MATCH_STR - * "Match metric of route\n" - * "Metric value\n" - * - */ DEFUN (no_match_metric, no_match_metric_cmd, - "no match metric", + "no match metric [(0-4294967295)]", NO_STR MATCH_STR - "Match metric of route\n") + "Match metric of route\n" + "Metric value\n") { - return ripng_route_match_delete (vty, vty->index, "metric", argv[3]->arg); + char *mval = (argc == 4) ? argv[3]->arg : NULL; + return ripng_route_match_delete (vty, vty->index, "metric", mval); } @@ -542,23 +535,16 @@ DEFUN (match_interface, return ripng_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * NO_STR - * MATCH_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface", + "no match interface [INTERFACE]", NO_STR MATCH_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { - return ripng_route_match_delete (vty, vty->index, "interface", argv[3]->arg); + char *iface = (argc == 4) ? argv[3]->arg : NULL; + return ripng_route_match_delete (vty, vty->index, "interface", iface); } @@ -573,23 +559,16 @@ DEFUN (match_tag, return ripng_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match tag <1-65535>", - * NO_STR - * MATCH_STR - * "Match tag of route\n" - * "Metric value\n" - * - */ DEFUN (no_match_tag, no_match_tag_cmd, - "no match tag", + "no match tag [(1-65535)]", NO_STR MATCH_STR - "Match tag of route\n") + "Match tag of route\n" + "Metric value\n") { - return ripng_route_match_delete (vty, vty->index, "tag", argv[3]->arg); + char *mval = (argc == 4) ? argv[3]->arg : NULL; + return ripng_route_match_delete (vty, vty->index, "tag", mval); } @@ -606,23 +585,16 @@ DEFUN (set_metric, return ripng_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric <0-4294967295>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Metric value\n" - * - */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric", + "no set metric [(0-4294967295)]", NO_STR SET_STR - "Metric value for destination routing protocol\n") + "Metric value for destination routing protocol\n" + "Metric value\n") { - return ripng_route_set_delete (vty, vty->index, "metric", argv[3]->arg); + char *mval = (argc == 4) ? argv[3]->arg : NULL; + return ripng_route_set_delete (vty, vty->index, "metric", mval); } @@ -655,27 +627,18 @@ DEFUN (set_ipv6_nexthop_local, return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set ipv6 next-hop local X:X::X:X", - * NO_STR - * SET_STR - * IPV6_STR - * "IPv6 next-hop address\n" - * "IPv6 local address\n" - * "IPv6 address of next hop\n" - * - */ DEFUN (no_set_ipv6_nexthop_local, no_set_ipv6_nexthop_local_cmd, - "no set ipv6 next-hop local", + "no set ipv6 next-hop local [X:X::X:X]", NO_STR SET_STR IPV6_STR "IPv6 next-hop address\n" - "IPv6 local address\n") + "IPv6 local address\n" + "IPv6 address of next hop\n") { - return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); + char *addr = (argc == 6) ? argv[5]->arg : NULL; + return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr); } @@ -690,23 +653,16 @@ DEFUN (set_tag, return ripng_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set tag <1-65535>", - * NO_STR - * SET_STR - * "Tag value for routing protocol\n" - * "Tag value\n" - * - */ DEFUN (no_set_tag, no_set_tag_cmd, - "no set tag", + "no set tag [(1-65535)]", NO_STR SET_STR - "Tag value for routing protocol\n") + "Tag value for routing protocol\n" + "Tag value\n") { - return ripng_route_set_delete (vty, vty->index, "tag", argv[3]->arg); + char *tag = (argc == 4) ? argv[3]->arg : NULL; + return ripng_route_set_delete (vty, vty->index, "tag", tag); } From c8952fc1227e1a7c320d607b67a1f793052244a6 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 27 Sep 2016 21:13:29 +0000 Subject: [PATCH 168/280] ripngd: finish CHECK ME's in ripngd Signed-off-by: Quentin Young --- ripngd/ripngd.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 78a92a497e..dc0bfa3647 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2554,23 +2554,15 @@ DEFUN (ripng_timers, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers basic <0-65535> <0-65535> <0-65535>", - * NO_STR - * "RIPng timers setup\n" - * "Basic timer\n" - * "Routing table update timer value in second. Default is 30.\n" - * "Routing information timeout timer. Default is 180.\n" - * "Garbage collection timer. Default is 120.\n" - * - */ DEFUN (no_ripng_timers, no_ripng_timers_cmd, - "no timers basic", + "no timers basic [(0-65535) (0-65535) (0-65535)", NO_STR "RIPng timers setup\n" - "Basic timer\n") + "Basic timer\n" + "Routing table update timer value in second. Default is 30.\n" + "Routing information timeout timer. Default is 180.\n" + "Garbage collection timer. Default is 120.\n") { /* Set each timer value to the default. */ ripng->update_time = RIPNG_UPDATE_TIMER_DEFAULT; @@ -2583,7 +2575,6 @@ DEFUN (no_ripng_timers, return CMD_SUCCESS; } - DEFUN (show_ipv6_protocols, show_ipv6_protocols_cmd, "show ipv6 protocols", From b62ecea584664417f78d13d5658e3800b86abdfe Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 28 Sep 2016 04:47:43 +0000 Subject: [PATCH 169/280] zebra: finish all zebra CHECK ME's Signed-off-by: Quentin Young --- zebra/interface.c | 201 ++++++++++++++--------------------- zebra/zebra_vty.c | 261 ++++++++++++---------------------------------- 2 files changed, 147 insertions(+), 315 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index c1fbc9cdd3..676b6ed0df 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1298,19 +1298,12 @@ struct cmd_node vrf_node = }; /* Show all interfaces to vty. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show interface vrf NAME", - * SHOW_STR - * "Interface status and configuration\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_interface, show_interface_cmd, - "show interface", + "show interface [vrf NAME]", SHOW_STR - "Interface status and configuration\n") + "Interface status and configuration\n" + VRF_CMD_HELP_STR) { struct listnode *node; struct interface *ifp; @@ -1318,8 +1311,8 @@ DEFUN (show_interface, interface_update_stats (); - if (argc > 0) - VRF_GET_ID (vrf_id, argv[2]->arg); + if (argc > 2) + VRF_GET_ID (vrf_id, argv[3]->arg); /* All interface print. */ for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) @@ -1385,17 +1378,9 @@ DEFUN (show_interface_name_vrf, } /* Show specified interface to vty. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show interface IFNAME", - * SHOW_STR - * "Interface status and configuration\n" - * "Interface name\n" - * - */ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, - "show interface IFNAME vrf all", + "show interface IFNAME [vrf all]", SHOW_STR "Interface status and configuration\n" "Interface name\n" @@ -1470,26 +1455,18 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id) } } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show interface description vrf NAME", - * SHOW_STR - * "Interface status and configuration\n" - * "Interface description\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_interface_desc, show_interface_desc_cmd, - "show interface description", + "show interface description [vrf NAME]", SHOW_STR "Interface status and configuration\n" - "Interface description\n") + "Interface description\n" + VRF_CMD_HELP_STR) { vrf_id_t vrf_id = VRF_DEFAULT; - if (argc > 0) - VRF_GET_ID (vrf_id, argv[3]->arg); + if (argc > 3) + VRF_GET_ID (vrf_id, argv[4]->arg); if_show_description (vty, vrf_id); @@ -1704,19 +1681,12 @@ DEFUN (bandwidth_if, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no bandwidth <1-100000>", - * NO_STR - * "Set bandwidth informational parameter\n" - * "Bandwidth in megabits\n" - * - */ DEFUN (no_bandwidth_if, no_bandwidth_if_cmd, - "no bandwidth", + "no bandwidth [(1-100000)]", NO_STR - "Set bandwidth informational parameter\n") + "Set bandwidth informational parameter\n" + "Bandwidth in megabits\n") { struct interface *ifp; @@ -2100,93 +2070,79 @@ DEFUN (no_link_params_inter_as, } /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "delay <0-16777215> min <0-16777215> max <0-16777215>", - * "Unidirectional Average Link Delay (optionally Minimum and Maximum delays)\n" - * "Average delay in micro-second as decimal (0...16777215)\n" - * "Minimum delay\n" - * "Minimum delay in micro-second as decimal (0...16777215)\n" - * "Maximum delay\n" - * "Maximum delay in micro-second as decimal (0...16777215)\n" - * - */ DEFUN (link_params_delay, link_params_delay_cmd, - "delay (0-16777215)", + "delay (0-16777215) [min (0-16777215) max (0-16777215)]", "Unidirectional Average Link Delay\n" - "Average delay in micro-second as decimal (0...16777215)\n") + "Average delay in micro-second as decimal (0...16777215)\n" + "Minimum delay\n" + "Minimum delay in micro-second as decimal (0...16777215)\n" + "Maximum delay\n" + "Maximum delay in micro-second as decimal (0...16777215)\n") { - int idx_number = 1; + /* Get and Check new delay values */ + u_int32_t delay = 0, low = 0, high = 0; + VTY_GET_ULONG("delay", delay, argv[1]->arg); + if (argc == 6) + { + VTY_GET_ULONG("minimum delay", low, argv[3]->arg); + VTY_GET_ULONG("maximum delay", high, argv[5]->arg); + } struct interface *ifp = (struct interface *) vty->index; struct if_link_params *iflp = if_link_params_get (ifp); - u_int32_t delay = 0, low = 0, high = 0; u_int8_t update = 0; - /* Get and Check new delay values */ - VTY_GET_ULONG("delay", delay, argv[idx_number]->arg); - switch (argc) - { - case 1: - /* Check new delay value against old Min and Max delays if set */ - if (IS_PARAM_SET(iflp, LP_MM_DELAY) - && (delay <= iflp->min_delay || delay >= iflp->max_delay)) - { - vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s", - iflp->min_delay, iflp->max_delay, VTY_NEWLINE); - return CMD_WARNING; - } - /* Update delay if value is not set or change */ - if (IS_PARAM_UNSET(iflp, LP_DELAY)|| iflp->av_delay != delay) - { - iflp->av_delay = delay; - SET_PARAM(iflp, LP_DELAY); - update = 1; - } - /* Unset Min and Max delays if already set */ - if (IS_PARAM_SET(iflp, LP_MM_DELAY)) - { - iflp->min_delay = 0; - iflp->max_delay = 0; - UNSET_PARAM(iflp, LP_MM_DELAY); - update = 1; - } - break; - case 2: - vty_out (vty, "You should specify both Minimum and Maximum delay with Average delay%s", - VTY_NEWLINE); - return CMD_WARNING; - break; - case 3: - VTY_GET_ULONG("minimum delay", low, argv[3]->arg); - VTY_GET_ULONG("maximum delay", high, argv[5]->arg); - /* Check new delays value coherency */ - if (delay <= low || delay >= high) - { - vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s", - low, high, VTY_NEWLINE); - return CMD_WARNING; - } - /* Update Delays if needed */ - if (IS_PARAM_UNSET(iflp, LP_DELAY) - || IS_PARAM_UNSET(iflp, LP_MM_DELAY) - || iflp->av_delay != delay - || iflp->min_delay != low - || iflp->max_delay != high) - { - iflp->av_delay = delay; - SET_PARAM(iflp, LP_DELAY); - iflp->min_delay = low; - iflp->max_delay = high; - SET_PARAM(iflp, LP_MM_DELAY); - update = 1; - } - break; - default: - return CMD_WARNING; - break; - } + if (argc == 2) + { + /* Check new delay value against old Min and Max delays if set */ + if (IS_PARAM_SET(iflp, LP_MM_DELAY) + && (delay <= iflp->min_delay || delay >= iflp->max_delay)) + { + vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s", + iflp->min_delay, iflp->max_delay, VTY_NEWLINE); + return CMD_WARNING; + } + /* Update delay if value is not set or change */ + if (IS_PARAM_UNSET(iflp, LP_DELAY)|| iflp->av_delay != delay) + { + iflp->av_delay = delay; + SET_PARAM(iflp, LP_DELAY); + update = 1; + } + /* Unset Min and Max delays if already set */ + if (IS_PARAM_SET(iflp, LP_MM_DELAY)) + { + iflp->min_delay = 0; + iflp->max_delay = 0; + UNSET_PARAM(iflp, LP_MM_DELAY); + update = 1; + } + } + else + { + /* Check new delays value coherency */ + if (delay <= low || delay >= high) + { + vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s", + low, high, VTY_NEWLINE); + return CMD_WARNING; + } + /* Update Delays if needed */ + if (IS_PARAM_UNSET(iflp, LP_DELAY) + || IS_PARAM_UNSET(iflp, LP_MM_DELAY) + || iflp->av_delay != delay + || iflp->min_delay != low + || iflp->max_delay != high) + { + iflp->av_delay = delay; + SET_PARAM(iflp, LP_DELAY); + iflp->min_delay = low; + iflp->max_delay = high; + SET_PARAM(iflp, LP_MM_DELAY); + update = 1; + } + } /* force protocols to update LINK STATE due to parameters change */ if (update == 1 && if_is_operative (ifp)) @@ -2195,7 +2151,6 @@ DEFUN (link_params_delay, return CMD_SUCCESS; } - DEFUN (no_link_params_delay, no_link_params_delay_cmd, "no delay", diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 88036f44bd..ddcffb5d4d 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -181,19 +181,9 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd, } /* Static unicast routes for multicast RPF lookup. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", - * IP_STR - * "Configure static unicast route into MRIB for multicast RPF lookup\n" - * "IP destination prefix (e.g. 10.0.0.0/8)\n" - * "Nexthop address\n" - * "Nexthop interface name\n" - * - */ DEFUN (ip_mroute_dist, ip_mroute_dist_cmd, - "ip mroute A.B.C.D/M (1-255)", + "ip mroute A.B.C.D/M [(1-255)]", IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -201,27 +191,16 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - int idx_ipv4_prefixlen = 2; - int idx_ipv4_ifname = 3; - int idx_number = 4; - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, NULL, NULL, argc > 2 ? argv[idx_number]->arg : NULL, NULL); + char *destprefix = argv[2]->arg; + char *nexthop = argv[3]->arg; + char *distance = (argc == 5) ? argv[4]->arg : NULL; + + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 1, destprefix, NULL, nexthop, NULL, NULL, distance, NULL); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)", - * NO_STR - * IP_STR - * "Configure static unicast route into MRIB for multicast RPF lookup\n" - * "IP destination prefix (e.g. 10.0.0.0/8)\n" - * "Nexthop address\n" - * "Nexthop interface name\n" - * - */ DEFUN (no_ip_mroute_dist, no_ip_mroute_dist_cmd, - "no ip mroute A.B.C.D/M (1-255)", + "no ip mroute A.B.C.D/M [(1-255)]", IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -229,12 +208,12 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - int idx_ipv4_prefixlen = 3; - int idx_ipv4_ifname = 4; - int idx_number = 5; - return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_ipv4_ifname]->arg, NULL, NULL, argc > 2 ? argv[idx_number]->arg : NULL, NULL); -} + char *destprefix = argv[2]->arg; + char *nexthop = argv[3]->arg; + char *distance = (argc == 5) ? argv[4]->arg : NULL; + return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, destprefix, NULL, nexthop, NULL, NULL, distance, NULL); +} DEFUN (ip_multicast_mode, ip_multicast_mode_cmd, @@ -248,17 +227,17 @@ DEFUN (ip_multicast_mode, "Lookup both, use entry with lower distance\n" "Lookup both, use entry with longer prefix\n") { - int idx_rpf_lookup_mode = 3; + char *mode = argv[3]->text; - if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "u", 1)) + if (strmatch (mode, "urib-only")) multicast_mode_ipv4_set (MCAST_URIB_ONLY); - else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "mrib-o", 6)) + else if (strmatch (mode, "mrib-only")) multicast_mode_ipv4_set (MCAST_MRIB_ONLY); - else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "mrib-t", 6)) + else if (strmatch (mode, "mrib-then-urib")) multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST); - else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "low", 3)) + else if (strmatch (mode, "lower-distance")) multicast_mode_ipv4_set (MCAST_MIX_DISTANCE); - else if (!strncmp (argv[idx_rpf_lookup_mode]->arg, "lon", 3)) + else if (strmatch (mode, "longer-prefix")) multicast_mode_ipv4_set (MCAST_MIX_PFXLEN); else { @@ -269,18 +248,9 @@ DEFUN (ip_multicast_mode, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip multicast rpf-lookup-mode", - * NO_STR - * IP_STR - * "Multicast options\n" - * "RPF lookup behavior\n" - * - */ DEFUN (no_ip_multicast_mode, no_ip_multicast_mode_cmd, - "no ip multicast rpf-lookup-mode ", + "no ip multicast rpf-lookup-mode []", NO_STR IP_STR "Multicast options\n" @@ -2776,23 +2746,15 @@ DEFUN (no_ipv6_route_ifname_flags, tag, distance, vrf); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " [json]", - * SHOW_STR - * IP_STR - * "IPv6 routing table\n" - * VRF_CMD_HELP_STR - * - */ DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 route [json]", + "show ipv6 route [vrf NAME] [json]", SHOW_STR IP_STR - "IPv6 routing table\n") + "IPv6 routing table\n" + VRF_CMD_HELP_STR + "Output JSON\n") { - int idx_json = 3; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2802,33 +2764,36 @@ DEFUN (show_ipv6_route, char buf[BUFSIZ]; json_object *json = NULL; json_object *json_prefix = NULL; - u_char uj = use_json(argc, argv); - if (argc > 0 && argv[idx_json]->arg && strcmp(argv[idx_json]->arg, "json") != 0) - { - if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[idx_json]->arg))) - { - if (uj) - vty_out (vty, "{}%s", VTY_NEWLINE); - else - vty_out (vty, "vrf %s not defined%s", argv[idx_json]->arg, VTY_NEWLINE); - return CMD_SUCCESS; - } + int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf")); + int uj = vrf ? argc == 6 : argc == 4; + char *vrfname = vrf ? argv[4]->arg : NULL; - if (zvrf->vrf_id == VRF_UNKNOWN) - { - if (uj) - vty_out (vty, "{}%s", VTY_NEWLINE); - else - vty_out (vty, "vrf %s inactive%s", argv[idx_json]->arg, VTY_NEWLINE); - return CMD_SUCCESS; - } - else - vrf_id = zvrf->vrf_id; - } + if (vrf) + { + if (!(zvrf = zebra_vrf_list_lookup_by_name (vrfname))) + { + if (uj) + vty_out (vty, "{}%s", VTY_NEWLINE); + else + vty_out (vty, "vrf %s not defined%s", vrfname, VTY_NEWLINE); + return CMD_SUCCESS; + } + + if (zvrf->vrf_id == VRF_UNKNOWN) + { + if (uj) + vty_out (vty, "{}%s", VTY_NEWLINE); + else + vty_out (vty, "vrf %s inactive%s", vrfname, VTY_NEWLINE); + return CMD_SUCCESS; + } + else + vrf_id = zvrf->vrf_id; + } table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); - if (! table) + if (!table) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); @@ -2981,26 +2946,15 @@ DEFUN (show_ipv6_route_prefix_longer, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 route " VRF_CMD_STR " " QUAGGA_IP6_REDIST_STR_ZEBRA, - * SHOW_STR - * IP_STR - * "IP routing table\n" - * VRF_CMD_HELP_STR - * QUAGGA_IP6_REDIST_HELP_STR_ZEBRA - * - */ DEFUN (show_ipv6_route_protocol, show_ipv6_route_protocol_cmd, - "show ipv6 route ", + "show ipv6 route [vrf NAME] ", SHOW_STR IP_STR "IP routing table\n" + VRF_CMD_HELP_STR QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { - int idx_protocol = 3; int type; struct route_table *table; struct route_node *rn; @@ -3008,13 +2962,16 @@ DEFUN (show_ipv6_route_protocol, int first = 1; vrf_id_t vrf_id = VRF_DEFAULT; - if ( argc >1 ) + char *vrfname = (argc == 6) ? argv[4]->arg : NULL; + char *proto = argv[argc - 1]->text; + + if (vrfname) { - VRF_GET_ID (vrf_id, argv[4]->arg); - type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); + VRF_GET_ID (vrf_id, vrfname); + type = proto_redistnum (AFI_IP6, proto); } else - type = proto_redistnum (AFI_IP6, argv[4]->arg); + type = proto_redistnum (AFI_IP6, proto); if (type < 0) { @@ -3731,65 +3688,9 @@ zebra_ip_config (struct vty *vty) return write; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip import-table <1-252>", - * IP_STR - * "import routes from non-main kernel table\n" - * "kernel routing table id\n" - * - */ DEFUN (ip_zebra_import_table_distance, ip_zebra_import_table_distance_cmd, - "ip import-table (1-252) distance (1-255)", - IP_STR - "import routes from non-main kernel table\n" - "kernel routing table id\n" - "Distance for imported routes\n" - "Default distance value\n") -{ - int idx_number = 2; - int idx_number_2 = 4; - u_int32_t table_id = 0; - int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; - - if (argc) - VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); - - if (!is_zebra_valid_kernel_table(table_id)) - { - vty_out(vty, "Invalid routing table ID, %d. Must be in range 1-252%s", - table_id, VTY_NEWLINE); - return CMD_WARNING; - } - - if (is_zebra_main_routing_table(table_id)) - { - vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s", - table_id, VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc > 1) - VTY_GET_INTEGER_RANGE("distance", distance, argv[idx_number_2]->arg, 1, 255); - return (zebra_import_table(AFI_IP, table_id, distance, NULL, 1)); - -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip import-table <1-252> route-map WORD", - * IP_STR - * "import routes from non-main kernel table\n" - * "kernel routing table id\n" - * "route-map for filtering\n" - * "route-map name\n" - * - */ -DEFUN (ip_zebra_import_table_distance_routemap, - ip_zebra_import_table_distance_routemap_cmd, - "ip import-table (1-252) distance (1-255) route-map WORD", + "ip import-table (1-252) [distance (1-255)] [route-map WORD>]", IP_STR "import routes from non-main kernel table\n" "kernel routing table id\n" @@ -3798,15 +3699,14 @@ DEFUN (ip_zebra_import_table_distance_routemap, "route-map for filtering\n" "route-map name\n") { - int idx_number = 2; - int idx_number_2 = 4; - int idx_word = 6; u_int32_t table_id = 0; - int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; - const char *rmap_name; - if (argc) - VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); + VTY_GET_INTEGER("table", table_id, argv[2]->arg); + int distance = ZEBRA_TABLE_DISTANCE_DEFAULT; + char *rmap = strmatch (argv[argc - 2]->text, "route-map") ? + XSTRDUP(MTYPE_ROUTE_MAP_NAME, argv[argc - 1]->arg) : NULL; + if (argc == 7 || (argc == 5 && !rmap)) + VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255); if (!is_zebra_valid_kernel_table(table_id)) { @@ -3818,44 +3718,23 @@ DEFUN (ip_zebra_import_table_distance_routemap, if (is_zebra_main_routing_table(table_id)) { vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s", - table_id, VTY_NEWLINE); + table_id, VTY_NEWLINE); return CMD_WARNING; } - if (argc > 2) - { - VTY_GET_INTEGER_RANGE("distance", distance, argv[idx_number_2]->arg, 1, 255); - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[idx_word]->arg); - } - else - rmap_name = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[idx_number_2]->arg); - - return (zebra_import_table(AFI_IP, table_id, distance, rmap_name, 1)); + return (zebra_import_table(AFI_IP, table_id, distance, rmap, 1)); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip import-table <1-252> distance <1-255> {route-map NAME}", - * IP_STR - * "import routes from non-main kernel table to main table" - * "kernel routing table id\n" - * "distance to be used\n" - * - */ DEFUN (no_ip_zebra_import_table, no_ip_zebra_import_table_cmd, - "no ip import-table (1-252) [route-map NAME]", + "no ip import-table (1-252) [distance (1-255)] [route-map NAME]", NO_STR IP_STR "import routes from non-main kernel table\n" "kernel routing table id\n") { - int idx_number = 3; u_int32_t table_id = 0; - - if (argc) - VTY_GET_INTEGER("table", table_id, argv[idx_number]->arg); + VTY_GET_INTEGER("table", table_id, argv[3]->arg); if (!is_zebra_valid_kernel_table(table_id)) { @@ -3877,7 +3756,6 @@ DEFUN (no_ip_zebra_import_table, return (zebra_import_table(AFI_IP, table_id, 0, NULL, 0)); } - static int config_write_protocol (struct vty *vty) { @@ -3934,7 +3812,6 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_mask_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd); install_element (CONFIG_NODE, &ip_zebra_import_table_distance_cmd); - install_element (CONFIG_NODE, &ip_zebra_import_table_distance_routemap_cmd); install_element (CONFIG_NODE, &no_ip_zebra_import_table_cmd); install_element (VIEW_NODE, &show_vrf_cmd); From d04c479dd9ff0d057c751a2f802bd3e5bb3ae8ad Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 28 Sep 2016 05:07:45 +0000 Subject: [PATCH 170/280] bgpd: change some <1-10> to (1-10> Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 2 +- bgpd/bgp_routemap.c | 2 +- bgpd/bgp_vty.c | 8 ++++---- ripngd/ripngd.c | 2 +- tools/argv_translator.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 712d9fda76..68a1ca7a3d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9817,7 +9817,7 @@ DEFUN (bgp_damp_set, DEFUN (bgp_damp_unset, bgp_damp_unset_cmd, - "no bgp dampening [<1-45> [<1-20000> <1-20000> <1-255>]]", + "no bgp dampening [(1-45) [(1-20000) (1-20000) (1-255)]]", NO_STR "BGP Specific commands\n" "Enable route-flap dampening\n") diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 230bebe3a1..dff42ec0dd 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3711,7 +3711,7 @@ DEFUN (no_set_weight, DEFUN (set_aspath_prepend, set_aspath_prepend_cmd, - "set as-path prepend <(1-4294967295)...|last-as <1-10>", + "set as-path prepend <(1-4294967295)...|last-as (1-10)>", SET_STR "Transform BGP AS_PATH attribute\n" "Prepend to the as-path\n" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9491e09470..a7a3520dad 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5493,7 +5493,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, - "no neighbor maximum-prefix [<1-4294967295> [<1-100>] [restart <1-65535>] [warning-only]]", + "no neighbor maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -9746,7 +9746,7 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, DEFUN (no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_cmd, - "no redistribute (1-65535) [metric <0-4294967295>] [route-map WORD]", + "no redistribute (1-65535) [metric (0-4294967295)] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" @@ -9773,7 +9773,7 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, DEFUN (no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_cmd, - "no redistribute [metric <0-4294967295>] [route-map WORD]", + "no redistribute [metric (0-4294967295)] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" QUAGGA_IP_REDIST_HELP_STR_BGPD @@ -9931,7 +9931,7 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap, DEFUN (no_bgp_redistribute_ipv6, no_bgp_redistribute_ipv6_cmd, - "no redistribute [metric <0-4294967295>] [route-map WORD]", + "no redistribute [metric (0-4294967295)] [route-map WORD]", NO_STR "Redistribute information from another routing protocol\n" QUAGGA_IP6_REDIST_HELP_STR_BGPD diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index dc0bfa3647..c896922bc0 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2556,7 +2556,7 @@ DEFUN (ripng_timers, DEFUN (no_ripng_timers, no_ripng_timers_cmd, - "no timers basic [(0-65535) (0-65535) (0-65535)", + "no timers basic [(0-65535) (0-65535) (0-65535)]", NO_STR "RIPng timers setup\n" "Basic timer\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 8ee4cd8cc7..523954a6f0 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -38,7 +38,7 @@ def token_is_variable(line_number, token): return True if token.startswith('('): - assert token.endswith(')'), "%d: token %s should end with )" % (line_number, token) + assert token.endswith(')') or token.endswith(')...'), "%d: token %s should end with )" % (line_number, token) return True if token.startswith('['): From 692b4c659416242381781dc918444580d2c31b07 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 29 Sep 2016 01:26:55 +0000 Subject: [PATCH 171/280] ospfd: resolve CHECK ME's Signed-off-by: Quentin Young --- ospfd/ospf_bfd.c | 20 +- ospfd/ospf_dump.c | 573 ++++++++++++------------------------------ ospfd/ospf_opaque.c | 34 +-- ospfd/ospf_ri.c | 20 +- ospfd/ospf_routemap.c | 182 ++++---------- ospfd/ospf_te.c | 10 +- 6 files changed, 234 insertions(+), 605 deletions(-) diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index ae4691efa9..803dc923ea 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -407,25 +407,16 @@ DEFUN (ip_ospf_bfd_param, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf bfd (2-255) (50-60000) (50-60000)", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Enables BFD support\n" - * "Detect Multiplier\n" - * "Required min receive interval\n" - * "Desired min transmit interval\n" - * - */ DEFUN (no_ip_ospf_bfd, no_ip_ospf_bfd_cmd, - "no ip ospf bfd", + "no ip ospf bfd [(2-255) (50-60000) (50-60000)]", NO_STR "IP Information\n" "OSPF interface commands\n" - "Disables BFD support\n") + "Disables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") { struct interface *ifp = (struct interface *)vty->index; struct ospf_if_params *params; @@ -442,7 +433,6 @@ DEFUN (no_ip_ospf_bfd, return CMD_SUCCESS; } - void ospf_bfd_init(void) { diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 9952513dcf..bf71c7be6a 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -753,54 +753,69 @@ ospf_packet_dump (struct stream *s) stream_set_getp (s, gp); } - -/* - [no] debug ospf [<1-65535>] packet (hello|dd|ls-request|ls-update|ls-ack|all) - [send|recv [detail]] -*/ -static int -debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - struct cmd_token **argv) +DEFUN (debug_ospf_packet, + debug_ospf_packet_cmd, + "debug ospf [(1-65535)] packet []", + DEBUG_STR + OSPF_STR + "Instance ID\n" + "OSPF packets\n" + "OSPF Hello\n" + "OSPF Database Description\n" + "OSPF Link State Request\n" + "OSPF Link State Update\n" + "OSPF Link State Acknowledgment\n" + "OSPF all packets\n" + "Packet sent\n" + "Detail Information\n" + "Packet received\n" + "Detail Information\n" + "Detail Information\n") { + int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0; + int detail = strmatch (argv[argc - 1]->text, "detail"); + int send = strmatch (argv[argc - (1+detail)]->text, "send"); + int recv = strmatch (argv[argc - (1+detail)]->text, "recv"); + char *packet = argv[3 + inst]->text; + + if (inst) // user passed instance ID + { + if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10))) + return CMD_SUCCESS; + } + int type = 0; int flag = 0; int i; - assert (argc > arg_base + 0); - /* Check packet type. */ - if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) + if (strmatch (packet, "hello")) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) + else if (strmatch (packet, "dd")) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) + else if (strmatch (packet, "ls-request")) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) + else if (strmatch (packet, "ls-update")) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) + else if (strmatch (packet, "ls-ack")) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) + else if (strmatch (packet, "all")) type = OSPF_DEBUG_ALL; - /* Default, both send and recv. */ - if (argc == arg_base + 1) - flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV; + /* Cases: + * (none) = send + recv + * detail = send + recv + detail + * recv = recv + * send = send + * recv detail = recv + detail + * send detail = send + detail + */ + if (!send && !recv) + send = recv = 1; - /* send or recv. */ - if (argc >= arg_base + 2) - { - if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) - flag = OSPF_DEBUG_SEND; - else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) - flag = OSPF_DEBUG_RECV; - else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) - flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; - } - - /* detail. */ - if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) - flag |= OSPF_DEBUG_DETAIL; + flag |= (send) ? OSPF_DEBUG_SEND : 0; + flag |= (recv) ? OSPF_DEBUG_RECV : 0; + flag |= (detail) ? OSPF_DEBUG_DETAIL : 0; for (i = 0; i < 5; i++) if (type & (0x01 << i)) @@ -814,91 +829,10 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail information\n" - * - */ -DEFUN (debug_ospf_packet, - debug_ospf_packet_all_cmd, - "debug ospf packet ", - DEBUG_STR - OSPF_STR - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n") -{ - return (debug_ospf_packet_common(vty, 0, argc, argv)); -} - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail information\n" - * - * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - */ -DEFUN (debug_ospf_instance_packet, - debug_ospf_instance_packet_all_cmd, - "debug ospf (1-65535) packet ", +DEFUN (no_debug_ospf_packet, + no_debug_ospf_packet_cmd, + "no debug ospf [(1-65535)] packet []", + NO_STR DEBUG_STR OSPF_STR "Instance ID\n" @@ -908,63 +842,57 @@ DEFUN (debug_ospf_instance_packet, "OSPF Link State Request\n" "OSPF Link State Update\n" "OSPF Link State Acknowledgment\n" - "OSPF all packets\n") + "OSPF all packets\n" + "Packet sent\n" + "Detail Information\n" + "Packet received\n" + "Detail Information\n" + "Detail Information\n") { - int idx_number = 2; - u_short instance = 0; + int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0; + int detail = strmatch (argv[argc - 1]->text, "detail"); + int send = strmatch (argv[argc - (1+detail)]->text, "send"); + int recv = strmatch (argv[argc - (1+detail)]->text, "recv"); + char *packet = argv[4 + inst]->text; - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - if (!ospf_lookup_instance (instance)) - return CMD_SUCCESS; + if (inst) // user passed instance ID + { + if (!ospf_lookup_instance (strtoul (argv[3]->arg, NULL, 10))) + return CMD_SUCCESS; + } - return (debug_ospf_packet_common(vty, 1, argc, argv)); -} - - - -static int -no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, - struct cmd_token **argv) -{ int type = 0; int flag = 0; int i; - assert (argc > arg_base + 0); - /* Check packet type. */ - if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0) + if (strmatch (packet, "hello")) type = OSPF_DEBUG_HELLO; - else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0) + else if (strmatch (packet, "dd")) type = OSPF_DEBUG_DB_DESC; - else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0) + else if (strmatch (packet, "ls-request")) type = OSPF_DEBUG_LS_REQ; - else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0) + else if (strmatch (packet, "ls-update")) type = OSPF_DEBUG_LS_UPD; - else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0) + else if (strmatch (packet, "ls-ack")) type = OSPF_DEBUG_LS_ACK; - else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0) + else if (strmatch (packet, "all")) type = OSPF_DEBUG_ALL; - /* Default, both send and recv. */ - if (argc == arg_base + 1) - flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL ; + /* Cases: + * (none) = send + recv + * detail = send + recv + detail + * recv = recv + * send = send + * recv detail = recv + detail + * send detail = send + detail + */ + if (!send && !recv) + send = recv = 1; - /* send or recv. */ - if (argc == arg_base + 2) - { - if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0) - flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0) - flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; - else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0) - flag = OSPF_DEBUG_DETAIL | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL; - } - - /* detail. */ - if (argc == arg_base + 3) - if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0) - flag = OSPF_DEBUG_DETAIL; + flag |= (send) ? OSPF_DEBUG_SEND : 0; + flag |= (recv) ? OSPF_DEBUG_RECV : 0; + flag |= (detail) ? OSPF_DEBUG_DETAIL : 0; for (i = 0; i < 5; i++) if (type & (0x01 << i)) @@ -985,135 +913,37 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - */ -DEFUN (no_debug_ospf_packet, - no_debug_ospf_packet_all_cmd, - "no debug ospf packet ", - NO_STR - DEBUG_STR - OSPF_STR - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n") -{ - return no_debug_ospf_packet_common(vty, 0, argc, argv); -} - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF packets\n" - * "OSPF Hello\n" - * "OSPF Database Description\n" - * "OSPF Link State Request\n" - * "OSPF Link State Update\n" - * "OSPF Link State Acknowledgment\n" - * "OSPF all packets\n" - * "Packet sent\n" - * "Packet received\n" - * "Detail Information\n" - * - */ -DEFUN (no_debug_ospf_instance_packet, - no_debug_ospf_instance_packet_all_cmd, - "no debug ospf (1-65535) packet ", - NO_STR +DEFUN (debug_ospf_ism, + debug_ospf_ism_cmd, + "debug ospf [(1-65535)] ism []", DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF packets\n" - "OSPF Hello\n" - "OSPF Database Description\n" - "OSPF Link State Request\n" - "OSPF Link State Update\n" - "OSPF Link State Acknowledgment\n" - "OSPF all packets\n") + "OSPF Interface State Machine\n" + "ISM Status Information\n" + "ISM Event Information\n" + "ISM TImer Information\n") { - int idx_number = 3; - u_short instance = 0; + int inst = (argv[2]->type == RANGE_TKN); + char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL; - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - if (!ospf_lookup_instance (instance)) - return CMD_SUCCESS; + if (inst) // user passed instance ID + { + if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10))) + return CMD_SUCCESS; + } - return (no_debug_ospf_packet_common(vty, 1, argc, argv)); -} - - - - -static int -debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) -{ if (vty->node == CONFIG_NODE) { - if (argc == arg_base + 0) + if (!dbgparam) DEBUG_ON (ism, ISM); - else if (argc == arg_base + 1) + else { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch (dbgparam, "status")) DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch (dbgparam, "events")) DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch (dbgparam, "timers")) DEBUG_ON (ism, ISM_TIMERS); } @@ -1121,167 +951,70 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token } /* ENABLE_NODE. */ - if (argc == arg_base + 0) + if (!dbgparam) TERM_DEBUG_ON (ism, ISM); - else if (argc == arg_base + 1) + else { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) - TERM_DEBUG_ON (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) - TERM_DEBUG_ON (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) - TERM_DEBUG_ON (ism, ISM_TIMERS); + if (strmatch (dbgparam, "status")) + TERM_DEBUG_ON (ism, ISM_STATUS); + else if (strmatch (dbgparam, "events")) + TERM_DEBUG_ON (ism, ISM_EVENTS); + else if (strmatch (dbgparam, "timers")) + TERM_DEBUG_ON (ism, ISM_TIMERS); } - - return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf ism (status|events|timers)", - * DEBUG_STR - * OSPF_STR - * "OSPF Interface State Machine\n" - * "ISM Status Information\n" - * "ISM Event Information\n" - * "ISM TImer Information\n" - * - */ -DEFUN (debug_ospf_ism, - debug_ospf_ism_cmd, - "debug ospf ism", - DEBUG_STR - OSPF_STR - "OSPF Interface State Machine\n") -{ - return debug_ospf_ism_common(vty, 0, argc, argv); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf <1-65535> ism (status|events|timers)", - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Interface State Machine\n" - * "ISM Status Information\n" - * "ISM Event Information\n" - * "ISM TImer Information\n" - * - */ -DEFUN (debug_ospf_instance_ism, - debug_ospf_instance_ism_cmd, - "debug ospf (1-65535) ism", +DEFUN (no_debug_ospf_ism, + no_debug_ospf_ism_cmd, + "no debug ospf [(1-65535)] ism []", DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Interface State Machine\n") + "OSPF Interface State Machine\n" + "ISM Status Information\n" + "ISM Event Information\n" + "ISM TImer Information\n") { - int idx_number = 2; - u_short instance = 0; + int inst = (argv[3]->type == RANGE_TKN); + char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL; - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - if (!ospf_lookup_instance (instance)) - return CMD_SUCCESS; + if (inst) // user passed instance ID + { + if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10))) + return CMD_SUCCESS; + } - return debug_ospf_ism_common(vty, 1, argc, argv); -} - - -static int -no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc, - struct cmd_token **argv) -{ if (vty->node == CONFIG_NODE) { - if (argc == arg_base + 0) + if (!dbgparam) DEBUG_OFF (ism, ISM); - else if (argc == arg_base + 1) + else { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch (dbgparam, "status")) DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch (dbgparam, "events")) DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch (dbgparam, "timers")) DEBUG_OFF (ism, ISM_TIMERS); } + return CMD_SUCCESS; } /* ENABLE_NODE. */ - if (argc == arg_base + 0) + if (!dbgparam) TERM_DEBUG_OFF (ism, ISM); - else if (argc == arg_base + 1) + else { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) - TERM_DEBUG_OFF (ism, ISM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) - TERM_DEBUG_OFF (ism, ISM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) - TERM_DEBUG_OFF (ism, ISM_TIMERS); + if (strmatch (dbgparam, "status")) + TERM_DEBUG_OFF (ism, ISM_STATUS); + else if (strmatch (dbgparam, "events")) + TERM_DEBUG_OFF (ism, ISM_EVENTS); + else if (strmatch (dbgparam, "timers")) + TERM_DEBUG_OFF (ism, ISM_TIMERS); } - - return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf ism (status|events|timers)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF Interface State Machine\n" - * "ISM Status Information\n" - * "ISM Event Information\n" - * "ISM Timer Information\n" - * - */ -DEFUN (no_debug_ospf_ism, - no_debug_ospf_ism_cmd, - "no debug ospf ism", - NO_STR - DEBUG_STR - OSPF_STR - "OSPF Interface State Machine") -{ - return no_debug_ospf_ism_common(vty, 0, argc, argv); -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf <1-65535> ism (status|events|timers)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF Interface State Machine\n" - * "ISM Status Information\n" - * "ISM Event Information\n" - * "ISM Timer Information\n" - * - */ -DEFUN (no_debug_ospf_instance_ism, - no_debug_ospf_instance_ism_cmd, - "no debug ospf (1-65535) ism", - NO_STR - DEBUG_STR - OSPF_STR - "Instance ID\n" - "OSPF Interface State Machine") -{ - int idx_number = 3; - u_short instance = 0; - - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - if (!ospf_lookup_instance (instance)) - return CMD_SUCCESS; - - return no_debug_ospf_ism_common(vty, 1, argc, argv); -} - - static int debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { @@ -2355,15 +2088,16 @@ debug_init () install_element (ENABLE_NODE, &no_debug_ospf_te_cmd); install_element (ENABLE_NODE, &show_debugging_ospf_instance_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_packet_all_cmd); - install_element (ENABLE_NODE, &debug_ospf_instance_ism_cmd); + install_element (ENABLE_NODE, &debug_ospf_packet_cmd); + install_element (ENABLE_NODE, &no_debug_ospf_packet_cmd); + install_element (ENABLE_NODE, &debug_ospf_ism_cmd); + install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd); + install_element (ENABLE_NODE, &debug_ospf_instance_nsm_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_lsa_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_zebra_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_event_cmd); install_element (ENABLE_NODE, &debug_ospf_instance_nssa_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_all_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_instance_ism_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd); install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd); @@ -2371,8 +2105,13 @@ debug_init () install_element (ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd); install_element (ENABLE_NODE, &no_debug_ospf_cmd); - install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd); + + + install_element (CONFIG_NODE, &debug_ospf_packet_cmd); + install_element (CONFIG_NODE, &no_debug_ospf_packet_cmd); install_element (CONFIG_NODE, &debug_ospf_ism_cmd); + install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd); + install_element (CONFIG_NODE, &debug_ospf_nsm_cmd); install_element (CONFIG_NODE, &debug_ospf_lsa_cmd); install_element (CONFIG_NODE, &debug_ospf_zebra_cmd); @@ -2388,15 +2127,11 @@ debug_init () install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd); install_element (CONFIG_NODE, &no_debug_ospf_te_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_packet_all_cmd); - install_element (CONFIG_NODE, &debug_ospf_instance_ism_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_nsm_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_lsa_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_zebra_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_event_cmd); install_element (CONFIG_NODE, &debug_ospf_instance_nssa_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_all_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_instance_ism_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd); install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd); diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 9ffb50896f..a1981be86d 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -763,13 +763,6 @@ out: * Followings are (vty) configuration functions for Opaque-LSAs handling. *------------------------------------------------------------------------*/ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ospf opaque-lsa", - * "OSPF specific commands\n" - * "Enable the Opaque-LSA capability (rfc2370)\n" - * - */ DEFUN (capability_opaque, capability_opaque_cmd, "capability opaque", @@ -793,15 +786,15 @@ DEFUN (capability_opaque, return CMD_SUCCESS; } +DEFUN (ospf_opaque, + ospf_opaque_cmd, + "ospf opaque-lsa", + "OSPF specific commands\n" + "Enable the Opaque-LSA capability (rfc2370)\n") +{ + return capability_opaque (self, vty, argc, argv); +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf opaque-lsa", - * NO_STR - * "OSPF specific commands\n" - * "Disable the Opaque-LSA capability (rfc2370)\n" - * - */ DEFUN (no_capability_opaque, no_capability_opaque_cmd, "no capability opaque", @@ -826,12 +819,23 @@ DEFUN (no_capability_opaque, return CMD_SUCCESS; } +DEFUN (no_ospf_opaque, + no_ospf_opaque_cmd, + "no ospf opaque-lsa", + NO_STR + "OSPF specific commands\n" + "Enable the Opaque-LSA capability (rfc2370)\n") +{ + return no_capability_opaque (self, vty, argc, argv); +} static void ospf_opaque_register_vty (void) { install_element (OSPF_NODE, &capability_opaque_cmd); install_element (OSPF_NODE, &no_capability_opaque_cmd); + install_element (OSPF_NODE, &ospf_opaque_cmd); + install_element (OSPF_NODE, &no_ospf_opaque_cmd); return; } diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index d3875e373b..151adadb9a 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1174,21 +1174,16 @@ ospf_router_info_config_write_router (struct vty *vty) * Followings are vty command functions. *------------------------------------------------------------------------*/ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "router-info as", - * OSPF_RI_STR - * "Enable the Router Information functionality with AS flooding scope\n" - * - */ DEFUN (router_info, router_info_area_cmd, - "router-info area A.B.C.D", + "router-info ", OSPF_RI_STR + "Enable the Router Information functionality with AS flooding scope\n" "Enable the Router Information functionality with Area flooding scope\n" "OSPF area ID in IP format") { int idx_ipv4 = 2; + char *area = (argc == 3) ? argv[2]->arg : NULL; u_int8_t scope; @@ -1196,14 +1191,9 @@ DEFUN (router_info, return CMD_SUCCESS; /* Check and get Area value if present */ - if (argc == 1) + if (area) { - if (!inet_aton (argv[idx_ipv4]->arg, &OspfRI.area_id)) - { - vty_out (vty, "Please specify Router Info Area by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } + inet_aton (area, &OspfRI.area_id); scope = OSPF_OPAQUE_AREA_LSA; } else diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index e2a5f53fa6..21dca9546c 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -704,27 +704,19 @@ DEFUN (match_ip_nexthop, return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP access-list name\n" - * - */ DEFUN (no_match_ip_nexthop, no_match_ip_nexthop_cmd, - "no match ip next-hop", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match next-hop address of route\n") + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP access-list name\n") { - return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "ip next-hop", al); } @@ -742,28 +734,18 @@ DEFUN (match_ip_next_hop_prefix_list, argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip next-hop prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match next-hop address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_next_hop_prefix_list, no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list", + "no match ip next-hop prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match next-hop address of route\n" - "Match entries of prefix-lists\n") + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { - return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argv[5]->arg); + char *pl = (argc == 6) ? argv[5]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", pl); } @@ -781,30 +763,21 @@ DEFUN (match_ip_address, return ospf_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address (<1-199>|<1300-2699>|WORD)", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "IP access-list number\n" - * "IP access-list number (expanded range)\n" - * "IP access-list name\n" - * - */ DEFUN (no_match_ip_address, no_match_ip_address_cmd, - "no match ip address", + "no match ip address [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR - "Match address of route\n") + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP access-list name\n") { - return ospf_route_match_delete (vty, vty->index, "ip address", argv[4]->arg); + char *al = (argc == 5) ? argv[4]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "ip address", al); } - DEFUN (match_ip_address_prefix_list, match_ip_address_prefix_list_cmd, "match ip address prefix-list WORD", @@ -819,31 +792,20 @@ DEFUN (match_ip_address_prefix_list, argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match ip address prefix-list WORD", - * NO_STR - * MATCH_STR - * IP_STR - * "Match address of route\n" - * "Match entries of prefix-lists\n" - * "IP prefix-list name\n" - * - */ DEFUN (no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", + "no match ip address prefix-list [WORD]", NO_STR MATCH_STR IP_STR "Match address of route\n" "Match entries of prefix-lists\n") + "IP prefix-list name\n" { - return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", - argv[5]->arg); + char *pl = (argc == 6) ? argv[5]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl); } - DEFUN (match_interface, match_interface_cmd, "match interface WORD", @@ -855,26 +817,18 @@ DEFUN (match_interface, return ospf_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * NO_STR - * MATCH_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface", + "no match interface [INTERFACE]", NO_STR MATCH_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { - return ospf_route_match_delete (vty, vty->index, "interface", argv[3]->arg); + char *iface = (argc == 4) ? argv[3]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "interface", iface); } - DEFUN (match_tag, match_tag_cmd, "match tag (1-65535)", @@ -886,26 +840,18 @@ DEFUN (match_tag, return ospf_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match tag <1-65535>", - * NO_STR - * MATCH_STR - * "Match tag of route\n" - * "Tag value\n" - * - */ DEFUN (no_match_tag, no_match_tag_cmd, - "no match tag", + "no match tag [(1-65535)]", NO_STR MATCH_STR - "Match tag of route\n") + "Match tag of route\n" + "Tag value\n") { - return ospf_route_match_delete (vty, vty->index, "tag", argv[3]->arg); + char *tag = (argc == 4) ? argv[3]->arg : NULL; + return ospf_route_match_delete (vty, vty->index, "tag", tag); } - DEFUN (set_metric, set_metric_cmd, "set metric (0-4294967295)", @@ -917,26 +863,18 @@ DEFUN (set_metric, return ospf_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric <0-4294967295>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Metric value\n" - * - */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric", + "no set metric [(0-4294967295)]", NO_STR SET_STR - "Metric value for destination routing protocol\n") + "Metric value for destination routing protocol\n" + "Metric value\n") { - return ospf_route_set_delete (vty, vty->index, "metric", argv[3]->arg); + char *mval = (argc == 4) ? argv[3]->arg : NULL; + return ospf_route_set_delete (vty, vty->index, "metric", mval); } - DEFUN (set_metric_type, set_metric_type_cmd, "set metric-type ", @@ -945,36 +883,23 @@ DEFUN (set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - int idx_external = 2; - if (strcmp (argv[idx_external]->arg, "1") == 0) - return ospf_route_set_add (vty, vty->index, "metric-type", "type-1"); - if (strcmp (argv[idx_external]->arg, "2") == 0) - return ospf_route_set_add (vty, vty->index, "metric-type", "type-2"); - - return ospf_route_set_add (vty, vty->index, "metric-type", argv[idx_external]->arg); + char *ext = argv[2]->text; + return ospf_route_set_add (vty, vty->index, "metric-type", ext); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric-type (type-1|type-2)", - * NO_STR - * SET_STR - * "Type of metric for destination routing protocol\n" - * "OSPF[6] external type 1 metric\n" - * "OSPF[6] external type 2 metric\n" - * - */ DEFUN (no_set_metric_type, no_set_metric_type_cmd, - "no set metric-type", + "no set metric-type []", NO_STR SET_STR "Type of metric for destination routing protocol\n") + "OSPF[6] external type 1 metric\n" + "OSPF[6] external type 2 metric\n" { - return ospf_route_set_delete (vty, vty->index, "metric-type", argv[3]->arg); + char *ext = (argc == 4) ? argv[3]->text : NULL; + return ospf_route_set_delete (vty, vty->index, "metric-type", ext); } - DEFUN (set_tag, set_tag_cmd, "set tag (1-65535)", @@ -986,23 +911,16 @@ DEFUN (set_tag, return ospf_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set tag <1-65535>", - * NO_STR - * SET_STR - * "Tag value for routing protocol\n" - * "Tag value\n" - * - */ DEFUN (no_set_tag, no_set_tag_cmd, - "no set tag", + "no set tag [(1-65535)]", NO_STR SET_STR - "Tag value for routing protocol\n") + "Tag value for routing protocol\n" + "Tag value\n") { - return ospf_route_set_delete (vty, vty->index, "tag", argv[3]->arg); + char *tag = (argc == 4) ? argv[3]->arg : NULL; + return ospf_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 7994bddca1..2044500f1e 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2297,17 +2297,9 @@ DEFUN (ospf_mpls_te_on, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no mpls-te on", - * NO_STR - * MPLS_TE_STR - * "Disable the MPLS-TE functionality\n" - * - */ DEFUN (no_ospf_mpls_te, no_ospf_mpls_te_cmd, - "no mpls-te", + "no mpls-tei [on]", NO_STR "Disable the MPLS-TE functionality\n") { From ff788d089ac145ac06b99018811f46a9f6b69dda Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 29 Sep 2016 17:37:07 +0000 Subject: [PATCH 172/280] ospfd: minor parser fixes Signed-off-by: Daniel Walton --- ospfd/ospf_dump.c | 7 ++++--- ospfd/ospf_ri.c | 2 +- ospfd/ospf_routemap.c | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index bf71c7be6a..f2b332053c 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -962,6 +962,8 @@ DEFUN (debug_ospf_ism, else if (strmatch (dbgparam, "timers")) TERM_DEBUG_ON (ism, ISM_TIMERS); } + + return CMD_SUCCESS; } DEFUN (no_debug_ospf_ism, @@ -1013,6 +1015,8 @@ DEFUN (no_debug_ospf_ism, else if (strmatch (dbgparam, "timers")) TERM_DEBUG_OFF (ism, ISM_TIMERS); } + + return CMD_SUCCESS; } static int @@ -2070,7 +2074,6 @@ debug_init () install_node (&debug_node, config_write_debug); install_element (ENABLE_NODE, &show_debugging_ospf_cmd); - install_element (ENABLE_NODE, &debug_ospf_packet_all_cmd); install_element (ENABLE_NODE, &debug_ospf_ism_cmd); install_element (ENABLE_NODE, &debug_ospf_nsm_cmd); install_element (ENABLE_NODE, &debug_ospf_lsa_cmd); @@ -2078,7 +2081,6 @@ debug_init () install_element (ENABLE_NODE, &debug_ospf_event_cmd); install_element (ENABLE_NODE, &debug_ospf_nssa_cmd); install_element (ENABLE_NODE, &debug_ospf_te_cmd); - install_element (ENABLE_NODE, &no_debug_ospf_packet_all_cmd); install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd); install_element (ENABLE_NODE, &no_debug_ospf_nsm_cmd); install_element (ENABLE_NODE, &no_debug_ospf_lsa_cmd); @@ -2118,7 +2120,6 @@ debug_init () install_element (CONFIG_NODE, &debug_ospf_event_cmd); install_element (CONFIG_NODE, &debug_ospf_nssa_cmd); install_element (CONFIG_NODE, &debug_ospf_te_cmd); - install_element (CONFIG_NODE, &no_debug_ospf_packet_all_cmd); install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd); install_element (CONFIG_NODE, &no_debug_ospf_nsm_cmd); install_element (CONFIG_NODE, &no_debug_ospf_lsa_cmd); diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 151adadb9a..bcb1cd8e20 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1183,7 +1183,7 @@ DEFUN (router_info, "OSPF area ID in IP format") { int idx_ipv4 = 2; - char *area = (argc == 3) ? argv[2]->arg : NULL; + char *area = (argc == 3) ? argv[idx_ipv4]->arg : NULL; u_int8_t scope; diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 21dca9546c..33ddc67fcc 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -799,8 +799,8 @@ DEFUN (no_match_ip_address_prefix_list, MATCH_STR IP_STR "Match address of route\n" - "Match entries of prefix-lists\n") - "IP prefix-list name\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") { char *pl = (argc == 6) ? argv[5]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl); @@ -892,9 +892,9 @@ DEFUN (no_set_metric_type, "no set metric-type []", NO_STR SET_STR - "Type of metric for destination routing protocol\n") + "Type of metric for destination routing protocol\n" "OSPF[6] external type 1 metric\n" - "OSPF[6] external type 2 metric\n" + "OSPF[6] external type 2 metric\n") { char *ext = (argc == 4) ? argv[3]->text : NULL; return ospf_route_set_delete (vty, vty->index, "metric-type", ext); From 67656e9b65ab7c6bb979be72b4917cfd4a2241b6 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 29 Sep 2016 17:48:57 +0000 Subject: [PATCH 173/280] all: added CHECK ME for DEFUNs that look at argc Signed-off-by: Daniel Walton --- bgpd/bgp_dump.c | 1 + bgpd/bgp_filter.c | 2 ++ bgpd/bgp_mplsvpn.c | 4 ++++ bgpd/bgp_route.c | 14 ++++++++++++++ bgpd/bgp_routemap.c | 27 +++++++++++++++++++++++++++ bgpd/bgp_vty.c | 27 +++++++++++++++++++++++++++ isisd/isis_redist.c | 3 +++ isisd/isis_routemap.c | 5 +++++ isisd/isis_te.c | 1 + isisd/isis_vty.c | 2 ++ isisd/isisd.c | 1 + lib/command.c | 11 +++++++++++ lib/distribute.c | 2 ++ lib/filter.c | 4 ++++ lib/grammar_sandbox.c | 3 +++ lib/if.c | 3 +++ lib/plist.c | 4 ++++ lib/routemap.c | 5 +++++ lib/thread.c | 2 ++ lib/vty.c | 3 +++ ospf6d/ospf6_area.c | 4 ++++ ospf6d/ospf6_asbr.c | 1 + ospf6d/ospf6_interface.c | 4 ++++ ospf6d/ospf6_lsa.c | 2 ++ ospf6d/ospf6_message.c | 2 ++ ospf6d/ospf6_neighbor.c | 3 +++ ospf6d/ospf6_spf.c | 1 + ospf6d/ospf6_top.c | 6 ++++++ ospf6d/ospf6_zebra.c | 2 ++ ospf6d/ospf6d.c | 17 +++++++++++++++++ ospfd/ospf_dump.c | 16 ++++++++++++++++ ospfd/ospf_opaque.c | 2 ++ ospfd/ospf_ri.c | 1 + ospfd/ospf_routemap.c | 9 +++++++++ ospfd/ospf_te.c | 1 + pimd/pim_cmd.c | 6 ++++++ ripd/rip_interface.c | 1 + ripd/rip_routemap.c | 9 +++++++++ ripngd/ripng_routemap.c | 6 ++++++ tools/argv_translator.py | 14 ++++++++++++++ vtysh/vtysh.c | 2 ++ zebra/interface.c | 4 ++++ zebra/router-id.c | 2 ++ zebra/rtadv.c | 1 + zebra/test_main.c | 1 + zebra/zebra_routemap.c | 14 ++++++++++++++ zebra/zebra_vty.c | 29 +++++++++++++++++++++++++++++ 47 files changed, 284 insertions(+) diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 48c43b7f6e..cb2dd931d3 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -736,6 +736,7 @@ DEFUN (dump_bgp_all, "Output filename\n" "Interval of output\n") { + /* CHECK ME argc referenced below */ int idx_dump_routes = 2; int idx_path = 3; int idx_interval = 4; diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 5af840810b..255f6c2b6a 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -437,6 +437,7 @@ DEFUN (ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { + /* CHECK ME argc referenced below */ int idx_word = 3; int idx_permit_deny = 4; enum as_filter_type type; @@ -496,6 +497,7 @@ DEFUN (no_ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { + /* CHECK ME argc referenced below */ int idx_word = 4; int idx_permit_deny = 5; enum as_filter_type type; diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 48baedcea5..03d712e714 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -924,6 +924,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 6; union sockunion su; struct peer *peer; @@ -979,6 +980,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_ext_community = 5; int idx_ipv4 = 7; int ret; @@ -1051,6 +1053,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 6; int ret; struct peer *peer; @@ -1105,6 +1108,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_ext_community = 5; int idx_ipv4 = 7; int ret; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 68a1ca7a3d..ac2d0ffc77 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7772,6 +7772,7 @@ DEFUN (show_ip_bgp_ipv4, "Display route and more specific routes\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -7879,6 +7880,7 @@ DEFUN (show_ip_bgp_route, "Display only multipaths\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -7930,6 +7932,7 @@ DEFUN (show_ip_bgp_instance_all, BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); /* CHECK ME we need to revisit all of the bgp_show_all_ commands */ @@ -7945,6 +7948,7 @@ DEFUN (show_bgp_instance_all, BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_routes_vty (vty, AFI_IP6, SAFI_UNICAST, uj); @@ -8861,6 +8865,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); @@ -8886,6 +8891,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_word = 4; int idx_peer = 6; struct peer *peer; @@ -8911,6 +8917,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); @@ -8936,6 +8943,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_word = 3; int idx_peer = 6; struct peer *peer; @@ -8964,6 +8972,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_safi = 4; int idx_peer = 6; struct peer *peer; @@ -8995,6 +9004,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); @@ -9271,6 +9281,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, "Name of the route map\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi = 5; @@ -9333,6 +9344,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -9442,6 +9454,7 @@ DEFUN (show_ip_bgp_neighbor_routes, "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -9779,6 +9792,7 @@ DEFUN (bgp_damp_set, "Value to start suppressing a route\n" "Maximum duration to suppress a stable route\n") { + /* CHECK ME argc referenced below */ int idx_half_life = 2; int idx_reuse = 3; int idx_suppress = 4; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index dff42ec0dd..7e1e20458b 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3026,6 +3026,7 @@ DEFUN (no_match_peer, "IP address of peer\n" "IPv6 address of peer\n") { + /* CHECK ME argc referenced below */ int idx_peer = 3; if (argc <= idx_peer) @@ -3064,6 +3065,7 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip address", NULL, @@ -3100,6 +3102,7 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL, @@ -3131,6 +3134,7 @@ DEFUN (no_match_probability, "Match portion of routes defined by percentage value\n" "Percentage of routes\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "probability", NULL, @@ -3167,6 +3171,7 @@ DEFUN (no_match_ip_route_source, "IP access-list number (expanded range)\n" "IP standard access-list name\n") { + /* CHECK ME argc referenced below */ int idx_number = 4; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "ip route-source", @@ -3201,6 +3206,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", @@ -3234,6 +3240,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", @@ -3268,6 +3275,7 @@ DEFUN (no_match_ip_route_source_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list", @@ -3298,6 +3306,7 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "metric", @@ -3329,6 +3338,7 @@ DEFUN (no_match_local_pref, "Match local preference of route\n" "Local preference value\n") { + /* CHECK ME argc referenced below */ int idx_localpref = 3; if (argc <= idx_localpref) return bgp_route_match_delete (vty, vty->index, "local-preference", @@ -3605,6 +3615,7 @@ DEFUN (no_set_ip_nexthop, "Use peer address (for BGP only)\n" "IP address of next hop\n") { + /* CHECK ME argc referenced below */ int idx_peer = 4; if (argc <= idx_peer) return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); @@ -3648,6 +3659,7 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_set_delete (vty, vty->index, "metric", NULL); @@ -3675,6 +3687,7 @@ DEFUN (no_set_local_pref, "BGP local preference path attribute\n" "Preference value\n") { + /* CHECK ME argc referenced below */ int idx_localpref = 3; if (argc <= idx_localpref) return bgp_route_set_delete (vty, vty->index, "local-preference", NULL); @@ -3702,6 +3715,7 @@ DEFUN (no_set_weight, "BGP weight for routing table\n" "Weight value\n") { + /* CHECK ME argc referenced below */ int idx_weight = 3; if (argc <= idx_weight) return bgp_route_set_delete (vty, vty->index, "weight", NULL); @@ -3719,6 +3733,7 @@ DEFUN (set_aspath_prepend, "Use the peer's AS-number\n" "Number of times to insert") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -3739,6 +3754,7 @@ DEFUN (no_set_aspath_prepend, "Prepend to the as-path\n" "AS number\n") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -3757,6 +3773,7 @@ DEFUN (set_aspath_exclude, "Exclude from the as-path\n" "AS number\n") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -3775,6 +3792,7 @@ DEFUN (no_set_aspath_exclude, "Exclude from the as-path\n" "AS number\n") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -3792,6 +3810,7 @@ DEFUN (set_community, "BGP community attribute\n" COMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ int i; int first = 0; int additive = 0; @@ -3942,6 +3961,7 @@ DEFUN (set_ecommunity_rt, "Route Target extended community\n" "VPN extended community\n") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -3972,6 +3992,7 @@ DEFUN (set_ecommunity_soo, "Site-of-Origin extended community\n" "VPN extended community\n") { + /* CHECK ME argc referenced below */ int ret; char *str; @@ -4090,6 +4111,7 @@ DEFUN (no_set_aggregator_as, "AS number\n" "IP address of aggregator\n") { + /* CHECK ME argc referenced below */ int idx_asn = 4; int idx_ip = 5; int ret; @@ -4139,6 +4161,7 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_set_delete (vty, vty->index, "tag", NULL); @@ -4319,6 +4342,7 @@ DEFUN (no_set_ipv6_nexthop_global, "IPv6 global address\n" "IPv6 address of next hop\n") { + /* CHECK ME argc referenced below */ int idx_ipv6 = 5; if (argc <= idx_ipv6) return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); @@ -4365,6 +4389,7 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { + /* CHECK ME argc referenced below */ int idx_ipv6 = 5; if (argc <= idx_ipv6) return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); @@ -4395,6 +4420,7 @@ DEFUN (no_set_vpnv4_nexthop, "VPNv4 next-hop address\n" "IP address of next hop\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 4; if (argc <= idx_ipv4) return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); @@ -4422,6 +4448,7 @@ DEFUN (no_set_originator_id, "BGP originator ID attribute\n" "IP address of originator\n") { + /* CHECK ME argc referenced below */ int idx_id = 3; if (argc < idx_id) return bgp_route_set_delete (vty, vty->index, "originator-id", NULL); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index a7a3520dad..362e7db0f1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -664,6 +664,7 @@ DEFUN (router_bgp, AS_STR BGP_INSTANCE_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_asn = 2; int idx_view_vrf = 3; int idx_vrf = 4; @@ -744,6 +745,7 @@ DEFUN (no_router_bgp, AS_STR BGP_INSTANCE_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_asn = 3; int idx_vrf = 5; as_t as; @@ -827,6 +829,7 @@ DEFUN (no_bgp_router_id, "Override configured router identifier\n" "Manually configured router identifier\n") { + /* CHECK ME argc referenced below */ int idx_router_id = 3; int ret; struct in_addr id; @@ -949,6 +952,7 @@ DEFUN (bgp_confederation_peers, "Peer ASs in BGP confederation\n" AS_STR) { + /* CHECK ME argc referenced below */ struct bgp *bgp; as_t as; int i; @@ -980,6 +984,7 @@ DEFUN (no_bgp_confederation_peers, "Peer ASs in BGP confederation\n" AS_STR) { + /* CHECK ME argc referenced below */ struct bgp *bgp; as_t as; int i; @@ -1106,6 +1111,7 @@ DEFUN (bgp_maxmed_onstartup, "Effective on a startup\n" "Time (seconds) period for max-med\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; struct bgp *bgp; @@ -1134,6 +1140,7 @@ DEFUN (bgp_maxmed_onstartup_medv, "Time (seconds) period for max-med\n" "Max MED value to be used\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; int idx_number_2 = 4; struct bgp *bgp; @@ -2778,6 +2785,7 @@ DEFUN (neighbor_interface_config, "Member of the peer-group\n" "peer-group name\n") { + /* CHECK ME argc referenced below */ int idx_word = 1; int idx_peer_group_word = 4; @@ -2799,6 +2807,7 @@ DEFUN (neighbor_interface_config_v6only, "Member of the peer-group\n" "peer-group name\n") { + /* CHECK ME argc referenced below */ int idx_word = 1; int idx_peer_group_word = 5; @@ -4343,6 +4352,7 @@ DEFUN (neighbor_description, "Neighbor specific description\n" "Up to 80 characters describing this neighbor\n") { + /* CHECK ME argc referenced below */ int idx_peer = 1; struct peer *peer; char *str; @@ -4924,6 +4934,7 @@ DEFUN (neighbor_interface, "Interface\n" "Interface name\n") { + /* CHECK ME argc referenced below */ int idx_ip = 1; int idx_word = 3; if (argc == 3) @@ -5519,6 +5530,7 @@ DEFUN (neighbor_allowas_in, "Accept as-path with my AS present in it\n" "Number of occurances of AS number\n") { + /* CHECK ME argc referenced below */ int idx_peer = 1; int idx_number = 3; int ret; @@ -6012,6 +6024,7 @@ DEFUN (clear_ip_bgp_all, BGP_SOFT_IN_STR BGP_SOFT_OUT_STR) { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_clr_sort = 5; @@ -6205,6 +6218,7 @@ DEFUN (show_bgp_vrfs, "Show BGP VRFs\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ struct list *inst = bm->bgp; struct listnode *node; struct bgp *bgp; @@ -6860,6 +6874,7 @@ DEFUN (show_ip_bgp_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -6886,6 +6901,7 @@ DEFUN (show_ip_bgp_instance_all_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); @@ -8737,6 +8753,7 @@ DEFUN (show_ip_bgp_neighbors, "Neighbor on bgp configured interface\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; @@ -8784,6 +8801,7 @@ DEFUN (show_ip_bgp_instance_all_neighbors, "Detailed information on TCP and BGP neighbor connections\n" "JavaScript Object Notation\n") { + /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_neighbors_vty (vty, uj); @@ -8918,6 +8936,7 @@ DEFUN (show_ip_bgp_updgrps, "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") { + /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -11302,6 +11321,7 @@ DEFUN (ip_community_list_standard, "Specify community to accept\n" COMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } @@ -11318,6 +11338,7 @@ DEFUN (no_ip_community_list_standard_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } @@ -11334,6 +11355,7 @@ DEFUN (ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); } @@ -11350,6 +11372,7 @@ DEFUN (no_ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); } @@ -11541,6 +11564,7 @@ DEFUN (ip_extcommunity_list_standard, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); } @@ -11556,6 +11580,7 @@ DEFUN (ip_extcommunity_list_name_expanded, "Specify community to accept\n" "An ordered list as a regular-expression\n") { + /* CHECK ME argc referenced below */ return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } @@ -11572,6 +11597,7 @@ DEFUN (no_ip_extcommunity_list_standard_all, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { + /* CHECK ME argc referenced below */ return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } @@ -11588,6 +11614,7 @@ DEFUN (no_ip_extcommunity_list_expanded_all, "Specify community to accept\n" "An ordered list as a regular-expression\n") { + /* CHECK ME argc referenced below */ return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 66a2d98252..038fba77e0 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -618,6 +618,7 @@ DEFUN (no_isis_redistribute, "Redistribute into level-1\n" "Redistribute into level-2\n") { + /* CHECK ME argc referenced below */ int idx_afi = 2; int idx_protocol = 3; int idx_level = 4; @@ -668,6 +669,7 @@ DEFUN (isis_default_originate, "Route map reference\n" "Pointer to route-map entries\n") { + /* CHECK ME argc referenced below */ int idx_afi = 2; int idx_level = 3; int idx_metric_rmap = 4; @@ -739,6 +741,7 @@ DEFUN (no_isis_default_originate, "Distribute default route into level-1\n" "Distribute default route into level-2\n") { + /* CHECK ME argc referenced below */ int idx_afi = 3; int idx_level = 4; struct isis_area *area = vty->index; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index a1f087548f..6d130d08d9 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -370,6 +370,7 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ int idx_acl = 4; if (argc <= idx_acl) return isis_route_match_delete(vty, vty->index, "ip address", NULL); @@ -403,6 +404,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); @@ -434,6 +436,7 @@ DEFUN (no_match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); @@ -466,6 +469,7 @@ DEFUN (no_match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); @@ -497,6 +501,7 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return isis_route_set_delete(vty, vty->index, "metric", NULL); diff --git a/isisd/isis_te.c b/isisd/isis_te.c index b9e75bcf28..2a5122a9de 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1318,6 +1318,7 @@ DEFUN (show_isis_mpls_te_interface, "Interface information\n" "Interface name\n") { + /* CHECK ME argc referenced below */ int idx_interface = 4; struct interface *ifp; struct listnode *node; diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index a1970a9017..91a7e2bde8 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -2067,6 +2067,7 @@ DEFUN (area_passwd_md5, "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") { + /* CHECK ME argc referenced below */ int idx_password = 0; int idx_word = 2; int idx_type = 5; @@ -2097,6 +2098,7 @@ DEFUN (area_passwd_clear, "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") { + /* CHECK ME argc referenced below */ int idx_password = 0; int idx_word = 2; int idx_type = 5; diff --git a/isisd/isisd.c b/isisd/isisd.c index ffe17b3643..8ee3ad4da5 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1918,6 +1918,7 @@ DEFUN (topology_generate_grid, "Optional param 3\n" "Topology\n") { + /* CHECK ME argc referenced below */ struct isis_area *area; area = vty->index; diff --git a/lib/command.c b/lib/command.c index 22416ea73f..4be178e122 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1016,6 +1016,7 @@ DEFUN (config_quit, "quit", "Exit current mode and down to previous mode\n") { + /* CHECK ME argc referenced below */ return config_exit (self, vty, argc, argv); } @@ -1137,6 +1138,7 @@ DEFUN (config_write, "Write configuration currently in memory\n" "Write configuration to terminal\n") { + /* CHECK ME argc referenced below */ int idx_type = 1; unsigned int i; int fd; @@ -1282,6 +1284,7 @@ DEFUN (show_running_config, SHOW_STR "running configuration (same as write terminal/memory)\n") { + /* CHECK ME argc referenced below */ return config_write (self, vty, argc, argv); } @@ -1293,6 +1296,7 @@ DEFUN (copy_runningconf_startupconf, "Copy running config to... \n" "Copy running config to startup config (same as write file)\n") { + /* CHECK ME argc referenced below */ return config_write (self, vty, argc, argv); } /** -- **/ @@ -1374,6 +1378,7 @@ DEFUN (config_password, "Specifies a HIDDEN password will follow\n" "The password string\n") { + /* CHECK ME argc referenced below */ int idx_8 = 1; int idx_word = 2; if (argc == 3) // '8' was specified @@ -1420,6 +1425,7 @@ DEFUN (config_enable_password, "dummy string \n" "The HIDDEN 'enable' password string\n") { + /* CHECK ME argc referenced below */ int idx_8 = 2; int idx_word = 3; /* Crypt type is specified. */ @@ -1626,6 +1632,7 @@ DEFUN (config_logmsg, LOG_LEVEL_DESC "The message to send\n") { + /* CHECK ME argc referenced below */ int idx_log_level = 1; int level; char *message; @@ -1699,6 +1706,7 @@ DEFUN (config_log_stdout, "Set stdout logging level\n" LOG_LEVEL_DESC) { + /* CHECK ME argc referenced below */ int idx_log_level = 2; if (argc == 2) { @@ -1732,6 +1740,7 @@ DEFUN (config_log_monitor, "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { + /* CHECK ME argc referenced below */ int idx_log_level = 2; if (argc == 2) { @@ -1820,6 +1829,7 @@ DEFUN (config_log_file, "Logging filename\n" LOG_LEVEL_DESC) { + /* CHECK ME argc referenced below */ int idx_filename = 2; int idx_log_levels = 3; if (argc == 4) @@ -1860,6 +1870,7 @@ DEFUN (config_log_syslog, "Set syslog logging level\n" LOG_LEVEL_DESC) { + /* CHECK ME argc referenced below */ int idx_log_levels = 2; if (argc == 3) { diff --git a/lib/distribute.c b/lib/distribute.c index 8a00833915..e0b4f0468a 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -308,6 +308,7 @@ DEFUN (distribute_list, "Filter outgoing routing updates\n" "Interface name\n") { + /* CHECK ME argc referenced below */ int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ @@ -339,6 +340,7 @@ DEFUN (no_distribute_list, "Filter outgoing routing updates\n" "Interface name\n") { + /* CHECK ME argc referenced below */ int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ diff --git a/lib/filter.c b/lib/filter.c index 11dd7cd1c9..fd80b2a637 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1480,6 +1480,7 @@ DEFUN (access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + /* CHECK ME argc referenced below */ int idx_acl = 1; struct access_list *access; @@ -1525,6 +1526,7 @@ DEFUN (no_access_list_remark_comment, "Access list entry comment\n" "Comment up to 100 characters\n") { + /* CHECK ME argc referenced below */ return no_access_list_remark (self, vty, argc, argv); } @@ -1673,6 +1675,7 @@ DEFUN (ipv6_access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { + /* CHECK ME argc referenced below */ int idx_word = 2; struct access_list *access; @@ -1712,6 +1715,7 @@ DEFUN (no_ipv6_access_list_remark_comment, "Access list entry comment\n" "Comment up to 100 characters\n") { + /* CHECK ME argc referenced below */ return no_ipv6_access_list_remark (self, vty, argc, argv); } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 41fee1c1cb..34e0b81064 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -57,6 +57,7 @@ DEFUN (grammar_test, GRAMMAR_STR "command to pass to new parser\n") { + /* CHECK ME argc referenced below */ // make a string from tokenized command line char *command = argv_concat (argv, argc, 0); @@ -80,6 +81,7 @@ DEFUN (grammar_test_complete, "attempt to complete input on DFA\n" "command to complete") { + /* CHECK ME argc referenced below */ char *cmdstr = argv_concat (argv, argc, 0); vector command = cmd_make_strvec (cmdstr); @@ -129,6 +131,7 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match") { + /* CHECK ME argc referenced below */ if (argv[0][0] == '#') return CMD_SUCCESS; diff --git a/lib/if.c b/lib/if.c index 3afba9879b..7b55a327cb 100644 --- a/lib/if.c +++ b/lib/if.c @@ -677,6 +677,7 @@ DEFUN (interface_desc, "Interface specific description\n" "Characters describing this interface\n") { + /* CHECK ME argc referenced below */ struct interface *ifp; if (argc == 1) @@ -755,6 +756,7 @@ DEFUN (interface, "Interface's name\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ifname = 1; const char *ifname = argv[idx_ifname]->arg; const char *vrfname = (argc > 2) ? argv[3]->arg : NULL; @@ -899,6 +901,7 @@ DEFUN (show_address, "address\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_vrf_cmd_str = 2; struct listnode *node; struct listnode *node2; diff --git a/lib/plist.c b/lib/plist.c index 0d1cafde66..4170230d82 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1905,6 +1905,7 @@ DEFUN (ip_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + /* CHECK ME argc referenced below */ int idx_word = 2; struct prefix_list *plist; @@ -1944,6 +1945,7 @@ DEFUN (no_ip_prefix_list_description_comment, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + /* CHECK ME argc referenced below */ return no_ip_prefix_list_description (self, vty, argc, argv); } @@ -2616,6 +2618,7 @@ DEFUN (ipv6_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + /* CHECK ME argc referenced below */ int idx_word = 2; struct prefix_list *plist; @@ -2655,6 +2658,7 @@ DEFUN (no_ipv6_prefix_list_description_comment, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { + /* CHECK ME argc referenced below */ return no_ipv6_prefix_list_description_comment (self, vty, argc, argv); } diff --git a/lib/routemap.c b/lib/routemap.c index 7ad75b4154..2b4ec0c67a 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1544,6 +1544,7 @@ DEFUN (rmap_onmatch_goto, "Goto Clause number\n" "Number\n") { + /* CHECK ME argc referenced below */ int idx_number = 2; char *num = NULL; if (!strcmp (argv[0]->text, "continue")) @@ -1609,6 +1610,7 @@ DEFUN (rmap_continue, "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") { + /* CHECK ME argc referenced below */ return rmap_onmatch_goto (self, vty, argc, argv); } @@ -1620,6 +1622,7 @@ DEFUN (no_rmap_continue, "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") { + /* CHECK ME argc referenced below */ return no_rmap_onmatch_goto (self, vty, argc, argv); } @@ -1631,6 +1634,7 @@ DEFUN (rmap_show_name, "route-map information\n" "route-map name\n") { + /* CHECK ME argc referenced below */ int idx_word = 2; const char *name = (argc == 3) ? argv[idx_word]->arg : NULL; return vty_show_route_map (vty, name); @@ -1694,6 +1698,7 @@ DEFUN (rmap_description, "Route-map comment\n" "Comment describing this route-map rule\n") { + /* CHECK ME argc referenced below */ struct route_map_index *index; index = vty->index; diff --git a/lib/thread.c b/lib/thread.c index 76acd07789..eb85d57af0 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -299,6 +299,7 @@ DEFUN (show_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + /* CHECK ME argc referenced below */ int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; @@ -382,6 +383,7 @@ DEFUN (clear_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + /* CHECK ME argc referenced below */ int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; diff --git a/lib/vty.c b/lib/vty.c index e922c672a8..7fcf4565a2 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2797,6 +2797,7 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { + /* CHECK ME argc referenced below */ int idx_word = 2; const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL; if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist))) @@ -2840,6 +2841,7 @@ DEFUN (no_vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { + /* CHECK ME argc referenced below */ int idx_word = 3; const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL; @@ -2948,6 +2950,7 @@ DEFUN (no_terminal_monitor, "Set terminal line parameters\n" "Copy debug output to the current terminal line\n") { + /* CHECK ME argc referenced below */ return terminal_no_monitor (self, vty, argc, argv); } diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index d67621d7c2..75c1bd2f67 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -468,6 +468,7 @@ DEFUN (area_range, "Specify IPv6 prefix\n" ) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_ipv6_prefixlen = 3; int ret; @@ -571,6 +572,7 @@ DEFUN (no_area_range, "Configured address range\n" "Specify IPv6 prefix\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int ret; struct ospf6_area *oa; @@ -680,6 +682,7 @@ DEFUN (area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_word = 4; struct ospf6_area *area; @@ -724,6 +727,7 @@ DEFUN (no_area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_word = 5; struct ospf6_area *area; diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 379320e869..3798f85df6 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1142,6 +1142,7 @@ DEFUN (no_set_metric, SET_STR "Metric value for destination routing protocol\n") { + /* CHECK ME argc referenced below */ int ret = 0; if (argc == 0) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index e9d66419df..e15fb9971e 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1006,6 +1006,7 @@ DEFUN (show_ipv6_ospf6_interface, IFNAME_STR ) { + /* CHECK ME argc referenced below */ int idx_ifname = 4; struct interface *ifp; struct listnode *i; @@ -1069,6 +1070,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, "Display connected prefixes to advertise\n" ) { + /* CHECK ME argc referenced below */ int idx_ifname = 4; struct interface *ifp; struct ospf6_interface *oi; @@ -1131,6 +1133,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix, "Display connected prefixes to advertise\n" ) { + /* CHECK ME argc referenced below */ struct listnode *i; struct ospf6_interface *oi; struct interface *ifp; @@ -1990,6 +1993,7 @@ DEFUN (clear_ipv6_ospf6_interface, IFNAME_STR ) { + /* CHECK ME argc referenced below */ int idx_ifname = 4; struct interface *ifp; struct listnode *node; diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index a70e450f60..7aa78048d3 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -835,6 +835,7 @@ DEFUN (debug_ospf6_lsa_type, "Specify LS type as Hexadecimal\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 3; unsigned int i; struct ospf6_lsa_handler *handler = NULL; @@ -893,6 +894,7 @@ DEFUN (no_debug_ospf6_lsa_type, "Specify LS type as Hexadecimal\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; u_int i; struct ospf6_lsa_handler *handler = NULL; diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 2cedc59ee5..8c4684081f 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2371,6 +2371,7 @@ DEFUN (debug_ospf6_message, "Debug All message\n" ) { + /* CHECK ME argc referenced below */ int idx_packet = 3; unsigned char level = 0; int type = 0; @@ -2450,6 +2451,7 @@ DEFUN (no_debug_ospf6_message, "Debug All message\n" ) { + /* CHECK ME argc referenced below */ int idx_packet = 4; unsigned char level = 0; int type = 0; diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 76c3862eca..573fced393 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -848,6 +848,7 @@ DEFUN (show_ipv6_ospf6_neighbor, "Neighbor list\n" ) { + /* CHECK ME argc referenced below */ struct ospf6_neighbor *on; struct ospf6_interface *oi; struct ospf6_area *oa; @@ -945,6 +946,7 @@ DEFUN (debug_ospf6_neighbor, "Debug OSPFv3 Neighbor\n" ) { + /* CHECK ME argc referenced below */ unsigned char level = 0; if (argc) { @@ -982,6 +984,7 @@ DEFUN (no_debug_ospf6_neighbor, "Debug OSPFv3 Neighbor\n" ) { + /* CHECK ME argc referenced below */ unsigned char level = 0; if (argc) { diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 3aa653814b..6590783539 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -885,6 +885,7 @@ DEFUN (ospf6_timers_throttle_spf, "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 5; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 5fef06d7ca..49e136c998 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -405,6 +405,7 @@ DEFUN (ospf6_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; unsigned int minarrival; struct ospf6 *ospf = vty->index; @@ -443,6 +444,7 @@ DEFUN (no_ospf6_timers_lsa, "OSPF6 LSA timers\n" "Minimum delay in receiving new version of a LSA\n") { + /* CHECK ME argc referenced below */ unsigned int minarrival; struct ospf6 *ospf = vty->index; @@ -816,6 +818,7 @@ DEFUN (show_ipv6_ospf6_route, ROUTE_STR ) { + /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); ospf6_route_table_show (vty, argc, argv, ospf6->route_table); @@ -846,6 +849,7 @@ DEFUN (show_ipv6_ospf6_route_match, "Display routes which match the specified route\n" ) { + /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); ospf6_route_table_show (vty, argc, argv, ospf6->route_table); @@ -864,6 +868,7 @@ DEFUN (show_ipv6_ospf6_route_match_detail, "Detailed information\n" ) { + /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); ospf6_route_table_show (vty, argc, argv, ospf6->route_table); @@ -886,6 +891,7 @@ DEFUN (show_ipv6_ospf6_route_type_detail, "Detailed information\n" ) { + /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); ospf6_route_table_show (vty, argc, argv, ospf6->route_table); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 6599fbc6cc..44d1bbfaf8 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -726,6 +726,7 @@ DEFUN (debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + /* CHECK ME argc referenced below */ int idx_send_recv = 3; unsigned char level = 0; @@ -766,6 +767,7 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { + /* CHECK ME argc referenced below */ int idx_send_recv = 4; unsigned char level = 0; diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index b572288851..c67b0878c3 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -187,6 +187,7 @@ DEFUN (show_ipv6_ospf6_database, "Display Link state database\n" ) { + /* CHECK ME argc referenced below */ int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -264,6 +265,7 @@ DEFUN (show_ipv6_ospf6_database_type, "Display Intra-Area-Prefix LSAs\n" ) { + /* CHECK ME argc referenced below */ int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -364,6 +366,7 @@ DEFUN (show_ipv6_ospf6_database_id, "Specify Link state ID as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 5; int level; struct listnode *i, *j; @@ -462,6 +465,7 @@ DEFUN (show_ipv6_ospf6_database_router, "Specify Advertising Router as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 6; int level; struct listnode *i, *j; @@ -598,6 +602,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, "Specify Link state ID as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -754,6 +759,7 @@ DEFUN (show_ipv6_ospf6_database_type_router, "Specify Advertising Router as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -848,6 +854,7 @@ DEFUN (show_ipv6_ospf6_database_id_router, "Specify Advertising Router as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 5; int level; struct listnode *i, *j; @@ -935,6 +942,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 5; int level; struct listnode *i, *j; @@ -1037,6 +1045,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, "Specify Advertising Router as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -1162,6 +1171,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -1259,6 +1269,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, "Display Self-originated LSAs\n" ) { + /* CHECK ME argc referenced below */ int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1341,6 +1352,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, "Display Self-originated LSAs\n" ) { + /* CHECK ME argc referenced below */ int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1444,6 +1456,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, "Specify Link state ID as IPv4 address notation\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -1558,6 +1571,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, "Display Self-originated LSAs\n" ) { + /* CHECK ME argc referenced below */ int idx_lsa = 4; int level; struct listnode *i, *j; @@ -1646,6 +1660,7 @@ DEFUN (show_ipv6_ospf6_border_routers, "Display routing table for ABR and ASBR\n" ) { + /* CHECK ME argc referenced below */ u_int32_t adv_router; void (*showfunc) (struct vty *, struct ospf6_route *); struct ospf6_route *ro; @@ -1724,6 +1739,7 @@ DEFUN (show_ipv6_ospf6_linkstate, "Display linkstate routing table\n" ) { + /* CHECK ME argc referenced below */ struct listnode *node; struct ospf6_area *oa; @@ -1751,6 +1767,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, "Display linkstate routing table\n" ) { + /* CHECK ME argc referenced below */ struct listnode *node; struct ospf6_area *oa; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index f2b332053c..c55ce1de8c 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -772,6 +772,7 @@ DEFUN (debug_ospf_packet, "Detail Information\n" "Detail Information\n") { + /* CHECK ME argc referenced below */ int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0; int detail = strmatch (argv[argc - 1]->text, "detail"); int send = strmatch (argv[argc - (1+detail)]->text, "send"); @@ -849,6 +850,7 @@ DEFUN (no_debug_ospf_packet, "Detail Information\n" "Detail Information\n") { + /* CHECK ME argc referenced below */ int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0; int detail = strmatch (argv[argc - 1]->text, "detail"); int send = strmatch (argv[argc - (1+detail)]->text, "send"); @@ -924,6 +926,7 @@ DEFUN (debug_ospf_ism, "ISM Event Information\n" "ISM TImer Information\n") { + /* CHECK ME argc referenced below */ int inst = (argv[2]->type == RANGE_TKN); char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL; @@ -977,6 +980,7 @@ DEFUN (no_debug_ospf_ism, "ISM Event Information\n" "ISM TImer Information\n") { + /* CHECK ME argc referenced below */ int inst = (argv[3]->type == RANGE_TKN); char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL; @@ -1073,6 +1077,7 @@ DEFUN (debug_ospf_nsm, OSPF_STR "OSPF Neighbor State Machine\n") { + /* CHECK ME argc referenced below */ return debug_ospf_nsm_common (vty, 0, argc, argv); } @@ -1097,6 +1102,7 @@ DEFUN (debug_ospf_instance_nsm, "Instance ID\n" "OSPF Neighbor State Machine\n") { + /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1164,6 +1170,7 @@ DEFUN (no_debug_ospf_nsm, OSPF_STR "OSPF Neighbor State Machine") { + /* CHECK ME argc referenced below */ return no_debug_ospf_nsm_common(vty, 0, argc, argv); } @@ -1190,6 +1197,7 @@ DEFUN (no_debug_ospf_instance_nsm, "Instance ID\n" "OSPF Neighbor State Machine") { + /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; @@ -1261,6 +1269,7 @@ DEFUN (debug_ospf_lsa, OSPF_STR "OSPF Link State Advertisement\n") { + /* CHECK ME argc referenced below */ return debug_ospf_lsa_common(vty, 0, argc, argv); } @@ -1286,6 +1295,7 @@ DEFUN (debug_ospf_instance_lsa, "Instance ID\n" "OSPF Link State Advertisement\n") { + /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1358,6 +1368,7 @@ DEFUN (no_debug_ospf_lsa, OSPF_STR "OSPF Link State Advertisement\n") { + /* CHECK ME argc referenced below */ return no_debug_ospf_lsa_common (vty, 0, argc, argv); } @@ -1385,6 +1396,7 @@ DEFUN (no_debug_ospf_instance_lsa, "Instance ID\n" "OSPF Link State Advertisement\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; @@ -1446,6 +1458,7 @@ DEFUN (debug_ospf_zebra, OSPF_STR "OSPF Zebra information\n") { + /* CHECK ME argc referenced below */ return debug_ospf_zebra_common(vty, 0, argc, argv); } @@ -1469,6 +1482,7 @@ DEFUN (debug_ospf_instance_zebra, "Instance ID\n" "OSPF Zebra information\n") { + /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1532,6 +1546,7 @@ DEFUN (no_debug_ospf_zebra, OSPF_STR "OSPF Zebra information\n") { + /* CHECK ME argc referenced below */ return no_debug_ospf_zebra_common(vty, 0, argc, argv); } @@ -1557,6 +1572,7 @@ DEFUN (no_debug_ospf_instance_zebra, "Instance ID\n" "OSPF Zebra information\n") { + /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index a1981be86d..ecf883c69b 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -792,6 +792,7 @@ DEFUN (ospf_opaque, "OSPF specific commands\n" "Enable the Opaque-LSA capability (rfc2370)\n") { + /* CHECK ME argc referenced below */ return capability_opaque (self, vty, argc, argv); } @@ -826,6 +827,7 @@ DEFUN (no_ospf_opaque, "OSPF specific commands\n" "Enable the Opaque-LSA capability (rfc2370)\n") { + /* CHECK ME argc referenced below */ return no_capability_opaque (self, vty, argc, argv); } diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index bcb1cd8e20..463671f7db 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1182,6 +1182,7 @@ DEFUN (router_info, "Enable the Router Information functionality with Area flooding scope\n" "OSPF area ID in IP format") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; char *area = (argc == 3) ? argv[idx_ipv4]->arg : NULL; diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 33ddc67fcc..1cb29f3ef4 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -715,6 +715,7 @@ DEFUN (no_match_ip_nexthop, "IP access-list number (expanded range)\n" "IP access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip next-hop", al); } @@ -744,6 +745,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *pl = (argc == 6) ? argv[5]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", pl); } @@ -774,6 +776,7 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip address", al); } @@ -802,6 +805,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *pl = (argc == 6) ? argv[5]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl); } @@ -825,6 +829,7 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { + /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "interface", iface); } @@ -848,6 +853,7 @@ DEFUN (no_match_tag, "Match tag of route\n" "Tag value\n") { + /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "tag", tag); } @@ -871,6 +877,7 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_set_delete (vty, vty->index, "metric", mval); } @@ -896,6 +903,7 @@ DEFUN (no_set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { + /* CHECK ME argc referenced below */ char *ext = (argc == 4) ? argv[3]->text : NULL; return ospf_route_set_delete (vty, vty->index, "metric-type", ext); } @@ -919,6 +927,7 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { + /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 2044500f1e..ac9f9c7d3b 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2620,6 +2620,7 @@ DEFUN (show_ip_ospf_mpls_te_link, "Interface information\n" "Interface name\n") { + /* CHECK ME argc referenced below */ int idx_interface = 5; struct interface *ifp; struct listnode *node, *nnode; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index b27088366f..bf68e3a51e 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2534,6 +2534,7 @@ DEFUN (ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int result; struct in_addr source_addr; @@ -2564,6 +2565,7 @@ DEFUN (no_ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { + /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int result; struct in_addr source_addr; @@ -3560,6 +3562,7 @@ DEFUN (interface_ip_pim_hello, IFACE_PIM_HELLO_TIME_STR IFACE_PIM_HELLO_HOLD_STR) { + /* CHECK ME argc referenced below */ int idx_time = 3; int idx_hold = 4; struct interface *ifp; @@ -4052,6 +4055,7 @@ DEFUN (test_igmp_receive_report, "Record type\n" "Sources\n") { + /* CHECK ME argc referenced below */ int idx_number = 4; int idx_ipv4 = 5; int idx_number_2 = 6; @@ -4167,6 +4171,7 @@ DEFUN (test_pim_receive_dump, "Neighbor address\n" "Packet dump\n") { + /* CHECK ME argc referenced below */ int idx_interface = 4; int idx_ipv4 = 5; uint8_t buf[1000]; @@ -4287,6 +4292,7 @@ DEFUN (test_pim_receive_hello, "Neighbor LAN prune delay T-bit\n" "Neighbor secondary addresses\n") { + /* CHECK ME argc referenced below */ int idx_interface = 4; int idx_ipv4 = 5; int idx_number = 6; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index d6686399c2..6b2fef7f50 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1528,6 +1528,7 @@ DEFUN (ip_rip_authentication_mode, "RFC compatible\n" "Old ripd compatible\n") { + /* CHECK ME argc referenced below */ char *cryptmode = argv[4]->text; char *authlen = (argc > 5) ? argv[6]->text : NULL; struct interface *ifp; diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e1017cfb27..e43c398c49 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -754,6 +754,7 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "metric", mval); } @@ -778,6 +779,7 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { + /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "interface", iface); } @@ -807,6 +809,7 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip next-hop", al); } @@ -834,6 +837,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist); } @@ -865,6 +869,7 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip address", al); } @@ -893,6 +898,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist); } @@ -917,6 +923,7 @@ DEFUN (no_match_tag, "Match tag of route\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "tag", mval); } @@ -989,6 +996,7 @@ DEFUN (no_set_ip_nexthop, "Next hop address\n" "IP address of next hop\n") { + /* CHECK ME argc referenced below */ char *addr = (argc == 5) ? argv[4]->arg : NULL; return rip_route_set_delete (vty, vty->index, "ip next-hop", addr); } @@ -1013,6 +1021,7 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { + /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return rip_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 6ecf084660..52aae9affc 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -519,6 +519,7 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "metric", mval); } @@ -543,6 +544,7 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { + /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "interface", iface); } @@ -567,6 +569,7 @@ DEFUN (no_match_tag, "Match tag of route\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "tag", mval); } @@ -593,6 +596,7 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { + /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "metric", mval); } @@ -637,6 +641,7 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { + /* CHECK ME argc referenced below */ char *addr = (argc == 6) ? argv[5]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr); } @@ -661,6 +666,7 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { + /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 523954a6f0..6c0d20b802 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -718,6 +718,18 @@ DEFUN (no_bgp_maxmed_onstartup, return used + def uses_argc(self): + for line in self.guts: + if 'CHECK ME argc referenced below' in line: + return False + + if 'use_json (argc, argv)' in line: + continue + + if 'argc' in line: + return True + return False + def dump(self): new_command_string = self.get_new_command_string() new_command_string_expanded = expand_command_string(new_command_string) @@ -730,6 +742,8 @@ DEFUN (no_bgp_maxmed_onstartup, lines.extend(self.help_strings) lines.append('{\n') + if self.uses_argc(): + lines.append(" /* CHECK ME argc referenced below */\n") lines.extend(self.guts) ''' diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index e6aebd6b1a..44985adbf0 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1732,6 +1732,7 @@ DEFUN (vtysh_show_thread, "Thread CPU usage\n" "Display filter (rwtexb)\n") { + /* CHECK ME argc referenced below */ unsigned int i; int ret = CMD_SUCCESS; char line[100]; @@ -2176,6 +2177,7 @@ DEFUN (vtysh_write_terminal, "Write running configuration to memory, network, or terminal\n" "Write to terminal\n") { + /* CHECK ME argc referenced below */ u_int i; char line[] = "write terminal\n"; FILE *fp = NULL; diff --git a/zebra/interface.c b/zebra/interface.c index 676b6ed0df..f49ab49036 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1305,6 +1305,7 @@ DEFUN (show_interface, "Interface status and configuration\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ struct listnode *node; struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; @@ -1354,6 +1355,7 @@ DEFUN (show_interface_name_vrf, "Interface name\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ifname = 2; int idx_name = 4; struct interface *ifp; @@ -1463,6 +1465,7 @@ DEFUN (show_interface_desc, "Interface description\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 3) @@ -2080,6 +2083,7 @@ DEFUN (link_params_delay, "Maximum delay\n" "Maximum delay in micro-second as decimal (0...16777215)\n") { + /* CHECK ME argc referenced below */ /* Get and Check new delay values */ u_int32_t delay = 0, low = 0, high = 0; VTY_GET_ULONG("delay", delay, argv[1]->arg); diff --git a/zebra/router-id.c b/zebra/router-id.c index 23b8cc743c..80ad0afa64 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -221,6 +221,7 @@ DEFUN (router_id, "IP address to use for router-id\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_name = 3; @@ -250,6 +251,7 @@ DEFUN (no_router_id, "IP address to use for router-id\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_name = 4; struct prefix rid; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 7edba55953..277cf4f06f 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1342,6 +1342,7 @@ DEFUN (ipv6_nd_prefix, "Do not use prefix for autoconfiguration\n" "Do not use prefix for onlink determination\n") { + /* CHECK ME argc referenced below */ /* prelude */ char *prefix = argv[3]->arg; int lifetimes = (argc > 4) && (argv[4]->type == RANGE_TKN || strmatch (argv[4]->text, "infinite")); diff --git a/zebra/test_main.c b/zebra/test_main.c index 4dd3e897f2..0e850f1629 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -124,6 +124,7 @@ DEFUN (test_interface_state, "up\n" "down\n") { + /* CHECK ME argc referenced below */ int idx_up_down = 1; struct interface *ifp; if (argc < 1) diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 6b861d7804..87dc85dd2e 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -314,6 +314,7 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { + /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "interface", iface, RMAP_EVENT_MATCH_DELETED); } @@ -338,6 +339,7 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { + /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "tag", tag, RMAP_EVENT_MATCH_DELETED); } @@ -368,6 +370,7 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop", al, RMAP_EVENT_FILTER_DELETED); } @@ -397,6 +400,7 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist, @@ -431,6 +435,7 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { + /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address", al, RMAP_EVENT_FILTER_DELETED); } @@ -460,6 +465,7 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { + /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address prefix-list", plist, @@ -489,6 +495,7 @@ DEFUN (no_match_ip_address_prefix_len, "Match prefixlen of ip address of route\n" "Prefix length\n") { + /* CHECK ME argc referenced below */ char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address prefix-len", plen, @@ -519,6 +526,7 @@ DEFUN (no_match_ip_nexthop_prefix_len, "Match prefix length of nexthop\n" "Prefix length\n") { + /* CHECK ME argc referenced below */ char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop prefix-len", plen, @@ -552,6 +560,7 @@ DEFUN (no_match_source_protocol, "No match protocol via which the route was learnt\n" ) { + /* CHECK ME argc referenced below */ char *proto = (argc == 4) ? argv[3]->text : NULL; return zebra_route_match_delete (vty, vty->index, "source-protocol", proto, RMAP_EVENT_MATCH_DELETED); } @@ -625,6 +634,7 @@ DEFUN (no_set_src, SET_STR "Source address for route\n") { + /* CHECK ME argc referenced below */ char *ip = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_set_delete (vty, vty->index, "src", ip); } @@ -708,6 +718,7 @@ DEFUN (no_ip_protocol, "Specify route map\n" "Route map name\n") { + /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -818,6 +829,7 @@ DEFUN (no_ipv6_protocol, "Specify route map\n" "Route map name\n") { + /* CHECK ME argc referenced below */ const char *proto = argv[3]->text; const char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -924,6 +936,7 @@ DEFUN (no_ip_protocol_nht_rmap, "Specify route map\n" "Route map name\n") { + /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -1019,6 +1032,7 @@ DEFUN (no_ipv6_protocol_nht_rmap, "Specify route map\n" "Route map name\n") { + /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ddcffb5d4d..b57634a8f9 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -191,6 +191,7 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { + /* CHECK ME argc referenced below */ char *destprefix = argv[2]->arg; char *nexthop = argv[3]->arg; char *distance = (argc == 5) ? argv[4]->arg : NULL; @@ -208,6 +209,7 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { + /* CHECK ME argc referenced below */ char *destprefix = argv[2]->arg; char *nexthop = argv[3]->arg; char *distance = (argc == 5) ? argv[4]->arg : NULL; @@ -351,6 +353,7 @@ DEFUN (ip_route, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname_null = 3; int idx_curr = 4; @@ -382,6 +385,7 @@ DEFUN (ip_route_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname = 3; int idx_reject_blackhole = 4; @@ -412,6 +416,7 @@ DEFUN (ip_route_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_reject_blackhole = 3; int idx_curr = 4; @@ -444,6 +449,7 @@ DEFUN (ip_route_mask, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname_null = 4; @@ -476,6 +482,7 @@ DEFUN (ip_route_mask_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname = 4; @@ -509,6 +516,7 @@ DEFUN (ip_route_mask_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_reject_blackhole = 4; @@ -541,6 +549,7 @@ DEFUN (no_ip_route, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname_null = 4; int idx_curr = 5; @@ -571,6 +580,7 @@ DEFUN (no_ip_route_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_curr = 5; char *tag, *distance, *vrf; @@ -600,6 +610,7 @@ DEFUN (no_ip_route_mask, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname_null = 5; @@ -632,6 +643,7 @@ DEFUN (no_ip_route_mask_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_curr = 6; @@ -663,6 +675,7 @@ DEFUN (no_ip_route_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; @@ -697,6 +710,7 @@ DEFUN (no_ip_route_mask_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname = 5; @@ -1139,6 +1153,7 @@ DEFUN (show_ip_route, IP_STR "IP routing table\n") { + /* CHECK ME argc referenced below */ return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); } @@ -1234,6 +1249,7 @@ DEFUN (show_ip_route_vrf, "IP routing table\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_json = 5; u_char uj = use_json(argc, argv); @@ -1251,6 +1267,7 @@ DEFUN (show_ip_nht, "IP nexthop tracking table\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; @@ -1291,6 +1308,7 @@ DEFUN (show_ipv6_nht, "IPv6 nexthop tracking table\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; @@ -2507,6 +2525,7 @@ DEFUN (ipv6_route, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_curr = 4; @@ -2539,6 +2558,7 @@ DEFUN (ipv6_route_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_reject_blackhole = 4; @@ -2569,6 +2589,7 @@ DEFUN (ipv6_route_ifname, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; @@ -2601,6 +2622,7 @@ DEFUN (ipv6_route_ifname_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; @@ -2633,6 +2655,7 @@ DEFUN (no_ipv6_route, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_curr = 5; @@ -2664,6 +2687,7 @@ DEFUN (no_ipv6_route_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_reject_blackhole = 5; @@ -2695,6 +2719,7 @@ DEFUN (no_ipv6_route_ifname, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; @@ -2728,6 +2753,7 @@ DEFUN (no_ipv6_route_ifname_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { + /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; @@ -2755,6 +2781,7 @@ DEFUN (show_ipv6_route, VRF_CMD_HELP_STR "Output JSON\n") { + /* CHECK ME argc referenced below */ struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2955,6 +2982,7 @@ DEFUN (show_ipv6_route_protocol, VRF_CMD_HELP_STR QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { + /* CHECK ME argc referenced below */ int type; struct route_table *table; struct route_node *rn; @@ -3699,6 +3727,7 @@ DEFUN (ip_zebra_import_table_distance, "route-map for filtering\n" "route-map name\n") { + /* CHECK ME argc referenced below */ u_int32_t table_id = 0; VTY_GET_INTEGER("table", table_id, argv[2]->arg); From 00d7d2d345bb027733e6a3172b6d8b87a9329b88 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 29 Sep 2016 18:21:36 +0000 Subject: [PATCH 174/280] bgpd and zebra: scrubbed argc CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_dump.c | 3 +-- bgpd/bgp_mplsvpn.c | 4 ---- bgpd/bgp_route.c | 14 ------------- bgpd/bgp_routemap.c | 20 ------------------ bgpd/bgp_vty.c | 45 +--------------------------------------- tools/argv_translator.py | 17 +++++++++++++-- zebra/interface.c | 7 +------ zebra/router-id.c | 2 -- zebra/test_main.c | 3 --- zebra/zebra_routemap.c | 14 ------------- zebra/zebra_vty.c | 32 ++-------------------------- 11 files changed, 20 insertions(+), 141 deletions(-) diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index cb2dd931d3..162642d2b0 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -736,7 +736,6 @@ DEFUN (dump_bgp_all, "Output filename\n" "Interval of output\n") { - /* CHECK ME argc referenced below */ int idx_dump_routes = 2; int idx_path = 3; int idx_interval = 4; @@ -766,7 +765,7 @@ DEFUN (dump_bgp_all, } /* When an interval is given */ - if (argc == 3) + if (argc == idx_interval + 1) interval = argv[idx_interval]->arg; return bgp_dump_set (vty, bgp_dump_struct, bgp_dump_type, diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 03d712e714..48baedcea5 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -924,7 +924,6 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 6; union sockunion su; struct peer *peer; @@ -980,7 +979,6 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_ext_community = 5; int idx_ipv4 = 7; int ret; @@ -1053,7 +1051,6 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 6; int ret; struct peer *peer; @@ -1108,7 +1105,6 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, "Display the routes advertised to a BGP neighbor\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_ext_community = 5; int idx_ipv4 = 7; int ret; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index ac2d0ffc77..68a1ca7a3d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7772,7 +7772,6 @@ DEFUN (show_ip_bgp_ipv4, "Display route and more specific routes\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -7880,7 +7879,6 @@ DEFUN (show_ip_bgp_route, "Display only multipaths\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -7932,7 +7930,6 @@ DEFUN (show_ip_bgp_instance_all, BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); /* CHECK ME we need to revisit all of the bgp_show_all_ commands */ @@ -7948,7 +7945,6 @@ DEFUN (show_bgp_instance_all, BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_routes_vty (vty, AFI_IP6, SAFI_UNICAST, uj); @@ -8865,7 +8861,6 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); @@ -8891,7 +8886,6 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_word = 4; int idx_peer = 6; struct peer *peer; @@ -8917,7 +8911,6 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_peer = 4; struct peer *peer; u_char uj = use_json(argc, argv); @@ -8943,7 +8936,6 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_word = 3; int idx_peer = 6; struct peer *peer; @@ -8972,7 +8964,6 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_safi = 4; int idx_peer = 6; struct peer *peer; @@ -9004,7 +8995,6 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, "Display detailed prefix count information\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_peer = 6; struct peer *peer; u_char uj = use_json(argc, argv); @@ -9281,7 +9271,6 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, "Name of the route map\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi = 5; @@ -9344,7 +9333,6 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -9454,7 +9442,6 @@ DEFUN (show_ip_bgp_neighbor_routes, "Display flap statistics of the routes learned from neighbor\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -9792,7 +9779,6 @@ DEFUN (bgp_damp_set, "Value to start suppressing a route\n" "Maximum duration to suppress a stable route\n") { - /* CHECK ME argc referenced below */ int idx_half_life = 2; int idx_reuse = 3; int idx_suppress = 4; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 7e1e20458b..3ddfef4be1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3026,7 +3026,6 @@ DEFUN (no_match_peer, "IP address of peer\n" "IPv6 address of peer\n") { - /* CHECK ME argc referenced below */ int idx_peer = 3; if (argc <= idx_peer) @@ -3065,7 +3064,6 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip address", NULL, @@ -3102,7 +3100,6 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL, @@ -3134,7 +3131,6 @@ DEFUN (no_match_probability, "Match portion of routes defined by percentage value\n" "Percentage of routes\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "probability", NULL, @@ -3171,7 +3167,6 @@ DEFUN (no_match_ip_route_source, "IP access-list number (expanded range)\n" "IP standard access-list name\n") { - /* CHECK ME argc referenced below */ int idx_number = 4; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "ip route-source", @@ -3206,7 +3201,6 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", @@ -3240,7 +3234,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", @@ -3275,7 +3268,6 @@ DEFUN (no_match_ip_route_source_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return bgp_route_match_delete (vty, vty->index, "ip route-source prefix-list", @@ -3306,7 +3298,6 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_match_delete (vty, vty->index, "metric", @@ -3338,7 +3329,6 @@ DEFUN (no_match_local_pref, "Match local preference of route\n" "Local preference value\n") { - /* CHECK ME argc referenced below */ int idx_localpref = 3; if (argc <= idx_localpref) return bgp_route_match_delete (vty, vty->index, "local-preference", @@ -3615,7 +3605,6 @@ DEFUN (no_set_ip_nexthop, "Use peer address (for BGP only)\n" "IP address of next hop\n") { - /* CHECK ME argc referenced below */ int idx_peer = 4; if (argc <= idx_peer) return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); @@ -3659,7 +3648,6 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_set_delete (vty, vty->index, "metric", NULL); @@ -3687,7 +3675,6 @@ DEFUN (no_set_local_pref, "BGP local preference path attribute\n" "Preference value\n") { - /* CHECK ME argc referenced below */ int idx_localpref = 3; if (argc <= idx_localpref) return bgp_route_set_delete (vty, vty->index, "local-preference", NULL); @@ -3715,7 +3702,6 @@ DEFUN (no_set_weight, "BGP weight for routing table\n" "Weight value\n") { - /* CHECK ME argc referenced below */ int idx_weight = 3; if (argc <= idx_weight) return bgp_route_set_delete (vty, vty->index, "weight", NULL); @@ -4111,7 +4097,6 @@ DEFUN (no_set_aggregator_as, "AS number\n" "IP address of aggregator\n") { - /* CHECK ME argc referenced below */ int idx_asn = 4; int idx_ip = 5; int ret; @@ -4161,7 +4146,6 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return bgp_route_set_delete (vty, vty->index, "tag", NULL); @@ -4342,7 +4326,6 @@ DEFUN (no_set_ipv6_nexthop_global, "IPv6 global address\n" "IPv6 address of next hop\n") { - /* CHECK ME argc referenced below */ int idx_ipv6 = 5; if (argc <= idx_ipv6) return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); @@ -4389,7 +4372,6 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { - /* CHECK ME argc referenced below */ int idx_ipv6 = 5; if (argc <= idx_ipv6) return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); @@ -4420,7 +4402,6 @@ DEFUN (no_set_vpnv4_nexthop, "VPNv4 next-hop address\n" "IP address of next hop\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 4; if (argc <= idx_ipv4) return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); @@ -4448,7 +4429,6 @@ DEFUN (no_set_originator_id, "BGP originator ID attribute\n" "IP address of originator\n") { - /* CHECK ME argc referenced below */ int idx_id = 3; if (argc < idx_id) return bgp_route_set_delete (vty, vty->index, "originator-id", NULL); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 362e7db0f1..4e4571a01a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -664,7 +664,6 @@ DEFUN (router_bgp, AS_STR BGP_INSTANCE_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_asn = 2; int idx_view_vrf = 3; int idx_vrf = 4; @@ -745,7 +744,6 @@ DEFUN (no_router_bgp, AS_STR BGP_INSTANCE_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_asn = 3; int idx_vrf = 5; as_t as; @@ -829,7 +827,6 @@ DEFUN (no_bgp_router_id, "Override configured router identifier\n" "Manually configured router identifier\n") { - /* CHECK ME argc referenced below */ int idx_router_id = 3; int ret; struct in_addr id; @@ -1111,21 +1108,12 @@ DEFUN (bgp_maxmed_onstartup, "Effective on a startup\n" "Time (seconds) period for max-med\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; struct bgp *bgp; bgp = vty->index; - - if (argc != 1) - { - vty_out (vty, "%% Must supply max-med on-startup period"); - return CMD_WARNING; - } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; - bgp_maxmed_update(bgp); return CMD_SUCCESS; @@ -1140,22 +1128,13 @@ DEFUN (bgp_maxmed_onstartup_medv, "Time (seconds) period for max-med\n" "Max MED value to be used\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; int idx_number_2 = 4; struct bgp *bgp; bgp = vty->index; - - if (argc != 2) - { - vty_out (vty, "%% Must supply max-med on-startup period and med value"); - return CMD_WARNING; - } - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[idx_number_2]->arg); - bgp_maxmed_update(bgp); return CMD_SUCCESS; @@ -2785,7 +2764,6 @@ DEFUN (neighbor_interface_config, "Member of the peer-group\n" "peer-group name\n") { - /* CHECK ME argc referenced below */ int idx_word = 1; int idx_peer_group_word = 4; @@ -2807,7 +2785,6 @@ DEFUN (neighbor_interface_config_v6only, "Member of the peer-group\n" "peer-group name\n") { - /* CHECK ME argc referenced below */ int idx_word = 1; int idx_peer_group_word = 5; @@ -4934,13 +4911,9 @@ DEFUN (neighbor_interface, "Interface\n" "Interface name\n") { - /* CHECK ME argc referenced below */ int idx_ip = 1; int idx_word = 3; - if (argc == 3) - return peer_interface_vty (vty, argv[idx_ip]->arg, argv[idx_word]->arg); - else - return peer_interface_vty (vty, argv[idx_ip]->arg, argv[idx_word]->arg); + return peer_interface_vty (vty, argv[idx_ip]->arg, argv[idx_word]->arg); } DEFUN (no_neighbor_interface, @@ -5530,7 +5503,6 @@ DEFUN (neighbor_allowas_in, "Accept as-path with my AS present in it\n" "Number of occurances of AS number\n") { - /* CHECK ME argc referenced below */ int idx_peer = 1; int idx_number = 3; int ret; @@ -6024,7 +5996,6 @@ DEFUN (clear_ip_bgp_all, BGP_SOFT_IN_STR BGP_SOFT_OUT_STR) { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_clr_sort = 5; @@ -6218,7 +6189,6 @@ DEFUN (show_bgp_vrfs, "Show BGP VRFs\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ struct list *inst = bm->bgp; struct listnode *node; struct bgp *bgp; @@ -6874,7 +6844,6 @@ DEFUN (show_ip_bgp_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -6901,7 +6870,6 @@ DEFUN (show_ip_bgp_instance_all_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); @@ -8753,7 +8721,6 @@ DEFUN (show_ip_bgp_neighbors, "Neighbor on bgp configured interface\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ int idx_ip = 1; int idx_view_vrf = 3; int idx_vrf = 4; @@ -8801,7 +8768,6 @@ DEFUN (show_ip_bgp_instance_all_neighbors, "Detailed information on TCP and BGP neighbor connections\n" "JavaScript Object Notation\n") { - /* CHECK ME argc referenced below */ u_char uj = use_json(argc, argv); bgp_show_all_instances_neighbors_vty (vty, uj); @@ -8936,7 +8902,6 @@ DEFUN (show_ip_bgp_updgrps, "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") { - /* CHECK ME argc referenced below */ int idx_view_vrf = 3; int idx_vrf = 4; int idx_afi; @@ -11321,7 +11286,6 @@ DEFUN (ip_community_list_standard, "Specify community to accept\n" COMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } @@ -11338,7 +11302,6 @@ DEFUN (no_ip_community_list_standard_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); } @@ -11355,7 +11318,6 @@ DEFUN (ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); } @@ -11372,7 +11334,6 @@ DEFUN (no_ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); } @@ -11564,7 +11525,6 @@ DEFUN (ip_extcommunity_list_standard, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); } @@ -11580,7 +11540,6 @@ DEFUN (ip_extcommunity_list_name_expanded, "Specify community to accept\n" "An ordered list as a regular-expression\n") { - /* CHECK ME argc referenced below */ return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } @@ -11597,7 +11556,6 @@ DEFUN (no_ip_extcommunity_list_standard_all, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } @@ -11614,7 +11572,6 @@ DEFUN (no_ip_extcommunity_list_expanded_all, "Specify community to accept\n" "An ordered list as a regular-expression\n") { - /* CHECK ME argc referenced below */ return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); } diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 6c0d20b802..02e7bac68f 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -726,6 +726,18 @@ DEFUN (no_bgp_maxmed_onstartup, if 'use_json (argc, argv)' in line: continue + if 'use_json(argc, argv)' in line: + continue + + if 'bgp_get_argv_vrf (argc,)' in line: + continue + + if 'bgp_get_argv_afi_safi (argc,' in line: + continue + + if 'zebra_vty_ip_route_tdv_helper (argc,' in line: + continue + if 'argc' in line: return True return False @@ -742,8 +754,9 @@ DEFUN (no_bgp_maxmed_onstartup, lines.extend(self.help_strings) lines.append('{\n') - if self.uses_argc(): - lines.append(" /* CHECK ME argc referenced below */\n") + # uncomment this to do ospf_vty.c + # if self.uses_argc(): + # lines.append(" /* CHECK ME argc referenced below */\n") lines.extend(self.guts) ''' diff --git a/zebra/interface.c b/zebra/interface.c index f49ab49036..62340a460a 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1305,7 +1305,6 @@ DEFUN (show_interface, "Interface status and configuration\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ struct listnode *node; struct interface *ifp; vrf_id_t vrf_id = VRF_DEFAULT; @@ -1355,7 +1354,6 @@ DEFUN (show_interface_name_vrf, "Interface name\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ifname = 2; int idx_name = 4; struct interface *ifp; @@ -1363,8 +1361,7 @@ DEFUN (show_interface_name_vrf, interface_update_stats (); - if (argc > 1) - VRF_GET_ID (vrf_id, argv[idx_name]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); /* Specified interface print. */ ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_id); @@ -1465,7 +1462,6 @@ DEFUN (show_interface_desc, "Interface description\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 3) @@ -2083,7 +2079,6 @@ DEFUN (link_params_delay, "Maximum delay\n" "Maximum delay in micro-second as decimal (0...16777215)\n") { - /* CHECK ME argc referenced below */ /* Get and Check new delay values */ u_int32_t delay = 0, low = 0, high = 0; VTY_GET_ULONG("delay", delay, argv[1]->arg); diff --git a/zebra/router-id.c b/zebra/router-id.c index 80ad0afa64..23b8cc743c 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -221,7 +221,6 @@ DEFUN (router_id, "IP address to use for router-id\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_name = 3; @@ -251,7 +250,6 @@ DEFUN (no_router_id, "IP address to use for router-id\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_name = 4; struct prefix rid; diff --git a/zebra/test_main.c b/zebra/test_main.c index 0e850f1629..d3813d7356 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -124,11 +124,8 @@ DEFUN (test_interface_state, "up\n" "down\n") { - /* CHECK ME argc referenced below */ int idx_up_down = 1; struct interface *ifp; - if (argc < 1) - return CMD_WARNING; ifp = vty->index; if (ifp->ifindex == IFINDEX_INTERNAL) diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 87dc85dd2e..6b861d7804 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -314,7 +314,6 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { - /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "interface", iface, RMAP_EVENT_MATCH_DELETED); } @@ -339,7 +338,6 @@ DEFUN (no_match_tag, MATCH_STR "Match tag of route\n") { - /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "tag", tag, RMAP_EVENT_MATCH_DELETED); } @@ -370,7 +368,6 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop", al, RMAP_EVENT_FILTER_DELETED); } @@ -400,7 +397,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist, @@ -435,7 +431,6 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address", al, RMAP_EVENT_FILTER_DELETED); } @@ -465,7 +460,6 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address prefix-list", plist, @@ -495,7 +489,6 @@ DEFUN (no_match_ip_address_prefix_len, "Match prefixlen of ip address of route\n" "Prefix length\n") { - /* CHECK ME argc referenced below */ char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip address prefix-len", plen, @@ -526,7 +519,6 @@ DEFUN (no_match_ip_nexthop_prefix_len, "Match prefix length of nexthop\n" "Prefix length\n") { - /* CHECK ME argc referenced below */ char *plen = (argc == 6) ? argv[5]->arg : NULL; return zebra_route_match_delete (vty, vty->index, "ip next-hop prefix-len", plen, @@ -560,7 +552,6 @@ DEFUN (no_match_source_protocol, "No match protocol via which the route was learnt\n" ) { - /* CHECK ME argc referenced below */ char *proto = (argc == 4) ? argv[3]->text : NULL; return zebra_route_match_delete (vty, vty->index, "source-protocol", proto, RMAP_EVENT_MATCH_DELETED); } @@ -634,7 +625,6 @@ DEFUN (no_set_src, SET_STR "Source address for route\n") { - /* CHECK ME argc referenced below */ char *ip = (argc == 4) ? argv[3]->arg : NULL; return zebra_route_set_delete (vty, vty->index, "src", ip); } @@ -718,7 +708,6 @@ DEFUN (no_ip_protocol, "Specify route map\n" "Route map name\n") { - /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -829,7 +818,6 @@ DEFUN (no_ipv6_protocol, "Specify route map\n" "Route map name\n") { - /* CHECK ME argc referenced below */ const char *proto = argv[3]->text; const char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -936,7 +924,6 @@ DEFUN (no_ip_protocol_nht_rmap, "Specify route map\n" "Route map name\n") { - /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; @@ -1032,7 +1019,6 @@ DEFUN (no_ipv6_protocol_nht_rmap, "Specify route map\n" "Route map name\n") { - /* CHECK ME argc referenced below */ char *proto = argv[3]->text; char *rmap = (argc == 6) ? argv[5]->arg : NULL; int i; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index b57634a8f9..02b68201ec 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -191,7 +191,6 @@ DEFUN (ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - /* CHECK ME argc referenced below */ char *destprefix = argv[2]->arg; char *nexthop = argv[3]->arg; char *distance = (argc == 5) ? argv[4]->arg : NULL; @@ -209,7 +208,6 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - /* CHECK ME argc referenced below */ char *destprefix = argv[2]->arg; char *nexthop = argv[3]->arg; char *distance = (argc == 5) ? argv[4]->arg : NULL; @@ -353,7 +351,6 @@ DEFUN (ip_route, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname_null = 3; int idx_curr = 4; @@ -385,7 +382,6 @@ DEFUN (ip_route_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_ipv4_ifname = 3; int idx_reject_blackhole = 4; @@ -416,7 +412,6 @@ DEFUN (ip_route_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 2; int idx_reject_blackhole = 3; int idx_curr = 4; @@ -449,7 +444,6 @@ DEFUN (ip_route_mask, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname_null = 4; @@ -482,7 +476,6 @@ DEFUN (ip_route_mask_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_ipv4_ifname = 4; @@ -516,7 +509,6 @@ DEFUN (ip_route_mask_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_ipv4_2 = 3; int idx_reject_blackhole = 4; @@ -549,7 +541,6 @@ DEFUN (no_ip_route, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname_null = 4; int idx_curr = 5; @@ -580,7 +571,6 @@ DEFUN (no_ip_route_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_curr = 5; char *tag, *distance, *vrf; @@ -610,7 +600,6 @@ DEFUN (no_ip_route_mask, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname_null = 5; @@ -643,7 +632,6 @@ DEFUN (no_ip_route_mask_flags2, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_curr = 6; @@ -675,7 +663,6 @@ DEFUN (no_ip_route_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4_prefixlen = 3; int idx_ipv4_ifname = 4; int idx_reject_blackhole = 5; @@ -710,7 +697,6 @@ DEFUN (no_ip_route_mask_flags, "Distance value for this route\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int idx_ipv4_2 = 4; int idx_ipv4_ifname = 5; @@ -1153,7 +1139,6 @@ DEFUN (show_ip_route, IP_STR "IP routing table\n") { - /* CHECK ME argc referenced below */ return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); } @@ -1249,14 +1234,11 @@ DEFUN (show_ip_route_vrf, "IP routing table\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ + int idx_vrf = 4; int idx_json = 5; u_char uj = use_json(argc, argv); - if (argc == 1 && uj) - return do_show_ip_route (vty, NULL, SAFI_UNICAST, uj); - else - return do_show_ip_route (vty, argv[idx_json]->arg, SAFI_UNICAST, uj); + return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uj); } DEFUN (show_ip_nht, @@ -1267,7 +1249,6 @@ DEFUN (show_ip_nht, "IP nexthop tracking table\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; @@ -1308,7 +1289,6 @@ DEFUN (show_ipv6_nht, "IPv6 nexthop tracking table\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_vrf = 4; vrf_id_t vrf_id = VRF_DEFAULT; @@ -2525,7 +2505,6 @@ DEFUN (ipv6_route, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_curr = 4; @@ -2558,7 +2537,6 @@ DEFUN (ipv6_route_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6_ifname = 3; int idx_reject_blackhole = 4; @@ -2589,7 +2567,6 @@ DEFUN (ipv6_route_ifname, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; @@ -2622,7 +2599,6 @@ DEFUN (ipv6_route_ifname_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 2; int idx_ipv6 = 3; int idx_interface = 4; @@ -2655,7 +2631,6 @@ DEFUN (no_ipv6_route, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_curr = 5; @@ -2687,7 +2662,6 @@ DEFUN (no_ipv6_route_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6_ifname = 4; int idx_reject_blackhole = 5; @@ -2719,7 +2693,6 @@ DEFUN (no_ipv6_route_ifname, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; @@ -2753,7 +2726,6 @@ DEFUN (no_ipv6_route_ifname_flags, "Distance value for this prefix\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ipv6_prefixlen = 3; int idx_ipv6 = 4; int idx_interface = 5; From abddf07563b9f00b6e256abf52b191f7c57655af Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 29 Sep 2016 19:51:56 +0000 Subject: [PATCH 175/280] all: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- isisd/isis_redist.c | 12 ------------ isisd/isis_routemap.c | 5 ----- isisd/isis_te.c | 3 +-- isisd/isis_vty.c | 2 -- lib/distribute.c | 2 -- lib/if.c | 7 +++---- lib/routemap.c | 13 ++++--------- lib/thread.c | 2 -- lib/vty.c | 6 ++---- pimd/pim_cmd.c | 7 ++----- ripd/rip_interface.c | 1 - ripd/rip_routemap.c | 9 --------- ripngd/ripng_routemap.c | 6 ------ vtysh/vtysh.c | 4 ++-- 14 files changed, 14 insertions(+), 65 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 038fba77e0..7cd3027f16 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -618,7 +618,6 @@ DEFUN (no_isis_redistribute, "Redistribute into level-1\n" "Redistribute into level-2\n") { - /* CHECK ME argc referenced below */ int idx_afi = 2; int idx_protocol = 3; int idx_level = 4; @@ -628,9 +627,6 @@ DEFUN (no_isis_redistribute, int family; int afi; - if (argc < 3) - return CMD_WARNING; - family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -669,7 +665,6 @@ DEFUN (isis_default_originate, "Route map reference\n" "Pointer to route-map entries\n") { - /* CHECK ME argc referenced below */ int idx_afi = 2; int idx_level = 3; int idx_metric_rmap = 4; @@ -680,9 +675,6 @@ DEFUN (isis_default_originate, unsigned long metric; const char *routemap; - if (argc < 5) - return CMD_WARNING; - family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -741,7 +733,6 @@ DEFUN (no_isis_default_originate, "Distribute default route into level-1\n" "Distribute default route into level-2\n") { - /* CHECK ME argc referenced below */ int idx_afi = 3; int idx_level = 4; struct isis_area *area = vty->index; @@ -749,9 +740,6 @@ DEFUN (no_isis_default_originate, int family; int level; - if (argc < 2) - return CMD_WARNING; - family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 6d130d08d9..a1f087548f 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -370,7 +370,6 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ int idx_acl = 4; if (argc <= idx_acl) return isis_route_match_delete(vty, vty->index, "ip address", NULL); @@ -404,7 +403,6 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); @@ -436,7 +434,6 @@ DEFUN (no_match_ipv6_address, "Match IPv6 address of route\n" "IPv6 access-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 4; if (argc <= idx_word) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); @@ -469,7 +466,6 @@ DEFUN (no_match_ipv6_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ int idx_word = 5; if (argc <= idx_word) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); @@ -501,7 +497,6 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; if (argc <= idx_number) return isis_route_set_delete(vty, vty->index, "metric", NULL); diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 2a5122a9de..95abf22310 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1318,13 +1318,12 @@ DEFUN (show_isis_mpls_te_interface, "Interface information\n" "Interface name\n") { - /* CHECK ME argc referenced below */ int idx_interface = 4; struct interface *ifp; struct listnode *node; /* Show All Interfaces. */ - if (argc == 0) + if (argc == 4) { for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 91a7e2bde8..a1970a9017 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -2067,7 +2067,6 @@ DEFUN (area_passwd_md5, "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") { - /* CHECK ME argc referenced below */ int idx_password = 0; int idx_word = 2; int idx_type = 5; @@ -2098,7 +2097,6 @@ DEFUN (area_passwd_clear, "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") { - /* CHECK ME argc referenced below */ int idx_password = 0; int idx_word = 2; int idx_type = 5; diff --git a/lib/distribute.c b/lib/distribute.c index e0b4f0468a..8a00833915 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -308,7 +308,6 @@ DEFUN (distribute_list, "Filter outgoing routing updates\n" "Interface name\n") { - /* CHECK ME argc referenced below */ int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ @@ -340,7 +339,6 @@ DEFUN (no_distribute_list, "Filter outgoing routing updates\n" "Interface name\n") { - /* CHECK ME argc referenced below */ int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0; /* Check of distribute list type. */ diff --git a/lib/if.c b/lib/if.c index 7b55a327cb..382e69d61c 100644 --- a/lib/if.c +++ b/lib/if.c @@ -756,10 +756,10 @@ DEFUN (interface, "Interface's name\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ int idx_ifname = 1; + int idx_vrf = 3; const char *ifname = argv[idx_ifname]->arg; - const char *vrfname = (argc > 2) ? argv[3]->arg : NULL; + const char *vrfname = (argc > 2) ? argv[idx_vrf]->arg : NULL; struct interface *ifp; size_t sl; @@ -901,8 +901,7 @@ DEFUN (show_address, "address\n" VRF_CMD_HELP_STR) { - /* CHECK ME argc referenced below */ - int idx_vrf_cmd_str = 2; + int idx_vrf = 3; struct listnode *node; struct listnode *node2; struct interface *ifp; diff --git a/lib/routemap.c b/lib/routemap.c index 2b4ec0c67a..b3d349d2f8 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1544,13 +1544,9 @@ DEFUN (rmap_onmatch_goto, "Goto Clause number\n" "Number\n") { - /* CHECK ME argc referenced below */ int idx_number = 2; char *num = NULL; - if (!strcmp (argv[0]->text, "continue")) - num = argv[1]->arg; - else - num = argv[idx_number]->arg; + num = argv[idx_number]->arg; struct route_map_index *index = vty->index; int d = 0; @@ -1565,7 +1561,7 @@ DEFUN (rmap_onmatch_goto, return CMD_WARNING; } - if (argc == 1 && num) + if (num) VTY_GET_INTEGER_RANGE("route-map index", d, num, 1, 65535); else d = index->pref + 1; @@ -1634,10 +1630,9 @@ DEFUN (rmap_show_name, "route-map information\n" "route-map name\n") { - /* CHECK ME argc referenced below */ int idx_word = 2; - const char *name = (argc == 3) ? argv[idx_word]->arg : NULL; - return vty_show_route_map (vty, name); + const char *name = (argc == 3) ? argv[idx_word]->arg : NULL; + return vty_show_route_map (vty, name); } DEFUN (rmap_call, diff --git a/lib/thread.c b/lib/thread.c index eb85d57af0..76acd07789 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -299,7 +299,6 @@ DEFUN (show_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { - /* CHECK ME argc referenced below */ int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; @@ -383,7 +382,6 @@ DEFUN (clear_thread_cpu, "Thread CPU usage\n" "Display filter (rwtexb)\n") { - /* CHECK ME argc referenced below */ int idx_filter = 3; int i = 0; thread_type filter = (thread_type) -1U; diff --git a/lib/vty.c b/lib/vty.c index 7fcf4565a2..301af667e1 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2797,10 +2797,9 @@ DEFUN (no_vty_access_class, "Filter connections based on an IP access list\n" "IP access list\n") { - /* CHECK ME argc referenced below */ int idx_word = 2; const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL; - if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist))) + if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist))) { vty_out (vty, "Access-class is not currently applied to vty%s", VTY_NEWLINE); @@ -2841,12 +2840,11 @@ DEFUN (no_vty_ipv6_access_class, "Filter connections based on an IP access list\n" "IPv6 access list\n") { - /* CHECK ME argc referenced below */ int idx_word = 3; const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL; if (! vty_ipv6_accesslist_name || - (argc && strcmp(vty_ipv6_accesslist_name, accesslist))) + (argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist))) { vty_out (vty, "IPv6 access-class is not currently applied to vty%s", VTY_NEWLINE); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index bf68e3a51e..5f2dcefdc8 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2534,11 +2534,10 @@ DEFUN (ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0"; + const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2565,11 +2564,10 @@ DEFUN (no_ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 3; int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0"; + const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -3562,7 +3560,6 @@ DEFUN (interface_ip_pim_hello, IFACE_PIM_HELLO_TIME_STR IFACE_PIM_HELLO_HOLD_STR) { - /* CHECK ME argc referenced below */ int idx_time = 3; int idx_hold = 4; struct interface *ifp; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 6b2fef7f50..d6686399c2 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1528,7 +1528,6 @@ DEFUN (ip_rip_authentication_mode, "RFC compatible\n" "Old ripd compatible\n") { - /* CHECK ME argc referenced below */ char *cryptmode = argv[4]->text; char *authlen = (argc > 5) ? argv[6]->text : NULL; struct interface *ifp; diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e43c398c49..e1017cfb27 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -754,7 +754,6 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "metric", mval); } @@ -779,7 +778,6 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { - /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "interface", iface); } @@ -809,7 +807,6 @@ DEFUN (no_match_ip_next_hop, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip next-hop", al); } @@ -837,7 +834,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist); } @@ -869,7 +865,6 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP Access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip address", al); } @@ -898,7 +893,6 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *plist = (argc == 6) ? argv[5]->arg : NULL; return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist); } @@ -923,7 +917,6 @@ DEFUN (no_match_tag, "Match tag of route\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return rip_route_match_delete (vty, vty->index, "tag", mval); } @@ -996,7 +989,6 @@ DEFUN (no_set_ip_nexthop, "Next hop address\n" "IP address of next hop\n") { - /* CHECK ME argc referenced below */ char *addr = (argc == 5) ? argv[4]->arg : NULL; return rip_route_set_delete (vty, vty->index, "ip next-hop", addr); } @@ -1021,7 +1013,6 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { - /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return rip_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 52aae9affc..6ecf084660 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -519,7 +519,6 @@ DEFUN (no_match_metric, "Match metric of route\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "metric", mval); } @@ -544,7 +543,6 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { - /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "interface", iface); } @@ -569,7 +567,6 @@ DEFUN (no_match_tag, "Match tag of route\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_match_delete (vty, vty->index, "tag", mval); } @@ -596,7 +593,6 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "metric", mval); } @@ -641,7 +637,6 @@ DEFUN (no_set_ipv6_nexthop_local, "IPv6 local address\n" "IPv6 address of next hop\n") { - /* CHECK ME argc referenced below */ char *addr = (argc == 6) ? argv[5]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr); } @@ -666,7 +661,6 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { - /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ripng_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 44985adbf0..09f761a3f7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1732,12 +1732,12 @@ DEFUN (vtysh_show_thread, "Thread CPU usage\n" "Display filter (rwtexb)\n") { - /* CHECK ME argc referenced below */ + int idx_filter = 3; unsigned int i; int ret = CMD_SUCCESS; char line[100]; - sprintf(line, "show thread cpu %s\n", (argc == 1) ? argv[0] : ""); + sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter] : ""); for (i = 0; i < array_size(vtysh_client); i++) if ( vtysh_client[i].fd >= 0 ) { From d8bd2affd3ccc2ab05c71af19beae39cb9c4ce9f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 29 Sep 2016 23:24:52 +0000 Subject: [PATCH 176/280] isisd: scrub argc CHECK ME's, refactor general Signed-off-by: Quentin Young --- isisd/isis_redist.c | 60 +++++++++++++++---------------------------- isisd/isis_routemap.c | 10 ++++---- isisd/isis_vty.c | 38 ++++++++++++++++++++++----- 3 files changed, 57 insertions(+), 51 deletions(-) diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 7cd3027f16..e330a10170 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -635,16 +635,11 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[idx_protocol]->arg); + type = proto_redistnum(afi, argv[idx_protocol]->text); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[idx_level]->arg)) - level = 1; - else if (!strcmp("level-2", argv[idx_level]->arg)) - level = 2; - else - return CMD_WARNING; + level = strmatch ("level-1", argv[idx_level]->text) ? 1 : 2; isis_redist_unset(area, level, family, type); return 0; @@ -652,7 +647,7 @@ DEFUN (no_isis_redistribute, DEFUN (isis_default_originate, isis_default_originate_cmd, - "default-information originate [always|metric (0-16777215)|route-map WORD]", + "default-information originate []", "Control distribution of default information\n" "Distribute a default route\n" "Distribute default route for IPv4\n" @@ -670,21 +665,16 @@ DEFUN (isis_default_originate, int idx_metric_rmap = 4; struct isis_area *area = vty->index; int family; - int originate_type; + int originate_type = DEFAULT_ORIGINATE; int level; - unsigned long metric; - const char *routemap; + unsigned long metric = 0xffffffff; + const char *routemap = NULL; - family = str2family(argv[idx_afi]->arg); + family = str2family(argv[idx_afi]->text); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[idx_level]->arg)) - level = 1; - else if (!strcmp("level-2", argv[idx_level]->arg)) - level = 2; - else - return CMD_WARNING; + level = strmatch ("level-1", argv[idx_level]->text) ? 1 : 2; if ((area->is_type & level) != level) { @@ -692,10 +682,15 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[idx_metric_rmap]->arg && *argv[idx_metric_rmap]->arg != '\0') - originate_type = DEFAULT_ORIGINATE_ALWAYS; - else - originate_type = DEFAULT_ORIGINATE; + if (argc > 4) + { + if (strmatch (argv[idx_metric_rmap]->text, "always")) + originate_type = DEFAULT_ORIGINATE_ALWAYS; + else if (strmatch(argv[idx_metric_rmap]->text, "metric")) + metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10); + else + routemap = argv[idx_metric_rmap + 1]->arg; + } if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS) { @@ -703,21 +698,6 @@ DEFUN (isis_default_originate, vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE); } - if (strmatch(argv[idx_metric_rmap]->text, "metric")) - { - char *endp; - metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10); - routemap = NULL; - - if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') - return CMD_WARNING; - } - else - { - routemap = argv[idx_metric_rmap + 1]->arg; - metric = 0xffffffff; - } - isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type); return 0; } @@ -740,13 +720,13 @@ DEFUN (no_isis_default_originate, int family; int level; - family = str2family(argv[idx_afi]->arg); + family = str2family(argv[idx_afi]->text); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[idx_level]->arg)) + if (strmatch ("level-1", argv[idx_level]->text)) level = 1; - else if (!strcmp("level-2", argv[idx_level]->arg)) + else if (strmatch ("level-2", argv[idx_level]->text)) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index a1f087548f..72caa5a096 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -371,7 +371,7 @@ DEFUN (no_match_ip_address, "IP Access-list name\n") { int idx_acl = 4; - if (argc <= idx_acl) + if (argc == 4) return isis_route_match_delete(vty, vty->index, "ip address", NULL); return isis_route_match_delete(vty, vty->index, "ip address", argv[idx_acl]->arg); } @@ -404,7 +404,7 @@ DEFUN (no_match_ip_address_prefix_list, "IP prefix-list name\n") { int idx_word = 5; - if (argc <= idx_word) + if (argc == 5) return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); } @@ -435,7 +435,7 @@ DEFUN (no_match_ipv6_address, "IPv6 access-list name\n") { int idx_word = 4; - if (argc <= idx_word) + if (argc == 4) return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[idx_word]->arg); } @@ -467,7 +467,7 @@ DEFUN (no_match_ipv6_address_prefix_list, "IP prefix-list name\n") { int idx_word = 5; - if (argc <= idx_word) + if (argc == 5) return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); } @@ -498,7 +498,7 @@ DEFUN (no_set_metric, "Metric value\n") { int idx_number = 3; - if (argc <= idx_number) + if (argc == 3) return isis_route_set_delete(vty, vty->index, "metric", NULL); return isis_route_set_delete(vty, vty->index, "metric", argv[idx_number]->arg); } diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index a1970a9017..93c5472609 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -2057,9 +2057,8 @@ area_passwd_set(struct vty *vty, int level, DEFUN (area_passwd_md5, area_passwd_md5_cmd, - " md5 WORD [authenticate snp ]", + "area-password md5 WORD [authenticate snp ]", "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" "Authentication type\n" "Level-wide password\n" "Authentication\n" @@ -2084,12 +2083,24 @@ DEFUN (area_passwd_md5, argv[idx_word]->arg, snp_auth); } +DEFUN (domain_passwd_md5, + domain_passwd_md5_cmd, + "domain-password md5 WORD [authenticate snp ]", + "Set the authentication password for a routing domain\n" + "Authentication type\n" + "Level-wide password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") +{ + return area_passwd_md5 (self, vty, argc, argv); +} DEFUN (area_passwd_clear, area_passwd_clear_cmd, - " clear WORD [authenticate snp ]", + "area-password clear WORD [authenticate snp ]", "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" "Authentication type\n" "Area password\n" "Authentication\n" @@ -2106,7 +2117,7 @@ DEFUN (area_passwd_clear, if (argc > 3) { snp_auth = SNP_AUTH_SEND; - if (strmatch(argv[idx_type]->arg, "validate")) + if (strmatch (argv[idx_type]->text, "validate")) snp_auth |= SNP_AUTH_RECV; } @@ -2114,6 +2125,19 @@ DEFUN (area_passwd_clear, argv[idx_word]->arg, snp_auth); } +DEFUN (domain_passwd_clear, + domain_passwd_clear_cmd, + "domain-password clear WORD [authenticate snp ]", + "Set the authentication password for a routing domain\n" + "Authentication type\n" + "Area password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") +{ + return area_passwd_clear (self, vty, argc, argv); +} DEFUN (no_area_passwd, no_area_passwd_cmd, @@ -2123,7 +2147,7 @@ DEFUN (no_area_passwd, "Set the authentication password for a routing domain\n") { int idx_password = 1; - int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = strmatch (argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; struct isis_area *area = vty->index; if (!area) @@ -2246,5 +2270,7 @@ isis_vty_init (void) install_element (ISIS_NODE, &area_passwd_md5_cmd); install_element (ISIS_NODE, &area_passwd_clear_cmd); + install_element (ISIS_NODE, &domain_passwd_md5_cmd); + install_element (ISIS_NODE, &domain_passwd_clear_cmd); install_element (ISIS_NODE, &no_area_passwd_cmd); } From 58749582a9a2c5930d907d88a3ad0d0c5c24f627 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 00:16:31 +0000 Subject: [PATCH 177/280] all: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- bgpd/bgp_filter.c | 6 ++---- bgpd/bgp_routemap.c | 28 ++++++++++++++-------------- bgpd/bgp_vty.c | 15 ++++++--------- lib/command.c | 23 ++++++++--------------- lib/filter.c | 10 ++++------ lib/grammar_sandbox.c | 12 ++++++------ lib/if.c | 9 +++------ lib/plist.c | 10 ++++------ lib/routemap.c | 6 ++---- lib/vty.c | 1 - ospfd/ospf_dump.c | 4 ---- ospfd/ospf_ri.c | 1 - ospfd/ospf_routemap.c | 9 --------- pimd/pim_cmd.c | 12 ++++++------ zebra/rtadv.c | 1 - zebra/zebra_vty.c | 4 ---- 16 files changed, 55 insertions(+), 96 deletions(-) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 255f6c2b6a..cee68e4d4c 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -437,7 +437,6 @@ DEFUN (ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { - /* CHECK ME argc referenced below */ int idx_word = 3; int idx_permit_deny = 4; enum as_filter_type type; @@ -458,7 +457,7 @@ DEFUN (ip_as_path, } /* Check AS path regex. */ - regstr = argv_concat(argv, argc, 2); + regstr = argv_concat(argv, argc, idx_permit_deny); regex = bgp_regcomp (regstr); if (!regex) @@ -497,7 +496,6 @@ DEFUN (no_ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { - /* CHECK ME argc referenced below */ int idx_word = 4; int idx_permit_deny = 5; enum as_filter_type type; @@ -527,7 +525,7 @@ DEFUN (no_ip_as_path, } /* Compile AS path. */ - regstr = argv_concat(argv, argc, 2); + regstr = argv_concat(argv, argc, idx_permit_deny); regex = bgp_regcomp (regstr); if (!regex) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 3ddfef4be1..d57d588667 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3719,11 +3719,11 @@ DEFUN (set_aspath_prepend, "Use the peer's AS-number\n" "Number of times to insert") { - /* CHECK ME argc referenced below */ + int idx_asn = 3; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn); ret = bgp_route_set_add (vty, vty->index, "as-path prepend", str); XFREE (MTYPE_TMP, str); @@ -3740,11 +3740,11 @@ DEFUN (no_set_aspath_prepend, "Prepend to the as-path\n" "AS number\n") { - /* CHECK ME argc referenced below */ + int idx_asn = 4; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn); ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str); XFREE (MTYPE_TMP, str); return ret; @@ -3759,11 +3759,11 @@ DEFUN (set_aspath_exclude, "Exclude from the as-path\n" "AS number\n") { - /* CHECK ME argc referenced below */ + int idx_asn = 3; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn); ret = bgp_route_set_add (vty, vty->index, "as-path exclude", str); XFREE (MTYPE_TMP, str); return ret; @@ -3778,11 +3778,11 @@ DEFUN (no_set_aspath_exclude, "Exclude from the as-path\n" "AS number\n") { - /* CHECK ME argc referenced below */ + int idx_asn = 4; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn); ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str); XFREE (MTYPE_TMP, str); return ret; @@ -3796,7 +3796,7 @@ DEFUN (set_community, "BGP community attribute\n" COMMUNITY_VAL_STR) { - /* CHECK ME argc referenced below */ + int idx_aa_nn = 2; int i; int first = 0; int additive = 0; @@ -3808,7 +3808,7 @@ DEFUN (set_community, b = buffer_new (1024); - for (i = 0; i < argc; i++) + for (i = idx_aa_nn; i < argc; i++) { if (strncmp (argv[i]->arg, "additive", strlen (argv[i]->arg)) == 0) { @@ -3947,11 +3947,11 @@ DEFUN (set_ecommunity_rt, "Route Target extended community\n" "VPN extended community\n") { - /* CHECK ME argc referenced below */ + int idx_asn_nn = 3; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn_nn); ret = bgp_route_set_add (vty, vty->index, "extcommunity rt", str); XFREE (MTYPE_TMP, str); @@ -3978,11 +3978,11 @@ DEFUN (set_ecommunity_soo, "Site-of-Origin extended community\n" "VPN extended community\n") { - /* CHECK ME argc referenced below */ + int idx_asn_nn = 3; int ret; char *str; - str = argv_concat (argv, argc, 0); + str = argv_concat (argv, argc, idx_asn_nn); ret = bgp_route_set_add (vty, vty->index, "extcommunity soo", str); XFREE (MTYPE_TMP, str); return ret; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4e4571a01a..0ced86023d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -949,14 +949,14 @@ DEFUN (bgp_confederation_peers, "Peer ASs in BGP confederation\n" AS_STR) { - /* CHECK ME argc referenced below */ + int idx_asn = 3; struct bgp *bgp; as_t as; int i; bgp = vty->index; - for (i = 0; i < argc; i++) + for (i = idx_asn; i < argc; i++) { VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); @@ -981,14 +981,14 @@ DEFUN (no_bgp_confederation_peers, "Peer ASs in BGP confederation\n" AS_STR) { - /* CHECK ME argc referenced below */ + int idx_asn = 4; struct bgp *bgp; as_t as; int i; bgp = vty->index; - for (i = 0; i < argc; i++) + for (i = idx_asn; i < argc; i++) { VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); @@ -4329,8 +4329,8 @@ DEFUN (neighbor_description, "Neighbor specific description\n" "Up to 80 characters describing this neighbor\n") { - /* CHECK ME argc referenced below */ int idx_peer = 1; + int idx_line = 3; struct peer *peer; char *str; @@ -4338,10 +4338,7 @@ DEFUN (neighbor_description, if (! peer) return CMD_WARNING; - if (argc == 1) - return CMD_SUCCESS; - - str = argv_concat(argv, argc, 1); + str = argv_concat(argv, argc, idx_line); peer_description_set (peer, str); diff --git a/lib/command.c b/lib/command.c index 4be178e122..95d69cdbf6 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1016,7 +1016,6 @@ DEFUN (config_quit, "quit", "Exit current mode and down to previous mode\n") { - /* CHECK ME argc referenced below */ return config_exit (self, vty, argc, argv); } @@ -1138,7 +1137,6 @@ DEFUN (config_write, "Write configuration currently in memory\n" "Write configuration to terminal\n") { - /* CHECK ME argc referenced below */ int idx_type = 1; unsigned int i; int fd; @@ -1284,7 +1282,6 @@ DEFUN (show_running_config, SHOW_STR "running configuration (same as write terminal/memory)\n") { - /* CHECK ME argc referenced below */ return config_write (self, vty, argc, argv); } @@ -1296,7 +1293,6 @@ DEFUN (copy_runningconf_startupconf, "Copy running config to... \n" "Copy running config to startup config (same as write file)\n") { - /* CHECK ME argc referenced below */ return config_write (self, vty, argc, argv); } /** -- **/ @@ -1378,7 +1374,6 @@ DEFUN (config_password, "Specifies a HIDDEN password will follow\n" "The password string\n") { - /* CHECK ME argc referenced below */ int idx_8 = 1; int idx_word = 2; if (argc == 3) // '8' was specified @@ -1425,9 +1420,9 @@ DEFUN (config_enable_password, "dummy string \n" "The HIDDEN 'enable' password string\n") { - /* CHECK ME argc referenced below */ int idx_8 = 2; int idx_word = 3; + /* Crypt type is specified. */ if (argc == 4) { @@ -1618,7 +1613,7 @@ DEFUN_HIDDEN (do_echo, { char *message; - vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 0)) ? message : ""), + vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 1)) ? message : ""), VTY_NEWLINE); if (message) XFREE(MTYPE_TMP, message); @@ -1632,15 +1627,15 @@ DEFUN (config_logmsg, LOG_LEVEL_DESC "The message to send\n") { - /* CHECK ME argc referenced below */ int idx_log_level = 1; + int idx_message = 2; int level; char *message; if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; - zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : "")); + zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, idx_message)) ? message : "")); if (message) XFREE(MTYPE_TMP, message); return CMD_SUCCESS; @@ -1706,9 +1701,9 @@ DEFUN (config_log_stdout, "Set stdout logging level\n" LOG_LEVEL_DESC) { - /* CHECK ME argc referenced below */ int idx_log_level = 2; - if (argc == 2) + + if (argc == idx_log_level) { zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl); return CMD_SUCCESS; @@ -1740,9 +1735,9 @@ DEFUN (config_log_monitor, "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) { - /* CHECK ME argc referenced below */ int idx_log_level = 2; - if (argc == 2) + + if (argc == idx_log_level) { zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl); return CMD_SUCCESS; @@ -1829,7 +1824,6 @@ DEFUN (config_log_file, "Logging filename\n" LOG_LEVEL_DESC) { - /* CHECK ME argc referenced below */ int idx_filename = 2; int idx_log_levels = 3; if (argc == 4) @@ -1870,7 +1864,6 @@ DEFUN (config_log_syslog, "Set syslog logging level\n" LOG_LEVEL_DESC) { - /* CHECK ME argc referenced below */ int idx_log_levels = 2; if (argc == 3) { diff --git a/lib/filter.c b/lib/filter.c index fd80b2a637..501b28f2da 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1480,8 +1480,8 @@ DEFUN (access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { - /* CHECK ME argc referenced below */ int idx_acl = 1; + int idx_remark = 3; struct access_list *access; access = access_list_get (AFI_IP, argv[idx_acl]->arg); @@ -1491,7 +1491,7 @@ DEFUN (access_list_remark, XFREE (MTYPE_TMP, access->remark); access->remark = NULL; } - access->remark = argv_concat(argv, argc, 1); + access->remark = argv_concat(argv, argc, idx_remark); return CMD_SUCCESS; } @@ -1526,7 +1526,6 @@ DEFUN (no_access_list_remark_comment, "Access list entry comment\n" "Comment up to 100 characters\n") { - /* CHECK ME argc referenced below */ return no_access_list_remark (self, vty, argc, argv); } @@ -1675,8 +1674,8 @@ DEFUN (ipv6_access_list_remark, "Access list entry comment\n" "Comment up to 100 characters\n") { - /* CHECK ME argc referenced below */ int idx_word = 2; + int idx_line = 4; struct access_list *access; access = access_list_get (AFI_IP6, argv[idx_word]->arg); @@ -1686,7 +1685,7 @@ DEFUN (ipv6_access_list_remark, XFREE (MTYPE_TMP, access->remark); access->remark = NULL; } - access->remark = argv_concat(argv, argc, 1); + access->remark = argv_concat(argv, argc, idx_line); return CMD_SUCCESS; } @@ -1715,7 +1714,6 @@ DEFUN (no_ipv6_access_list_remark_comment, "Access list entry comment\n" "Comment up to 100 characters\n") { - /* CHECK ME argc referenced below */ return no_ipv6_access_list_remark (self, vty, argc, argv); } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 34e0b81064..c4ae2d7d77 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -57,9 +57,9 @@ DEFUN (grammar_test, GRAMMAR_STR "command to pass to new parser\n") { - /* CHECK ME argc referenced below */ + int idx_command = 2; // make a string from tokenized command line - char *command = argv_concat (argv, argc, 0); + char *command = argv_concat (argv, argc, idx_command); // create cmd_element for parser struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); @@ -81,8 +81,8 @@ DEFUN (grammar_test_complete, "attempt to complete input on DFA\n" "command to complete") { - /* CHECK ME argc referenced below */ - char *cmdstr = argv_concat (argv, argc, 0); + int idx_command = 2; + char *cmdstr = argv_concat (argv, argc, idx_command); vector command = cmd_make_strvec (cmdstr); // generate completions of user input @@ -131,11 +131,11 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match") { - /* CHECK ME argc referenced below */ + int idx_command = 2; if (argv[0][0] == '#') return CMD_SUCCESS; - char *cmdstr = argv_concat(argv, argc, 0); + char *cmdstr = argv_concat(argv, argc, idx_command); vector command = cmd_make_strvec (cmdstr); struct list *argvv = NULL; diff --git a/lib/if.c b/lib/if.c index 382e69d61c..dd8922ee91 100644 --- a/lib/if.c +++ b/lib/if.c @@ -677,16 +677,13 @@ DEFUN (interface_desc, "Interface specific description\n" "Characters describing this interface\n") { - /* CHECK ME argc referenced below */ + int idx_line = 1; struct interface *ifp; - if (argc == 1) - return CMD_SUCCESS; - ifp = vty->index; if (ifp->desc) XFREE (MTYPE_TMP, ifp->desc); - ifp->desc = argv_concat(argv, argc, 1); + ifp->desc = argv_concat(argv, argc, idx_line); return CMD_SUCCESS; } @@ -910,7 +907,7 @@ DEFUN (show_address, vrf_id_t vrf_id = VRF_DEFAULT; if (argc > 2) - VRF_GET_ID (vrf_id, argv[idx_vrf_cmd_str]->arg); + VRF_GET_ID (vrf_id, argv[idx_vrf]->arg); for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) { diff --git a/lib/plist.c b/lib/plist.c index 4170230d82..23d580bd65 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1905,8 +1905,8 @@ DEFUN (ip_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { - /* CHECK ME argc referenced below */ int idx_word = 2; + int idx_line = 4; struct prefix_list *plist; plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg); @@ -1916,7 +1916,7 @@ DEFUN (ip_prefix_list_description, XFREE (MTYPE_TMP, plist->desc); plist->desc = NULL; } - plist->desc = argv_concat(argv, argc, 1); + plist->desc = argv_concat(argv, argc, idx_line); return CMD_SUCCESS; } @@ -1945,7 +1945,6 @@ DEFUN (no_ip_prefix_list_description_comment, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { - /* CHECK ME argc referenced below */ return no_ip_prefix_list_description (self, vty, argc, argv); } @@ -2618,8 +2617,8 @@ DEFUN (ipv6_prefix_list_description, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { - /* CHECK ME argc referenced below */ int idx_word = 2; + int iddx_line = 4; struct prefix_list *plist; plist = prefix_list_get (AFI_IP6, 0, argv[idx_word]->arg); @@ -2629,7 +2628,7 @@ DEFUN (ipv6_prefix_list_description, XFREE (MTYPE_TMP, plist->desc); plist->desc = NULL; } - plist->desc = argv_concat(argv, argc, 1); + plist->desc = argv_concat(argv, argc, iddx_line); return CMD_SUCCESS; } @@ -2658,7 +2657,6 @@ DEFUN (no_ipv6_prefix_list_description_comment, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { - /* CHECK ME argc referenced below */ return no_ipv6_prefix_list_description_comment (self, vty, argc, argv); } diff --git a/lib/routemap.c b/lib/routemap.c index b3d349d2f8..2e8637bcbe 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1606,7 +1606,6 @@ DEFUN (rmap_continue, "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") { - /* CHECK ME argc referenced below */ return rmap_onmatch_goto (self, vty, argc, argv); } @@ -1618,7 +1617,6 @@ DEFUN (no_rmap_continue, "Continue on a different entry within the route-map\n" "Route-map entry sequence number\n") { - /* CHECK ME argc referenced below */ return no_rmap_onmatch_goto (self, vty, argc, argv); } @@ -1693,7 +1691,7 @@ DEFUN (rmap_description, "Route-map comment\n" "Comment describing this route-map rule\n") { - /* CHECK ME argc referenced below */ + int idx_line = 1; struct route_map_index *index; index = vty->index; @@ -1701,7 +1699,7 @@ DEFUN (rmap_description, { if (index->description) XFREE (MTYPE_TMP, index->description); - index->description = argv_concat (argv, argc, 1); + index->description = argv_concat (argv, argc, idx_line); } return CMD_SUCCESS; } diff --git a/lib/vty.c b/lib/vty.c index 301af667e1..5a4f0fcbe7 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2948,7 +2948,6 @@ DEFUN (no_terminal_monitor, "Set terminal line parameters\n" "Copy debug output to the current terminal line\n") { - /* CHECK ME argc referenced below */ return terminal_no_monitor (self, vty, argc, argv); } diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index c55ce1de8c..08afb75d2c 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -772,7 +772,6 @@ DEFUN (debug_ospf_packet, "Detail Information\n" "Detail Information\n") { - /* CHECK ME argc referenced below */ int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0; int detail = strmatch (argv[argc - 1]->text, "detail"); int send = strmatch (argv[argc - (1+detail)]->text, "send"); @@ -850,7 +849,6 @@ DEFUN (no_debug_ospf_packet, "Detail Information\n" "Detail Information\n") { - /* CHECK ME argc referenced below */ int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0; int detail = strmatch (argv[argc - 1]->text, "detail"); int send = strmatch (argv[argc - (1+detail)]->text, "send"); @@ -926,7 +924,6 @@ DEFUN (debug_ospf_ism, "ISM Event Information\n" "ISM TImer Information\n") { - /* CHECK ME argc referenced below */ int inst = (argv[2]->type == RANGE_TKN); char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL; @@ -980,7 +977,6 @@ DEFUN (no_debug_ospf_ism, "ISM Event Information\n" "ISM TImer Information\n") { - /* CHECK ME argc referenced below */ int inst = (argv[3]->type == RANGE_TKN); char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL; diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 463671f7db..bcb1cd8e20 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1182,7 +1182,6 @@ DEFUN (router_info, "Enable the Router Information functionality with Area flooding scope\n" "OSPF area ID in IP format") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; char *area = (argc == 3) ? argv[idx_ipv4]->arg : NULL; diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 1cb29f3ef4..33ddc67fcc 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -715,7 +715,6 @@ DEFUN (no_match_ip_nexthop, "IP access-list number (expanded range)\n" "IP access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip next-hop", al); } @@ -745,7 +744,6 @@ DEFUN (no_match_ip_next_hop_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *pl = (argc == 6) ? argv[5]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", pl); } @@ -776,7 +774,6 @@ DEFUN (no_match_ip_address, "IP access-list number (expanded range)\n" "IP access-list name\n") { - /* CHECK ME argc referenced below */ char *al = (argc == 5) ? argv[4]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip address", al); } @@ -805,7 +802,6 @@ DEFUN (no_match_ip_address_prefix_list, "Match entries of prefix-lists\n" "IP prefix-list name\n") { - /* CHECK ME argc referenced below */ char *pl = (argc == 6) ? argv[5]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl); } @@ -829,7 +825,6 @@ DEFUN (no_match_interface, "Match first hop interface of route\n" "Interface name\n") { - /* CHECK ME argc referenced below */ char *iface = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "interface", iface); } @@ -853,7 +848,6 @@ DEFUN (no_match_tag, "Match tag of route\n" "Tag value\n") { - /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_match_delete (vty, vty->index, "tag", tag); } @@ -877,7 +871,6 @@ DEFUN (no_set_metric, "Metric value for destination routing protocol\n" "Metric value\n") { - /* CHECK ME argc referenced below */ char *mval = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_set_delete (vty, vty->index, "metric", mval); } @@ -903,7 +896,6 @@ DEFUN (no_set_metric_type, "OSPF[6] external type 1 metric\n" "OSPF[6] external type 2 metric\n") { - /* CHECK ME argc referenced below */ char *ext = (argc == 4) ? argv[3]->text : NULL; return ospf_route_set_delete (vty, vty->index, "metric-type", ext); } @@ -927,7 +919,6 @@ DEFUN (no_set_tag, "Tag value for routing protocol\n" "Tag value\n") { - /* CHECK ME argc referenced below */ char *tag = (argc == 4) ? argv[3]->arg : NULL; return ospf_route_set_delete (vty, vty->index, "tag", tag); } diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 5f2dcefdc8..8cc5cf95db 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4052,10 +4052,10 @@ DEFUN (test_igmp_receive_report, "Record type\n" "Sources\n") { - /* CHECK ME argc referenced below */ int idx_number = 4; int idx_ipv4 = 5; int idx_number_2 = 6; + int idx_line = 7; char buf[1000]; char *igmp_msg; struct ip *ip_hdr; @@ -4121,7 +4121,7 @@ DEFUN (test_igmp_receive_report, /* Scan LINE sources */ sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); src_addr = sources; - for (argi = 3; argi < argc; ++argi,++src_addr) { + for (argi = idx_line; argi < argc; ++argi,++src_addr) { src_str = argv[argi]->arg; result = inet_pton(AF_INET, src_str, src_addr); if (result <= 0) { @@ -4168,9 +4168,9 @@ DEFUN (test_pim_receive_dump, "Neighbor address\n" "Packet dump\n") { - /* CHECK ME argc referenced below */ int idx_interface = 4; int idx_ipv4 = 5; + int idx_line = 6; uint8_t buf[1000]; uint8_t *pim_msg; struct ip *ip_hdr; @@ -4219,7 +4219,7 @@ DEFUN (test_pim_receive_dump, pim_msg_size = 0; /* Scan LINE dump into buffer */ - for (argi = 2; argi < argc; ++argi) { + for (argi = idx_line; argi < argc; ++argi) { const char *str = argv[argi]->arg; int str_len = strlen(str); int str_last = str_len - 1; @@ -4289,7 +4289,6 @@ DEFUN (test_pim_receive_hello, "Neighbor LAN prune delay T-bit\n" "Neighbor secondary addresses\n") { - /* CHECK ME argc referenced below */ int idx_interface = 4; int idx_ipv4 = 5; int idx_number = 6; @@ -4298,6 +4297,7 @@ DEFUN (test_pim_receive_hello, int idx_number_4 = 9; int idx_number_5 = 10; int idx_number_6 = 11; + int idx_line = 12; uint8_t buf[1000]; uint8_t *pim_msg; struct ip *ip_hdr; @@ -4359,7 +4359,7 @@ DEFUN (test_pim_receive_hello, pim_msg = buf + ip_hlen; /* Scan LINE addresses */ - for (argi = 8; argi < argc; ++argi) { + for (argi = idx_line; argi < argc; ++argi) { const char *sec_str = argv[argi]->arg; struct in_addr sec_addr; result = inet_pton(AF_INET, sec_str, &sec_addr); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 277cf4f06f..7edba55953 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1342,7 +1342,6 @@ DEFUN (ipv6_nd_prefix, "Do not use prefix for autoconfiguration\n" "Do not use prefix for onlink determination\n") { - /* CHECK ME argc referenced below */ /* prelude */ char *prefix = argv[3]->arg; int lifetimes = (argc > 4) && (argv[4]->type == RANGE_TKN || strmatch (argv[4]->text, "infinite")); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 02b68201ec..e6e7f5d2ea 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1235,7 +1235,6 @@ DEFUN (show_ip_route_vrf, VRF_CMD_HELP_STR) { int idx_vrf = 4; - int idx_json = 5; u_char uj = use_json(argc, argv); return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uj); @@ -2753,7 +2752,6 @@ DEFUN (show_ipv6_route, VRF_CMD_HELP_STR "Output JSON\n") { - /* CHECK ME argc referenced below */ struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2954,7 +2952,6 @@ DEFUN (show_ipv6_route_protocol, VRF_CMD_HELP_STR QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { - /* CHECK ME argc referenced below */ int type; struct route_table *table; struct route_node *rn; @@ -3699,7 +3696,6 @@ DEFUN (ip_zebra_import_table_distance, "route-map for filtering\n" "route-map name\n") { - /* CHECK ME argc referenced below */ u_int32_t table_id = 0; VTY_GET_INTEGER("table", table_id, argv[2]->arg); From 1d68dbfe66479d81a570d8d4aa2d0f0d7ba57184 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 01:27:05 +0000 Subject: [PATCH 178/280] ospf6d: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- ospf6d/ospf6_area.c | 42 +---- ospf6d/ospf6_asbr.c | 60 +++---- ospf6d/ospf6_interface.c | 35 +--- ospf6d/ospf6_lsa.c | 53 ++---- ospf6d/ospf6_message.c | 70 ++------ ospf6d/ospf6_neighbor.c | 76 +++------ ospf6d/ospf6_route.c | 4 +- ospf6d/ospf6_route.h | 2 +- ospf6d/ospf6_spf.c | 26 +-- ospf6d/ospf6_top.c | 91 +++-------- ospf6d/ospf6_zebra.c | 39 +---- ospfd/ospf_dump.c | 343 ++++++++++++--------------------------- ospfd/ospf_opaque.c | 2 - ospfd/ospf_te.c | 3 +- 14 files changed, 223 insertions(+), 623 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 75c1bd2f67..bd9c0bcb2d 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -532,47 +532,15 @@ DEFUN (area_range, return CMD_SUCCESS; } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", - * NO_STR - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - * "no area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", - * NO_STR - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Configured address range\n" - * "Specify IPv6 prefix\n" - * - * "no area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", - * NO_STR - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - */ DEFUN (no_area_range, no_area_range_cmd, - "no area A.B.C.D range X:X::X:X/M", + "no area A.B.C.D range X:X::X:X/M [] [cost (0-16777215)]", NO_STR "OSPF area parameters\n" OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int ret; struct ospf6_area *oa; @@ -580,8 +548,6 @@ DEFUN (no_area_range, struct ospf6_route *range, *route; OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa); - argc--; - argv++; ret = str2prefix (argv[idx_ipv4]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) @@ -682,15 +648,12 @@ DEFUN (area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_word = 4; struct ospf6_area *area; struct prefix_list *plist; OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area); - argc--; - argv++; plist = prefix_list_lookup (AFI_IP6, argv[idx_ipv4]->arg); if (strncmp (argv[idx_word]->arg, "in", 2) == 0) @@ -727,14 +690,11 @@ DEFUN (no_area_filter_list, "Filter networks sent to this area\n" "Filter networks sent from this area\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 2; int idx_word = 5; struct ospf6_area *area; OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area); - argc--; - argv++; if (strncmp (argv[idx_word]->arg, "in", 2) == 0) { diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 3798f85df6..8489d33661 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -681,27 +681,19 @@ DEFUN (ospf6_redistribute_routemap, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no redistribute route-map WORD", - * NO_STR - * "Redistribute\n" - * QUAGGA_REDIST_HELP_STR_OSPF6D - * "Route map reference\n" - * "Route map name\n" - * - */ DEFUN (no_ospf6_redistribute, no_ospf6_redistribute_cmd, - "no redistribute ", + "no redistribute [route-map WORD]", NO_STR "Redistribute\n" QUAGGA_REDIST_HELP_STR_OSPF6D - ) + "Route map reference\n" + "Route map name\n") { + int idx_protocol = 2; int type; - type = proto_redistnum(AFI_IP6, argv[3]->arg); + type = proto_redistnum(AFI_IP6, argv[idx_protocol]->text); if (type < 0 || type == ZEBRA_ROUTE_OSPF6) return CMD_WARNING; @@ -1058,24 +1050,23 @@ DEFUN (ospf6_routemap_match_interface, } /* "no match interface WORD" */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no match interface WORD", - * MATCH_STR - * NO_STR - * "Match first hop interface of route\n" - * "Interface name\n" - * - */ DEFUN (ospf6_routemap_no_match_interface, ospf6_routemap_no_match_interface_cmd, - "no match interface", + "no match interface [WORD]", MATCH_STR NO_STR - "Match first hop interface of route\n") + "Match first hop interface of route\n" + "Interface name\n") { - int ret = route_map_delete_match ((struct route_map_index *) vty->index, - "interface", argv[3]->arg); + int idx_word = 3; + int ret; + + if (argc == 4) + ret = route_map_delete_match ((struct route_map_index *) vty->index, + "interface", argv[idx_word]->arg); + else + ret = route_map_delete_match ((struct route_map_index *) vty->index, + "interface", NULL); return route_map_command_status (vty, ret); } @@ -1126,31 +1117,22 @@ DEFUN (set_metric, } /* delete "set metric" */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no set metric <0-4294967295>", - * NO_STR - * SET_STR - * "Metric value for destination routing protocol\n" - * "Metric value\n" - * - */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric", + "no set metric [(0-4294967295)]", NO_STR SET_STR "Metric value for destination routing protocol\n") { - /* CHECK ME argc referenced below */ + int idx_number = 3; int ret = 0; - if (argc == 0) + if (argc == 3) ret = route_map_delete_set ((struct route_map_index *) vty->index, "metric", NULL); else ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric", argv[3]->arg); + "metric", argv[idx_number]->arg); return route_map_command_status (vty, ret); } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index e15fb9971e..c08d4ee840 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -986,32 +986,20 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp) } /* show interface */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 interface", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * INTERFACE_STR - * - * - */ DEFUN (show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd, - "show ipv6 ospf6 interface IFNAME", + "show ipv6 ospf6 interface [IFNAME]", SHOW_STR IP6_STR OSPF6_STR INTERFACE_STR - IFNAME_STR - ) + IFNAME_STR) { - /* CHECK ME argc referenced below */ int idx_ifname = 4; struct interface *ifp; struct listnode *i; - if (argc) + if (argc == 5) { ifp = if_lookup_by_name (argv[idx_ifname]->arg); if (ifp == NULL) @@ -1364,21 +1352,13 @@ DEFUN (auto_cost_reference_bandwidth, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no auto-cost reference-bandwidth <1-4294967>", - * NO_STR - * "Calculate OSPF interface cost according to bandwidth\n" - * "Use reference bandwidth method to assign OSPF cost\n" - * "The reference bandwidth in terms of Mbits per second\n" - * - */ DEFUN (no_auto_cost_reference_bandwidth, no_auto_cost_reference_bandwidth_cmd, - "no auto-cost reference-bandwidth", + "no auto-cost reference-bandwidth [1-4294967]", NO_STR "Calculate OSPF interface cost according to bandwidth\n" - "Use reference bandwidth method to assign OSPF cost\n") + "Use reference bandwidth method to assign OSPF cost\n" + "The reference bandwidth in terms of Mbits per second\n") { struct ospf6 *o = vty->index; struct ospf6_area *oa; @@ -1993,12 +1973,11 @@ DEFUN (clear_ipv6_ospf6_interface, IFNAME_STR ) { - /* CHECK ME argc referenced below */ int idx_ifname = 4; struct interface *ifp; struct listnode *node; - if (argc == 0) /* Clear all the ospfv3 interfaces. */ + if (argc == 4) /* Clear all the ospfv3 interfaces. */ { for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) ospf6_interface_clear (vty, ifp); diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 7aa78048d3..c65cae3927 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -816,32 +816,19 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) return buf; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)", - * DEBUG_STR - * OSPF6_STR - * "Debug Link State Advertisements (LSAs)\n" - * "Specify LS type as Hexadecimal\n" - * - * - */ DEFUN (debug_ospf6_lsa_type, debug_ospf6_lsa_hex_cmd, - "debug ospf6 lsa ", + "debug ospf6 lsa [originate|examine|flooding]", DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) + "Specify LS type as Hexadecimal\n") { - /* CHECK ME argc referenced below */ int idx_lsa = 3; + int idx_type = 4; unsigned int i; struct ospf6_lsa_handler *handler = NULL; - assert (argc); - for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++) { handler = vector_slot (ospf6_lsa_handler_vector, i); @@ -857,13 +844,13 @@ DEFUN (debug_ospf6_lsa_type, if (handler == NULL) handler = &unknown_handler; - if (argc >= 2) + if (argc == 5) { - if (! strcmp (argv[4]->arg, "originate")) + if (! strcmp (argv[idx_type]->text, "originate")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - if (! strcmp (argv[4]->arg, "examine")) + else if (! strcmp (argv[idx_type]->text, "examine")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - if (! strcmp (argv[4]->arg, "flooding")) + else if (! strcmp (argv[idx_type]->text, "flooding")) SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else @@ -872,21 +859,9 @@ DEFUN (debug_ospf6_lsa_type, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix) (originate|examine|flooding)", - * NO_STR - * DEBUG_STR - * OSPF6_STR - * "Debug Link State Advertisements (LSAs)\n" - * "Specify LS type as Hexadecimal\n" - * - * - */ DEFUN (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_cmd, - "no debug ospf6 lsa ", + "no debug ospf6 lsa [originate|examine|flooding]", NO_STR DEBUG_STR OSPF6_STR @@ -894,13 +869,11 @@ DEFUN (no_debug_ospf6_lsa_type, "Specify LS type as Hexadecimal\n" ) { - /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_type = 5; u_int i; struct ospf6_lsa_handler *handler = NULL; - assert (argc); - for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++) { handler = vector_slot (ospf6_lsa_handler_vector, i); @@ -915,13 +888,13 @@ DEFUN (no_debug_ospf6_lsa_type, if (handler == NULL) return CMD_SUCCESS; - if (argc >= 2) + if (argc == 6) { - if (! strcmp (argv[5]->arg, "originate")) + if (! strcmp (argv[idx_type]->text, "originate")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE); - if (! strcmp (argv[5]->arg, "examine")) + if (! strcmp (argv[idx_type]->text, "examine")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN); - if (! strcmp (argv[5]->arg, "flooding")) + if (! strcmp (argv[idx_type]->text, "flooding")) UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD); } else diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 8c4684081f..e9a25d37e5 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -2338,27 +2338,9 @@ ospf6_lsack_send_interface (struct thread *thread) /* Commands */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf6 message (unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", - * DEBUG_STR - * OSPF6_STR - * "Debug OSPFv3 message\n" - * "Debug Unknown message\n" - * "Debug Hello message\n" - * "Debug Database Description message\n" - * "Debug Link State Request message\n" - * "Debug Link State Update message\n" - * "Debug Link State Acknowledgement message\n" - * "Debug All message\n" - * "Debug only sending message\n" - * "Debug only receiving message\n" - * - * - */ DEFUN (debug_ospf6_message, debug_ospf6_message_cmd, - "debug ospf6 message ", + "debug ospf6 message []", DEBUG_STR OSPF6_STR "Debug OSPFv3 message\n" @@ -2369,16 +2351,15 @@ DEFUN (debug_ospf6_message, "Debug Link State Update message\n" "Debug Link State Acknowledgement message\n" "Debug All message\n" - ) + "Debug only sending message\n" + "Debug only receiving message\n") { - /* CHECK ME argc referenced below */ int idx_packet = 3; + int idx_send_recv = 4; unsigned char level = 0; int type = 0; int i; - assert (argc > 0); - /* check type */ if (! strncmp (argv[idx_packet]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; @@ -2395,11 +2376,11 @@ DEFUN (debug_ospf6_message, else if (! strncmp (argv[idx_packet]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; - if (argc == 1) + if (argc == 4) level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; - else if (! strncmp (argv[4]->arg, "s", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) level = OSPF6_DEBUG_MESSAGE_SEND; - else if (! strncmp (argv[4]->arg, "r", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) level = OSPF6_DEBUG_MESSAGE_RECV; if (type == OSPF6_MESSAGE_TYPE_ALL) @@ -2413,31 +2394,9 @@ DEFUN (debug_ospf6_message, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf6 message " - * "(unknown|hello|dbdesc|lsreq|lsupdate|lsack|all) (send|recv)", - * NO_STR - * DEBUG_STR - * OSPF6_STR - * "Debug OSPFv3 message\n" - * "Debug Unknown message\n" - * "Debug Hello message\n" - * "Debug Database Description message\n" - * "Debug Link State Request message\n" - * "Debug Link State Update message\n" - * "Debug Link State Acknowledgement message\n" - * "Debug All message\n" - * "Debug only sending message\n" - * "Debug only receiving message\n" - * - * - */ DEFUN (no_debug_ospf6_message, no_debug_ospf6_message_cmd, - "no debug ospf6 message ", + "no debug ospf6 message []", NO_STR DEBUG_STR OSPF6_STR @@ -2449,16 +2408,15 @@ DEFUN (no_debug_ospf6_message, "Debug Link State Update message\n" "Debug Link State Acknowledgement message\n" "Debug All message\n" - ) + "Debug only sending message\n" + "Debug only receiving message\n") { - /* CHECK ME argc referenced below */ int idx_packet = 4; + int idx_send_recv = 5; unsigned char level = 0; int type = 0; int i; - assert (argc > 0); - /* check type */ if (! strncmp (argv[idx_packet]->arg, "u", 1)) type = OSPF6_MESSAGE_TYPE_UNKNOWN; @@ -2475,11 +2433,11 @@ DEFUN (no_debug_ospf6_message, else if (! strncmp (argv[idx_packet]->arg, "a", 1)) type = OSPF6_MESSAGE_TYPE_ALL; - if (argc == 1) + if (argc == 5) level = OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_RECV; - else if (! strncmp (argv[5]->arg, "s", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) level = OSPF6_DEBUG_MESSAGE_SEND; - else if (! strncmp (argv[5]->arg, "r", 1)) + else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) level = OSPF6_DEBUG_MESSAGE_RECV; if (type == OSPF6_MESSAGE_TYPE_ALL) diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 573fced393..1c55175d20 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -827,28 +827,17 @@ ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) ospf6_bfd_show_info(vty, on->bfd_info, 0); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 neighbor (detail|drchoice)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * "Neighbor list\n" - * "Display details\n" - * "Display DR choices\n" - * - * - */ DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, - "show ipv6 ospf6 neighbor", + "show ipv6 ospf6 neighbor [detail|drchoice]", SHOW_STR IP6_STR OSPF6_STR "Neighbor list\n" - ) + "Display details\n" + "Display DR choices\n") { - /* CHECK ME argc referenced below */ + int idx_type = 4; struct ospf6_neighbor *on; struct ospf6_interface *oi; struct ospf6_area *oa; @@ -858,11 +847,11 @@ DEFUN (show_ipv6_ospf6_neighbor, OSPF6_CMD_CHECK_RUNNING (); showfunc = ospf6_neighbor_show; - if (argc) + if (argc == 5) { - if (! strncmp (argv[4]->arg, "de", 2)) + if (! strncmp (argv[idx_type]->arg, "de", 2)) showfunc = ospf6_neighbor_show_detail; - else if (! strncmp (argv[4]->arg, "dr", 2)) + else if (! strncmp (argv[idx_type]->arg, "dr", 2)) showfunc = ospf6_neighbor_show_drchoice; } @@ -927,32 +916,23 @@ ospf6_neighbor_init (void) install_element (ENABLE_NODE, &show_ipv6_ospf6_neighbor_cmd); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf6 neighbor (state|event)", - * DEBUG_STR - * OSPF6_STR - * "Debug OSPFv3 Neighbor\n" - * "Debug OSPFv3 Neighbor State Change\n" - * "Debug OSPFv3 Neighbor Event\n" - * - * - */ DEFUN (debug_ospf6_neighbor, debug_ospf6_neighbor_cmd, - "debug ospf6 neighbor", + "debug ospf6 neighbor [state|event]", DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n" - ) + "Debug OSPFv3 Neighbor State Change\n" + "Debug OSPFv3 Neighbor Event\n") { - /* CHECK ME argc referenced below */ + int idx_type = 3; unsigned char level = 0; - if (argc) + + if (argc == 4) { - if (! strncmp (argv[3]->arg, "s", 1)) + if (! strncmp (argv[idx_type]->arg, "s", 1)) level = OSPF6_DEBUG_NEIGHBOR_STATE; - if (! strncmp (argv[3]->arg, "e", 1)) + else if (! strncmp (argv[idx_type]->arg, "e", 1)) level = OSPF6_DEBUG_NEIGHBOR_EVENT; } else @@ -963,34 +943,24 @@ DEFUN (debug_ospf6_neighbor, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf6 neighbor (state|event)", - * NO_STR - * DEBUG_STR - * OSPF6_STR - * "Debug OSPFv3 Neighbor\n" - * "Debug OSPFv3 Neighbor State Change\n" - * "Debug OSPFv3 Neighbor Event\n" - * - * - */ DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, - "no debug ospf6 neighbor", + "no debug ospf6 neighbor [state|event]", NO_STR DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n" - ) + "Debug OSPFv3 Neighbor State Change\n" + "Debug OSPFv3 Neighbor Event\n") { - /* CHECK ME argc referenced below */ + int idx_type = 4; unsigned char level = 0; - if (argc) + + if (argc == 5) { - if (! strncmp (argv[4]->arg, "s", 1)) + if (! strncmp (argv[idx_type]->arg, "s", 1)) level = OSPF6_DEBUG_NEIGHBOR_STATE; - if (! strncmp (argv[4]->arg, "e", 1)) + if (! strncmp (argv[idx_type]->arg, "e", 1)) level = OSPF6_DEBUG_NEIGHBOR_EVENT; } else diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index bc4c951f13..58bb2fc80b 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1298,7 +1298,7 @@ ospf6_route_show_table (struct vty *vty, int detail, } int -ospf6_route_table_show (struct vty *vty, int argc, struct cmd_token **argv, +ospf6_route_table_show (struct vty *vty, int argc_start, int argc, struct cmd_token **argv, struct ospf6_route_table *table) { int summary = 0; @@ -1312,7 +1312,7 @@ ospf6_route_table_show (struct vty *vty, int argc, struct cmd_token **argv, memset (&prefix, 0, sizeof (struct prefix)); - for (i = 0; i < argc; i++) + for (i = argc_start; i < argc; i++) { if (! strcmp (argv[i]->arg, "summary")) { diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 8c5ca4eb27..ad429d86cd 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -328,7 +328,7 @@ extern void ospf6_route_dump (struct ospf6_route_table *table); extern void ospf6_route_show (struct vty *vty, struct ospf6_route *route); extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); -extern int ospf6_route_table_show (struct vty *, int, struct cmd_token **, +extern int ospf6_route_table_show (struct vty *, int, int, struct cmd_token **, struct ospf6_route_table *); extern int ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv, diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 6590783539..67958be06c 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -885,18 +885,11 @@ DEFUN (ospf6_timers_throttle_spf, "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 5; unsigned int delay, hold, max; - if (argc != 3) - { - vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); - return CMD_WARNING; - } - VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000); VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000); VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000); @@ -904,25 +897,16 @@ DEFUN (ospf6_timers_throttle_spf, return ospf6_timers_spf_set (vty, delay, hold, max); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers throttle spf <0-600000> <0-600000> <0-600000>", - * NO_STR - * "Adjust routing timers\n" - * "Throttling adaptive timer\n" - * "OSPF6 SPF timers\n" - * "Delay (msec) from first change received till SPF calculation\n" - * "Initial hold time (msec) between consecutive SPF calculations\n" - * "Maximum hold time (msec)\n" - * - */ DEFUN (no_ospf6_timers_throttle_spf, no_ospf6_timers_throttle_spf_cmd, - "no timers throttle spf", + "no timers throttle spf [(0-600000) (0-600000) (0-600000)]", NO_STR "Adjust routing timers\n" "Throttling adaptive timer\n" - "OSPF6 SPF timers\n") + "OSPF6 SPF timers\n" + "Delay (msec) from first change received till SPF calculation\n" + "Initial hold time (msec) between consecutive SPF calculations\n" + "Maximum hold time (msec)\n") { return ospf6_timers_spf_set (vty, OSPF_SPF_DELAY_DEFAULT, diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 49e136c998..58301b1c0f 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -405,7 +405,6 @@ DEFUN (ospf6_timers_lsa, "Minimum delay in receiving new version of a LSA\n" "Delay in milliseconds\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; unsigned int minarrival; struct ospf6 *ospf = vty->index; @@ -413,47 +412,30 @@ DEFUN (ospf6_timers_lsa, if (!ospf) return CMD_SUCCESS; - if (argc != 1) - { - vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); - return CMD_WARNING; - } - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg); - ospf->lsa_minarrival = minarrival; return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers lsa min-arrival <0-600000>", - * NO_STR - * "Adjust routing timers\n" - * "OSPF6 LSA timers\n" - * "Minimum delay in receiving new version of a LSA\n" - * "Delay in milliseconds\n" - * - */ DEFUN (no_ospf6_timers_lsa, no_ospf6_timers_lsa_cmd, - "no timers lsa min-arrival", + "no timers lsa min-arrival [(0-600000)]", NO_STR "Adjust routing timers\n" "OSPF6 LSA timers\n" "Minimum delay in receiving new version of a LSA\n") { - /* CHECK ME argc referenced below */ + int idx_number = 4; unsigned int minarrival; struct ospf6 *ospf = vty->index; if (!ospf) return CMD_SUCCESS; - if (argc) + if (argc == 5) { - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[4]->arg); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg); if (ospf->lsa_minarrival != minarrival || minarrival == OSPF_MIN_LS_ARRIVAL) @@ -784,75 +766,42 @@ DEFUN (show_ipv6_ospf6, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * ROUTE_STR - * "Display Intra-Area routes\n" - * "Display Inter-Area routes\n" - * "Display Type-1 External routes\n" - * "Display Type-2 External routes\n" - * - * - * "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * ROUTE_STR - * "Specify IPv6 address\n" - * "Specify IPv6 prefix\n" - * "Detailed information\n" - * "Summary of route table\n" - * - * - */ DEFUN (show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, - "show ipv6 ospf6 route", + "show ipv6 ospf6 route [intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary]", SHOW_STR IP6_STR OSPF6_STR ROUTE_STR - ) + "Display Intra-Area routes\n" + "Display Inter-Area routes\n" + "Display Type-1 External routes\n" + "Display Type-2 External routes\n" + "Specify IPv6 address\n" + "Specify IPv6 prefix\n" + "Detailed information\n" + "Summary of route table\n") { - /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, argc, argv, ospf6->route_table); + ospf6_route_table_show (vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 route X:X::X:X/M longer", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * ROUTE_STR - * "Specify IPv6 prefix\n" - * "Display routes longer than the specified route\n" - * - * - */ DEFUN (show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd, - "show ipv6 ospf6 route X:X::X:X/M match", + "show ipv6 ospf6 route X:X::X:X/M ", SHOW_STR IP6_STR OSPF6_STR ROUTE_STR "Specify IPv6 prefix\n" "Display routes which match the specified route\n" - ) + "Display routes longer than the specified route\n") { - /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, argc, argv, ospf6->route_table); + ospf6_route_table_show (vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; } @@ -868,10 +817,9 @@ DEFUN (show_ipv6_ospf6_route_match_detail, "Detailed information\n" ) { - /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, argc, argv, ospf6->route_table); + ospf6_route_table_show (vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; } @@ -891,10 +839,9 @@ DEFUN (show_ipv6_ospf6_route_type_detail, "Detailed information\n" ) { - /* CHECK ME argc referenced below */ OSPF6_CMD_CHECK_RUNNING (); - ospf6_route_table_show (vty, argc, argv, ospf6->route_table); + ospf6_route_table_show (vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 44d1bbfaf8..ded8041cb7 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -707,18 +707,9 @@ ospf6_zebra_init (struct thread_master *master) /* Debug */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf6 zebra", - * DEBUG_STR - * OSPF6_STR - * "Debug connection between zebra\n" - * - * - */ DEFUN (debug_ospf6_zebra_sendrecv, debug_ospf6_zebra_sendrecv_cmd, - "debug ospf6 zebra ", + "debug ospf6 zebra []", DEBUG_STR OSPF6_STR "Debug connection between zebra\n" @@ -726,15 +717,14 @@ DEFUN (debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { - /* CHECK ME argc referenced below */ int idx_send_recv = 3; unsigned char level = 0; - if (argc) + if (argc == 4) { - if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) + if (strmatch(argv[idx_send_recv]->text, "send")) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) + else if (strmatch(argv[idx_send_recv]->text, "recv")) level = OSPF6_DEBUG_ZEBRA_RECV; } else @@ -744,21 +734,9 @@ DEFUN (debug_ospf6_zebra_sendrecv, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf6 zebra", - * NO_STR - * DEBUG_STR - * OSPF6_STR - * "Debug connection between zebra\n" - * - * - */ DEFUN (no_debug_ospf6_zebra_sendrecv, no_debug_ospf6_zebra_sendrecv_cmd, - "no debug ospf6 zebra ", + "no debug ospf6 zebra []", NO_STR DEBUG_STR OSPF6_STR @@ -767,15 +745,14 @@ DEFUN (no_debug_ospf6_zebra_sendrecv, "Debug Receiving zebra\n" ) { - /* CHECK ME argc referenced below */ int idx_send_recv = 4; unsigned char level = 0; - if (argc) + if (argc == 5) { - if (! strncmp (argv[idx_send_recv]->arg, "s", 1)) + if (strmatch(argv[idx_send_recv]->text, "send")) level = OSPF6_DEBUG_ZEBRA_SEND; - else if (! strncmp (argv[idx_send_recv]->arg, "r", 1)) + else if (strmatch(argv[idx_send_recv]->text, "recv")) level = OSPF6_DEBUG_ZEBRA_RECV; } else diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 08afb75d2c..de5c918280 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -1028,11 +1028,11 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch(argv[arg_base]->text, "status")) DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch(argv[arg_base]->text, "events")) DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch(argv[arg_base]->text, "timers")) DEBUG_ON (nsm, NSM_TIMERS); } @@ -1044,61 +1044,41 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token TERM_DEBUG_ON (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch(argv[arg_base]->text, "status")) TERM_DEBUG_ON (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch(argv[arg_base]->text, "events")) TERM_DEBUG_ON (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch(argv[arg_base]->text, "timers")) TERM_DEBUG_ON (nsm, NSM_TIMERS); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf nsm (status|events|timers)", - * DEBUG_STR - * OSPF_STR - * "OSPF Neighbor State Machine\n" - * "NSM Status Information\n" - * "NSM Event Information\n" - * "NSM Timer Information\n" - * - */ DEFUN (debug_ospf_nsm, debug_ospf_nsm_cmd, - "debug ospf nsm", + "debug ospf nsm [status|events|timers]", DEBUG_STR OSPF_STR - "OSPF Neighbor State Machine\n") + "OSPF Neighbor State Machine\n" + "NSM Status Information\n" + "NSM Event Information\n" + "NSM Timer Information\n") { - /* CHECK ME argc referenced below */ - return debug_ospf_nsm_common (vty, 0, argc, argv); + return debug_ospf_nsm_common (vty, 3, argc, argv); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf <1-65535> nsm (status|events|timers)", - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Neighbor State Machine\n" - * "NSM Status Information\n" - * "NSM Event Information\n" - * "NSM Timer Information\n" - * - */ DEFUN (debug_ospf_instance_nsm, debug_ospf_instance_nsm_cmd, - "debug ospf (1-65535) nsm", + "debug ospf (1-65535) nsm [status|events|timers]", DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Neighbor State Machine\n") + "OSPF Neighbor State Machine\n" + "NSM Status Information\n" + "NSM Event Information\n" + "NSM Timer Information\n") { - /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1106,7 +1086,7 @@ DEFUN (debug_ospf_instance_nsm, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return debug_ospf_nsm_common (vty, 1, argc, argv); + return debug_ospf_nsm_common (vty, 4, argc, argv); } @@ -1119,11 +1099,11 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch(argv[arg_base]->text, "status")) DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch(argv[arg_base]->text, "events")) DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch(argv[arg_base]->text, "timers")) DEBUG_OFF (nsm, NSM_TIMERS); } @@ -1135,65 +1115,44 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_to TERM_DEBUG_OFF (nsm, NSM); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0) + if (strmatch(argv[arg_base]->text, "status")) TERM_DEBUG_OFF (nsm, NSM_STATUS); - else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0) + else if (strmatch(argv[arg_base]->text, "events")) TERM_DEBUG_OFF (nsm, NSM_EVENTS); - else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0) + else if (strmatch(argv[arg_base]->text, "timers")) TERM_DEBUG_OFF (nsm, NSM_TIMERS); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf nsm (status|events|timers)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "OSPF Interface State Machine\n" - * "NSM Status Information\n" - * "NSM Event Information\n" - * "NSM Timer Information\n" - * - */ DEFUN (no_debug_ospf_nsm, no_debug_ospf_nsm_cmd, - "no debug ospf nsm", + "no debug ospf nsm [status|events|timers]", NO_STR DEBUG_STR OSPF_STR - "OSPF Neighbor State Machine") + "OSPF Neighbor State Machine" + "NSM Status Information\n" + "NSM Event Information\n" + "NSM Timer Information\n") { - /* CHECK ME argc referenced below */ - return no_debug_ospf_nsm_common(vty, 0, argc, argv); + return no_debug_ospf_nsm_common(vty, 4, argc, argv); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf <1-65535> nsm (status|events|timers)", - * NO_STR - * "Debugging functions\n" - * "OSPF information\n" - * "Instance ID\n" - * "OSPF Interface State Machine\n" - * "NSM Status Information\n" - * "NSM Event Information\n" - * "NSM Timer Information\n" - * - */ DEFUN (no_debug_ospf_instance_nsm, no_debug_ospf_instance_nsm_cmd, - "no debug ospf (1-65535) nsm", + "no debug ospf (1-65535) nsm [status|events|timers]", NO_STR DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Neighbor State Machine") + "OSPF Neighbor State Machine" + "NSM Status Information\n" + "NSM Event Information\n" + "NSM Timer Information\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; @@ -1201,11 +1160,10 @@ DEFUN (no_debug_ospf_instance_nsm, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return no_debug_ospf_nsm_common(vty, 1, argc, argv); + return no_debug_ospf_nsm_common(vty, 5, argc, argv); } - static int debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { @@ -1215,13 +1173,13 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) + if (strmatch(argv[arg_base]->text, "generate")) DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) + else if (strmatch(argv[arg_base]->text, "flooding")) DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + else if (strmatch(argv[arg_base]->text, "install")) DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "refresh")) DEBUG_ON (lsa, LSA_REFRESH); } @@ -1233,65 +1191,45 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token TERM_DEBUG_ON (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) + if (strmatch(argv[arg_base]->text, "generate")) TERM_DEBUG_ON (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) + else if (strmatch(argv[arg_base]->text, "flooding")) TERM_DEBUG_ON (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + else if (strmatch(argv[arg_base]->text, "install")) TERM_DEBUG_ON (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "refresh")) TERM_DEBUG_ON (lsa, LSA_REFRESH); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf lsa (generate|flooding|install|refresh)", - * DEBUG_STR - * OSPF_STR - * "OSPF Link State Advertisement\n" - * "LSA Generation\n" - * "LSA Flooding\n" - * "LSA Install/Delete\n" - * "LSA Refresh\n" - * - */ DEFUN (debug_ospf_lsa, debug_ospf_lsa_cmd, - "debug ospf lsa", + "debug ospf lsa [generate|flooding|install|refresh]", DEBUG_STR OSPF_STR - "OSPF Link State Advertisement\n") + "OSPF Link State Advertisement\n" + "LSA Generation\n" + "LSA Flooding\n" + "LSA Install/Delete\n" + "LSA Refresh\n") { - /* CHECK ME argc referenced below */ - return debug_ospf_lsa_common(vty, 0, argc, argv); + return debug_ospf_lsa_common(vty, 3, argc, argv); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf <1-65535> lsa (generate|flooding|install|refresh)", - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Link State Advertisement\n" - * "LSA Generation\n" - * "LSA Flooding\n" - * "LSA Install/Delete\n" - * "LSA Refresh\n" - * - */ DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, - "debug ospf (1-65535) lsa", + "debug ospf (1-65535) lsa [generate|flooding|install|refresh]", DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Link State Advertisement\n") + "OSPF Link State Advertisement\n" + "LSA Generation\n" + "LSA Flooding\n" + "LSA Install/Delete\n" + "LSA Refresh\n") { - /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1299,7 +1237,7 @@ DEFUN (debug_ospf_instance_lsa, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return debug_ospf_lsa_common(vty, 1, argc, argv); + return debug_ospf_lsa_common(vty, 4, argc, argv); } @@ -1312,13 +1250,13 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) + if (strmatch(argv[arg_base]->text, "generate")) DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) + else if (strmatch(argv[arg_base]->text, "flooding")) DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + else if (strmatch(argv[arg_base]->text, "install")) DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "refresh")) DEBUG_OFF (lsa, LSA_REFRESH); } @@ -1330,69 +1268,47 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_to TERM_DEBUG_OFF (lsa, LSA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "g", 1) == 0) + if (strmatch(argv[arg_base]->text, "generate")) TERM_DEBUG_OFF (lsa, LSA_GENERATE); - else if (strncmp (argv[arg_base + 0]->arg, "f", 1) == 0) + else if (strmatch(argv[arg_base]->text, "flooding")) TERM_DEBUG_OFF (lsa, LSA_FLOODING); - else if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + else if (strmatch(argv[arg_base]->text, "install")) TERM_DEBUG_OFF (lsa, LSA_INSTALL); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "refresh")) TERM_DEBUG_OFF (lsa, LSA_REFRESH); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf lsa (generate|flooding|install|refresh)", - * NO_STR - * DEBUG_STR - * OSPF_STR - * "OSPF Link State Advertisement\n" - * "LSA Generation\n" - * "LSA Flooding\n" - * "LSA Install/Delete\n" - * "LSA Refres\n" - * - */ DEFUN (no_debug_ospf_lsa, no_debug_ospf_lsa_cmd, - "no debug ospf lsa", + "no debug ospf lsa [generate|flooding|install|refresh]", NO_STR DEBUG_STR OSPF_STR - "OSPF Link State Advertisement\n") + "OSPF Link State Advertisement\n" + "LSA Generation\n" + "LSA Flooding\n" + "LSA Install/Delete\n" + "LSA Refres\n") { - /* CHECK ME argc referenced below */ - return no_debug_ospf_lsa_common (vty, 0, argc, argv); + return no_debug_ospf_lsa_common (vty, 4, argc, argv); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf <1-65535> lsa (generate|flooding|install|refresh)", - * NO_STR - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Link State Advertisement\n" - * "LSA Generation\n" - * "LSA Flooding\n" - * "LSA Install/Delete\n" - * "LSA Refres\n" - * - */ DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, - "no debug ospf (1-65535) lsa", + "no debug ospf (1-65535) lsa [generate|flooding|install|refresh]", NO_STR DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Link State Advertisement\n") + "OSPF Link State Advertisement\n" + "LSA Generation\n" + "LSA Flooding\n" + "LSA Install/Delete\n" + "LSA Refres\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; @@ -1400,11 +1316,10 @@ DEFUN (no_debug_ospf_instance_lsa, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return no_debug_ospf_lsa_common (vty, 1, argc, argv); + return no_debug_ospf_lsa_common (vty, 5, argc, argv); } - static int debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { @@ -1414,9 +1329,9 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_tok DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + if (strmatch(argv[arg_base]->text, "interface")) DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "redistribute")) DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } @@ -1428,57 +1343,37 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_tok TERM_DEBUG_ON (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + if (strmatch(argv[arg_base]->text, "interface")) TERM_DEBUG_ON (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "redistribute")) TERM_DEBUG_ON (zebra, ZEBRA_REDISTRIBUTE); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf zebra (interface|redistribute)", - * DEBUG_STR - * OSPF_STR - * "OSPF Zebra information\n" - * "Zebra interface\n" - * "Zebra redistribute\n" - * - */ DEFUN (debug_ospf_zebra, debug_ospf_zebra_cmd, - "debug ospf zebra", + "debug ospf zebra [interface|redistribute]", DEBUG_STR OSPF_STR - "OSPF Zebra information\n") + "OSPF Zebra information\n" + "Zebra interface\n" + "Zebra redistribute\n") { - /* CHECK ME argc referenced below */ - return debug_ospf_zebra_common(vty, 0, argc, argv); + return debug_ospf_zebra_common(vty, 3, argc, argv); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "debug ospf <1-65535> zebra (interface|redistribute)", - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Zebra information\n" - * "Zebra interface\n" - * "Zebra redistribute\n" - * - */ DEFUN (debug_ospf_instance_zebra, debug_ospf_instance_zebra_cmd, - "debug ospf (1-65535) zebra", + "debug ospf (1-65535) zebra [interface|redistribute]", DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Zebra information\n") + "OSPF Zebra information\n" + "Zebra interface\n" + "Zebra redistribute\n") { - /* CHECK ME argc referenced below */ int idx_number = 2; u_short instance = 0; @@ -1486,7 +1381,7 @@ DEFUN (debug_ospf_instance_zebra, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return debug_ospf_zebra_common(vty, 1, argc, argv); + return debug_ospf_zebra_common(vty, 4, argc, argv); } @@ -1500,9 +1395,9 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + if (strmatch(argv[arg_base]->text, "interface")) DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "redistribute")) DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } @@ -1514,61 +1409,39 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF (zebra, ZEBRA); else if (argc == arg_base + 1) { - if (strncmp (argv[arg_base + 0]->arg, "i", 1) == 0) + if (strmatch(argv[arg_base]->text, "interface")) TERM_DEBUG_OFF (zebra, ZEBRA_INTERFACE); - else if (strncmp (argv[arg_base + 0]->arg, "r", 1) == 0) + else if (strmatch(argv[arg_base]->text, "redistribute")) TERM_DEBUG_OFF (zebra, ZEBRA_REDISTRIBUTE); } return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf zebra (interface|redistribute)", - * NO_STR - * DEBUG_STR - * OSPF_STR - * "OSPF Zebra information\n" - * "Zebra interface\n" - * "Zebra redistribute\n" - * - */ DEFUN (no_debug_ospf_zebra, no_debug_ospf_zebra_cmd, - "no debug ospf zebra", + "no debug ospf zebra [interface|redistribute]", NO_STR DEBUG_STR OSPF_STR - "OSPF Zebra information\n") + "OSPF Zebra information\n" + "Zebra interface\n" + "Zebra redistribute\n") { - /* CHECK ME argc referenced below */ - return no_debug_ospf_zebra_common(vty, 0, argc, argv); + return no_debug_ospf_zebra_common(vty, 4, argc, argv); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no debug ospf <1-65535> zebra (interface|redistribute)", - * NO_STR - * DEBUG_STR - * OSPF_STR - * "Instance ID\n" - * "OSPF Zebra information\n" - * "Zebra interface\n" - * "Zebra redistribute\n" - * - */ DEFUN (no_debug_ospf_instance_zebra, no_debug_ospf_instance_zebra_cmd, - "no debug ospf (1-65535) zebra", + "no debug ospf (1-65535) zebra [interface|redistribute]", NO_STR DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Zebra information\n") + "OSPF Zebra information\n" + "Zebra interface\n" + "Zebra redistribute\n") { - /* CHECK ME argc referenced below */ int idx_number = 3; u_short instance = 0; @@ -1576,7 +1449,7 @@ DEFUN (no_debug_ospf_instance_zebra, if (!ospf_lookup_instance (instance)) return CMD_SUCCESS; - return no_debug_ospf_zebra_common(vty, 1, argc, argv); + return no_debug_ospf_zebra_common(vty, 5, argc, argv); } diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index ecf883c69b..a1981be86d 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -792,7 +792,6 @@ DEFUN (ospf_opaque, "OSPF specific commands\n" "Enable the Opaque-LSA capability (rfc2370)\n") { - /* CHECK ME argc referenced below */ return capability_opaque (self, vty, argc, argv); } @@ -827,7 +826,6 @@ DEFUN (no_ospf_opaque, "OSPF specific commands\n" "Enable the Opaque-LSA capability (rfc2370)\n") { - /* CHECK ME argc referenced below */ return no_capability_opaque (self, vty, argc, argv); } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index ac9f9c7d3b..26034fd360 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2620,13 +2620,12 @@ DEFUN (show_ip_ospf_mpls_te_link, "Interface information\n" "Interface name\n") { - /* CHECK ME argc referenced below */ int idx_interface = 5; struct interface *ifp; struct listnode *node, *nnode; /* Show All Interfaces. */ - if (argc == 0) + if (argc == 5) { for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp)) show_mpls_te_link_sub (vty, ifp); From 4e626c014a108fb675131ebd9ba70fc9c7ffed80 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 02:48:58 +0000 Subject: [PATCH 179/280] ospf6d: clean up command string in CHECK ME comments Signed-off-by: Daniel Walton --- ospf6d/ospf6d.c | 57 +++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index c67b0878c3..5e545bc286 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -224,10 +224,7 @@ DEFUN (show_ipv6_ospf6_database, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -319,8 +316,7 @@ DEFUN (show_ipv6_ospf6_database_type, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database * A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -416,8 +412,7 @@ DEFUN (show_ipv6_ospf6_database_id, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * * A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database * * A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -515,10 +510,7 @@ DEFUN (show_ipv6_ospf6_database_router, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -670,10 +662,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) * A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) * A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -827,8 +816,7 @@ DEFUN (show_ipv6_ospf6_database_type_router, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * A.B.C.D A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database * A.B.C.D A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -913,8 +901,7 @@ DEFUN (show_ipv6_ospf6_database_id_router, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1001,10 +988,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D " - * "(dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D (dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1122,11 +1106,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) " - * "adv-router A.B.C.D linkstate-id A.B.C.D " - * "(dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D (dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1248,8 +1228,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database self-originated " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database self-originated (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1309,10 +1288,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) self-originated " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1409,10 +1385,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) self-originated " - * "linkstate-id A.B.C.D (detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1525,10 +1498,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, /* * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -1718,7 +1688,6 @@ DEFUN (show_ipv6_ospf6_border_routers, * "Display Network Entry\n" * "Specify Router ID as IPv4 address notation\n" * "Specify Link state ID as IPv4 address notation\n" - * * * "show ipv6 ospf6 linkstate router A.B.C.D", * SHOW_STR From 14b16482c4800302d9c4f0542e5e668d2afa446e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 05:09:42 +0000 Subject: [PATCH 180/280] ospf6d: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- ospf6d/ospf6_interface.c | 9 +- ospf6d/ospf6d.c | 674 ++++++++++----------------------------- 2 files changed, 168 insertions(+), 515 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index c08d4ee840..5002222f15 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1055,8 +1055,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, OSPF6_STR INTERFACE_STR IFNAME_STR - "Display connected prefixes to advertise\n" - ) + "Display connected prefixes to advertise\n") { /* CHECK ME argc referenced below */ int idx_ifname = 4; @@ -1077,9 +1076,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, return CMD_WARNING; } - argc--; - argv++; - ospf6_route_table_show (vty, argc, argv, oi->route_connected); + ospf6_route_table_show (vty, 6, argc, argv, oi->route_connected); return CMD_SUCCESS; } @@ -1132,7 +1129,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix, if (oi == NULL) continue; - ospf6_route_table_show (vty, argc, argv, oi->route_connected); + ospf6_route_table_show (vty, 5, argc, argv, oi->route_connected); } return CMD_SUCCESS; diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 5e545bc286..e825f6ad18 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -126,68 +126,61 @@ config_write_ospf6_debug (struct vty *vty) "%s AS Scoped Link State Database%s%s" static int -parse_show_level (int argc, struct cmd_token **argv) +parse_show_level (int idx_level, int argc, struct cmd_token **argv) { - int level = 0; - if (argc) + int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL; + + if (argc > idx_level) { - if (! strncmp (argv[0]->arg, "de", 2)) + if (strmatch (argv[idx_level]->text, "detail")) level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; - else if (! strncmp (argv[0]->arg, "du", 2)) + else if (strmatch (argv[idx_level]->text, "dump")) level = OSPF6_LSDB_SHOW_LEVEL_DUMP; - else if (! strncmp (argv[0]->arg, "in", 2)) + else if (strmatch (argv[idx_level]->text, "internal")) level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL; } - else - level = OSPF6_LSDB_SHOW_LEVEL_NORMAL; + return level; } static u_int16_t -parse_type_spec (int argc, struct cmd_token **argv) +parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv) { u_int16_t type = 0; - assert (argc); - if (! strcmp (argv[0]->arg, "router")) - type = htons (OSPF6_LSTYPE_ROUTER); - else if (! strcmp (argv[0]->arg, "network")) - type = htons (OSPF6_LSTYPE_NETWORK); - else if (! strcmp (argv[0]->arg, "as-external")) - type = htons (OSPF6_LSTYPE_AS_EXTERNAL); - else if (! strcmp (argv[0]->arg, "intra-prefix")) - type = htons (OSPF6_LSTYPE_INTRA_PREFIX); - else if (! strcmp (argv[0]->arg, "inter-router")) - type = htons (OSPF6_LSTYPE_INTER_ROUTER); - else if (! strcmp (argv[0]->arg, "inter-prefix")) - type = htons (OSPF6_LSTYPE_INTER_PREFIX); - else if (! strcmp (argv[0]->arg, "link")) - type = htons (OSPF6_LSTYPE_LINK); + + if (argc > idx_lsa) + { + if (strmatch (argv[0]->text, "router")) + type = htons (OSPF6_LSTYPE_ROUTER); + else if (strmatch (argv[0]->text, "network")) + type = htons (OSPF6_LSTYPE_NETWORK); + else if (strmatch (argv[0]->text, "as-external")) + type = htons (OSPF6_LSTYPE_AS_EXTERNAL); + else if (strmatch (argv[0]->text, "intra-prefix")) + type = htons (OSPF6_LSTYPE_INTRA_PREFIX); + else if (strmatch (argv[0]->text, "inter-router")) + type = htons (OSPF6_LSTYPE_INTER_ROUTER); + else if (strmatch (argv[0]->text, "inter-prefix")) + type = htons (OSPF6_LSTYPE_INTER_PREFIX); + else if (strmatch (argv[0]->text, "link")) + type = htons (OSPF6_LSTYPE_LINK); + } + return type; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, - "show ipv6 ospf6 database", + "show ipv6 ospf6 database [detail|dump|internal]", SHOW_STR IPV6_STR OSPF6_STR "Display Link state database\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ + int idx_level = 4; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -196,7 +189,7 @@ DEFUN (show_ipv6_ospf6_database, OSPF6_CMD_CHECK_RUNNING (); - level = parse_show_level (argc, argv); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) { @@ -221,32 +214,9 @@ DEFUN (show_ipv6_ospf6_database, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, - "show ipv6 ospf6 database ", + "show ipv6 ospf6 database []", SHOW_STR IPV6_STR OSPF6_STR @@ -260,9 +230,13 @@ DEFUN (show_ipv6_ospf6_database_type, "Display Type-7 LSAs\n" "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n" ) { - /* CHECK ME argc referenced below */ + int idx_lsa = 4; + int idx_level = 5; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -272,10 +246,8 @@ DEFUN (show_ipv6_ospf6_database_type, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + level = parse_show_level (idx_level, argc, argv); switch (OSPF6_LSA_SCOPE (type)) { @@ -328,8 +300,7 @@ DEFUN (show_ipv6_ospf6_database_type, * "Display LSA's internal information\n" * * - * "show ipv6 ospf6 database linkstate-id A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database linkstate-id A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -364,6 +335,7 @@ DEFUN (show_ipv6_ospf6_database_id, { /* CHECK ME argc referenced below */ int idx_ipv4 = 5; + int idx_level = 6; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -372,17 +344,8 @@ DEFUN (show_ipv6_ospf6_database_id, u_int32_t id = 0; OSPF6_CMD_CHECK_RUNNING (); - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) - { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &id); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) { @@ -434,8 +397,7 @@ DEFUN (show_ipv6_ospf6_database_id, * "Specify Advertising Router as IPv4 address notation\n" * * - * "show ipv6 ospf6 database adv-router A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database adv-router A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -462,6 +424,7 @@ DEFUN (show_ipv6_ospf6_database_router, { /* CHECK ME argc referenced below */ int idx_ipv4 = 6; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -470,17 +433,8 @@ DEFUN (show_ipv6_ospf6_database_router, u_int32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING (); - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) { @@ -531,10 +485,7 @@ DEFUN (show_ipv6_ospf6_database_router, * "Display LSA's internal information\n" * * - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -554,9 +505,7 @@ DEFUN (show_ipv6_ospf6_database_router, * "Display LSA's internal information\n" * * - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -596,6 +545,8 @@ DEFUN (show_ipv6_ospf6_database_type_id, { /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_ipv4 = 5; + int idx_level = 6; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -606,20 +557,9 @@ DEFUN (show_ipv6_ospf6_database_type_id, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) - { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &id); + level = parse_show_level (idx_level, argc, argv); switch (OSPF6_LSA_SCOPE (type)) { @@ -683,10 +623,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, * "Display LSA's internal information\n" * * - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D " - * "(detail|dump|internal)", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D (detail|dump|internal)", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -707,9 +644,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, * "Display LSA's internal information\n" * * - * "show ipv6 ospf6 database " - * "(router|network|inter-prefix|inter-router|as-external|" - * "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D", + * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D", * SHOW_STR * IPV6_STR * OSPF6_STR @@ -750,6 +685,8 @@ DEFUN (show_ipv6_ospf6_database_type_router, { /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_ipv4 = 6; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -760,20 +697,9 @@ DEFUN (show_ipv6_ospf6_database_type_router, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router); + level = parse_show_level (idx_level, argc, argv); switch (OSPF6_LSA_SCOPE (type)) { @@ -812,27 +738,9 @@ DEFUN (show_ipv6_ospf6_database_type_router, } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * A.B.C.D A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Any Link state Type\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_id_router, show_ipv6_ospf6_database_id_router_cmd, - "show ipv6 ospf6 database * A.B.C.D A.B.C.D", + "show ipv6 ospf6 database * A.B.C.D A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -840,10 +748,14 @@ DEFUN (show_ipv6_ospf6_database_id_router, "Any Link state Type\n" "Specify Link state ID as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n" ) { - /* CHECK ME argc referenced below */ - int idx_ipv4 = 5; + int idx_ls_id = 5; + int idx_adv_rtr = 6; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -853,27 +765,9 @@ DEFUN (show_ipv6_ospf6_database_id_router, u_int32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING (); - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) - { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) { @@ -899,26 +793,9 @@ DEFUN (show_ipv6_ospf6_database_id_router, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, - "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D", + "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -927,10 +804,13 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, "Specify Advertising Router as IPv4 address notation\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ - int idx_ipv4 = 5; + int idx_adv_rtr = 5; + int idx_ls_id = 7; + int idx_level = 8; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -940,27 +820,9 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, u_int32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING (); - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) - { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[idx_ipv4]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) { @@ -985,33 +847,9 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D (dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_id_router, show_ipv6_ospf6_database_type_id_router_cmd, - "show ipv6 ospf6 database A.B.C.D A.B.C.D", + "show ipv6 ospf6 database A.B.C.D A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -1027,10 +865,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n" - ) + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_ls_id = 5; + int idx_adv_rtr = 6; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1040,32 +881,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, u_int32_t id = 0; u_int32_t adv_router = 0; + // dwalton is this needed? OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) - { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router); + level = parse_show_level (idx_level, argc, argv); switch (OSPF6_LSA_SCOPE (type)) { @@ -1104,34 +926,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D (dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, - "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D", + "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -1149,10 +946,13 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, "Specify Advertising Router as IPv4 address notation\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ) + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_adv_rtr = 6; + int idx_ls_id = 8; + int idx_level = 9; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1164,30 +964,10 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1) - { - vty_out (vty, "Advertising Router is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) - { - vty_out (vty, "Link state ID is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + level = parse_show_level (idx_level, argc, argv); switch (OSPF6_LSA_SCOPE (type)) { @@ -1225,30 +1005,18 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database self-originated (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Self-originated LSAs\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_self_originated, show_ipv6_ospf6_database_self_originated_cmd, - "show ipv6 ospf6 database self-originated", + "show ipv6 ospf6 database self-originated []", SHOW_STR IPV6_STR OSPF6_STR "Display Self-originated LSAs\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ + int idx_level = 5; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1257,9 +1025,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, u_int32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING (); - - level = parse_show_level (argc, argv); - + level = parse_show_level (idx_level, argc, argv); adv_router = o->router_id; for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) @@ -1286,32 +1052,9 @@ DEFUN (show_ipv6_ospf6_database_self_originated, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Display Self-originated LSAs\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_self_originated, show_ipv6_ospf6_database_type_self_originated_cmd, - "show ipv6 ospf6 database self-originated", + "show ipv6 ospf6 database self-originated []", SHOW_STR IPV6_STR OSPF6_STR @@ -1326,9 +1069,12 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Display Self-originated LSAs\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ + int idx_lsa = 4; + int idx_level = 6; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1339,10 +1085,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - level = parse_show_level (argc, argv); + type = parse_type_spec (idx_lsa, argc, argv); + level = parse_show_level (idx_level, argc, argv); adv_router = o->router_id; @@ -1382,35 +1126,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Display Self-originated LSAs\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, - "show ipv6 ospf6 database self-originated linkstate-id A.B.C.D", + "show ipv6 ospf6 database self-originated linkstate-id A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -1427,10 +1145,13 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, "Display Self-originated LSAs\n" "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_ls_id = 7; + int idx_level = 8; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1442,21 +1163,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) - { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); - + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + level = parse_show_level (idx_level, argc, argv); adv_router = o->router_id; switch (OSPF6_LSA_SCOPE (type)) @@ -1495,35 +1204,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Display Self-originated LSAs\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, show_ipv6_ospf6_database_type_id_self_originated_cmd, - "show ipv6 ospf6 database A.B.C.D self-originated", + "show ipv6 ospf6 database A.B.C.D self-originated []", SHOW_STR IPV6_STR OSPF6_STR @@ -1539,10 +1222,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, "Display Intra-Area-Prefix LSAs\n" "Specify Link state ID as IPv4 address notation\n" "Display Self-originated LSAs\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ int idx_lsa = 4; + int idx_ls_id = 5; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -1554,21 +1240,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, OSPF6_CMD_CHECK_RUNNING (); - type = parse_type_spec (argc, argv); - argc--; - argv++; - - if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1) - { - vty_out (vty, "Link State ID is not parsable: %s%s", - argv[idx_lsa]->arg, VNL); - return CMD_SUCCESS; - } - - argc--; - argv++; - level = parse_show_level (argc, argv); - + type = parse_type_spec (idx_lsa, argc, argv); + inet_pton (AF_INET, argv[idx_ls_id]->arg, &id); + level = parse_show_level (idx_level, argc, argv); adv_router = o->router_id; switch (OSPF6_LSA_SCOPE (type)) @@ -1607,73 +1281,55 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 border-routers (A.B.C.D|detail)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * "Display routing table for ABR and ASBR\n" - * "Specify Router-ID\n" - * "Display Detail\n" - * - * - */ DEFUN (show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd, - "show ipv6 ospf6 border-routers", + "show ipv6 ospf6 border-routers []", SHOW_STR IP6_STR OSPF6_STR "Display routing table for ABR and ASBR\n" ) { - /* CHECK ME argc referenced below */ + int idx_ipv4 = 4; u_int32_t adv_router; - void (*showfunc) (struct vty *, struct ospf6_route *); struct ospf6_route *ro; struct prefix prefix; OSPF6_CMD_CHECK_RUNNING (); - if (argc && ! strcmp ("detail", argv[4]->arg)) + if (argc == 5) { - showfunc = ospf6_route_show_detail; - argc--; - argv++; + if (strmatch (argv[idx_ipv4]->text, "detail")) + { + for (ro = ospf6_route_head (ospf6->brouter_table); ro; + ro = ospf6_route_next (ro)) + ospf6_route_show_detail (vty, ro); + } + else + { + inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router); + + ospf6_linkstate_prefix (adv_router, 0, &prefix); + ro = ospf6_route_lookup (&prefix, ospf6->brouter_table); + if (!ro) + { + vty_out (vty, "No Route found for Router ID: %s%s", argv[4]->arg, VNL); + return CMD_SUCCESS; + } + + ospf6_route_show_detail (vty, ro); + return CMD_SUCCESS; + } } else - showfunc = ospf6_brouter_show; - - if (argc) { - if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) - { - vty_out (vty, "Router ID is not parsable: %s%s", argv[4]->arg, VNL); - return CMD_SUCCESS; - } + ospf6_brouter_show_header (vty); - ospf6_linkstate_prefix (adv_router, 0, &prefix); - ro = ospf6_route_lookup (&prefix, ospf6->brouter_table); - if (!ro) - { - vty_out (vty, "No Route found for Router ID: %s%s", argv[4]->arg, VNL); - return CMD_SUCCESS; - } - - ospf6_route_show_detail (vty, ro); - return CMD_SUCCESS; + for (ro = ospf6_route_head (ospf6->brouter_table); ro; + ro = ospf6_route_next (ro)) + ospf6_brouter_show (vty, ro); } - if (showfunc == ospf6_brouter_show) - ospf6_brouter_show_header (vty); - - for (ro = ospf6_route_head (ospf6->brouter_table); ro; - ro = ospf6_route_next (ro)) - (*showfunc) (vty, ro); - return CMD_SUCCESS; } From 093d7a3a3413250e8328abebd372bb695f874ca8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 13:38:08 +0000 Subject: [PATCH 181/280] ospf6d: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- ospf6d/ospf6_area.c | 41 ++---- ospf6d/ospf6_interface.c | 81 +++-------- ospf6d/ospf6_route.c | 5 +- ospf6d/ospf6d.c | 285 +++++---------------------------------- 4 files changed, 64 insertions(+), 348 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index bd9c0bcb2d..766562a828 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -433,44 +433,21 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) oa = ospf6_area_get (area_id, ospf6); \ } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>", - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - * "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)", - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Configured address range\n" - * "Specify IPv6 prefix\n" - * - * - * "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>", - * "OSPF area parameters\n" - * OSPF6_AREA_ID_STR - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - */ DEFUN (area_range, area_range_cmd, - "area A.B.C.D range X:X::X:X/M", + "area ]", "OSPF area parameters\n" OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n" - ) + "Advertise\n" + "Do not advertise\n" + "User specified metric for this range\n" + "Advertised metric for this range\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 1; int idx_ipv6_prefixlen = 3; + int idx_type = 4; int ret; struct ospf6_area *oa; struct prefix prefix; @@ -498,13 +475,13 @@ DEFUN (area_range, (u_int32_t) htonl(ospf6_new_range_ls_id (oa->range_table)); } - if (argc > 2) + if (argc > idx_type) { - if (strcmp (argv[4]->arg, "not-advertise") == 0) + if (strmatch (argv[idx_type]->text, "not-advertise")) { SET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } - else if (strcmp (argv[4]->arg, "advertise") == 0) + else if (strmatch (argv[idx_type]->text, "advertise")) { UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE); } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 5002222f15..27788745d0 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1019,46 +1019,22 @@ DEFUN (show_ipv6_ospf6_interface, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * INTERFACE_STR - * IFNAME_STR - * "Display connected prefixes to advertise\n" - * OSPF6_ROUTE_ADDRESS_STR - * OSPF6_ROUTE_PREFIX_STR - * "Display details of the prefixes\n" - * - * - * "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * INTERFACE_STR - * IFNAME_STR - * "Display connected prefixes to advertise\n" - * OSPF6_ROUTE_PREFIX_STR - * OSPF6_ROUTE_MATCH_STR - * "Display details of the prefixes\n" - * - * - */ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, show_ipv6_ospf6_interface_ifname_prefix_cmd, - "show ipv6 ospf6 interface IFNAME prefix", + "show ipv6 ospf6 interface IFNAME prefix [] []", SHOW_STR IP6_STR OSPF6_STR INTERFACE_STR IFNAME_STR - "Display connected prefixes to advertise\n") + "Display connected prefixes to advertise\n" + OSPF6_ROUTE_ADDRESS_STR + OSPF6_ROUTE_PREFIX_STR + OSPF6_ROUTE_MATCH_STR + "Display details of the prefixes\n") { - /* CHECK ME argc referenced below */ int idx_ifname = 4; + int idx_prefix = 6; struct interface *ifp; struct ospf6_interface *oi; @@ -1076,49 +1052,25 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, return CMD_WARNING; } - ospf6_route_table_show (vty, 6, argc, argv, oi->route_connected); + ospf6_route_table_show (vty, idx_prefix, argc, argv, oi->route_connected); return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * INTERFACE_STR - * "Display connected prefixes to advertise\n" - * OSPF6_ROUTE_PREFIX_STR - * OSPF6_ROUTE_MATCH_STR - * "Display details of the prefixes\n" - * - * - * "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * INTERFACE_STR - * "Display connected prefixes to advertise\n" - * OSPF6_ROUTE_ADDRESS_STR - * OSPF6_ROUTE_PREFIX_STR - * "Display details of the prefixes\n" - * - * - */ DEFUN (show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd, - "show ipv6 ospf6 interface prefix", + "show ipv6 ospf6 interface prefix [] []", SHOW_STR IP6_STR OSPF6_STR INTERFACE_STR "Display connected prefixes to advertise\n" - ) + OSPF6_ROUTE_ADDRESS_STR + OSPF6_ROUTE_PREFIX_STR + OSPF6_ROUTE_MATCH_STR + "Display details of the prefixes\n") { - /* CHECK ME argc referenced below */ + int idx_prefix = 5; struct listnode *i; struct ospf6_interface *oi; struct interface *ifp; @@ -1129,15 +1081,12 @@ DEFUN (show_ipv6_ospf6_interface_prefix, if (oi == NULL) continue; - ospf6_route_table_show (vty, 5, argc, argv, oi->route_connected); + ospf6_route_table_show (vty, idx_prefix, argc, argv, oi->route_connected); } return CMD_SUCCESS; } - - - /* interface variable set command */ DEFUN (ipv6_ospf6_ifmtu, ipv6_ospf6_ifmtu_cmd, diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 58bb2fc80b..3263f4a06c 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1473,7 +1473,8 @@ ospf6_linkstate_show_table (struct vty *vty, int detail, } int -ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv, +ospf6_linkstate_table_show (struct vty *vty, int idx_ipv4, int argc, + struct cmd_token **argv, struct ospf6_route_table *table) { int detail = 0; @@ -1486,7 +1487,7 @@ ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv, memset (&id, 0, sizeof (struct prefix)); memset (&prefix, 0, sizeof (struct prefix)); - for (i = 0; i < argc; i++) + for (i = idx_ipv4; i < argc; i++) { if (! strcmp (argv[i]->arg, "detail")) { diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index e825f6ad18..785c9361c0 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -285,56 +285,21 @@ DEFUN (show_ipv6_ospf6_database_type, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Any Link state Type\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database linkstate-id A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database linkstate-id A.B.C.D", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, - "show ipv6 ospf6 database * A.B.C.D", + "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR "Display Link state database\n" "Any Link state Type\n" + "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ - int idx_ipv4 = 5; + int idx_ipv4 = 4; int idx_level = 6; int level; struct listnode *i, *j; @@ -344,7 +309,10 @@ DEFUN (show_ipv6_ospf6_database_id, u_int32_t id = 0; OSPF6_CMD_CHECK_RUNNING (); - inet_pton (AF_INET, argv[idx_ipv4]->arg, &id); + + if (argv[idx_ipv4]->type == IPV4_TKN) + inet_pton (AF_INET, argv[idx_ipv4]->arg, &id); + level = parse_show_level (idx_level, argc, argv); for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) @@ -370,59 +338,21 @@ DEFUN (show_ipv6_ospf6_database_id, return CMD_SUCCESS; } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database * * A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Any Link state Type\n" - * "Any Link state ID\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database adv-router A.B.C.D", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * - * - * "show ipv6 ospf6 database adv-router A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, - "show ipv6 ospf6 database * * A.B.C.D", + "show ipv6 ospf6 database <*|adv-router> * A.B.C.D ", SHOW_STR IPV6_STR OSPF6_STR "Display Link state database\n" "Any Link state Type\n" + "Search by Advertising Router\n" "Any Link state ID\n" "Specify Advertising Router as IPv4 address notation\n" - ) + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { - /* CHECK ME argc referenced below */ int idx_ipv4 = 6; int idx_level = 7; int level; @@ -459,74 +389,9 @@ DEFUN (show_ipv6_ospf6_database_router, return CMD_SUCCESS; } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Specify Link state ID as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Search by Link state ID\n" - * "Specify Link state ID as IPv4 address notation\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, - "show ipv6 ospf6 database A.B.C.D", + "show ipv6 ospf6 database [linkstate-id] A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -540,13 +405,16 @@ DEFUN (show_ipv6_ospf6_database_type_id, "Display Type-7 LSAs\n" "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" + "Search by Link state ID\n" "Specify Link state ID as IPv4 address notation\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n" ) { - /* CHECK ME argc referenced below */ int idx_lsa = 4; - int idx_ipv4 = 5; - int idx_level = 6; + int idx_ipv4 = 6; + int idx_level = 7; int level; struct listnode *i, *j; struct ospf6 *o = ospf6; @@ -597,75 +465,9 @@ DEFUN (show_ipv6_ospf6_database_type_id, return CMD_SUCCESS; } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) * A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Any Link state ID\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D (detail|dump|internal)", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * "Display details of LSAs\n" - * "Dump LSAs\n" - * "Display LSA's internal information\n" - * - * - * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D", - * SHOW_STR - * IPV6_STR - * OSPF6_STR - * "Display Link state database\n" - * "Display Router LSAs\n" - * "Display Network LSAs\n" - * "Display Inter-Area-Prefix LSAs\n" - * "Display Inter-Area-Router LSAs\n" - * "Display As-External LSAs\n" - * "Display Group-Membership LSAs\n" - * "Display Type-7 LSAs\n" - * "Display Link LSAs\n" - * "Display Intra-Area-Prefix LSAs\n" - * "Search by Advertising Router\n" - * "Specify Advertising Router as IPv4 address notation\n" - * - * - */ DEFUN (show_ipv6_ospf6_database_type_router, show_ipv6_ospf6_database_type_router_cmd, - "show ipv6 ospf6 database * A.B.C.D", + "show ipv6 ospf6 database <*|adv-router> A.B.C.D []", SHOW_STR IPV6_STR OSPF6_STR @@ -680,10 +482,13 @@ DEFUN (show_ipv6_ospf6_database_type_router, "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" "Any Link state ID\n" + "Search by Advertising Router\n" "Specify Advertising Router as IPv4 address notation\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n" ) { - /* CHECK ME argc referenced below */ int idx_lsa = 4; int idx_ipv4 = 6; int idx_level = 7; @@ -1334,37 +1139,21 @@ DEFUN (show_ipv6_ospf6_border_routers, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * "Display linkstate routing table\n" - * "Display Network Entry\n" - * "Specify Router ID as IPv4 address notation\n" - * "Specify Link state ID as IPv4 address notation\n" - * - * "show ipv6 ospf6 linkstate router A.B.C.D", - * SHOW_STR - * IP6_STR - * OSPF6_STR - * "Display linkstate routing table\n" - * "Display Router Entry\n" - * "Specify Router ID as IPv4 address notation\n" - * - * - */ DEFUN (show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, - "show ipv6 ospf6 linkstate", + "show ipv6 ospf6 linkstate ", SHOW_STR IP6_STR OSPF6_STR "Display linkstate routing table\n" + "Display Router Entry\n" + "Specify Router ID as IPv4 address notation\n" + "Display Network Entry\n" + "Specify Router ID as IPv4 address notation\n" + "Specify Link state ID as IPv4 address notation\n" ) { - /* CHECK ME argc referenced below */ + int idx_ipv4 = 4; struct listnode *node; struct ospf6_area *oa; @@ -1374,7 +1163,7 @@ DEFUN (show_ipv6_ospf6_linkstate, { vty_out (vty, "%s SPF Result in Area %s%s%s", VNL, oa->name, VNL, VNL); - ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table); + ospf6_linkstate_table_show (vty, idx_ipv4, argc, argv, oa->spf_table); } vty_out (vty, "%s", VNL); @@ -1392,7 +1181,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, "Display linkstate routing table\n" ) { - /* CHECK ME argc referenced below */ + int idx_detail = 4; struct listnode *node; struct ospf6_area *oa; @@ -1402,7 +1191,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, { vty_out (vty, "%s SPF Result in Area %s%s%s", VNL, oa->name, VNL, VNL); - ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table); + ospf6_linkstate_table_show (vty, idx_detail, argc, argv, oa->spf_table); } vty_out (vty, "%s", VNL); From 8749a04cc2e29f760bca018e32edeb8419e80157 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 13:39:56 +0000 Subject: [PATCH 182/280] ospf6d: scrubbed some argc CHECK MEs Signed-off-by: Daniel Walton --- isisd/isisd.c | 1 - ospf6d/ospf6_route.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/isisd/isisd.c b/isisd/isisd.c index 8ee3ad4da5..ffe17b3643 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1918,7 +1918,6 @@ DEFUN (topology_generate_grid, "Optional param 3\n" "Topology\n") { - /* CHECK ME argc referenced below */ struct isis_area *area; area = vty->index; diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index ad429d86cd..d0126b30d6 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -330,7 +330,7 @@ extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) extern int ospf6_route_table_show (struct vty *, int, int, struct cmd_token **, struct ospf6_route_table *); -extern int ospf6_linkstate_table_show (struct vty *vty, int argc, +extern int ospf6_linkstate_table_show (struct vty *vty, int idx_ipv4, int argc, struct cmd_token **argv, struct ospf6_route_table *table); From 4fb25c53b8d75b26fa20bf90bf33986476fd0e78 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 14:27:04 +0000 Subject: [PATCH 183/280] bgpd: combine special cases for vrf "all" Signed-off-by: Daniel Walton --- bgpd/bgp_routemap.c | 25 ++-- bgpd/bgp_vty.c | 288 ++++++++++++++++++++------------------------ vtysh/vtysh.c | 5 - 3 files changed, 137 insertions(+), 181 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d57d588667..e08b43bc17 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3612,28 +3612,17 @@ DEFUN (no_set_ip_nexthop, } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "set metric (rtt|+rtt|-rtt)", - * SET_STR - * "Metric value for destination routing protocol\n" - * "Assign round trip time\n" - * "Add round trip time\n" - * "Subtract round trip time\n" - * - * "set metric <+/-metric>", - * SET_STR - * "Metric value for destination routing protocol\n" - * "Add or subtract metric\n" - * - */ DEFUN (set_metric, set_metric_cmd, - "set metric (0-4294967295)", + "set metric <(0-4294967295)|rtt|+rtt|-rtt|+metric|-metric>", SET_STR "Metric value for destination routing protocol\n" - "Metric value\n") + "Metric value\n" + "Assign round trip time\n" + "Add round trip time\n" + "Subtract round trip time\n" + "Add metric\n" + "Subtract metric\n") { int idx_number = 2; return bgp_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0ced86023d..0d6a071ec6 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6747,34 +6747,6 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, return CMD_SUCCESS; } -static int -bgp_show_summary_vty (struct vty *vty, const char *name, - afi_t afi, safi_t safi, u_char use_json) -{ - struct bgp *bgp; - - if (name) - { - bgp = bgp_lookup_by_name (name); - - if (! bgp) - { - vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - - bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); - return CMD_SUCCESS; - } - - bgp = bgp_get_default (); - - if (bgp) - bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); - - return CMD_SUCCESS; -} - static void bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, u_char use_json) @@ -6791,14 +6763,7 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, { if (use_json) { - if (!(json = json_object_new_object())) - { - zlog_err("Unable to allocate memory for JSON object"); - vty_out (vty, - "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", - VTY_NEWLINE); - return; - } + json = json_object_new_object(); if (! is_first) vty_out (vty, ",%s", VTY_NEWLINE); @@ -6823,6 +6788,45 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, } +static int +bgp_show_summary_vty (struct vty *vty, const char *name, + afi_t afi, safi_t safi, u_char use_json) +{ + struct bgp *bgp; + + if (name) + { + if (strmatch(name, "all")) + { + bgp_show_all_instances_summary_vty (vty, afi, safi, use_json); + return CMD_SUCCESS; + } + else + { + bgp = bgp_lookup_by_name (name); + + if (! bgp) + { + if (use_json) + vty_out (vty, "{}%s", VTY_NEWLINE); + else + vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); + return CMD_WARNING; + } + + bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); + return CMD_SUCCESS; + } + } + + bgp = bgp_get_default (); + + if (bgp) + bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); + + return CMD_SUCCESS; +} + /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, @@ -6857,22 +6861,6 @@ DEFUN (show_ip_bgp_summary, return bgp_show_summary_vty (vty, vrf, afi, safi, uj); } -DEFUN (show_ip_bgp_instance_all_summary, - show_ip_bgp_instance_all_summary_cmd, - "show ip bgp all summary [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_ALL_HELP_STR - "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - - bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); - return CMD_SUCCESS; -} - const char * afi_safi_print (afi_t afi, safi_t safi) { @@ -8595,59 +8583,6 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, return CMD_SUCCESS; } -static int -bgp_show_neighbor_vty (struct vty *vty, const char *name, - enum show_type type, const char *ip_str, u_char use_json) -{ - int ret; - struct bgp *bgp; - union sockunion su; - json_object *json = NULL; - - if (use_json) - json = json_object_new_object(); - - if (name) - { - bgp = bgp_lookup_by_name (name); - if (! bgp) - { - if (use_json) - { - json_object_boolean_true_add(json, "bgpNoSuchInstance"); - vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); - json_object_free(json); - } - else - vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); - - return CMD_WARNING; - } - } - else - { - bgp = bgp_get_default (); - } - - if (bgp) - { - if (ip_str) - { - ret = str2sockunion (ip_str, &su); - if (ret < 0) - bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); - else - bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); - } - else - { - bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); - } - } - - return CMD_SUCCESS; -} - static void bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) { @@ -8702,6 +8637,67 @@ bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) vty_out (vty, "}%s", VTY_NEWLINE); } +static int +bgp_show_neighbor_vty (struct vty *vty, const char *name, + enum show_type type, const char *ip_str, u_char use_json) +{ + int ret; + struct bgp *bgp; + union sockunion su; + json_object *json = NULL; + + if (use_json) + json = json_object_new_object(); + + if (name) + { + if (strmatch(name, "all")) + { + bgp_show_all_instances_neighbors_vty (vty, use_json); + return CMD_SUCCESS; + } + else + { + bgp = bgp_lookup_by_name (name); + if (! bgp) + { + if (use_json) + { + json_object_boolean_true_add(json, "bgpNoSuchInstance"); + vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); + json_object_free(json); + } + else + vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); + + return CMD_WARNING; + } + } + } + else + { + bgp = bgp_get_default (); + } + + if (bgp) + { + if (ip_str) + { + ret = str2sockunion (ip_str, &su); + if (ret < 0) + bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); + else + bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); + } + else + { + bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); + } + } + + return CMD_SUCCESS; +} + /* "show ip bgp neighbors" commands. */ DEFUN (show_ip_bgp_neighbors, show_ip_bgp_neighbors_cmd, @@ -8755,22 +8751,6 @@ DEFUN (show_ip_bgp_neighbors, return bgp_show_neighbor_vty (vty, vrf, sh_type, sh_arg, uj); } -DEFUN (show_ip_bgp_instance_all_neighbors, - show_ip_bgp_instance_all_neighbors_cmd, - "show [ip] bgp all neighbors [json]", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_ALL_HELP_STR - "Detailed information on TCP and BGP neighbor connections\n" - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - - bgp_show_all_instances_neighbors_vty (vty, uj); - return CMD_SUCCESS; -} - /* Show BGP's AS paths internal data. There are both `show ip bgp paths' and `show ip mbgp paths'. Those functions results are the same.*/ @@ -8847,22 +8827,6 @@ DEFUN (show_ip_bgp_attr_info, return CMD_SUCCESS; } -static int bgp_show_update_groups(struct vty *vty, const char *name, - int afi, int safi, - uint64_t subgrp_id) -{ - struct bgp *bgp; - - if (name) - bgp = bgp_lookup_by_name (name); - else - bgp = bgp_get_default (); - - if (bgp) - update_group_show(bgp, afi, safi, vty, subgrp_id); - return CMD_SUCCESS; -} - static void bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) { @@ -8879,6 +8843,35 @@ bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) } } +static int +bgp_show_update_groups(struct vty *vty, const char *name, + int afi, int safi, + uint64_t subgrp_id) +{ + struct bgp *bgp; + + if (name) + { + if (strmatch (name, "all")) + { + bgp_show_all_instances_updgrps_vty (vty, afi, safi); + return CMD_SUCCESS; + } + else + { + bgp = bgp_lookup_by_name (name); + } + } + else + { + bgp = bgp_get_default (); + } + + if (bgp) + update_group_show(bgp, afi, safi, vty, subgrp_id); + return CMD_SUCCESS; +} + DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] update-groups [SUBGROUP-ID]", @@ -8921,19 +8914,6 @@ DEFUN (show_ip_bgp_updgrps, return (bgp_show_update_groups(vty, vrf, afi, safi, subgrp_id)); } -DEFUN (show_ip_bgp_instance_all_updgrps, - show_ip_bgp_instance_all_updgrps_cmd, - "show ip bgp all update-groups", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_ALL_HELP_STR - "Detailed info about dynamic update groups\n") -{ - bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); - return CMD_SUCCESS; -} - DEFUN (show_bgp_instance_all_ipv6_updgrps, show_bgp_instance_all_ipv6_updgrps_cmd, "show bgp all update-groups", @@ -10987,7 +10967,6 @@ bgp_vty_init (void) /* "show ip bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); @@ -10999,10 +10978,8 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); @@ -11014,10 +10991,8 @@ bgp_vty_init (void) install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); @@ -11029,13 +11004,10 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); /* "show ip bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); - install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); /* "show ip bgp peer-group" commands. */ install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 09f761a3f7..ec94c37d66 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2177,7 +2177,6 @@ DEFUN (vtysh_write_terminal, "Write running configuration to memory, network, or terminal\n" "Write to terminal\n") { - /* CHECK ME argc referenced below */ u_int i; char line[] = "write terminal\n"; FILE *fp = NULL; @@ -2199,10 +2198,6 @@ DEFUN (vtysh_write_terminal, VTY_NEWLINE); vty_out (vty, "!%s", VTY_NEWLINE); - for (i = 0; i < array_size(vtysh_client); i++) - if ((argc < 1 ) || (begins_with(vtysh_client[i].name, argv[0]))) - vtysh_client_config (&vtysh_client[i], line); - /* Integrate vtysh specific configuration. */ vtysh_config_write (); From 273f77435b834646057fea7b4d585701adc05a35 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 14:37:36 +0000 Subject: [PATCH 184/280] bgpd: combine special cases for vrf "all" Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 68a1ca7a3d..eca6a4a7b3 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7923,31 +7923,26 @@ DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, - "show ip bgp all [json]", + "show [ip] bgp all [< [unicast]|ipv4 multicast|vpnv4 unicast>] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { + int idx_view_vrf = 3; + int idx_vrf = 4; + int idx_afi; + int idx_safi; + afi_t afi; + safi_t safi; + u_char uj = use_json(argc, argv); + bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); + idx_safi = idx_afi + 1; + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, NULL); - /* CHECK ME we need to revisit all of the bgp_show_all_ commands */ - bgp_show_all_instances_routes_vty (vty, AFI_IP, SAFI_UNICAST, uj); - return CMD_SUCCESS; -} - -DEFUN (show_bgp_instance_all, - show_bgp_instance_all_cmd, - "show bgp all [json]", - SHOW_STR - BGP_STR - BGP_INSTANCE_ALL_HELP_STR - "JavaScript Object Notation\n") -{ - u_char uj = use_json(argc, argv); - - bgp_show_all_instances_routes_vty (vty, AFI_IP6, SAFI_UNICAST, uj); + bgp_show_all_instances_routes_vty (vty, afi, safi, uj); return CMD_SUCCESS; } @@ -10299,14 +10294,6 @@ bgp_route_init (void) install_element (BGP_IPV6M_NODE, &ipv6_bgp_network_cmd); install_element (BGP_IPV6M_NODE, &no_ipv6_bgp_network_cmd); - /* Old config IPv6 BGP commands. */ - install_element (VIEW_NODE, &show_bgp_instance_all_cmd); - - /* Restricted: - * VIEW_NODE - (set of dangerous commands) - (commands dependent on prev) - */ - install_element (ENABLE_NODE, &show_bgp_instance_all_cmd); - /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); install_element (ENABLE_NODE, &show_bgp_statistics_view_cmd); From 7a7be51923d07bbacda978fd35b805b22d65fd31 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Sep 2016 11:16:19 -0400 Subject: [PATCH 185/280] ospfd: resolve argc CHECK MEs in ospf_vty.c Signed-off-by: Don Slice --- ospfd/ospf_vty.c | 2753 ++++++++++++++++++++++------------------------ 1 file changed, 1294 insertions(+), 1459 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 09947f49e5..5753671f16 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -143,20 +143,12 @@ ospf_oi_count (struct interface *ifp) return i; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "router ospf <1-65535>", - * "Enable a routing process\n" - * "Start OSPF configuration\n" - * "Instance ID\n" - * - */ DEFUN (router_ospf, router_ospf_cmd, - "router ospf", + "router ospf [(1-65535)]", "Enable a routing process\n" - "Start OSPF configuration\n") + "Start OSPF configuration\n" + "Instance ID\n") { struct ospf *ospf; u_short instance = 0; @@ -170,8 +162,8 @@ DEFUN (router_ospf, vty->node = OSPF_NODE; - if (argc) - VTY_GET_INTEGER ("Instance", instance, argv[0]); + if (argc > 2) + VTY_GET_INTEGER ("Instance", instance, argv[2]->arg); /* The following logic to set the vty->index is in place to be able to ignore the commands which dont belong to this instance. */ @@ -189,27 +181,18 @@ DEFUN (router_ospf, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no router ospf <1-65535>", - * NO_STR - * "Enable a routing process\n" - * "Start OSPF configuration\n" - * "Instance ID\n" - * - */ DEFUN (no_router_ospf, no_router_ospf_cmd, - "no router ospf", + "no router ospf [(1-65535)]", NO_STR "Enable a routing process\n" - "Start OSPF configuration\n") + "Start OSPF configuration\n" + "Instance ID\n") { struct ospf *ospf; u_short instance = 0; - if (argc) + if (argc > 3) VTY_GET_INTEGER ("Instance", instance, argv[3]->arg); if ((ospf = ospf_lookup_instance (instance)) == NULL) @@ -260,27 +243,51 @@ DEFUN (ospf_router_id, return CMD_SUCCESS; } -ALIAS_HIDDEN (ospf_router_id, +DEFUN_HIDDEN (ospf_router_id_old, ospf_router_id_old_cmd, "router-id A.B.C.D", "router-id for the OSPF process\n" "OSPF router-id in IP address format\n") +{ + int idx_ipv4 = 1; + struct ospf *ospf = vty->index; + struct listnode *node; + struct ospf_area *area; + struct in_addr router_id; + int ret; + + if (!ospf) + return CMD_SUCCESS; + + ret = inet_aton (argv[idx_ipv4]->arg, &router_id); + if (!ret) + { + vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); + return CMD_WARNING; + } + + ospf->router_id_static = router_id; + + for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) + if (area->full_nbrs) + { + vty_out (vty, "For this router-id change to take effect," + " save config and restart ospfd%s", VTY_NEWLINE); + return CMD_SUCCESS; + } + + ospf_router_id_update (ospf); + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf router-id A.B.C.D", - * NO_STR - * "OSPF specific commands\n" - * "router-id for the OSPF process\n" - * "OSPF router-id in IP address format\n" - * - */ DEFUN (no_ospf_router_id, no_ospf_router_id_cmd, - "no ospf router-id", + "no ospf router-id [A.B.C.D]", NO_STR "OSPF specific commands\n" - "router-id for the OSPF process\n") + "router-id for the OSPF process\n" + "OSPF router-id in IP address format\n") { struct ospf *ospf = vty->index; struct listnode *node; @@ -368,22 +375,12 @@ ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, } } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "passive-interface IFNAME", - * "Suppress routing updates on an interface\n" - * "Interface's name\n" - * - * "passive-interface default", - * "Suppress routing updates on an interface\n" - * "Suppress routing updates on interfaces by default\n" - * - */ DEFUN (ospf_passive_interface, ospf_passive_interface_addr_cmd, - "passive-interface IFNAME A.B.C.D", + "passive-interface ", "Suppress routing updates on an interface\n" - "Interface's name\n") + "Interface's name\n" + "Suppress routing updates on interfaces by default\n") { int idx_ipv4 = 2; struct interface *ifp; @@ -396,19 +393,19 @@ DEFUN (ospf_passive_interface, if (!ospf) return CMD_SUCCESS; - if (argc == 0) + if (strcmp (argv[1]->text, "default") == 0) { ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); return CMD_SUCCESS; } - ifp = if_get_by_name (argv[idx_ipv4]->arg); + ifp = if_get_by_name (argv[1]->arg); params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 3) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -449,27 +446,13 @@ DEFUN (ospf_passive_interface, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no passive-interface default", - * NO_STR - * "Allow routing updates on an interface\n" - * "Allow routing updates on interfaces by default\n" - * - * "no passive-interface IFNAME", - * NO_STR - * "Allow routing updates on an interface\n" - * "Interface's name\n" - * - */ DEFUN (no_ospf_passive_interface, no_ospf_passive_interface_addr_cmd, - "no passive-interface IFNAME A.B.C.D", + "no passive-interface ", NO_STR "Allow routing updates on an interface\n" - "Interface's name\n") + "Interface's name\n" + "Allow routing updates on interfaces by default\n") { int idx_ipv4 = 3; struct interface *ifp; @@ -482,19 +465,19 @@ DEFUN (no_ospf_passive_interface, if (!ospf) return CMD_SUCCESS; - if (argc == 0) + if (strcmp (argv[2]->text, "default") == 0) { ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); return CMD_SUCCESS; } - ifp = if_get_by_name (argv[idx_ipv4]->arg); + ifp = if_get_by_name (argv[2]->arg); params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 4) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -619,48 +602,21 @@ DEFUN (no_ospf_network_area, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "OSPF area range for route advertise (default)\n" - * "Area range prefix\n" - * "Advertise this range (default)\n" - * - * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "Advertise this range (default)\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - */ DEFUN (ospf_area_range, ospf_area_range_cmd, - "area range A.B.C.D/M", + "area range A.B.C.D/M [advertise [cost (0-16777215)]]", "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n") + "Area range prefix\n" + "Advertise this range (default)\n" + "User specified metric for this range\n" + "Advertised metric for this range\n") { int idx_ipv4_number = 1; int idx_ipv4_prefixlen = 3; + int idx_cost = 6; struct ospf *ospf = vty->index; struct prefix_ipv4 p; struct in_addr area_id; @@ -674,17 +630,48 @@ DEFUN (ospf_area_range, VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); - if (argc > 2) + if (argc > 5) { - VTY_GET_INTEGER ("range cost", cost, argv[2]); + VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg); ospf_area_range_cost_set (ospf, area_id, &p, cost); } return CMD_SUCCESS; } +DEFUN (ospf_area_range_cost, + ospf_area_range_cost_cmd, + "area range A.B.C.D/M cost (0-16777215)", + "OSPF area parameters\n" + "OSPF area ID in IP address format\n" + "OSPF area ID as a decimal value\n" + "Summarize routes matching address/mask (border routers only)\n" + "Area range prefix\n" + "User specified metric for this range\n" + "Advertised metric for this range\n") +{ + int idx_ipv4_number = 1; + int idx_ipv4_prefixlen = 3; + int idx_cost = 5; + struct ospf *ospf = vty->index; + struct prefix_ipv4 p; + struct in_addr area_id; + int format; + u_int32_t cost; + if (!ospf) + return CMD_SUCCESS; + VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); + VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); + + ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); + + VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg); + ospf_area_range_cost_set (ospf, area_id, &p, cost); + + return CMD_SUCCESS; +} DEFUN (ospf_area_range_not_advertise, ospf_area_range_not_advertise_cmd, @@ -714,49 +701,17 @@ DEFUN (ospf_area_range_not_advertise, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", - * NO_STR - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "Advertise this range (default)\n" - * "DoNotAdvertise this range\n" - * - * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", - * NO_STR - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "Advertise this range (default)\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", - * NO_STR - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Summarize routes matching address/mask (border routers only)\n" - * "Area range prefix\n" - * "User specified metric for this range\n" - * "Advertised metric for this range\n" - * - */ DEFUN (no_ospf_area_range, no_ospf_area_range_cmd, - "no area range A.B.C.D/M", + "no area range A.B.C.D/M []", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" "Summarize routes matching address/mask (border routers only)\n" - "Area range prefix\n") + "Area range prefix\n" + "Advertise this range (default)\n" + "DoNotAdvertise this range\n") { int idx_ipv4_number = 2; int idx_ipv4_prefixlen = 4; @@ -776,9 +731,6 @@ DEFUN (no_ospf_area_range, return CMD_SUCCESS; } - - - DEFUN (ospf_area_range_substitute, ospf_area_range_substitute_cmd, "area range A.B.C.D/M substitute A.B.C.D/M", @@ -858,7 +810,6 @@ DEFUN (no_ospf_area_range_substitute, Wed, 21 Feb 2001 15:13:52 +1300 */ - /* Configuration data for virtual links */ struct ospf_vl_config_data { @@ -1026,7 +977,6 @@ ospf_vl_set_timers (struct ospf_vl_data *vl_data, } - /* The business end of all of the above */ static int ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) @@ -1096,93 +1046,19 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) "Use MD5 algorithm\n" \ "The OSPF password (key)" -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null) " - * "(authentication-key|) AUTH_KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * VLINK_HELPSTR_AUTH_SIMPLE - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) " - * "(authentication-key|) AUTH_KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * VLINK_HELPSTR_AUTH_SIMPLE - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null)", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(message-digest-key|) <1-255> md5 KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTH_MD5 - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) " - * "(message-digest-key|) <1-255> md5 KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * VLINK_HELPSTR_AUTH_MD5 - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null) " - * "(message-digest-key|) <1-255> md5 KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * VLINK_HELPSTR_AUTH_MD5 - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|)", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * - * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication-key|) AUTH_KEY", - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTH_SIMPLE - * - */ DEFUN (ospf_area_vlink, ospf_area_vlink_cmd, - "area virtual-link A.B.C.D", - VLINK_HELPSTR_IPADDR) + "area virtual-link A.B.C.D " + "[authentication] [] " + "[arg - %s%s", i, argv[i]->text, VTY_NEWLINE); */ - switch (argv[i][0]) + switch (argv[i]->arg[0]) { case 'a': - if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) + if (i >5 || strncmp (argv[i]->arg, "authentication-", 15) == 0) { /* authentication-key - this option can occur anywhere on command line. At start of command line must check for authentication option. */ memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); + strncpy (auth_key, argv[i+1]->text, OSPF_AUTH_SIMPLE_SIZE); vl_config.auth_key = auth_key; i++; } - else if (strncmp (argv[i], "authentication", 14) == 0) + else if (strncmp (argv[i]->arg, "authentication", 14) == 0) { /* authentication - this option can only occur at start of command line */ vl_config.auth_type = OSPF_AUTH_SIMPLE; if ((i+1) < argc) { - if (strncmp (argv[i+1], "n", 1) == 0) + if (strncmp (argv[i+1]->arg, "n", 1) == 0) { /* "authentication null" */ vl_config.auth_type = OSPF_AUTH_NULL; i++; } - else if (strncmp (argv[i+1], "m", 1) == 0 - && strcmp (argv[i+1], "message-digest-") != 0) + else if (strncmp (argv[i+1]->arg, "m", 1) == 0 + && strcmp (argv[i+1]->arg, "message-digest-") != 0) { /* "authentication message-digest" */ vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; @@ -1268,19 +1144,86 @@ DEFUN (ospf_area_vlink, case 'm': /* message-digest-key */ i++; - vl_config.crypto_key_id = strtol (argv[i], NULL, 10); + vl_config.crypto_key_id = strtol (argv[i]->arg, NULL, 10); if (vl_config.crypto_key_id < 0) return CMD_WARNING; i++; memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); + strncpy (md5_key, argv[i]->arg, OSPF_AUTH_MD5_SIZE); vl_config.md5_key = md5_key; break; + } + } + + + /* Action configuration */ + + return ospf_vl_set (ospf, &vl_config); + +} + +DEFUN (ospf_area_vlink_intervals, + ospf_area_vlink_intervals_cmd, + "area virtual-link A.B.C.D " + "[ (1-65535)] " + "[ (1-65535)] " + "[ (1-65535)] " + "[ (1-65535)] ", + VLINK_HELPSTR_IPADDR + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM) +{ + int idx_ipv4_number = 1; + int idx_ipv4 = 3; + struct ospf *ospf = vty->index; + struct ospf_vl_config_data vl_config; + int i; + int ret; + + if (!ospf) + return CMD_SUCCESS; + + ospf_vl_config_data_init(&vl_config, vty); + + /* Read off first 2 parameters and check them */ + ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format); + if (ret < 0) + { + vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); + if (! ret) + { + vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + if (argc <=4) + { + /* Thats all folks! - BUGS B. strikes again!!!*/ + + return ospf_vl_set (ospf, &vl_config); + } + + /* Deal with other parameters */ + for (i=5; i < argc; i++) + { + + /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->arg, VTY_NEWLINE); */ + + switch (argv[i]->arg[0]) + { + case 'h': /* Hello interval */ i++; - vl_config.hello_interval = strtol (argv[i], NULL, 10); + vl_config.hello_interval = strtol (argv[i]->arg, NULL, 10); if (vl_config.hello_interval < 0) return CMD_WARNING; break; @@ -1288,7 +1231,7 @@ DEFUN (ospf_area_vlink, case 'r': /* Retransmit Interval */ i++; - vl_config.retransmit_interval = strtol (argv[i], NULL, 10); + vl_config.retransmit_interval = strtol (argv[i]->arg, NULL, 10); if (vl_config.retransmit_interval < 0) return CMD_WARNING; break; @@ -1296,7 +1239,7 @@ DEFUN (ospf_area_vlink, case 't': /* Transmit Delay */ i++; - vl_config.transmit_delay = strtol (argv[i], NULL, 10); + vl_config.transmit_delay = strtol (argv[i]->arg, NULL, 10); if (vl_config.transmit_delay < 0) return CMD_WARNING; break; @@ -1304,7 +1247,7 @@ DEFUN (ospf_area_vlink, case 'd': /* Dead Interval */ i++; - vl_config.dead_interval = strtol (argv[i], NULL, 10); + vl_config.dead_interval = strtol (argv[i]->arg, NULL, 10); if (vl_config.dead_interval < 0) return CMD_WARNING; break; @@ -1318,106 +1261,20 @@ DEFUN (ospf_area_vlink, } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) " - * "(message-digest-key|) <1-255> md5 KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * VLINK_HELPSTR_AUTH_MD5 - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * VLINK_HELPSTR_TIME_PARAM - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_TIME_PARAM - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(message-digest-key|) <1-255> md5 KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTH_MD5 - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|)", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null) " - * "(message-digest-key|) <1-255> md5 KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * VLINK_HELPSTR_AUTH_MD5 - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) " - * "(authentication-key|) AUTH_KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_SIMPLE - * VLINK_HELPSTR_AUTH_SIMPLE - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication-key|) AUTH_KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTH_SIMPLE - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null)", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * - * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " - * "(authentication|) (message-digest|null) " - * "(authentication-key|) AUTH_KEY", - * NO_STR - * VLINK_HELPSTR_IPADDR - * VLINK_HELPSTR_AUTHTYPE_ALL - * VLINK_HELPSTR_AUTH_SIMPLE - * - */ DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, - "no area virtual-link A.B.C.D", + "area virtual-link A.B.C.D " + "[authentication] [] " + "[arg[0]) { case 'a': - if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) + if (i > 2 || strncmp (argv[i]->text, "authentication-", 15) == 0) { /* authentication-key - this option can occur anywhere on command line. At start of command line @@ -1487,7 +1344,7 @@ DEFUN (no_ospf_area_vlink, memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); vl_config.auth_key = auth_key; } - else if (strncmp (argv[i], "authentication", 14) == 0) + else if (strncmp (argv[i]->text, "authentication", 14) == 0) { /* authentication - this option can only occur at start of command line */ @@ -1499,12 +1356,92 @@ DEFUN (no_ospf_area_vlink, /* message-digest-key */ /* Delete one key */ i++; - vl_config.crypto_key_id = strtol (argv[i], NULL, 10); + vl_config.crypto_key_id = strtol (argv[i]->arg, NULL, 10); if (vl_config.crypto_key_id < 0) return CMD_WARNING; vl_config.md5_key = NULL; break; + } + } + + + /* Action configuration */ + + return ospf_vl_set (ospf, &vl_config); +} + +DEFUN (no_ospf_area_vlink_intervals, + no_ospf_area_vlink_intervals_cmd, + "area virtual-link A.B.C.D " + "[ (1-65535)] " + "[ (1-65535)] " + "[ (1-65535)] " + "[ (1-65535)] ", + VLINK_HELPSTR_IPADDR + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM + VLINK_HELPSTR_TIME_PARAM) +{ + int idx_ipv4_number = 2; + int idx_ipv4 = 4; + struct ospf *ospf = vty->index; + struct ospf_area *area; + struct ospf_vl_config_data vl_config; + struct ospf_vl_data *vl_data = NULL; + int i; + int ret, format; + + if (!ospf) + return CMD_SUCCESS; + + ospf_vl_config_data_init(&vl_config, vty); + + ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); + if (ret < 0) + { + vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); + if (!area) + { + vty_out (vty, "Area does not exist%s", VTY_NEWLINE); + return CMD_WARNING; + } + + ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); + if (! ret) + { + vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + if (argc <=5) + { + /* Basic VLink no command */ + /* Thats all folks! - BUGS B. strikes again!!!*/ + if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) + ospf_vl_delete (ospf, vl_data); + + ospf_area_check_free (ospf, vl_config.area_id); + + return CMD_SUCCESS; + } + + /* If we are down here, we are reseting parameters */ + + /* Deal with other parameters */ + for (i=6; i < argc; i++) + { + /* vty_out (vty, "argv[%d] - %s%s", i, argv[i]->arg, VTY_NEWLINE); */ + + switch (argv[i]->arg[0]) + { + case 'h': /* Hello interval */ vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; @@ -1534,31 +1471,6 @@ DEFUN (no_ospf_area_vlink, return ospf_vl_set (ospf, &vl_config); } - - - - - - - - - - - - - - - - - - - - - - - - - DEFUN (ospf_area_shortcut, ospf_area_shortcut_cmd, "area shortcut ", @@ -1749,7 +1661,7 @@ DEFUN (no_ospf_area_stub_no_summary, } static int -ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], +ospf_area_nssa_cmd_handler (struct vty *vty, int argc, struct cmd_token **argv, int nosum) { struct ospf *ospf = vty->index; @@ -1759,7 +1671,7 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], if (!ospf) return CMD_SUCCESS; - VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); + VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[1]->arg); ret = ospf_area_nssa_set (ospf, area_id); if (ret == 0) @@ -1771,13 +1683,13 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], if (argc > 1) { - if (strncmp (argv[1], "translate-c", 11) == 0) + if (strncmp (argv[3]->text, "translate-c", 11) == 0) ospf_area_nssa_translator_role_set (ospf, area_id, OSPF_NSSA_ROLE_CANDIDATE); - else if (strncmp (argv[1], "translate-n", 11) == 0) + else if (strncmp (argv[3]->text, "translate-n", 11) == 0) ospf_area_nssa_translator_role_set (ospf, area_id, OSPF_NSSA_ROLE_NEVER); - else if (strncmp (argv[1], "translate-a", 11) == 0) + else if (strncmp (argv[3]->text, "translate-a", 11) == 0) ospf_area_nssa_translator_role_set (ospf, area_id, OSPF_NSSA_ROLE_ALWAYS); } @@ -1849,29 +1761,19 @@ DEFUN (ospf_area_nssa_no_summary, return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always|) {no-summary}", - * NO_STR - * "OSPF area parameters\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * "Configure OSPF area as nssa\n" - * "Configure NSSA-ABR for translate election (default)\n" - * "Configure NSSA-ABR to never translate\n" - * "Configure NSSA-ABR to always translate\n" - * "Do not inject inter-area routes into nssa\n" - * - */ DEFUN (no_ospf_area_nssa, no_ospf_area_nssa_cmd, - "no area nssa", + "no area nssa [ [no-summary]]", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" - "Configure OSPF area as nssa\n") -{ + "Configure OSPF area as nssa\n" + "Configure NSSA-ABR for translate election (default)\n" + "Configure NSSA-ABR to never translate\n" + "Configure NSSA-ABR to always translate\n" + "Do not inject inter-area routes into nssa\n") + { int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct in_addr area_id; @@ -2009,7 +1911,7 @@ DEFUN (ospf_area_export_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); - ospf_area_export_list_set (ospf, area, argv[1]); + ospf_area_export_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; } @@ -2066,7 +1968,7 @@ DEFUN (ospf_area_import_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); area = ospf_area_get (ospf, area_id, format); - ospf_area_import_list_set (ospf, area, argv[1]); + ospf_area_import_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; } @@ -2436,13 +2338,6 @@ DEFUN (no_ospf_log_adjacency_changes_detail, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ospf rfc1583compatibility", - * "OSPF specific commands\n" - * "Enable the RFC1583Compatibility flag\n" - * - */ DEFUN (ospf_compatible_rfc1583, ospf_compatible_rfc1583_cmd, "compatible rfc1583", @@ -2462,14 +2357,6 @@ DEFUN (ospf_compatible_rfc1583, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf rfc1583compatibility", - * NO_STR - * "OSPF specific commands\n" - * "Disable the RFC1583Compatibility flag\n" - * - */ DEFUN (no_ospf_compatible_rfc1583, no_ospf_compatible_rfc1583_cmd, "no compatible rfc1583", @@ -2490,7 +2377,18 @@ DEFUN (no_ospf_compatible_rfc1583, return CMD_SUCCESS; } +ALIAS (ospf_compatible_rfc1583, + ospf_rfc1583_flag_cmd, + "ospf rfc1583compatibility", + "OSPF specific commands\n" + "Enable the RFC1583Compatibility flag\n") +ALIAS (no_ospf_compatible_rfc1583, + no_ospf_rfc1583_flag_cmd, + "no ospf rfc1583compatibility", + NO_STR + "OSPF specific commands\n" + "Disable the RFC1583Compatibility flag\n") static int ospf_timers_spf_set (struct vty *vty, unsigned int delay, @@ -2538,25 +2436,15 @@ DEFUN (ospf_timers_min_ls_interval, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers throttle lsa all <0-5000>", - * NO_STR - * "Adjust routing timers\n" - * "Throttling adaptive timer\n" - * "LSA delay between transmissions\n" - * "All LSA types\n" - * "Delay (msec) between sending LSAs\n" - * - */ DEFUN (no_ospf_timers_min_ls_interval, no_ospf_timers_min_ls_interval_cmd, - "no timers throttle lsa all", + "no timers throttle lsa all [(0-5000)]", NO_STR "Adjust routing timers\n" "Throttling adaptive timer\n" "LSA delay between transmissions\n" - "All LSA types\n") + "All LSA types\n" + "Delay (msec) between sending LSAs\n") { struct ospf *ospf = vty->index; ospf->min_ls_interval = OSPF_MIN_LS_INTERVAL; @@ -2593,23 +2481,14 @@ DEFUN (ospf_timers_min_ls_arrival, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers lsa arrival <0-1000>", - * NO_STR - * "Adjust routing timers\n" - * "Throttling link state advertisement delays\n" - * "OSPF minimum arrival interval delay\n" - * "Delay (msec) between accepted LSAs\n" - * - */ DEFUN (no_ospf_timers_min_ls_arrival, no_ospf_timers_min_ls_arrival_cmd, - "no timers lsa arrival", + "no timers lsa arrival [(0-1000)]", NO_STR "Adjust routing timers\n" "Throttling link state advertisement delays\n" - "OSPF minimum arrival interval delay\n") + "OSPF minimum arrival interval delay\n" + "Delay (msec) between accepted LSAs\n") { struct ospf *ospf = vty->index; @@ -2650,26 +2529,17 @@ DEFUN (ospf_timers_throttle_spf, return ospf_timers_spf_set (vty, delay, hold, max); } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers throttle spf <0-600000> <0-600000> <0-600000>", - * NO_STR - * "Adjust routing timers\n" - * "Throttling adaptive timer\n" - * "OSPF SPF timers\n" - * "Delay (msec) from first change received till SPF calculation\n" - * "Initial hold time (msec) between consecutive SPF calculations\n" - * "Maximum hold time (msec)\n" - * - */ DEFUN (no_ospf_timers_throttle_spf, no_ospf_timers_throttle_spf_cmd, - "no timers throttle spf", + "no timers throttle spf [(0-600000)(0-600000)(0-600000)]", NO_STR "Adjust routing timers\n" "Throttling adaptive timer\n" - "OSPF SPF timers\n") -{ + "OSPF SPF timers\n" + "Delay (msec) from first change received till SPF calculation\n" + "Initial hold time (msec) between consecutive SPF calculations\n" + "Maximum hold time (msec)\n") + { return ospf_timers_spf_set (vty, OSPF_SPF_DELAY_DEFAULT, OSPF_SPF_HOLDTIME_DEFAULT, @@ -2705,23 +2575,14 @@ DEFUN (ospf_timers_lsa, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no timers lsa min-arrival <0-600000>", - * NO_STR - * "Adjust routing timers\n" - * "OSPF LSA timers\n" - * "Minimum delay in receiving new version of a LSA\n" - * "Delay in milliseconds\n" - * - */ DEFUN (no_ospf_timers_lsa, no_ospf_timers_lsa_cmd, - "no timers lsa min-arrival", + "no timers lsa min-arrival [(0-600000)]", NO_STR "Adjust routing timers\n" "OSPF LSA timers\n" - "Minimum delay in receiving new version of a LSA\n") + "Minimum delay in receiving new version of a LSA\n" + "Delay in milliseconds\n") { unsigned int minarrival; struct ospf *ospf = vty->index; @@ -2729,9 +2590,9 @@ DEFUN (no_ospf_timers_lsa, if (!ospf) return CMD_SUCCESS; - if (argc) + if (argc > 4) { - VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[4]->arg); if (ospf->min_ls_arrival != minarrival || minarrival == OSPF_MIN_LS_ARRIVAL) @@ -2743,80 +2604,19 @@ DEFUN (no_ospf_timers_lsa, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Neighbor Priority\n" - * "Priority\n" - * "Dead Neighbor Polling interval\n" - * "Seconds\n" - * - * "neighbor A.B.C.D priority <0-255>", - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Neighbor Priority\n" - * "Seconds\n" - * - */ DEFUN (ospf_neighbor, ospf_neighbor_cmd, - "neighbor A.B.C.D", - NEIGHBOR_STR - "Neighbor IP address\n") -{ - int idx_ipv4 = 1; - struct ospf *ospf = vty->index; - struct in_addr nbr_addr; - unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; - unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; - - if (!ospf) - return CMD_SUCCESS; - - VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); - - if (argc > 1) - VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); - - if (argc > 2) - VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); - - ospf_nbr_nbma_set (ospf, nbr_addr); - if (argc > 1) - ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); - if (argc > 2) - ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); - - return CMD_SUCCESS; -} - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", - * NEIGHBOR_STR - * "Neighbor address\n" - * "OSPF dead-router polling interval\n" - * "Seconds\n" - * "OSPF priority of non-broadcast neighbor\n" - * "Priority\n" - * - */ -DEFUN (ospf_neighbor_poll_interval, - ospf_neighbor_poll_interval_cmd, - "neighbor A.B.C.D poll-interval (1-65535)", + "neighbor A.B.C.D [priority (0-255) [poll-interval (1-65535)]]", NEIGHBOR_STR "Neighbor IP address\n" + "Neighbor Priority\n" + "Priority\n" "Dead Neighbor Polling interval\n" "Seconds\n") { int idx_ipv4 = 1; - int idx_number = 3; + int idx_pri = 3; + int idx_poll = 5; struct ospf *ospf = vty->index; struct in_addr nbr_addr; unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; @@ -2827,63 +2627,70 @@ DEFUN (ospf_neighbor_poll_interval, VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); - if (argc > 1) - VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_number]->arg, 1, 65535); - if (argc > 2) - VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); + VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255); + + if (argc > 4) + VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535); ospf_nbr_nbma_set (ospf, nbr_addr); - if (argc > 1) - ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); + if (argc > 2) ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); + if (argc > 4) + ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); + + return CMD_SUCCESS; +} + +DEFUN (ospf_neighbor_poll_interval, + ospf_neighbor_poll_interval_cmd, + "neighbor A.B.C.D poll-interval (1-65535) [priority (0-255)]", + NEIGHBOR_STR + "Neighbor IP address\n" + "Dead Neighbor Polling interval\n" + "Seconds\n" + "OSPF priority of non-broadcast neighbor\n" + "Priority\n") + { + int idx_ipv4 = 1; + int idx_poll = 3; + int idx_pri = 5; + struct ospf *ospf = vty->index; + struct in_addr nbr_addr; + unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; + unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; + + if (!ospf) + return CMD_SUCCESS; + + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); + + VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535); + + if (argc > 4) + VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255); + + ospf_nbr_nbma_set (ospf, nbr_addr); + ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); + + if (argc > 4) + ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); + return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", - * NO_STR - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Neighbor Priority\n" - * "Priority\n" - * "Dead Neighbor Polling interval\n" - * "Seconds\n" - * - * "no neighbor A.B.C.D priority <0-255>", - * NO_STR - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Neighbor Priority\n" - * "Priority\n" - * - * "no neighbor A.B.C.D poll-interval <1-65535>", - * NO_STR - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Dead Neighbor Polling interval\n" - * "Seconds\n" - * - * "no neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", - * NO_STR - * NEIGHBOR_STR - * "Neighbor IP address\n" - * "Dead Neighbor Polling interval\n" - * "Seconds\n" - * "OSPF priority of non-broadcast neighbor\n" - * "Priority\n" - * - */ DEFUN (no_ospf_neighbor, no_ospf_neighbor_cmd, - "no neighbor A.B.C.D", + "no neighbor A.B.C.D [priority (0-255) [poll-interval (1-65525)]]", NO_STR NEIGHBOR_STR - "Neighbor IP address\n") + "Neighbor IP address\n" + "Neighbor Priority\n" + "Priority\n" + "Dead Neighbor Polling interval\n" + "Seconds\n") { int idx_ipv4 = 2; struct ospf *ospf = vty->index; @@ -2899,9 +2706,30 @@ DEFUN (no_ospf_neighbor, return CMD_SUCCESS; } +DEFUN (no_ospf_neighbor_poll, + no_ospf_neighbor_poll_cmd, + "no neighbor A.B.C.D poll-interval (1-65535) [priority (0-255)]", + NO_STR + NEIGHBOR_STR + "Neighbor IP address\n" + "Dead Neighbor Polling interval\n" + "Seconds\n" + "Neighbor Priority\n" + "Priority\n") +{ + int idx_ipv4 = 2; + struct ospf *ospf = vty->index; + struct in_addr nbr_addr; + if (!ospf) + return CMD_SUCCESS; + VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg); + (void)ospf_nbr_nbma_unset (ospf, nbr_addr); + + return CMD_SUCCESS; +} DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, @@ -2925,16 +2753,9 @@ DEFUN (ospf_refresh_timer, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no refresh timer", - * "Adjust refresh parameters\n" - * "Unset refresh timer\n" - * - */ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, - "no refresh timer (10-1800)", + "no refresh timer [(10-1800)]", "Adjust refresh parameters\n" "Unset refresh timer\n" "Timer value in seconds\n") @@ -2995,21 +2816,13 @@ DEFUN (ospf_auto_cost_reference_bandwidth, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no auto-cost reference-bandwidth <1-4294967>", - * NO_STR - * "Calculate OSPF interface cost according to bandwidth\n" - * "Use reference bandwidth method to assign OSPF cost\n" - * "The reference bandwidth in terms of Mbits per second\n" - * - */ DEFUN (no_ospf_auto_cost_reference_bandwidth, no_ospf_auto_cost_reference_bandwidth_cmd, - "no auto-cost reference-bandwidth", + "no auto-cost reference-bandwidth [(1-4294967)]", NO_STR "Calculate OSPF interface cost according to bandwidth\n" - "Use reference bandwidth method to assign OSPF cost\n") + "Use reference bandwidth method to assign OSPF cost\n" + "The reference bandwidth in terms of Mbits per second\n") { struct ospf *ospf = vty->index; struct listnode *node, *nnode; @@ -3031,14 +2844,6 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "write-multiplier <1-100>", - * "Write multiplier\n" - * "Maximum number of interface serviced per write\n" - * - */ DEFUN (ospf_write_multiplier, ospf_write_multiplier_cmd, "ospf write-multiplier (1-100)", @@ -3046,13 +2851,18 @@ DEFUN (ospf_write_multiplier, "Write multiplier\n" "Maximum number of interface serviced per write\n") { - int idx_number = 2; + int idx_number; struct ospf *ospf = vty->index; u_int32_t write_oi_count; if (!ospf) return CMD_SUCCESS; + if (argc == 3) + idx_number = 2; + else + idx_number = 1; + write_oi_count = strtol (argv[idx_number]->arg, NULL, 10); if (write_oi_count < 1 || write_oi_count > 100) { @@ -3064,19 +2874,12 @@ DEFUN (ospf_write_multiplier, return CMD_SUCCESS; } +ALIAS (ospf_write_multiplier, + write_multiplier_cmd, + "write-multiplier (1-100)", + "Write multiplier\n" + "Maximum number of interface serviced per write\n") -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no write-multiplier", - * NO_STR - * "Write multiplier\n" - * - * "no write-multiplier <1-100>", - * NO_STR - * "Write multiplier\n" - * "Maximum number of interface serviced per write\n" - * - */ DEFUN (no_ospf_write_multiplier, no_ospf_write_multiplier_cmd, "no ospf write-multiplier (1-100)", @@ -3094,7 +2897,12 @@ DEFUN (no_ospf_write_multiplier, return CMD_SUCCESS; } - +ALIAS (no_ospf_write_multiplier, + no_write_multiplier_cmd, + "no write-multiplier (1-100)", + NO_STR + "Write multiplier\n" + "Maximum number of interface serviced per write\n") const char *ospf_abr_type_descr_str[] = { @@ -3989,7 +3797,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface static int show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, - const char **argv, int iface_argv, u_char use_json) + struct cmd_token **argv, int iface_argv, u_char use_json) { struct interface *ifp; struct listnode *node; @@ -4024,7 +3832,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, } } } - else if (argv[iface_argv] && strcmp(argv[iface_argv], "json") == 0) + else if (argv[iface_argv] && strcmp(argv[iface_argv]->arg, "json") == 0) { if (!use_json) { @@ -4046,7 +3854,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, else { /* Interface name is specified. */ - if ((ifp = if_lookup_by_name (argv[iface_argv])) == NULL) + if ((ifp = if_lookup_by_name (argv[iface_argv]->arg)) == NULL) { if (use_json) json_object_boolean_true_add(json, "noSuchIface"); @@ -4386,7 +4194,7 @@ DEFUN (show_ip_ospf_instance_neighbor_all, static int show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_base, - const char **argv, u_char use_json) + struct cmd_token **argv, u_char use_json) { struct interface *ifp; struct route_node *rn; @@ -4406,7 +4214,7 @@ show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_ba VTY_NEWLINE, VTY_NEWLINE); } - ifp = if_lookup_by_name (argv[arg_base]); + ifp = if_lookup_by_name (argv[arg_base]->arg); if (!ifp) { if (use_json) @@ -4756,7 +4564,7 @@ show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, static int show_ip_ospf_neighbor_id_common (struct vty *vty, struct ospf *ospf, - int arg_base, const char **argv, u_char use_json) + int arg_base, struct cmd_token **argv, u_char use_json) { struct listnode *node; struct ospf_neighbor *nbr; @@ -4777,7 +4585,7 @@ show_ip_ospf_neighbor_id_common (struct vty *vty, struct ospf *ospf, VTY_NEWLINE, VTY_NEWLINE); } - ret = inet_aton (argv[arg_base], &router_id); + ret = inet_aton (argv[arg_base]->arg, &router_id); if (!ret) { if (!use_json) @@ -5040,7 +4848,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, static int show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf, - int arg_base, const char **argv, u_char use_json) + int arg_base, struct cmd_token **argv, u_char use_json) { struct ospf_interface *oi; struct interface *ifp; @@ -5060,7 +4868,7 @@ show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf, VTY_NEWLINE, VTY_NEWLINE); } - ifp = if_lookup_by_name (argv[arg_base]); + ifp = if_lookup_by_name (argv[arg_base]->arg); if (!ifp) { if (!use_json) @@ -5444,7 +5252,6 @@ show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) return 0; } - #if 0 static int show_as_external_lsa_stdvty (struct ospf_lsa *lsa) @@ -5470,7 +5277,6 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa) return 0; } #endif - /* Show AS-NSSA-LSA detail information. */ static int show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) @@ -5770,8 +5576,9 @@ show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) static int show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, - int arg_base, int argc, const char **argv) + int arg_base, int argc, struct cmd_token **argv) { + int idx_type = 4; int type, ret; struct in_addr id, adv_router; @@ -5783,64 +5590,64 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); /* Show all LSA. */ - if (argc == arg_base + 0) + if (argc == arg_base + 4) { show_ip_ospf_database_summary (vty, ospf, 0); return CMD_SUCCESS; } /* Set database type to show. */ - if (strncmp (argv[arg_base + 0], "r", 1) == 0) + if (strncmp (argv[arg_base + idx_type]->text, "r", 1) == 0) type = OSPF_ROUTER_LSA; - else if (strncmp (argv[arg_base + 0], "ne", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "ne", 2) == 0) type = OSPF_NETWORK_LSA; - else if (strncmp (argv[arg_base + 0], "ns", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "ns", 2) == 0) type = OSPF_AS_NSSA_LSA; - else if (strncmp (argv[arg_base + 0], "su", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "su", 2) == 0) type = OSPF_SUMMARY_LSA; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "a", 1) == 0) type = OSPF_ASBR_SUMMARY_LSA; - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "e", 1) == 0) type = OSPF_AS_EXTERNAL_LSA; - else if (strncmp (argv[arg_base + 0], "se", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "se", 2) == 0) { show_ip_ospf_database_summary (vty, ospf, 1); return CMD_SUCCESS; } - else if (strncmp (argv[arg_base + 0], "m", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "m", 1) == 0) { show_ip_ospf_database_maxage (vty, ospf); return CMD_SUCCESS; } - else if (strncmp (argv[arg_base + 0], "opaque-l", 8) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-l", 8) == 0) type = OSPF_OPAQUE_LINK_LSA; - else if (strncmp (argv[arg_base + 0], "opaque-ar", 9) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-ar", 9) == 0) type = OSPF_OPAQUE_AREA_LSA; - else if (strncmp (argv[arg_base + 0], "opaque-as", 9) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-as", 9) == 0) type = OSPF_OPAQUE_AS_LSA; else return CMD_WARNING; /* `show ip ospf database LSA'. */ - if (argc == arg_base + 1) + if (argc == arg_base + 5) show_lsa_detail (vty, ospf, type, NULL, NULL); - else if (argc >= arg_base + 2) + else if (argc >= arg_base + 6) { - ret = inet_aton (argv[arg_base + 1], &id); + ret = inet_aton (argv[arg_base + 5]->arg, &id); if (!ret) return CMD_WARNING; /* `show ip ospf database LSA ID'. */ - if (argc == arg_base + 2) + if (argc == arg_base + 6) show_lsa_detail (vty, ospf, type, &id, NULL); /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ - else if (argc == arg_base + 3) + else if (argc == arg_base + 7) { - if (strncmp (argv[arg_base + 2], "s", 1) == 0) + if (strncmp (argv[arg_base + 6]->text, "s", 1) == 0) adv_router = ospf->router_id; else { - ret = inet_aton (argv[arg_base + 2], &adv_router); + ret = inet_aton (argv[arg_base + 7]->arg, &adv_router); if (!ret) return CMD_WARNING; } @@ -5851,53 +5658,18 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * - * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * "Self-originated link states\n" - * "\n" - * - * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * "Advertising Router link states\n" - * "Advertising Router (as an IP address)\n" - * - * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "LSAs in MaxAge list\n" - * "Self-originated link states\n" - * - */ DEFUN (show_ip_ospf_database, show_ip_ospf_database_cmd, - "show ip ospf database", + "show ip ospf database [ [A.B.C.D []]]", SHOW_STR IP_STR "OSPF information\n" - "Database summary\n") + "Database summary\n" + OSPF_LSA_TYPES_DESC + "Link State ID (as an IP address)\n" + "Self-originated link states\n" + "Advertising Router link states\n" + "Advertising Router (as an IP address)\n") { struct ospf *ospf; @@ -5907,62 +5679,60 @@ DEFUN (show_ip_ospf_database, return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv)); } +DEFUN (show_ip_ospf_database_max, + show_ip_ospf_database_max_cmd, + "show ip ospf database ", + SHOW_STR + IP_STR + "OSPF information\n" + "Database summary\n" + "LSAs in MaxAge list\n" + "Self-originated link states\n") +{ + struct ospf *ospf; + if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running) + return CMD_SUCCESS; + return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv)); +} - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Instance ID\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * "Advertising Router link states\n" - * "Advertising Router (as an IP address)\n" - * - * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Instance ID\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * - * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Instance ID\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Link State ID (as an IP address)\n" - * "Self-originated link states\n" - * "\n" - * - * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Instance ID\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "LSAs in MaxAge list\n" - * "Self-originated link states\n" - * - */ DEFUN (show_ip_ospf_instance_database, show_ip_ospf_instance_database_cmd, - "show ip ospf (1-65535) database", + "show ip ospf (1-65535) database [ [A.B.C.D []]]", SHOW_STR IP_STR "OSPF information\n" "Instance ID\n" - "Database summary\n") + "Database summary\n" + OSPF_LSA_TYPES_DESC + "Link State ID (as an IP address)\n" + "Self-originated link states\n" + "Advertising Router link states\n" + "Advertising Router (as an IP address)\n") +{ + int idx_number = 3; + struct ospf *ospf; + u_short instance = 0; + + VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); + + if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) + return CMD_SUCCESS; + + return (show_ip_ospf_database_common(vty, ospf, 1, argc, argv)); +} + +DEFUN (show_ip_ospf_instance_database_max, + show_ip_ospf_instance_database_max_cmd, + "show ip ospf (1-65535) database ", + SHOW_STR + IP_STR + "OSPF information\n" + "Instance ID\n" + "Database summary\n" + "LSAs in MaxAge list\n" + "Self-originated link states\n") { int idx_number = 3; struct ospf *ospf; @@ -5977,14 +5747,11 @@ DEFUN (show_ip_ospf_instance_database, } - - - - static int show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf, - int arg_base, int argc, const char **argv) + int arg_base, int argc, struct cmd_token **argv) { + int idx_type = 4; int type, ret; struct in_addr adv_router; @@ -5995,37 +5762,37 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); - if (argc != arg_base + 2) + if (argc != arg_base + 7) return CMD_WARNING; /* Set database type to show. */ - if (strncmp (argv[arg_base + 0], "r", 1) == 0) + if (strncmp (argv[arg_base + idx_type]->text, "r", 1) == 0) type = OSPF_ROUTER_LSA; - else if (strncmp (argv[arg_base + 0], "ne", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "ne", 2) == 0) type = OSPF_NETWORK_LSA; - else if (strncmp (argv[arg_base + 0], "ns", 2) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "ns", 2) == 0) type = OSPF_AS_NSSA_LSA; - else if (strncmp (argv[arg_base + 0], "s", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "s", 1) == 0) type = OSPF_SUMMARY_LSA; - else if (strncmp (argv[arg_base + 0], "a", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "a", 1) == 0) type = OSPF_ASBR_SUMMARY_LSA; - else if (strncmp (argv[arg_base + 0], "e", 1) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "e", 1) == 0) type = OSPF_AS_EXTERNAL_LSA; - else if (strncmp (argv[arg_base + 0], "opaque-l", 8) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-l", 8) == 0) type = OSPF_OPAQUE_LINK_LSA; - else if (strncmp (argv[arg_base + 0], "opaque-ar", 9) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-ar", 9) == 0) type = OSPF_OPAQUE_AREA_LSA; - else if (strncmp (argv[arg_base + 0], "opaque-as", 9) == 0) + else if (strncmp (argv[arg_base + idx_type]->text, "opaque-as", 9) == 0) type = OSPF_OPAQUE_AS_LSA; else return CMD_WARNING; /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ - if (strncmp (argv[arg_base + 1], "s", 1) == 0) + if (strncmp (argv[arg_base + 5]->text, "s", 1) == 0) adv_router = ospf->router_id; else { - ret = inet_aton (argv[arg_base + 1], &adv_router); + ret = inet_aton (argv[arg_base + 6]->arg, &adv_router); if (!ret) return CMD_WARNING; } @@ -6035,20 +5802,9 @@ show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Self-originated link states\n" - * - */ DEFUN (show_ip_ospf_database_type_adv_router, show_ip_ospf_database_type_adv_router_cmd, - "show ip ospf database adv-router A.B.C.D", + "show ip ospf database ", SHOW_STR IP_STR "OSPF information\n" @@ -6065,22 +5821,9 @@ DEFUN (show_ip_ospf_database_type_adv_router, return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 0, argc, argv)); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)", - * SHOW_STR - * IP_STR - * "OSPF information\n" - * "Instance ID\n" - * "Database summary\n" - * OSPF_LSA_TYPES_DESC - * "Self-originated link states\n" - * - */ DEFUN (show_ip_ospf_instance_database_type_adv_router, show_ip_ospf_instance_database_type_adv_router_cmd, - "show ip ospf (1-65535) database adv-router A.B.C.D", + "show ip ospf (1-65535) database ", SHOW_STR IP_STR "OSPF information\n" @@ -6102,26 +5845,15 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv)); } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf authentication (null|message-digest)", - * "IP Information\n" - * "OSPF interface commands\n" - * "Enable authentication on this interface\n" - * "Use null authentication\n" - * "Use message-digest authentication\n" - * - */ DEFUN (ip_ospf_authentication_args, ip_ospf_authentication_args_addr_cmd, - "ip ospf authentication A.B.C.D", + "ip ospf authentication [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Enable authentication on this interface\n" "Use null authentication\n" "Use message-digest authentication\n" - "Address of interface") + "Address of interface\n") { int idx_encryption = 3; int idx_ipv4 = 4; @@ -6133,7 +5865,7 @@ DEFUN (ip_ospf_authentication_args, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6167,18 +5899,9 @@ DEFUN (ip_ospf_authentication_args, return CMD_WARNING; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf authentication", - * "IP Information\n" - * "OSPF interface commands\n" - * "Enable authentication on this interface\n" - * - */ DEFUN (ip_ospf_authentication, ip_ospf_authentication_addr_cmd, - "ip ospf authentication A.B.C.D", + "ip ospf authentication [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Enable authentication on this interface\n" @@ -6193,7 +5916,7 @@ DEFUN (ip_ospf_authentication, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 1) + if (argc == 4) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6213,21 +5936,9 @@ DEFUN (ip_ospf_authentication, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf authentication (null|message-digest)", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Enable authentication on this interface\n" - * "Use null authentication\n" - * "Use message-digest authentication\n" - * - */ DEFUN (no_ip_ospf_authentication_args, no_ip_ospf_authentication_args_addr_cmd, - "no ip ospf authentication A.B.C.D", + "no ip ospf authentication [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6248,7 +5959,7 @@ DEFUN (no_ip_ospf_authentication_args, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 6) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6320,19 +6031,9 @@ DEFUN (no_ip_ospf_authentication_args, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf authentication", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Enable authentication on this interface\n" - * - */ DEFUN (no_ip_ospf_authentication, no_ip_ospf_authentication_addr_cmd, - "no ip ospf authentication A.B.C.D", + "no ip ospf authentication [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6349,7 +6050,7 @@ DEFUN (no_ip_ospf_authentication, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 1) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6413,19 +6114,9 @@ DEFUN (no_ip_ospf_authentication, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf authentication-key AUTH_KEY", - * "IP Information\n" - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * "The OSPF password (key)" - * - */ DEFUN (ip_ospf_authentication_key, ip_ospf_authentication_key_addr_cmd, - "ip ospf authentication-key AUTH_KEY A.B.C.D", + "ip ospf authentication-key AUTH_KEY [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Authentication password (key)\n" @@ -6441,9 +6132,9 @@ DEFUN (ip_ospf_authentication_key, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 5) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6456,58 +6147,36 @@ DEFUN (ip_ospf_authentication_key, } memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy ((char *) params->auth_simple, argv[idx_ipv4]->arg, OSPF_AUTH_SIMPLE_SIZE); + strncpy ((char *) params->auth_simple, argv[3]->arg, OSPF_AUTH_SIMPLE_SIZE); SET_IF_PARAM (params, auth_simple); return CMD_SUCCESS; } -ALIAS_HIDDEN (ip_ospf_authentication_key, +DEFUN_HIDDEN (ospf_authentication_key, ospf_authentication_key_cmd, "ospf authentication-key AUTH_KEY", "OSPF interface commands\n" "Authentication password (key)\n" "The OSPF password (key)") +{ + struct interface *ifp; + struct ospf_if_params *params; -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf authentication-key AUTH_KEY A.B.C.D", - * NO_STR - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * "The OSPF password (key)\n" - * "Address of interface" - * - * "no ospf authentication-key AUTH_KEY", - * NO_STR - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * "The OSPF password (key)\n" - * - * "no ip ospf authentication-key", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * - * "no ip ospf authentication-key AUTH_KEY", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * - * "no ospf authentication-key", - * NO_STR - * "OSPF interface commands\n" - * "Authentication password (key)\n" - * - */ -DEFUN (no_ip_ospf_authentication_key, - no_ip_ospf_authentication_key_authkey_addr_cmd, - "no ip ospf authentication-key AUTH_KEY A.B.C.D", + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); + strncpy ((char *) params->auth_simple, argv[2]->arg, OSPF_AUTH_SIMPLE_SIZE); + SET_IF_PARAM (params, auth_simple); + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_authentication_key, + no_ospf_authentication_key_authkey_addr_cmd, + "no ospf authentication-key [AUTH_KEY [A.B.C.D]]", NO_STR - "IP Information\n" "OSPF interface commands\n" "Authentication password (key)\n" "The OSPF password (key)") @@ -6520,9 +6189,9 @@ DEFUN (no_ip_ospf_authentication_key, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 5) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6547,25 +6216,53 @@ DEFUN (no_ip_ospf_authentication_key, return CMD_SUCCESS; } +DEFUN (no_ip_ospf_authentication_key, + no_ip_ospf_authentication_key_authkey_addr_cmd, + "no ip ospf authentication-key [AUTH_KEY [A.B.C.D]]", + NO_STR + "IP Information\n" + "OSPF interface commands\n" + "Authentication password (key)\n" + "The OSPF password (key)") +{ + struct interface *ifp; + struct in_addr addr; + struct ospf_if_params *params; + int ret; + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + if (argc == 6) + { + ret = inet_aton(argv[5]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + params = ospf_lookup_if_params (ifp, addr); + if (params == NULL) + return CMD_SUCCESS; + } + memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); + UNSET_IF_PARAM (params, auth_simple); + + if (params != IF_DEF_PARAMS (ifp)) + { + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf message-digest-key <1-255> md5 KEY", - * "IP Information\n" - * "OSPF interface commands\n" - * "Message digest authentication password (key)\n" - * "Key ID\n" - * "Use MD5 algorithm\n" - * "The OSPF password (key)" - * - */ DEFUN (ip_ospf_message_digest_key, ip_ospf_message_digest_key_addr_cmd, - "ip ospf message-digest-key (1-255) md5 KEY A.B.C.D", + "ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Message digest authentication password (key)\n" @@ -6586,9 +6283,9 @@ DEFUN (ip_ospf_message_digest_key, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 3) + if (argc == 7) { - ret = inet_aton(argv[2], &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6619,7 +6316,7 @@ DEFUN (ip_ospf_message_digest_key, } -ALIAS_HIDDEN (ip_ospf_message_digest_key, +DEFUN_HIDDEN (ospf_message_digest_key, ospf_message_digest_key_cmd, "ospf message-digest-key <1-255> md5 KEY", "OSPF interface commands\n" @@ -6627,22 +6324,36 @@ ALIAS_HIDDEN (ip_ospf_message_digest_key, "Key ID\n" "Use MD5 algorithm\n" "The OSPF password (key)") +{ + int idx_number = 2; + struct interface *ifp; + struct crypt_key *ck; + u_char key_id; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + key_id = strtol (argv[idx_number]->arg, NULL, 10); + if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) + { + vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); + return CMD_WARNING; + } + + ck = ospf_crypt_key_new (); + ck->key_id = (u_char) key_id; + memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); + strncpy ((char *) ck->auth_key, argv[idx_number]->arg, OSPF_AUTH_MD5_SIZE); + + ospf_crypt_key_add (params->auth_crypt, ck); + SET_IF_PARAM (params, auth_crypt); + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf message-digest-key <1-255> md5 KEY", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Message digest authentication password (key)\n" - * "Key ID\n" - * "Use MD5 algorithm\n" - * "The OSPF password (key)" - * - */ DEFUN (no_ip_ospf_message_digest_key_md5, no_ip_ospf_message_digest_key_md5_addr_cmd, - "no ip ospf message-digest-key (1-255) md5 KEY A.B.C.D", + "no ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6663,9 +6374,9 @@ DEFUN (no_ip_ospf_message_digest_key_md5, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 3) + if (argc == 8) { - ret = inet_aton(argv[2], &addr); + ret = inet_aton(argv[7]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6697,46 +6408,28 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf message-digest-key <1-255>", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Message digest authentication password (key)\n" - * "Key ID\n" - * - * "no ospf message-digest-key <1-255>", - * NO_STR - * "OSPF interface commands\n" - * "Message digest authentication password (key)\n" - * "Key ID\n" - * - */ -DEFUN (no_ip_ospf_message_digest_key, - no_ip_ospf_message_digest_key_addr_cmd, - "no ip ospf message-digest-key (1-255) A.B.C.D", +DEFUN (no_ospf_message_digest_key, + no_ospf_message_digest_key_addr_cmd, + "no ospf message-digest-key (1-255) [A.B.C.D]", NO_STR - "IP Information\n" "OSPF interface commands\n" "Message digest authentication password (key)\n" "Key ID\n" "Address of interface") { - int idx_number = 4; - int idx_ipv4 = 5; + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp; struct crypt_key *ck; int key_id; struct in_addr addr; int ret; struct ospf_if_params *params; - + ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6766,24 +6459,69 @@ DEFUN (no_ip_ospf_message_digest_key, ospf_free_if_params (ifp, addr); ospf_if_update_params (ifp, addr); } - + return CMD_SUCCESS; } - +DEFUN (no_ip_ospf_message_digest_key, + no_ip_ospf_message_digest_key_addr_cmd, + "no ip ospf message-digest-key (1-255) [A.B.C.D]", + NO_STR + "IP Information\n" + "OSPF interface commands\n" + "Message digest authentication password (key)\n" + "Key ID\n" + "Address of interface") +{ + int idx_number = 4; + int idx_ipv4 = 5; + struct interface *ifp; + struct crypt_key *ck; + int key_id; + struct in_addr addr; + int ret; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + if (argc == 6) + { + ret = inet_aton(argv[idx_ipv4]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + params = ospf_lookup_if_params (ifp, addr); + if (params == NULL) + return CMD_SUCCESS; + } + + key_id = strtol (argv[idx_number]->arg, NULL, 10); + ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); + if (ck == NULL) + { + vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); + return CMD_WARNING; + } + + ospf_crypt_key_delete (params->auth_crypt, key_id); + + if (params != IF_DEF_PARAMS (ifp)) + { + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf cost <1-65535>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Interface cost\n" - * "Cost" - * - */ DEFUN (ip_ospf_cost, ip_ospf_cost_u32_inet4_cmd, - "ip ospf cost (1-65535) A.B.C.D", + "ip ospf cost (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Interface cost\n" @@ -6797,7 +6535,7 @@ DEFUN (ip_ospf_cost, struct in_addr addr; int ret; struct ospf_if_params *params; - + params = IF_DEF_PARAMS (ifp); cost = strtol (argv[idx_number]->arg, NULL, 10); @@ -6809,7 +6547,7 @@ DEFUN (ip_ospf_cost, return CMD_WARNING; } - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6831,45 +6569,103 @@ DEFUN (ip_ospf_cost, return CMD_SUCCESS; } - -ALIAS_HIDDEN (ip_ospf_cost, - ospf_cost_u32_cmd, - "ospf cost <1-65535>", - "OSPF interface commands\n" - "Interface cost\n" - "Cost") - -ALIAS_HIDDEN (ip_ospf_cost, +DEFUN_HIDDEN (ospf_cost, ospf_cost_u32_inet4_cmd, "ospf cost <1-65535> A.B.C.D", "OSPF interface commands\n" "Interface cost\n" "Cost\n" "Address of interface") +{ + int idx_number = 2; + int idx_ipv4 = 3; + struct interface *ifp = vty->index; + u_int32_t cost; + struct in_addr addr; + int ret; + struct ospf_if_params *params; + + params = IF_DEF_PARAMS (ifp); + + cost = strtol (argv[idx_number]->arg, NULL, 10); + + /* cost range is <1-65535>. */ + if (cost < 1 || cost > 65535) + { + vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (argc == 5) + { + ret = inet_aton(argv[idx_ipv4]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + params = ospf_get_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + + SET_IF_PARAM (params, output_cost_cmd); + params->output_cost_cmd = cost; + + ospf_if_recalculate_output_cost (ifp); + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_cost, + no_ospf_cost_inet4_cmd, + "no ospf cost [A.B.C.D]", + NO_STR + "OSPF interface commands\n" + "Interface cost\n" + "Address of interface") +{ + int idx_ipv4 = 3; + struct interface *ifp = vty->index; + struct in_addr addr; + int ret; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + if (argc == 4) + { + ret = inet_aton(argv[idx_ipv4]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + params = ospf_lookup_if_params (ifp, addr); + if (params == NULL) + return CMD_SUCCESS; + } + + UNSET_IF_PARAM (params, output_cost_cmd); + + if (params != IF_DEF_PARAMS (ifp)) + { + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + + ospf_if_recalculate_output_cost (ifp); + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf cost A.B.C.D", - * NO_STR - * "OSPF interface commands\n" - * "Interface cost\n" - * "Address of interface" - * - * "no ospf cost", - * NO_STR - * "OSPF interface commands\n" - * "Interface cost\n" - * - * "no ip ospf cost", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interface cost\n" - * - */ DEFUN (no_ip_ospf_cost, no_ip_ospf_cost_inet4_cmd, - "no ip ospf cost A.B.C.D", + "no ip ospf cost [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -6881,11 +6677,11 @@ DEFUN (no_ip_ospf_cost, struct in_addr addr; int ret; struct ospf_if_params *params; - + ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 1) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -6913,43 +6709,17 @@ DEFUN (no_ip_ospf_cost, return CMD_SUCCESS; } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf cost <1-65535>", - * NO_STR - * "OSPF interface commands\n" - * "Interface cost\n" - * "Cost" - * - * "no ospf cost <1-65535> A.B.C.D", - * NO_STR - * "OSPF interface commands\n" - * "Interface cost\n" - * "Cost\n" - * "Address of interface" - * - * "no ip ospf cost <1-65535> A.B.C.D", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interface cost\n" - * "Cost\n" - * "Address of interface" - * - */ -DEFUN (no_ip_ospf_cost2, - no_ip_ospf_cost_u32_cmd, - "no ip ospf cost (1-65535)", +DEFUN (no_ospf_cost2, + no_ospf_cost_u32_cmd, + "no ospf cost [(1-65535) [A.B.C.D]]", NO_STR - "IP Information\n" "OSPF interface commands\n" "Interface cost\n" - "Cost") + "Cost\n" + "Address of interface\n") { - int idx_number = 4; + int idx_number = 3; + int idx_ipv4 = 4; struct interface *ifp = vty->index; struct in_addr addr; u_int32_t cost; @@ -6971,9 +6741,70 @@ DEFUN (no_ip_ospf_cost2, return CMD_WARNING; } - if (argc == 2) + if (argc == 5) { - ret = inet_aton(argv[1], &addr); + ret = inet_aton(argv[idx_ipv4]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + params = ospf_lookup_if_params (ifp, addr); + if (params == NULL) + return CMD_SUCCESS; + } + + UNSET_IF_PARAM (params, output_cost_cmd); + + if (params != IF_DEF_PARAMS (ifp)) + { + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + + ospf_if_recalculate_output_cost (ifp); + + return CMD_SUCCESS; +} + +DEFUN (no_ip_ospf_cost2, + no_ip_ospf_cost_u32_cmd, + "no ip ospf cost (1-65535) [A.B.C.D]", + NO_STR + "IP Information\n" + "OSPF interface commands\n" + "Interface cost\n" + "Cost\n" + "Address of interface\n") +{ + int idx_number = 4; + int idx_ipv4 = 5; + struct interface *ifp = vty->index; + struct in_addr addr; + u_int32_t cost; + int ret; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + /* According to the semantics we are mimicking "no ip ospf cost N" is + * always treated as "no ip ospf cost" regardless of the actual value + * of N already configured for the interface. Thus the first argument + * is always checked to be a number, but is ignored after that. + */ + cost = strtol (argv[idx_number]->arg, NULL, 10); + if (cost < 1 || cost > 65535) + { + vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (argc == 5) + { + ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7097,19 +6928,9 @@ ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf dead-interval <1-65535>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * "Seconds\n" - * - */ DEFUN (ip_ospf_dead_interval, ip_ospf_dead_interval_addr_cmd, - "ip ospf dead-interval (1-65535) A.B.C.D", + "ip ospf dead-interval (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" @@ -7118,34 +6939,28 @@ DEFUN (ip_ospf_dead_interval, { int idx_number = 3; int idx_ipv4 = 4; - if (argc == 2) + if (argc == 5) return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, argv[idx_ipv4]->arg, NULL); else return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL); } -ALIAS_HIDDEN (ip_ospf_dead_interval, +DEFUN_HIDDEN (ospf_dead_interval, ospf_dead_interval_cmd, "ospf dead-interval <1-65535>", "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" "Seconds\n") +{ + int idx_number = 2; + + return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL); +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf dead-interval minimal hello-multiplier <1-10>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * "Minimal 1s dead-interval with fast sub-second hellos\n" - * "Hello multiplier factor\n" - * "Number of Hellos to send each second\n" - * - */ DEFUN (ip_ospf_dead_interval_minimal, ip_ospf_dead_interval_minimal_addr_cmd, - "ip ospf dead-interval minimal hello-multiplier (1-10) A.B.C.D", + "ip ospf dead-interval minimal hello-multiplier (1-10) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" @@ -7156,56 +6971,37 @@ DEFUN (ip_ospf_dead_interval_minimal, { int idx_number = 5; int idx_ipv4 = 6; - if (argc == 2) + if (argc == 7) return ospf_vty_dead_interval_set (vty, NULL, argv[idx_ipv4]->arg, argv[idx_number]->arg); else return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg); } +DEFUN (no_ospf_dead_interval, + no_ospf_dead_interval_cmd, + "no ospf dead-interval", + NO_STR + "OSPF interface commands\n" + "Interval after which a neighbor is declared dead\n") +{ + struct interface *ifp = vty->index; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + UNSET_IF_PARAM (params, v_wait); + params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; + + UNSET_IF_PARAM (params, fast_hello); + params->fast_hello = OSPF_FAST_HELLO_DEFAULT; + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf dead-interval", - * NO_STR - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * - * "no ip ospf dead-interval minimal hello-multiplier <1-10>", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * "Minimal 1s dead-interval with fast sub-second hellos\n" - * "Hello multiplier factor\n" - * "Number of Hellos to send each second\n" - * - * "no ip ospf dead-interval <1-65535>", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * "Seconds\n" - * - * "no ip ospf dead-interval", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * - * "no ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Interval after which a neighbor is declared dead\n" - * "Minimal 1s dead-interval with fast sub-second hellos\n" - * "Hello multiplier factor\n" - * "Number of Hellos to send each second\n" - * "Address of interface\n" - * - */ DEFUN (no_ip_ospf_dead_interval, no_ip_ospf_dead_interval_addr_cmd, - "no ip ospf dead-interval (1-65535) A.B.C.D", + "no ip ospf dead-interval [[(1-65535)|] [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7213,7 +7009,7 @@ DEFUN (no_ip_ospf_dead_interval, "Seconds\n" "Address of interface") { - int idx_ipv4 = 5; + int idx_ipv4 = argc - 1; struct interface *ifp = vty->index; struct in_addr addr; int ret; @@ -7224,7 +7020,7 @@ DEFUN (no_ip_ospf_dead_interval, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argv[idx_ipv4]->type == IPV4_TKN) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7273,23 +7069,9 @@ DEFUN (no_ip_ospf_dead_interval, return CMD_SUCCESS; } - - - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf hello-interval <1-65535>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between HELLO packets\n" - * "Seconds\n" - * - */ DEFUN (ip_ospf_hello_interval, ip_ospf_hello_interval_addr_cmd, - "ip ospf hello-interval (1-65535) A.B.C.D", + "ip ospf hello-interval (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Time between HELLO packets\n" @@ -7315,7 +7097,7 @@ DEFUN (ip_ospf_hello_interval, return CMD_WARNING; } - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7336,38 +7118,38 @@ DEFUN (ip_ospf_hello_interval, } -ALIAS_HIDDEN (ip_ospf_hello_interval, +DEFUN_HIDDEN (ospf_hello_interval, ospf_hello_interval_cmd, "ospf hello-interval <1-65535>", "OSPF interface commands\n" "Time between HELLO packets\n" "Seconds\n") +{ + int idx_number = 2; + struct interface *ifp = vty->index; + u_int32_t seconds; + struct ospf_if_params *params; + + params = IF_DEF_PARAMS (ifp); + + seconds = strtol (argv[idx_number]->arg, NULL, 10); + + /* HelloInterval range is <1-65535>. */ + if (seconds < 1 || seconds > 65535) + { + vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + SET_IF_PARAM (params, v_hello); + params->v_hello = seconds; + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf hello-interval <1-65535>", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between HELLO packets\n" - * "Seconds\n" - * - * "no ip ospf hello-interval", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between HELLO packets\n" - * - * "no ospf hello-interval <1-65535>", - * NO_STR - * "OSPF interface commands\n" - * "Time between HELLO packets\n" - * "Seconds\n" - * - */ DEFUN (no_ip_ospf_hello_interval, no_ip_ospf_hello_interval_addr_cmd, - "no ip ospf hello-interval (1-65535) A.B.C.D", + "no [ip] ospf hello-interval [(1-65535) [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7384,7 +7166,10 @@ DEFUN (no_ip_ospf_hello_interval, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (strcmp (argv[1]->arg, "ip") == 0) + idx_ipv4 = 4; + + if (argc == idx_ipv4+1) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7469,7 +7254,7 @@ DEFUN (ip_ospf_network, return CMD_SUCCESS; } -ALIAS_HIDDEN (ip_ospf_network, +DEFUN_HIDDEN (ospf_network, ospf_network_cmd, "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", "OSPF interface commands\n" @@ -7478,42 +7263,62 @@ ALIAS_HIDDEN (ip_ospf_network, "Specify OSPF NBMA network\n" "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", - * NO_STR - * "OSPF interface commands\n" - * "Network type\n" - * "Specify OSPF broadcast multi-access network\n" - * "Specify OSPF NBMA network\n" - * "Specify OSPF point-to-multipoint network\n" - * "Specify OSPF point-to-point network\n" - * - * "no ospf network", - * NO_STR - * "OSPF interface commands\n" - * "Network type\n" - * - * "no ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Network type\n" - * "Specify OSPF broadcast multi-access network\n" - * "Specify OSPF NBMA network\n" - * "Specify OSPF point-to-multipoint network\n" - * "Specify OSPF point-to-point network\n" - * - */ -DEFUN (no_ip_ospf_network, - no_ip_ospf_network_cmd, - "no ip ospf network", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Network type\n") { + int idx_network = 2; + struct interface *ifp = vty->index; + int old_type = IF_DEF_PARAMS (ifp)->type; + struct route_node *rn; + + if (old_type == OSPF_IFTYPE_LOOPBACK) + { + vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (strncmp (argv[idx_network]->arg, "b", 1) == 0) + IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; + else if (strncmp (argv[idx_network]->arg, "n", 1) == 0) + IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; + else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0) + IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; + else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0) + IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; + + if (IF_DEF_PARAMS (ifp)->type == old_type) + return CMD_SUCCESS; + + SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); + + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) + { + struct ospf_interface *oi = rn->info; + + if (!oi) + continue; + + oi->type = IF_DEF_PARAMS (ifp)->type; + + if (oi->state > ISM_Down) + { + OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); + OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); + } + } + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_network, + no_ospf_network_cmd, + "no ospf network []", + NO_STR + "OSPF interface commands\n" + "Network type\n" + "Specify OSPF broadcast multi-access network\n" + "Specify OSPF NBMA network\n" + "Specify OSPF point-to-multipoint network\n" + "Specify OSPF point-to-point network\n") + { struct interface *ifp = vty->index; int old_type = IF_DEF_PARAMS (ifp)->type; struct route_node *rn; @@ -7529,9 +7334,9 @@ DEFUN (no_ip_ospf_network, if (!oi) continue; - + oi->type = IF_DEF_PARAMS (ifp)->type; - + if (oi->state > ISM_Down) { OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); @@ -7542,21 +7347,49 @@ DEFUN (no_ip_ospf_network, return CMD_SUCCESS; } +DEFUN (no_ip_ospf_network, + no_ip_ospf_network_cmd, + "no ip ospf network []", + NO_STR + "IP Information\n" + "OSPF interface commands\n" + "Network type\n" + "Specify OSPF broadcast multi-access network\n" + "Specify OSPF NBMA network\n" + "Specify OSPF point-to-multipoint network\n" + "Specify OSPF point-to-point network\n") + { + struct interface *ifp = vty->index; + int old_type = IF_DEF_PARAMS (ifp)->type; + struct route_node *rn; + IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); + if (IF_DEF_PARAMS (ifp)->type == old_type) + return CMD_SUCCESS; + + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) + { + struct ospf_interface *oi = rn->info; + + if (!oi) + continue; + + oi->type = IF_DEF_PARAMS (ifp)->type; + + if (oi->state > ISM_Down) + { + OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); + OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); + } + } + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf priority <0-255>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Router priority\n" - * "Priority\n" - * - */ DEFUN (ip_ospf_priority, ip_ospf_priority_addr_cmd, - "ip ospf priority (0-255) A.B.C.D", + "ip ospf priority (0-255) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Router priority\n" @@ -7571,11 +7404,11 @@ DEFUN (ip_ospf_priority, struct in_addr addr; int ret; struct ospf_if_params *params; - + params = IF_DEF_PARAMS (ifp); priority = strtol (argv[idx_number]->arg, NULL, 10); - + /* Router Priority range is <0-255>. */ if (priority < 0 || priority > 255) { @@ -7583,7 +7416,7 @@ DEFUN (ip_ospf_priority, return CMD_WARNING; } - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7596,10 +7429,116 @@ DEFUN (ip_ospf_priority, params = ospf_get_if_params (ifp, addr); ospf_if_update_params (ifp, addr); } - + SET_IF_PARAM (params, priority); params->priority = priority; + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) + { + struct ospf_interface *oi = rn->info; + + if (!oi) + continue; + + if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) + { + PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); + OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); + } + } + + return CMD_SUCCESS; +} + + +DEFUN_HIDDEN (ospf_priority, + ospf_priority_cmd, + "ospf priority <0-255>", + "OSPF interface commands\n" + "Router priority\n" + "Priority\n") +{ + int idx_number = 2; + struct interface *ifp = vty->index; + long priority; + struct route_node *rn; + struct ospf_if_params *params; + + params = IF_DEF_PARAMS (ifp); + + priority = strtol (argv[idx_number]->arg, NULL, 10); + + /* Router Priority range is <0-255>. */ + if (priority < 0 || priority > 255) + { + vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + SET_IF_PARAM (params, priority); + params->priority = priority; + + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) + { + struct ospf_interface *oi = rn->info; + + if (!oi) + continue; + + + if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) + { + PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); + OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); + } + } + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_priority, + no_ospf_priority_addr_cmd, + "no ospf priority [(0-255) [A.B.C.D]]", + NO_STR + "OSPF interface commands\n" + "Router priority\n" + "Priority\n" + "Address of interface") +{ + int idx_ipv4 = 4; + struct interface *ifp = vty->index; + struct route_node *rn; + struct in_addr addr; + int ret; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + if (argc == 5) + { + ret = inet_aton(argv[idx_ipv4]->arg, &addr); + if (!ret) + { + vty_out (vty, "Please specify interface address by A.B.C.D%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + params = ospf_lookup_if_params (ifp, addr); + if (params == NULL) + return CMD_SUCCESS; + } + + UNSET_IF_PARAM (params, priority); + params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; + + if (params != IF_DEF_PARAMS (ifp)) + { + ospf_free_if_params (ifp, addr); + ospf_if_update_params (ifp, addr); + } + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) { struct ospf_interface *oi = rn->info; @@ -7618,39 +7557,9 @@ DEFUN (ip_ospf_priority, return CMD_SUCCESS; } - -ALIAS_HIDDEN (ip_ospf_priority, - ospf_priority_cmd, - "ospf priority <0-255>", - "OSPF interface commands\n" - "Router priority\n" - "Priority\n") - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf priority", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Router priority\n" - * - * "no ip ospf priority <0-255>", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Router priority\n" - * "Priority\n" - * - * "no ospf priority <0-255>", - * NO_STR - * "OSPF interface commands\n" - * "Router priority\n" - * "Priority\n" - * - */ DEFUN (no_ip_ospf_priority, no_ip_ospf_priority_addr_cmd, - "no ip ospf priority (0-255) A.B.C.D", + "no ip ospf priority [(0-255) [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7668,7 +7577,7 @@ DEFUN (no_ip_ospf_priority, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 2) + if (argc == 6) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7711,21 +7620,9 @@ DEFUN (no_ip_ospf_priority, } - - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf retransmit-interval <3-65535>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between retransmitting lost link state advertisements\n" - * "Seconds\n" - * - */ DEFUN (ip_ospf_retransmit_interval, ip_ospf_retransmit_interval_addr_cmd, - "ip ospf retransmit-interval (3-65535) A.B.C.D", + "ip ospf retransmit-interval (3-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" @@ -7751,7 +7648,7 @@ DEFUN (ip_ospf_retransmit_interval, } - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7771,39 +7668,55 @@ DEFUN (ip_ospf_retransmit_interval, return CMD_SUCCESS; } - -ALIAS_HIDDEN (ip_ospf_retransmit_interval, +DEFUN_HIDDEN (ospf_retransmit_interval, ospf_retransmit_interval_cmd, "ospf retransmit-interval <3-65535>", "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" "Seconds\n") +{ + int idx_number = 2; + struct interface *ifp = vty->index; + u_int32_t seconds; + struct ospf_if_params *params; + + params = IF_DEF_PARAMS (ifp); + seconds = strtol (argv[idx_number]->arg, NULL, 10); + + /* Retransmit Interval range is <3-65535>. */ + if (seconds < 3 || seconds > 65535) + { + vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + SET_IF_PARAM (params, retransmit_interval); + params->retransmit_interval = seconds; + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_retransmit_interval, + no_ospf_retransmit_interval_cmd, + "no ospf retransmit-interval", + NO_STR + "OSPF interface commands\n" + "Time between retransmitting lost link state advertisements\n") +{ + struct interface *ifp = vty->index; + struct ospf_if_params *params; + + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + UNSET_IF_PARAM (params, retransmit_interval); + params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf retransmit-interval <3-65535> A.B.C.D", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between retransmitting lost link state advertisements\n" - * "Seconds\n" - * "Address of interface" - * - * "no ip ospf retransmit-interval", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Time between retransmitting lost link state advertisements\n" - * - * "no ospf retransmit-interval", - * NO_STR - * "OSPF interface commands\n" - * "Time between retransmitting lost link state advertisements\n" - * - */ DEFUN (no_ip_ospf_retransmit_interval, no_ip_ospf_retransmit_interval_addr_cmd, - "no ip ospf retransmit-interval A.B.C.D", + "no ip ospf retransmit-interval [<(3-65535 [A.B.C.D]|A.B.C.D>]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7819,14 +7732,14 @@ DEFUN (no_ip_ospf_retransmit_interval, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc >= 1) + if (argc >= 5) { - if (argc == 1) - addr_index = 0; + if (argc == 5) + addr_index = 4; else - addr_index = 1; + addr_index = 5; - ret = inet_aton(argv[addr_index], &addr); + ret = inet_aton(argv[addr_index]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -7852,42 +7765,9 @@ DEFUN (no_ip_ospf_retransmit_interval, } - - -DEFUN (no_ip_ospf_retransmit_interval_sec, - no_ip_ospf_retransmit_interval_sec_cmd, - "no ip ospf retransmit-interval (3-65535)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n" - "Seconds\n") -{ - struct interface *ifp = vty->index; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - UNSET_IF_PARAM (params, retransmit_interval); - params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; - - return CMD_SUCCESS; -} - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf transmit-delay <1-65535>", - * "IP Information\n" - * "OSPF interface commands\n" - * "Link state transmit delay\n" - * "Seconds\n" - * - */ DEFUN (ip_ospf_transmit_delay, ip_ospf_transmit_delay_addr_cmd, - "ip ospf transmit-delay (1-65535) A.B.C.D", + "ip ospf transmit-delay (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Link state transmit delay\n" @@ -7912,7 +7792,7 @@ DEFUN (ip_ospf_transmit_delay, return CMD_WARNING; } - if (argc == 2) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -7933,38 +7813,37 @@ DEFUN (ip_ospf_transmit_delay, } -ALIAS_HIDDEN (ip_ospf_transmit_delay, +DEFUN_HIDDEN (ospf_transmit_delay, ospf_transmit_delay_cmd, "ospf transmit-delay <1-65535>", "OSPF interface commands\n" "Link state transmit delay\n" "Seconds\n") +{ + int idx_number = 2; + struct interface *ifp = vty->index; + u_int32_t seconds; + struct ospf_if_params *params; + + params = IF_DEF_PARAMS (ifp); + seconds = strtol (argv[idx_number]->arg, NULL, 10); + + /* Transmit Delay range is <1-65535>. */ + if (seconds < 1 || seconds > 65535) + { + vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + SET_IF_PARAM (params, transmit_delay); + params->transmit_delay = seconds; + + return CMD_SUCCESS; +} -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ospf transmit-delay", - * NO_STR - * "OSPF interface commands\n" - * "Link state transmit delay\n" - * - * "no ip ospf transmit-delay", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Link state transmit delay\n" - * - * "no ip ospf transmit-delay <1-65535> A.B.C.D", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Link state transmit delay\n" - * "Seconds\n" - * "Address of interface" - * - */ DEFUN (no_ip_ospf_transmit_delay, no_ip_ospf_transmit_delay_addr_cmd, - "no ip ospf transmit-delay A.B.C.D", + "no ip ospf transmit-delay []", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7980,14 +7859,14 @@ DEFUN (no_ip_ospf_transmit_delay, ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc >= 1) + if (argc >= 5) { - if (argc == 1) - addr_index = 0; + if (argc == 5) + addr_index = 4; else - addr_index = 1; + addr_index = 5; - ret = inet_aton(argv[addr_index], &addr); + ret = inet_aton(argv[addr_index]->arg, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -8013,7 +7892,24 @@ DEFUN (no_ip_ospf_transmit_delay, } +DEFUN (no_ospf_transmit_delay, + no_ospf_transmit_delay_cmd, + "no ospf transmit-delay", + NO_STR + "OSPF interface commands\n" + "Link state transmit delay\n") +{ + struct interface *ifp = vty->index; + struct ospf_if_params *params; + ifp = vty->index; + params = IF_DEF_PARAMS (ifp); + + UNSET_IF_PARAM (params, transmit_delay); + params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; + + return CMD_SUCCESS; +} DEFUN (no_ip_ospf_transmit_delay_sec, no_ip_ospf_transmit_delay_sec_cmd, @@ -8037,27 +7933,17 @@ DEFUN (no_ip_ospf_transmit_delay_sec, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", - * "IP Information\n" - * "OSPF interface commands\n" - * "Instance ID\n" - * "Enable OSPF on this interface\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * - */ DEFUN (ip_ospf_area, ip_ospf_area_cmd, - "ip ospf area ", + "ip ospf [(1-65535)]area ", "IP Information\n" "OSPF interface commands\n" + "Instance ID\n" "Enable OSPF on this interface\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { - int idx_ipv4_number = 3; + int idx_ipv4_number = 2; struct interface *ifp = vty->index; int format, ret; struct in_addr area_id; @@ -8066,7 +7952,7 @@ DEFUN (ip_ospf_area, struct route_node *rn; u_short instance = 0; - if (argc == 2) + if (argc == 5) VTY_GET_INTEGER ("Instance", instance, argv[idx_ipv4_number]->arg); ospf = ospf_lookup_instance (instance); @@ -8082,7 +7968,7 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } - ret = ospf_str2area_id (argv[instance ? 1 : 0], &area_id, &format); + ret = ospf_str2area_id (argv[instance ? 4 : 3]->arg, &area_id, &format); if (ret < 0) { vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s", @@ -8120,25 +8006,15 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf area (A.B.C.D|<0-4294967295>)", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Disable OSPF on this interface\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * - */ DEFUN (no_ip_ospf_area, no_ip_ospf_area_cmd, - "no ip ospf area", + "no ip ospf area []", NO_STR "IP Information\n" "OSPF interface commands\n" - "Disable OSPF on this interface\n") + "Disable OSPF on this interface\n" + "OSPF area ID in IP address format\n" + "OSPF area ID as a decimal value\n") { struct interface *ifp = vty->index; struct ospf *ospf; @@ -8160,22 +8036,9 @@ DEFUN (no_ip_ospf_area, return CMD_SUCCESS; } - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)", - * NO_STR - * "IP Information\n" - * "OSPF interface commands\n" - * "Instance ID\n" - * "Disable OSPF on this interface\n" - * "OSPF area ID in IP address format\n" - * "OSPF area ID as a decimal value\n" - * - */ DEFUN (no_ip_ospf_instance_area, no_ip_ospf_instance_area_cmd, - "no ip ospf (1-65535) area", + "no ip ospf (1-65535) area []", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -8205,7 +8068,6 @@ DEFUN (no_ip_ospf_instance_area, return CMD_SUCCESS; } - DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, "redistribute [metric (0-16777214)|metric-type <1|2>|route-map WORD]", @@ -8242,19 +8104,19 @@ DEFUN (ospf_redistribute_source, return CMD_WARNING; /* Get metric value. */ - if (argv[idx_redist_param]->arg != NULL) - if (!str2metric (argv[idx_redist_param]->arg, &metric)) + if (strcmp (argv[idx_redist_param]->arg, "metric") == 0) + if (!str2metric (argv[idx_redist_param+1]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ - if (argv[2] != NULL) - if (!str2metric_type (argv[2], &type)) + if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0) + if (!str2metric_type (argv[idx_redist_param+1]->arg, &type)) return CMD_WARNING; red = ospf_redist_add(ospf, source, 0); - if (argv[3] != NULL) - ospf_routemap_set (red, argv[3]); + if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0) + ospf_routemap_set (red, argv[idx_redist_param+1]->arg); else ospf_routemap_unset (red); @@ -8347,18 +8209,19 @@ DEFUN (ospf_redistribute_instance_source, } /* Get metric value. */ - if (argv[idx_redist_param]->arg != NULL) - if (!str2metric (argv[idx_redist_param]->arg, &metric)) + if (strcmp (argv[idx_redist_param]->arg, "metric") == 0) + if (!str2metric (argv[idx_redist_param+1]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ - if (argv[3] != NULL) - if (!str2metric_type (argv[3], &type)) + if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0) + if (!str2metric_type (argv[idx_redist_param+1]->arg, &type)) return CMD_WARNING; red = ospf_redist_add(ospf, source, instance); - if (argv[4] != NULL) - ospf_routemap_set (red, argv[4]); + + if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0) + ospf_routemap_set (red, argv[idx_redist_param+1]->arg); else ospf_routemap_unset (red); @@ -8501,17 +8364,17 @@ DEFUN (ospf_default_information_originate, red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); /* Get metric value. */ - if (argv[1] != NULL) - if (!str2metric (argv[1], &metric)) + if (strcmp (argv[idx_redist_param]->arg, "metric") == 0) + if (!str2metric (argv[idx_redist_param+1]->arg, &metric)) return CMD_WARNING; /* Get metric type. */ - if (argv[2] != NULL) - if (!str2metric_type (argv[2], &type)) + if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0) + if (!str2metric_type (argv[idx_redist_param+1]->arg, &type)) return CMD_WARNING; - if (argv[3] != NULL) - ospf_routemap_set (red, argv[3]); + if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0) + ospf_routemap_set (red, argv[idx_redist_param+1]->arg); else ospf_routemap_unset (red); @@ -8583,19 +8446,12 @@ DEFUN (ospf_default_metric, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no default-metric <0-16777214>", - * NO_STR - * "Set metric of redistributed routes\n" - * "Default metric\n" - * - */ DEFUN (no_ospf_default_metric, no_ospf_default_metric_cmd, - "no default-metric", + "no default-metric [(0-16777214)]", NO_STR - "Set metric of redistributed routes\n") + "Set metric of redistributed routes\n" + "Default metric\n") { struct ospf *ospf = vty->index; @@ -8715,14 +8571,14 @@ DEFUN (ospf_distance_ospf, return CMD_WARNING; } - if (argv[idx_area_distance]->arg != NULL) - ospf->distance_intra = atoi(argv[idx_area_distance]->arg); + if (strcmp (argv[idx_area_distance]->text, "intra") == 0) + ospf->distance_intra = atoi(argv[idx_area_distance+1]->arg); - if (argv[1] != NULL) - ospf->distance_inter = atoi(argv[1]); + if (strcmp (argv[idx_area_distance]->text, "inter") == 0) + ospf->distance_inter = atoi(argv[idx_area_distance+1]->arg); - if (argv[2] != NULL) - ospf->distance_external = atoi(argv[2]); + if (strcmp (argv[idx_area_distance]->text, "external") == 0) + ospf->distance_external = atoi(argv[idx_area_distance+1]->arg); return CMD_SUCCESS; } @@ -8809,17 +8665,9 @@ DEFUN (no_ospf_distance_source_access_list, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "ip ospf mtu-ignore", - * "IP Information\n" - * "OSPF interface commands\n" - * "Disable mtu mismatch detection\n" - * - */ DEFUN (ip_ospf_mtu_ignore, ip_ospf_mtu_ignore_addr_cmd, - "ip ospf mtu-ignore A.B.C.D", + "ip ospf mtu-ignore [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Disable mtu mismatch detection\n" @@ -8833,7 +8681,7 @@ DEFUN (ip_ospf_mtu_ignore, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - if (argc == 1) + if (argc == 4) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -8860,19 +8708,9 @@ DEFUN (ip_ospf_mtu_ignore, return CMD_SUCCESS; } - - -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ip ospf mtu-ignore", - * "IP Information\n" - * "OSPF interface commands\n" - * "Disable mtu mismatch detection\n" - * - */ DEFUN (no_ip_ospf_mtu_ignore, no_ip_ospf_mtu_ignore_addr_cmd, - "no ip ospf mtu-ignore A.B.C.D", + "no ip ospf mtu-ignore [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Disable mtu mismatch detection\n" @@ -8886,7 +8724,7 @@ DEFUN (no_ip_ospf_mtu_ignore, struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - if (argc == 1) + if (argc == 5) { ret = inet_aton(argv[idx_ipv4]->arg, &addr); if (!ret) @@ -9001,18 +8839,9 @@ DEFUN (ospf_max_metric_router_lsa_startup, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no max-metric router-lsa on-startup", - * NO_STR - * "OSPF maximum / infinite-distance metric\n" - * "Advertise own Router-LSA with infinite distance (stub router)\n" - * "Automatically advertise stub Router-LSA on startup of OSPF\n" - * - */ DEFUN (no_ospf_max_metric_router_lsa_startup, no_ospf_max_metric_router_lsa_startup_cmd, - "no max-metric router-lsa on-startup (5-86400)", + "no max-metric router-lsa on-startup [(5-86400)]", NO_STR "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" @@ -9072,21 +8901,9 @@ DEFUN (ospf_max_metric_router_lsa_shutdown, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no max-metric router-lsa on-shutdown", - * NO_STR - * "OSPF maximum / infinite-distance metric\n" - * "Advertise own Router-LSA with infinite distance (stub router)\n" - * "Advertise stub-router prior to full shutdown of OSPF\n"); - * - * static void - * config_write_stub_router (struct vty *vty, struct ospf *ospf - * - */ DEFUN (no_ospf_max_metric_router_lsa_shutdown, no_ospf_max_metric_router_lsa_shutdown_cmd, - "no max-metric router-lsa on-shutdown (5-100)", + "no max-metric router-lsa on-shutdown [(5-100)]", NO_STR "OSPF maximum / infinite-distance metric\n" "Advertise own Router-LSA with infinite distance (stub router)\n" @@ -10172,13 +9989,17 @@ ospf_vty_show_init (void) /* "show ip ospf database" commands. */ install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); install_element (VIEW_NODE, &show_ip_ospf_database_cmd); + install_element (VIEW_NODE, &show_ip_ospf_database_max_cmd); install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); + install_element (ENABLE_NODE, &show_ip_ospf_database_max_cmd); install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd); install_element (VIEW_NODE, &show_ip_ospf_instance_database_cmd); + install_element (VIEW_NODE, &show_ip_ospf_instance_database_max_cmd); install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd); install_element (ENABLE_NODE, &show_ip_ospf_instance_database_cmd); + install_element (ENABLE_NODE, &show_ip_ospf_instance_database_max_cmd); /* "show ip ospf interface" commands. */ install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); @@ -10261,16 +10082,20 @@ ospf_vty_if_init (void) install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_authkey_addr_cmd); + install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_addr_cmd); /* "ip ospf message-digest-key" commands. */ install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd); + install_element (INTERFACE_NODE, &no_ospf_message_digest_key_addr_cmd); /* "ip ospf cost" commands. */ install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); + install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); + install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); /* "ip ospf mtu-ignore" commands. */ install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); @@ -10288,20 +10113,23 @@ ospf_vty_if_init (void) /* "ip ospf network" commands. */ install_element (INTERFACE_NODE, &ip_ospf_network_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); + install_element (INTERFACE_NODE, &no_ospf_network_cmd); /* "ip ospf priority" commands. */ install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); + install_element (INTERFACE_NODE, &no_ospf_priority_addr_cmd); /* "ip ospf retransmit-interval" commands. */ install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_sec_cmd); + install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); /* "ip ospf transmit-delay" commands. */ install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_cmd); + install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); /* "ip ospf area" commands. */ install_element (INTERFACE_NODE, &ip_ospf_area_cmd); @@ -10311,7 +10139,6 @@ ospf_vty_if_init (void) /* These commands are compatibitliy for previous version. */ install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); - install_element (INTERFACE_NODE, &ospf_cost_u32_cmd); install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); @@ -10381,14 +10208,14 @@ DEFUN (clear_ip_ospf_interface, struct interface *ifp; struct listnode *node; - if (argc == 0) /* Clear all the ospfv2 interfaces. */ + if (argc == 4) /* Clear all the ospfv2 interfaces. */ { for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) ospf_interface_clear(ifp); } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_ifname]->text)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else ospf_interface_clear(ifp); @@ -10440,6 +10267,8 @@ ospf_vty_init (void) /* "ospf rfc1583-compatible" commands. */ install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); + install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); + install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); /* "network area" commands. */ install_element (OSPF_NODE, &ospf_network_area_cmd); @@ -10452,6 +10281,7 @@ ospf_vty_init (void) /* "area range" commands. */ install_element (OSPF_NODE, &ospf_area_range_cmd); + install_element (OSPF_NODE, &ospf_area_range_cost_cmd); install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); install_element (OSPF_NODE, &no_ospf_area_range_cmd); install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); @@ -10459,7 +10289,9 @@ ospf_vty_init (void) /* "area virtual-link" commands. */ install_element (OSPF_NODE, &ospf_area_vlink_cmd); + install_element (OSPF_NODE, &ospf_area_vlink_intervals_cmd); install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); + install_element (OSPF_NODE, &no_ospf_area_vlink_intervals_cmd); @@ -10530,10 +10362,13 @@ ospf_vty_init (void) install_element (OSPF_NODE, &ospf_neighbor_cmd); install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); install_element (OSPF_NODE, &no_ospf_neighbor_cmd); + install_element (OSPF_NODE, &no_ospf_neighbor_poll_cmd); /* write multiplier commands */ install_element (OSPF_NODE, &ospf_write_multiplier_cmd); + install_element (OSPF_NODE, &write_multiplier_cmd); install_element (OSPF_NODE, &no_ospf_write_multiplier_cmd); + install_element (OSPF_NODE, &no_write_multiplier_cmd); /* Init interface related vty commands. */ ospf_vty_if_init (); From 6de69f83055163cfc4015d609de3750af8fbff52 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 15:31:48 +0000 Subject: [PATCH 186/280] all: added some missing <>s within []s Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 4 ++-- bgpd/bgp_routemap.c | 4 ++-- isisd/isis_redist.c | 2 +- lib/command.c | 14 +++++++------- ospf6d/ospf6_area.c | 2 +- ospf6d/ospf6_lsa.c | 4 ++-- ospf6d/ospf6_neighbor.c | 6 +++--- ospf6d/ospf6_top.c | 2 +- ospf6d/ospf6d.c | 2 +- ospfd/ospf_dump.c | 26 +++++++++++++------------- ripd/rip_interface.c | 4 ++-- tools/argv_translator.py | 23 ++++++++++++++++++++--- zebra/debug.c | 4 ++-- zebra/zebra_vty.c | 33 +++++++++++++++++++++------------ 14 files changed, 78 insertions(+), 52 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index eca6a4a7b3..bb1849e4b4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,7 +7732,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", SHOW_STR IP_STR BGP_STR @@ -7857,7 +7857,7 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [bestpath|multipath] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [] [json]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e08b43bc17..d823b962b8 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3091,7 +3091,7 @@ DEFUN (match_ip_next_hop, DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop [<(1-199)|(1300-2699)|WORD]", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR @@ -3158,7 +3158,7 @@ DEFUN (match_ip_route_source, DEFUN (no_match_ip_route_source, no_match_ip_route_source_cmd, - "no match ip route-source [(1-199)|(1300-2699)|WORD]", + "no match ip route-source [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index e330a10170..384eb3572b 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -539,7 +539,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute [metric (0-16777215)|route-map WORD]", + "redistribute []", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" diff --git a/lib/command.c b/lib/command.c index 95d69cdbf6..c98e2562db 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1696,7 +1696,7 @@ DEFUN (show_logging, DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log stdout []", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1718,7 +1718,7 @@ DEFUN (config_log_stdout, DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, - "no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log stdout []", NO_STR "Logging control\n" "Cancel logging to stdout\n" @@ -1730,7 +1730,7 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, - "log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log monitor []", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1752,7 +1752,7 @@ DEFUN (config_log_monitor, DEFUN (no_config_log_monitor, no_config_log_monitor_cmd, - "no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log monitor []", NO_STR "Logging control\n" "Disable terminal line (monitor) logging\n" @@ -1818,7 +1818,7 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) DEFUN (config_log_file, config_log_file_cmd, - "log file FILENAME [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log file FILENAME []", "Logging control\n" "Logging to file\n" "Logging filename\n" @@ -1859,7 +1859,7 @@ DEFUN (no_config_log_file, DEFUN (config_log_syslog, config_log_syslog_cmd, - "log syslog [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log syslog []", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) @@ -1897,7 +1897,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [] [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log syslog [] []", NO_STR "Logging control\n" "Cancel logging to syslog\n" diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 766562a828..45e7f720f3 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -435,7 +435,7 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) DEFUN (area_range, area_range_cmd, - "area ]", + "area range X:X::X:X/M []", "OSPF area parameters\n" OSPF6_AREA_ID_STR "Configured address range\n" diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index c65cae3927..87e50bcf86 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -818,7 +818,7 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) DEFUN (debug_ospf6_lsa_type, debug_ospf6_lsa_hex_cmd, - "debug ospf6 lsa [originate|examine|flooding]", + "debug ospf6 lsa []", DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" @@ -861,7 +861,7 @@ DEFUN (debug_ospf6_lsa_type, DEFUN (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_cmd, - "no debug ospf6 lsa [originate|examine|flooding]", + "no debug ospf6 lsa []", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 1c55175d20..91c7f7c62c 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -829,7 +829,7 @@ ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, - "show ipv6 ospf6 neighbor [detail|drchoice]", + "show ipv6 ospf6 neighbor []", SHOW_STR IP6_STR OSPF6_STR @@ -918,7 +918,7 @@ ospf6_neighbor_init (void) DEFUN (debug_ospf6_neighbor, debug_ospf6_neighbor_cmd, - "debug ospf6 neighbor [state|event]", + "debug ospf6 neighbor []", DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n" @@ -945,7 +945,7 @@ DEFUN (debug_ospf6_neighbor, DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, - "no debug ospf6 neighbor [state|event]", + "no debug ospf6 neighbor []", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 58301b1c0f..ccffa131a6 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -768,7 +768,7 @@ DEFUN (show_ipv6_ospf6, DEFUN (show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, - "show ipv6 ospf6 route [intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary]", + "show ipv6 ospf6 route []", SHOW_STR IP6_STR OSPF6_STR diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 785c9361c0..3e2db84a67 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -171,7 +171,7 @@ parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv) DEFUN (show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, - "show ipv6 ospf6 database [detail|dump|internal]", + "show ipv6 ospf6 database []", SHOW_STR IPV6_STR OSPF6_STR diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index de5c918280..91fde066f1 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -982,7 +982,7 @@ DEFUN (no_debug_ospf_ism, if (inst) // user passed instance ID { - if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10))) + if (!ospf_lookup_instance (strtoul (inst, NULL, 10))) return CMD_SUCCESS; } @@ -1057,7 +1057,7 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEFUN (debug_ospf_nsm, debug_ospf_nsm_cmd, - "debug ospf nsm [status|events|timers]", + "debug ospf nsm []", DEBUG_STR OSPF_STR "OSPF Neighbor State Machine\n" @@ -1070,7 +1070,7 @@ DEFUN (debug_ospf_nsm, DEFUN (debug_ospf_instance_nsm, debug_ospf_instance_nsm_cmd, - "debug ospf (1-65535) nsm [status|events|timers]", + "debug ospf (1-65535) nsm []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1128,7 +1128,7 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEFUN (no_debug_ospf_nsm, no_debug_ospf_nsm_cmd, - "no debug ospf nsm [status|events|timers]", + "no debug ospf nsm []", NO_STR DEBUG_STR OSPF_STR @@ -1143,7 +1143,7 @@ DEFUN (no_debug_ospf_nsm, DEFUN (no_debug_ospf_instance_nsm, no_debug_ospf_instance_nsm_cmd, - "no debug ospf (1-65535) nsm [status|events|timers]", + "no debug ospf (1-65535) nsm []", NO_STR DEBUG_STR OSPF_STR @@ -1206,7 +1206,7 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEFUN (debug_ospf_lsa, debug_ospf_lsa_cmd, - "debug ospf lsa [generate|flooding|install|refresh]", + "debug ospf lsa []", DEBUG_STR OSPF_STR "OSPF Link State Advertisement\n" @@ -1220,7 +1220,7 @@ DEFUN (debug_ospf_lsa, DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, - "debug ospf (1-65535) lsa [generate|flooding|install|refresh]", + "debug ospf (1-65535) lsa []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1283,7 +1283,7 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEFUN (no_debug_ospf_lsa, no_debug_ospf_lsa_cmd, - "no debug ospf lsa [generate|flooding|install|refresh]", + "no debug ospf lsa []", NO_STR DEBUG_STR OSPF_STR @@ -1298,7 +1298,7 @@ DEFUN (no_debug_ospf_lsa, DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, - "no debug ospf (1-65535) lsa [generate|flooding|install|refresh]", + "no debug ospf (1-65535) lsa []", NO_STR DEBUG_STR OSPF_STR @@ -1354,7 +1354,7 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_tok DEFUN (debug_ospf_zebra, debug_ospf_zebra_cmd, - "debug ospf zebra [interface|redistribute]", + "debug ospf zebra []", DEBUG_STR OSPF_STR "OSPF Zebra information\n" @@ -1366,7 +1366,7 @@ DEFUN (debug_ospf_zebra, DEFUN (debug_ospf_instance_zebra, debug_ospf_instance_zebra_cmd, - "debug ospf (1-65535) zebra [interface|redistribute]", + "debug ospf (1-65535) zebra []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1420,7 +1420,7 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, DEFUN (no_debug_ospf_zebra, no_debug_ospf_zebra_cmd, - "no debug ospf zebra [interface|redistribute]", + "no debug ospf zebra []", NO_STR DEBUG_STR OSPF_STR @@ -1433,7 +1433,7 @@ DEFUN (no_debug_ospf_zebra, DEFUN (no_debug_ospf_instance_zebra, no_debug_ospf_instance_zebra_cmd, - "no debug ospf (1-65535) zebra [interface|redistribute]", + "no debug ospf (1-65535) zebra []", NO_STR DEBUG_STR OSPF_STR diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index d6686399c2..95fadde952 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1400,7 +1400,7 @@ DEFUN (ip_rip_receive_version_2, DEFUN (no_ip_rip_receive_version, no_ip_rip_receive_version_cmd, - "no ip rip receive version [(1-1)|(2-2)]", + "no ip rip receive version [<1|2>]", NO_STR IP_STR "Routing Information Protocol\n" @@ -1495,7 +1495,7 @@ DEFUN (ip_rip_send_version_2, DEFUN (no_ip_rip_send_version, no_ip_rip_send_version_cmd, - "no ip rip send version [(1-1)|(2-2)]", + "no ip rip send version [<1|2>]", NO_STR IP_STR "Routing Information Protocol\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 02e7bac68f..af88475d21 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -684,9 +684,26 @@ DEFUN (no_bgp_maxmed_onstartup, if not line.endswith('\n'): line += '\n' + if '|<' in line: + print "%d: ERROR |< is illegal in '%s'" % (self.line_number, line) + + if '|[' in line: + print "%d: ERROR |[ is illegal in '%s'" % (self.line_number, line) + # compress duplicate whitespaces re_space = re.search('^(\s*).*(\s*)$', line) line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) + + for token in line_to_tokens(self.line_number, line): + token = token.strip() + + if token.endswith('",'): + token = token[0:-2] + + if token.startswith('[') and '|' in token: + if not token.startswith('[<') or not token.endswith('>]'): + print "%s: suspend token '%s'" % (self.line_number, token) + return line def get_used_idx_variables(self, idx_table): @@ -743,8 +760,9 @@ DEFUN (no_bgp_maxmed_onstartup, return False def dump(self): - new_command_string = self.get_new_command_string() - new_command_string_expanded = expand_command_string(new_command_string) + # new_command_string = self.get_new_command_string() + # new_command_string_expanded = expand_command_string(new_command_string) + new_command_string_expanded = self.get_new_command_string() lines = [] lines.append("DEFUN (%s,\n" % self.name) @@ -898,7 +916,6 @@ def update_argvs(filename): state = None fh.write(line) elif line.strip().startswith('* ') and not line.strip().startswith('* '): - # dwalton new_line = expand_command_string(line[3:]) # chop the leading " * " fh.write(" * %s" % new_line) else: diff --git a/zebra/debug.c b/zebra/debug.c index 3714ffe3f6..6acf32b43d 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -174,7 +174,7 @@ DEFUN (debug_zebra_kernel, DEFUN (debug_zebra_kernel_msgdump, debug_zebra_kernel_msgdump_cmd, - "debug zebra kernel msgdump [recv|send]", + "debug zebra kernel msgdump []", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" @@ -292,7 +292,7 @@ DEFUN (no_debug_zebra_kernel, DEFUN (no_debug_zebra_kernel_msgdump, no_debug_zebra_kernel_msgdump_cmd, - "no debug zebra kernel msgdump [recv|send]", + "no debug zebra kernel msgdump []", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index e6e7f5d2ea..7f1a042f56 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -208,9 +208,9 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - char *destprefix = argv[2]->arg; - char *nexthop = argv[3]->arg; - char *distance = (argc == 5) ? argv[4]->arg : NULL; + char *destprefix = argv[3]->arg; + char *nexthop = argv[4]->arg; + char *distance = (argc == 6) ? argv[5]->arg : NULL; return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, destprefix, NULL, nexthop, NULL, NULL, distance, NULL); } @@ -1392,6 +1392,9 @@ DEFUN (show_ip_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_vrf = 3; + int idx_name = 4; + int idx_tag = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -1399,14 +1402,15 @@ DEFUN (show_ip_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strmatch(argv[3]->text, "vrf")) + if (strmatch(argv[idx_vrf]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[4]->arg); - tag = atoi(argv[6]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); + tag = atoi(argv[idx_tag]->arg); } else { - tag = atoi(argv[4]->arg); + idx_tag -= 2; + tag = atoi(argv[idx_tag]->arg); } table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); @@ -2852,6 +2856,9 @@ DEFUN (show_ipv6_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_vrf = 3; + int idx_name = 4; + int idx_tag = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2859,14 +2866,15 @@ DEFUN (show_ipv6_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strmatch(argv[3]->text, "vrf")) + if (strmatch(argv[idx_vrf]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[4]->arg); - tag = atoi(argv[6]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); + tag = atoi(argv[idx_tag]->arg); } else { - tag = atoi(argv[4]->arg); + idx_tag -= 2; + tag = atoi(argv[idx_tag]->arg); } table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); @@ -3352,6 +3360,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, VRF_ALL_CMD_HELP_STR QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { + int idx_protocol = 5; int type; struct route_table *table; struct route_node *rn; @@ -3361,7 +3370,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[4]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); From 22b27e953015251655ca3dd0329aa1f888fc39dc Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 16:05:55 +0000 Subject: [PATCH 187/280] ospfd: added some missing <>s Signed-off-by: Daniel Walton --- ospfd/ospf_dump.c | 2 +- ospfd/ospf_vty.c | 52 ++++++++++++++++------------------------ tools/argv_translator.py | 5 +++- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 91fde066f1..07a55ebaa8 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -982,7 +982,7 @@ DEFUN (no_debug_ospf_ism, if (inst) // user passed instance ID { - if (!ospf_lookup_instance (strtoul (inst, NULL, 10))) + if (!ospf_lookup_instance (strtoul (argv[3]->arg, NULL, 10))) return CMD_SUCCESS; } diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 5753671f16..aae433bb7b 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1048,9 +1048,7 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) DEFUN (ospf_area_vlink, ospf_area_vlink_cmd, - "area virtual-link A.B.C.D " - "[authentication] [] " - "[ virtual-link A.B.C.D [authentication] [] []", VLINK_HELPSTR_IPADDR "Enable authentication on this virtual link\n" \ "Use null authentication\n" \ @@ -1165,11 +1163,7 @@ DEFUN (ospf_area_vlink, DEFUN (ospf_area_vlink_intervals, ospf_area_vlink_intervals_cmd, - "area virtual-link A.B.C.D " - "[ (1-65535)] " - "[ (1-65535)] " - "[ (1-65535)] " - "[ (1-65535)] ", + "area virtual-link A.B.C.D [ (1-65535)] [ (1-65535)] [ (1-65535)] [ (1-65535)] ", VLINK_HELPSTR_IPADDR VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM @@ -1263,9 +1257,7 @@ DEFUN (ospf_area_vlink_intervals, DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, - "area virtual-link A.B.C.D " - "[authentication] [] " - "[ virtual-link A.B.C.D [authentication] [] []", NO_STR VLINK_HELPSTR_IPADDR "Enable authentication on this virtual link\n" \ @@ -1373,11 +1365,7 @@ DEFUN (no_ospf_area_vlink, DEFUN (no_ospf_area_vlink_intervals, no_ospf_area_vlink_intervals_cmd, - "area virtual-link A.B.C.D " - "[ (1-65535)] " - "[ (1-65535)] " - "[ (1-65535)] " - "[ (1-65535)] ", + "area virtual-link A.B.C.D [ (1-65535)] [ (1-65535)] [ (1-65535)] [ (1-65535)]", VLINK_HELPSTR_IPADDR VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM @@ -1773,7 +1761,7 @@ DEFUN (no_ospf_area_nssa, "Configure NSSA-ABR to never translate\n" "Configure NSSA-ABR to always translate\n" "Do not inject inter-area routes into nssa\n") - { +{ int idx_ipv4_number = 2; struct ospf *ospf = vty->index; struct in_addr area_id; @@ -2539,7 +2527,7 @@ DEFUN (no_ospf_timers_throttle_spf, "Delay (msec) from first change received till SPF calculation\n" "Initial hold time (msec) between consecutive SPF calculations\n" "Maximum hold time (msec)\n") - { +{ return ospf_timers_spf_set (vty, OSPF_SPF_DELAY_DEFAULT, OSPF_SPF_HOLDTIME_DEFAULT, @@ -2653,7 +2641,7 @@ DEFUN (ospf_neighbor_poll_interval, "Seconds\n" "OSPF priority of non-broadcast neighbor\n" "Priority\n") - { +{ int idx_ipv4 = 1; int idx_poll = 3; int idx_pri = 5; @@ -7001,7 +6989,7 @@ DEFUN (no_ospf_dead_interval, DEFUN (no_ip_ospf_dead_interval, no_ip_ospf_dead_interval_addr_cmd, - "no ip ospf dead-interval [[(1-65535)|] [A.B.C.D]]", + "no ip ospf dead-interval [[(1-65535)|minimal hello-multiplier (1-10)] [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7318,7 +7306,7 @@ DEFUN (no_ospf_network, "Specify OSPF NBMA network\n" "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") - { +{ struct interface *ifp = vty->index; int old_type = IF_DEF_PARAMS (ifp)->type; struct route_node *rn; @@ -7358,7 +7346,7 @@ DEFUN (no_ip_ospf_network, "Specify OSPF NBMA network\n" "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") - { +{ struct interface *ifp = vty->index; int old_type = IF_DEF_PARAMS (ifp)->type; struct route_node *rn; @@ -7716,7 +7704,7 @@ DEFUN (no_ospf_retransmit_interval, DEFUN (no_ip_ospf_retransmit_interval, no_ip_ospf_retransmit_interval_addr_cmd, - "no ip ospf retransmit-interval [<(3-65535 [A.B.C.D]|A.B.C.D>]", + "no ip ospf retransmit-interval [<<3-65535 [A.B.C.D]|A.B.C.D>]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7935,7 +7923,7 @@ DEFUN (no_ip_ospf_transmit_delay_sec, DEFUN (ip_ospf_area, ip_ospf_area_cmd, - "ip ospf [(1-65535)]area ", + "ip ospf [(1-65535)] area ", "IP Information\n" "OSPF interface commands\n" "Instance ID\n" @@ -8070,7 +8058,7 @@ DEFUN (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "redistribute [|route-map WORD>]", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8125,7 +8113,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "no redistribute [|route-map WORD>]", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8158,7 +8146,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "redistribute (1-65535) [|route-map WORD>]", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -8230,7 +8218,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "no redistribute (1-65535) [|route-map WORD>]", NO_STR REDIST_STR "Open Shortest Path First\n" @@ -8332,7 +8320,7 @@ DEFUN (no_ospf_distribute_list_out, /* Default information originate. */ DEFUN (ospf_default_information_originate, ospf_default_information_originate_cmd, - "default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "default-information originate [|route-map WORD>]", "Control distribution of default information\n" "Distribute a default route\n" "Always advertise default route\n" @@ -8384,7 +8372,7 @@ DEFUN (ospf_default_information_originate, DEFUN (no_ospf_default_information_originate, no_ospf_default_information_originate_cmd, - "no default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]", + "no default-information originate [|route-map WORD>]", NO_STR "Control distribution of default information\n" "Distribute a default route\n" @@ -8500,7 +8488,7 @@ DEFUN (no_ospf_distance, DEFUN (no_ospf_distance_ospf, no_ospf_distance_ospf_cmd, - "no distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]", + "no distance ospf []", NO_STR "Define an administrative distance\n" "OSPF Administrative distance\n" @@ -8545,7 +8533,7 @@ DEFUN (no_ospf_distance_ospf, DEFUN (ospf_distance_ospf, ospf_distance_ospf_cmd, - "distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]", + "distance ospf []", "Define an administrative distance\n" "OSPF Administrative distance\n" "Intra-area routes\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index af88475d21..5325969fdf 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -694,6 +694,9 @@ DEFUN (no_bgp_maxmed_onstartup, re_space = re.search('^(\s*).*(\s*)$', line) line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) + ''' + # I ran this once and cleaned them all up...this spews many + # false positives so we don't want to leave this on for token in line_to_tokens(self.line_number, line): token = token.strip() @@ -703,6 +706,7 @@ DEFUN (no_bgp_maxmed_onstartup, if token.startswith('[') and '|' in token: if not token.startswith('[<') or not token.endswith('>]'): print "%s: suspend token '%s'" % (self.line_number, token) + ''' return line @@ -772,7 +776,6 @@ DEFUN (no_bgp_maxmed_onstartup, lines.extend(self.help_strings) lines.append('{\n') - # uncomment this to do ospf_vty.c # if self.uses_argc(): # lines.append(" /* CHECK ME argc referenced below */\n") lines.extend(self.guts) From bfbc035bd033774586cddbd9a69f571964999c9c Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 16:10:28 +0000 Subject: [PATCH 188/280] vtysh: fixed compile errors Signed-off-by: Daniel Walton --- vtysh/extract.pl.in | 2 +- vtysh/vtysh.c | 32 ++++++++++++++------------------ vtysh/vtysh_user.c | 6 ++++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index b7533881a3..e777039b34 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -212,7 +212,7 @@ foreach (@ARGV) { } } -my $bad_cli_stomps = 108; +my $bad_cli_stomps = 71; # Currently we have $bad_cli_stomps. This was determined by # running this script and counting up the collisions from what # was returned. diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ec94c37d66..8f0a7fd551 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -44,8 +44,6 @@ #include "ns.h" #include "vrf.h" -#include "lib/grammar_sandbox.h" - DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy") /* Struct VTY. */ @@ -827,11 +825,11 @@ vtysh_rl_describe (void) { int len; - if (token->cmd[0] == '\0') + if (token->arg[0] == '\0') continue; - len = strlen (token->cmd); - if (token->cmd[0] == '.') + len = strlen (token->arg); + if (token->arg[0] == '.') len--; if (width < len) @@ -841,16 +839,16 @@ vtysh_rl_describe (void) for (i = 0; i < vector_active (describe); i++) if ((token = vector_slot (describe, i)) != NULL) { - if (token->cmd[0] == '\0') + if (token->arg[0] == '\0') continue; if (! token->desc) fprintf (stdout," %-s\n", - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd); + token->arg[0] == '.' ? token->arg + 1 : token->arg); else fprintf (stdout," %-*s %s\n", width, - token->cmd[0] == '.' ? token->cmd + 1 : token->cmd, + token->arg[0] == '.' ? token->arg + 1 : token->arg, token->desc); } @@ -1737,7 +1735,7 @@ DEFUN (vtysh_show_thread, int ret = CMD_SUCCESS; char line[100]; - sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter] : ""); + sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter]->arg : ""); for (i = 0; i < array_size(vtysh_client); i++) if ( vtysh_client[i].fd >= 0 ) { @@ -1784,12 +1782,13 @@ DEFUN (vtysh_show_work_queues_daemon, "For the bgp daemon\n" "For the isis daemon\n") { + int idx_protocol = 2; unsigned int i; int ret = CMD_SUCCESS; for (i = 0; i < array_size(vtysh_client); i++) { - if (begins_with(vtysh_client[i].name, argv[0])) + if (begins_with(vtysh_client[i].name, argv[idx_protocol]->arg)) break; } @@ -2177,8 +2176,6 @@ DEFUN (vtysh_write_terminal, "Write running configuration to memory, network, or terminal\n" "Write to terminal\n") { - u_int i; - char line[] = "write terminal\n"; FILE *fp = NULL; if (vtysh_pager_name) @@ -2233,12 +2230,13 @@ DEFUN (vtysh_write_terminal_daemon, "For the isis daemon\n" "For the pim daemon\n") { + int idx_protocol = 2; unsigned int i; int ret = CMD_SUCCESS; for (i = 0; i < array_size(vtysh_client); i++) { - if (begins_with(vtysh_client[i].name, argv[0])) + if (begins_with(vtysh_client[i].name, argv[idx_protocol]->arg)) break; } @@ -2437,11 +2435,12 @@ DEFUN (vtysh_terminal_length, "Set number of lines on a screen\n" "Number of lines on screen (0 for no pausing)\n") { + int idx_number = 2; int lines; char *endptr = NULL; char default_pager[10]; - lines = strtol (argv[0], &endptr, 10); + lines = strtol (argv[idx_number]->arg, &endptr, 10); if (lines < 0 || lines > 512 || *endptr != '\0') { vty_out (vty, "length is malformed%s", VTY_NEWLINE); @@ -2498,7 +2497,7 @@ DEFUN (vtysh_show_daemons, /* Execute command in child process. */ static void -execute_command (const char *command, int argc, const char *arg1, +execute_command (const char *command, int argc, struct cmd_token *arg1, const char *arg2) { pid_t pid; @@ -3185,7 +3184,4 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &vtysh_enable_password_cmd); install_element (CONFIG_NODE, &vtysh_enable_password_text_cmd); install_element (CONFIG_NODE, &no_vtysh_enable_password_cmd); - - /* grammar sandbox */ - grammar_sandbox_init(); } diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index 1886ba3a67..b1ba1a24ae 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -173,7 +173,8 @@ DEFUN (banner_motd_file, "Banner from a file\n" "Filename\n") { - return cmd_banner_motd_file (argv[0]); + int idx_file = 3; + return cmd_banner_motd_file (argv[idx_file]->arg); } DEFUN (username_nopassword, @@ -183,8 +184,9 @@ DEFUN (username_nopassword, "\n" "\n") { + int idx_word = 1; struct vtysh_user *user; - user = user_get (argv[0]); + user = user_get (argv[idx_word]->arg); user->nopassword = 1; return CMD_SUCCESS; } From 76b6abb95a1b4df23952d6cc20f9c4fc958323a4 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 30 Sep 2016 19:33:11 +0000 Subject: [PATCH 189/280] lib: initialize cmd_vector and add a root node to graph Signed-off-by: Quentin Young --- lib/command.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/command.c b/lib/command.c index c98e2562db..877edde9aa 100644 --- a/lib/command.c +++ b/lib/command.c @@ -206,6 +206,10 @@ install_node (struct cmd_node *node, vector_set_index (cmdvec, node->node, node); node->func = func; node->cmdgraph = graph_new (); + node->cmd_vector = vector_init (VECTOR_MIN_SIZE); + // add start node + struct cmd_token *token = new_cmd_token (START_TKN, NULL, NULL); + graph_new_node (node->cmdgraph, token, (void (*)(void *)) &del_cmd_token); } /* Breaking up string into each command piece. I assume given From a98d33ab20e583e4e30acdff59ed6523bc5e139e Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 30 Sep 2016 23:03:05 +0000 Subject: [PATCH 190/280] lib, vtysh: refactor vtysh.c, allow parser continuance Signed-off-by: Quentin Young --- lib/command.c | 2 + lib/command_parse.y | 2 +- vtysh/vtysh.c | 350 +++++++++++++++++++------------------------- 3 files changed, 153 insertions(+), 201 deletions(-) diff --git a/lib/command.c b/lib/command.c index 877edde9aa..a74e967c94 100644 --- a/lib/command.c +++ b/lib/command.c @@ -311,6 +311,7 @@ install_element (enum node_type ntype, struct cmd_element *cmd) exit (EXIT_FAILURE); } + fprintf (stdout, "installing %s in node %d\n", cmd->string, ntype); // add node to command graph and command vector command_parse_format (cnode->cmdgraph, cmd); vector_set (cnode->cmd_vector, cmd); @@ -2129,6 +2130,7 @@ host_config_set (const char *filename) void install_default (enum node_type node) { + fprintf (stdout, "installing default\n"); install_element (node, &config_exit_cmd); install_element (node, &config_quit_cmd); install_element (node, &config_end_cmd); diff --git a/lib/command_parse.y b/lib/command_parse.y index 63a6f83c35..88dbbb137a 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -405,7 +405,7 @@ yyerror (struct graph *graph, struct cmd_element *el, char const *msg) { zlog_err ("%s: FATAL parse error: %s", __func__, msg); zlog_err ("while parsing this command definition: \n\t%s\n", el->string); - exit(EXIT_FAILURE); + //exit(EXIT_FAILURE); } static void diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 8f0a7fd551..53f63256be 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1082,32 +1082,17 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_BGPD, router_bgp, router_bgp_cmd, - "router bgp (1-4294967295)", + "router bgp [(1-4294967295) [ WORD]]", ROUTER_STR BGP_STR - AS_STR) + AS_STR + "BGP view\nBGP VRF\n" + "View/VRF name\n") { vty->node = BGP_NODE; return CMD_SUCCESS; } -ALIAS_SH (VTYSH_BGPD, - router_bgp, - router_bgp_asn_cmd, - "router bgp", - ROUTER_STR - BGP_STR) - -ALIAS_SH (VTYSH_BGPD, - router_bgp, - router_bgp_view_cmd, - "router bgp (1-4294967295) (view|vrf) WORD", - ROUTER_STR - BGP_STR - AS_STR - "BGP view\nBGP VRF\n" - "View/VRF name\n") - DEFUNSH (VTYSH_BGPD, address_family_vpnv4, address_family_vpnv4_cmd, @@ -1261,7 +1246,7 @@ DEFUNSH (VTYSH_RIPD, DEFUNSH (VTYSH_RIPD, key, key_cmd, - "key <0-2147483647>", + "key (0-2147483647)", "Configure a key\n" "Key identifier number\n") { @@ -1294,22 +1279,15 @@ DEFUNSH (VTYSH_RIPNGD, DEFUNSH (VTYSH_OSPFD, router_ospf, router_ospf_cmd, - "router ospf", + "router ospf [(1-65535)]", "Enable a routing process\n" - "Start OSPF configuration\n") + "Start OSPF configuration\n" + "Instance ID\n") { vty->node = OSPF_NODE; return CMD_SUCCESS; } -ALIAS_SH (VTYSH_OSPFD, - router_ospf, - router_ospf_instance_cmd, - "router ospf <1-65535>", - "Enable a routing process\n" - "Start OSPF configuration\n" - "Instance ID\n") - DEFUNSH (VTYSH_OSPF6D, router_ospf6, router_ospf6_cmd, @@ -1336,7 +1314,7 @@ DEFUNSH (VTYSH_ISISD, DEFUNSH (VTYSH_RMAP, route_map, route_map_cmd, - "route-map WORD (deny|permit) <1-65535>", + "route-map WORD (1-65535)", "Create route-map or enter route-map command mode\n" "Route map tag\n" "Route map denies set operations\n" @@ -1451,10 +1429,14 @@ DEFUNSH (VTYSH_ALL, return vtysh_exit (vty); } -ALIAS (vtysh_exit_all, - vtysh_quit_all_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_ALL, + vtysh_quit_all, + vtysh_quit_all_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_all (self, vty, argc, argv); +} DEFUNSH (VTYSH_BGPD, exit_address_family, @@ -1483,10 +1465,14 @@ DEFUNSH (VTYSH_ZEBRA, return vtysh_exit (vty); } -ALIAS (vtysh_exit_zebra, - vtysh_quit_zebra_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_ZEBRA, + vtysh_quit_zebra, + vtysh_quit_zebra_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_zebra (self, vty, argc, argv); +} DEFUNSH (VTYSH_RIPD, vtysh_exit_ripd, @@ -1497,10 +1483,14 @@ DEFUNSH (VTYSH_RIPD, return vtysh_exit (vty); } -ALIAS (vtysh_exit_ripd, - vtysh_quit_ripd_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_RIPD, + vtysh_quit_ripd, + vtysh_quit_ripd_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_ripd (self, vty, argc, argv); +} DEFUNSH (VTYSH_RIPNGD, vtysh_exit_ripngd, @@ -1511,10 +1501,14 @@ DEFUNSH (VTYSH_RIPNGD, return vtysh_exit (vty); } -ALIAS (vtysh_exit_ripngd, - vtysh_quit_ripngd_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_RIPNGD, + vtysh_quit_ripngd, + vtysh_quit_ripngd_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_ripngd (self, vty, argc, argv); +} DEFUNSH (VTYSH_RMAP, vtysh_exit_rmap, @@ -1525,10 +1519,14 @@ DEFUNSH (VTYSH_RMAP, return vtysh_exit (vty); } -ALIAS (vtysh_exit_rmap, - vtysh_quit_rmap_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_RMAP, + vtysh_quit_rmap, + vtysh_quit_rmap_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_rmap (self, vty, argc, argv); +} DEFUNSH (VTYSH_BGPD, vtysh_exit_bgpd, @@ -1539,10 +1537,14 @@ DEFUNSH (VTYSH_BGPD, return vtysh_exit (vty); } -ALIAS (vtysh_exit_bgpd, - vtysh_quit_bgpd_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_BGPD, + vtysh_quit_bgpd, + vtysh_quit_bgpd_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_bgpd (self, vty, argc, argv); +} DEFUNSH (VTYSH_OSPFD, vtysh_exit_ospfd, @@ -1553,10 +1555,14 @@ DEFUNSH (VTYSH_OSPFD, return vtysh_exit (vty); } -ALIAS (vtysh_exit_ospfd, - vtysh_quit_ospfd_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_OSPFD, + vtysh_quit_ospfd, + vtysh_quit_ospfd_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_ospfd (self, vty, argc, argv); +} DEFUNSH (VTYSH_OSPF6D, vtysh_exit_ospf6d, @@ -1567,10 +1573,14 @@ DEFUNSH (VTYSH_OSPF6D, return vtysh_exit (vty); } -ALIAS (vtysh_exit_ospf6d, - vtysh_quit_ospf6d_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_OSPF6D, + vtysh_quit_ospf6d, + vtysh_quit_ospf6d_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_ospf6d (self, vty, argc, argv); +} DEFUNSH (VTYSH_ISISD, vtysh_exit_isisd, @@ -1581,10 +1591,14 @@ DEFUNSH (VTYSH_ISISD, return vtysh_exit (vty); } -ALIAS (vtysh_exit_isisd, - vtysh_quit_isisd_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_ISISD, + vtysh_quit_isisd, + vtysh_quit_isisd_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_isisd (self, vty, argc, argv); +} DEFUNSH (VTYSH_ALL, vtysh_exit_line_vty, @@ -1595,30 +1609,27 @@ DEFUNSH (VTYSH_ALL, return vtysh_exit (vty); } -ALIAS (vtysh_exit_line_vty, - vtysh_quit_line_vty_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_ALL, + vtysh_quit_line_vty, + vtysh_quit_line_vty_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_line_vty (self, vty, argc, argv); +} DEFUNSH (VTYSH_INTERFACE, vtysh_interface, vtysh_interface_cmd, - "interface IFNAME", + "interface IFNAME [vrf NAME]", "Select an interface to configure\n" - "Interface's name\n") + "Interface's name\n" + VRF_CMD_HELP_STR) { vty->node = INTERFACE_NODE; return CMD_SUCCESS; } -ALIAS_SH (VTYSH_ZEBRA, - vtysh_interface, - vtysh_interface_vrf_cmd, - "interface IFNAME vrf NAME", - "Select an interface to configure\n" - "Interface's name\n" - VRF_CMD_HELP_STR) - /* TODO Implement "no interface command in isisd. */ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D, vtysh_no_interface_cmd, @@ -1638,7 +1649,7 @@ DEFSH (VTYSH_ZEBRA, DEFUNSH (VTYSH_NS, vtysh_ns, vtysh_ns_cmd, - "logical-router <1-65535 ns NAME", + "logical-router (1-65535) ns NAME", "Enable a logical-router\n" "Specify the logical-router indentifier\n" "The Name Space\n" @@ -1675,10 +1686,14 @@ DEFUNSH (VTYSH_NS, return vtysh_exit (vty); } -ALIAS (vtysh_exit_ns, - vtysh_quit_ns_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_NS, + vtysh_quit_ns, + vtysh_quit_ns_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_quit_ns(self, vty, argc, argv); +} DEFUNSH (VTYSH_VRF, vtysh_exit_vrf, @@ -1689,10 +1704,14 @@ DEFUNSH (VTYSH_VRF, return vtysh_exit (vty); } -ALIAS (vtysh_exit_vrf, - vtysh_quit_vrf_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_VRF, + vtysh_quit_vrf, + vtysh_quit_vrf_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_vrf (self, vty, argc, argv); +} /* TODO Implement interface description commands in ripngd, ospf6d * and isisd. */ @@ -1717,10 +1736,14 @@ DEFUNSH (VTYSH_INTERFACE, return vtysh_exit (vty); } -ALIAS (vtysh_exit_interface, - vtysh_quit_interface_cmd, - "quit", - "Exit current mode and down to previous mode\n") +DEFUNSH (VTYSH_INTERFACE, + vtysh_quit_interface, + vtysh_quit_interface_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_interface (self, vty, argc, argv); +} DEFUN (vtysh_show_thread, vtysh_show_thread_cmd, @@ -1913,42 +1936,23 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, no_vtysh_log_file, no_vtysh_log_file_cmd, - "no log file [FILENAME]", + "no log file [FILENAME [LEVEL]]", NO_STR "Logging control\n" "Cancel logging to file\n" - "Logging file name\n") + "Logging file name\n" + "Logging level\n") { return CMD_SUCCESS; } -ALIAS_SH (VTYSH_ALL, - no_vtysh_log_file, - no_vtysh_log_file_level_cmd, - "no log file FILENAME LEVEL", - NO_STR - "Logging control\n" - "Cancel logging to file\n" - "Logging file name\n" - "Logging level\n") - DEFUNSH (VTYSH_ALL, vtysh_log_monitor, vtysh_log_monitor_cmd, - "log monitor", - "Logging control\n" - "Set terminal line (monitor) logging level\n") -{ - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_ALL, - vtysh_log_monitor_level, - vtysh_log_monitor_level_cmd, - "log monitor ", + "log monitor [", "Logging control\n" "Set terminal line (monitor) logging level\n" - LOG_LEVEL_DESC) + LOG_LEVEL_DESC) { return CMD_SUCCESS; } @@ -1968,20 +1972,10 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_syslog, vtysh_log_syslog_cmd, - "log syslog", - "Logging control\n" - "Set syslog logging level\n") -{ - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_ALL, - vtysh_log_syslog_level, - vtysh_log_syslog_level_cmd, "log syslog ", "Logging control\n" "Set syslog logging level\n" - LOG_LEVEL_DESC) + LOG_LEVEL_DESC) { return CMD_SUCCESS; } @@ -2071,7 +2065,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_timestamp_precision, vtysh_log_timestamp_precision_cmd, - "log timestamp precision <0-6>", + "log timestamp precision (0-6)", "Logging control\n" "Timestamp configuration\n" "Set the timestamp precision\n" @@ -2116,7 +2110,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_config_password, vtysh_password_cmd, - "password (8|) WORD", + "password (8-8) WORD", "Assign the terminal connection password\n" "Specifies a HIDDEN password will follow\n" "dummy string \n" @@ -2138,11 +2132,10 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_config_enable_password, vtysh_enable_password_cmd, - "enable password (8|) WORD", + "enable password (8-8) WORD", "Modify enable password parameters\n" "Assign the privileged level password\n" "Specifies a HIDDEN password will follow\n" - "dummy string \n" "The HIDDEN 'enable' password string\n") { return CMD_SUCCESS; @@ -2172,10 +2165,17 @@ DEFUNSH (VTYSH_ALL, DEFUN (vtysh_write_terminal, vtysh_write_terminal_cmd, - "write terminal", + "write terminal []", "Write running configuration to memory, network, or terminal\n" "Write to terminal\n") { + if (argc == 3) + { + for (unsigned int i = 0; i < array_size(vtysh_client); i++) + if (begins_with(vtysh_client[i].name, argv[2]->arg)) + break; + } + FILE *fp = NULL; if (vtysh_pager_name) @@ -2216,11 +2216,11 @@ DEFUN (vtysh_write_terminal, return CMD_SUCCESS; } -DEFUN (vtysh_write_terminal_daemon, - vtysh_write_terminal_daemon_cmd, - "write terminal ", - "Write running configuration to memory, network, or terminal\n" - "Write to terminal\n" +DEFUN (vtysh_show_running_config, + vtysh_show_running_config_cmd, + "show running-config []", + SHOW_STR + "Current operating configuration\n" "For the zebra daemon\n" "For the rip daemon\n" "For the ripng daemon\n" @@ -2230,19 +2230,7 @@ DEFUN (vtysh_write_terminal_daemon, "For the isis daemon\n" "For the pim daemon\n") { - int idx_protocol = 2; - unsigned int i; - int ret = CMD_SUCCESS; - - for (i = 0; i < array_size(vtysh_client); i++) - { - if (begins_with(vtysh_client[i].name, argv[idx_protocol]->arg)) - break; - } - - ret = vtysh_client_execute(&vtysh_client[i], "show running-config\n", stdout); - - return ret; + return vtysh_write_terminal (self, vty, argc, argv); } DEFUN (vtysh_integrated_config, @@ -2344,9 +2332,10 @@ write_config_integrated(void) DEFUN (vtysh_write_memory, vtysh_write_memory_cmd, - "write memory", + "write []", "Write running configuration to memory, network, or terminal\n" - "Write configuration to the file (same as write file)\n") + "Write configuration to the file (same as write file)\n" + "Write configuration to the file (same as write memory)\n") { int ret = CMD_SUCCESS; char line[] = "write memory\n"; @@ -2390,43 +2379,16 @@ DEFUN (vtysh_write_memory, return ret; } -ALIAS (vtysh_write_memory, - vtysh_copy_runningconfig_startupconfig_cmd, - "copy running-config startup-config", +DEFUN (vtysh_copy_running_config, + vtysh_copy_running_config_cmd, + "copy running-config startup-config", "Copy from one file to another\n" "Copy from current system configuration\n" "Copy to startup configuration\n") +{ + return vtysh_write_memory (self, vty, argc, argv); +} -ALIAS (vtysh_write_memory, - vtysh_write_file_cmd, - "write file", - "Write running configuration to memory, network, or terminal\n" - "Write configuration to the file (same as write memory)\n") - -ALIAS (vtysh_write_memory, - vtysh_write_cmd, - "write", - "Write running configuration to memory, network, or terminal\n") - -ALIAS (vtysh_write_terminal, - vtysh_show_running_config_cmd, - "show running-config", - SHOW_STR - "Current operating configuration\n") - -ALIAS (vtysh_write_terminal, - vtysh_show_running_config_daemon_cmd, - "show running-config (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd)", - SHOW_STR - "Current operating configuration\n" - "For the zebra daemon\n" - "For the rip daemon\n" - "For the ripng daemon\n" - "For the ospf daemon\n" - "For the ospfv6 daemon\n" - "For the bgp daemon\n" - "For the isis daemon\n" - "For the pim daemon\n") DEFUN (vtysh_terminal_length, vtysh_terminal_length_cmd, @@ -2959,7 +2921,6 @@ vtysh_init_vty (void) /* "exit" command. */ install_element (VIEW_NODE, &vtysh_exit_all_cmd); - install_element (VIEW_NODE, &vtysh_quit_all_cmd); install_element (CONFIG_NODE, &vtysh_exit_all_cmd); /* install_element (CONFIG_NODE, &vtysh_quit_all_cmd); */ install_element (ENABLE_NODE, &vtysh_exit_all_cmd); @@ -3044,14 +3005,11 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &router_ripng_cmd); #endif install_element (CONFIG_NODE, &router_ospf_cmd); - install_element (CONFIG_NODE, &router_ospf_instance_cmd); #ifdef HAVE_IPV6 install_element (CONFIG_NODE, &router_ospf6_cmd); #endif install_element (CONFIG_NODE, &router_isis_cmd); install_element (CONFIG_NODE, &router_bgp_cmd); - install_element (CONFIG_NODE, &router_bgp_asn_cmd); - install_element (CONFIG_NODE, &router_bgp_view_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); @@ -3081,21 +3039,16 @@ vtysh_init_vty (void) install_element (KEYCHAIN_KEY_NODE, &key_chain_cmd); install_element (CONFIG_NODE, &vtysh_interface_cmd); install_element (CONFIG_NODE, &vtysh_no_interface_cmd); - install_element (CONFIG_NODE, &vtysh_interface_vrf_cmd); install_element (CONFIG_NODE, &vtysh_no_interface_vrf_cmd); install_element (INTERFACE_NODE, &vtysh_link_params_cmd); install_element (ENABLE_NODE, &vtysh_show_running_config_cmd); - install_element (ENABLE_NODE, &vtysh_show_running_config_daemon_cmd); - install_element (ENABLE_NODE, &vtysh_copy_runningconfig_startupconfig_cmd); - install_element (ENABLE_NODE, &vtysh_write_file_cmd); - install_element (ENABLE_NODE, &vtysh_write_cmd); + install_element (ENABLE_NODE, &vtysh_copy_running_config_cmd); install_element (CONFIG_NODE, &vtysh_vrf_cmd); install_element (CONFIG_NODE, &vtysh_no_vrf_cmd); /* "write terminal" command. */ install_element (ENABLE_NODE, &vtysh_write_terminal_cmd); - install_element (ENABLE_NODE, &vtysh_write_terminal_daemon_cmd); install_element (CONFIG_NODE, &vtysh_integrated_config_cmd); install_element (CONFIG_NODE, &no_vtysh_integrated_config_cmd); @@ -3160,12 +3113,9 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &vtysh_log_file_cmd); install_element (CONFIG_NODE, &vtysh_log_file_level_cmd); install_element (CONFIG_NODE, &no_vtysh_log_file_cmd); - install_element (CONFIG_NODE, &no_vtysh_log_file_level_cmd); install_element (CONFIG_NODE, &vtysh_log_monitor_cmd); - install_element (CONFIG_NODE, &vtysh_log_monitor_level_cmd); install_element (CONFIG_NODE, &no_vtysh_log_monitor_cmd); install_element (CONFIG_NODE, &vtysh_log_syslog_cmd); - install_element (CONFIG_NODE, &vtysh_log_syslog_level_cmd); install_element (CONFIG_NODE, &no_vtysh_log_syslog_cmd); install_element (CONFIG_NODE, &vtysh_log_trap_cmd); install_element (CONFIG_NODE, &no_vtysh_log_trap_cmd); From f66625df514f7b617d3b1c39a394fa0732297499 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 30 Sep 2016 23:16:29 +0000 Subject: [PATCH 191/280] lib: fix double free in parser Signed-off-by: Quentin Young --- lib/command_parse.y | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 88dbbb137a..2d8881689d 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -292,7 +292,6 @@ selector_seq_seq: // link in last sequence graph_add_edge ($$->start, $3->start); graph_add_edge ($3->end, $$->end); - free ($3); for (unsigned int i = 0; i < vector_active ($1->start->to); i++) { From c3f24f0653a139737598c9d90d0d4dc61898691f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 1 Oct 2016 01:03:24 +0000 Subject: [PATCH 192/280] lib: Fix '?'-completion dereferences in vtysh Signed-off-by: Quentin Young --- vtysh/vtysh.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 53f63256be..de973cf4ce 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -823,32 +823,25 @@ vtysh_rl_describe (void) for (i = 0; i < vector_active (describe); i++) if ((token = vector_slot (describe, i)) != NULL) { - int len; + if (token->text[0] == '\0') + continue; - if (token->arg[0] == '\0') - continue; + int len = strlen (token->text); - len = strlen (token->arg); - if (token->arg[0] == '.') - len--; - - if (width < len) - width = len; + if (width < len) + width = len; } for (i = 0; i < vector_active (describe); i++) if ((token = vector_slot (describe, i)) != NULL) { - if (token->arg[0] == '\0') - continue; - if (! token->desc) fprintf (stdout," %-s\n", - token->arg[0] == '.' ? token->arg + 1 : token->arg); + token->text); else fprintf (stdout," %-*s %s\n", width, - token->arg[0] == '.' ? token->arg + 1 : token->arg, + token->text, token->desc); } From e83a94147f4ca09451da4acd00ad2b1e3af3d22c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 1 Oct 2016 04:20:30 +0000 Subject: [PATCH 193/280] all: fix sundry syntax errors Signed-off-by: Quentin Young --- bgpd/bgp_bfd.c | 4 ++-- bgpd/bgp_vty.c | 2 +- ospfd/ospf_vty.c | 26 +++++++++++++------------- ripd/rip_interface.c | 8 ++++---- vtysh/vtysh.c | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 7bc902ef92..684694d0bc 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -615,7 +615,7 @@ DEFUN (neighbor_bfd_param, DEFUN_HIDDEN (neighbor_bfd_type, neighbor_bfd_type_cmd, - "neighbor bfd (multihop|singlehop)", + "neighbor bfd ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" @@ -674,7 +674,7 @@ DEFUN (no_neighbor_bfd, DEFUN_HIDDEN (no_neighbor_bfd_type, no_neighbor_bfd_type_cmd, - "no neighbor bfd (multihop|singlehop)", + "no neighbor bfd ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0d6a071ec6..e188de6e76 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -974,7 +974,7 @@ DEFUN (bgp_confederation_peers, DEFUN (no_bgp_confederation_peers, no_bgp_confederation_peers_cmd, - "no bgp confederation peers . (1-4294967295)", + "no bgp confederation peers (1-4294967295)...", NO_STR "BGP specific commands\n" "AS confederation parameters\n" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index aae433bb7b..3609299007 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6306,7 +6306,7 @@ DEFUN (ip_ospf_message_digest_key, DEFUN_HIDDEN (ospf_message_digest_key, ospf_message_digest_key_cmd, - "ospf message-digest-key <1-255> md5 KEY", + "ospf message-digest-key (1-255) md5 KEY", "OSPF interface commands\n" "Message digest authentication password (key)\n" "Key ID\n" @@ -6559,7 +6559,7 @@ DEFUN (ip_ospf_cost, DEFUN_HIDDEN (ospf_cost, ospf_cost_u32_inet4_cmd, - "ospf cost <1-65535> A.B.C.D", + "ospf cost (1-65535) A.B.C.D", "OSPF interface commands\n" "Interface cost\n" "Cost\n" @@ -6936,7 +6936,7 @@ DEFUN (ip_ospf_dead_interval, DEFUN_HIDDEN (ospf_dead_interval, ospf_dead_interval_cmd, - "ospf dead-interval <1-65535>", + "ospf dead-interval (1-65535)", "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" "Seconds\n") @@ -6989,7 +6989,7 @@ DEFUN (no_ospf_dead_interval, DEFUN (no_ip_ospf_dead_interval, no_ip_ospf_dead_interval_addr_cmd, - "no ip ospf dead-interval [[(1-65535)|minimal hello-multiplier (1-10)] [A.B.C.D]]", + "no ip ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7108,7 +7108,7 @@ DEFUN (ip_ospf_hello_interval, DEFUN_HIDDEN (ospf_hello_interval, ospf_hello_interval_cmd, - "ospf hello-interval <1-65535>", + "ospf hello-interval (1-65535)", "OSPF interface commands\n" "Time between HELLO packets\n" "Seconds\n") @@ -7244,7 +7244,7 @@ DEFUN (ip_ospf_network, DEFUN_HIDDEN (ospf_network, ospf_network_cmd, - "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", + "ospf network ", "OSPF interface commands\n" "Network type\n" "Specify OSPF broadcast multi-access network\n" @@ -7441,7 +7441,7 @@ DEFUN (ip_ospf_priority, DEFUN_HIDDEN (ospf_priority, ospf_priority_cmd, - "ospf priority <0-255>", + "ospf priority (0-255)", "OSPF interface commands\n" "Router priority\n" "Priority\n") @@ -7658,7 +7658,7 @@ DEFUN (ip_ospf_retransmit_interval, DEFUN_HIDDEN (ospf_retransmit_interval, ospf_retransmit_interval_cmd, - "ospf retransmit-interval <3-65535>", + "ospf retransmit-interval (3-65535)", "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" "Seconds\n") @@ -7704,7 +7704,7 @@ DEFUN (no_ospf_retransmit_interval, DEFUN (no_ip_ospf_retransmit_interval, no_ip_ospf_retransmit_interval_addr_cmd, - "no ip ospf retransmit-interval [<<3-65535 [A.B.C.D]|A.B.C.D>]", + "no ip ospf retransmit-interval [<(3-65535) [A.B.C.D]|A.B.C.D>]", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7803,7 +7803,7 @@ DEFUN (ip_ospf_transmit_delay, DEFUN_HIDDEN (ospf_transmit_delay, ospf_transmit_delay_cmd, - "ospf transmit-delay <1-65535>", + "ospf transmit-delay (1-65535)", "OSPF interface commands\n" "Link state transmit delay\n" "Seconds\n") @@ -8058,7 +8058,7 @@ DEFUN (no_ip_ospf_instance_area, DEFUN (ospf_redistribute_source, ospf_redistribute_source_cmd, - "redistribute [|route-map WORD>]", + "redistribute []", REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD "Metric for redistributed routes\n" @@ -8113,7 +8113,7 @@ DEFUN (ospf_redistribute_source, DEFUN (no_ospf_redistribute_source, no_ospf_redistribute_source_cmd, - "no redistribute [|route-map WORD>]", + "no redistribute []", NO_STR REDIST_STR QUAGGA_REDIST_HELP_STR_OSPFD @@ -8320,7 +8320,7 @@ DEFUN (no_ospf_distribute_list_out, /* Default information originate. */ DEFUN (ospf_default_information_originate, ospf_default_information_originate_cmd, - "default-information originate [|route-map WORD>]", + "default-information originate []", "Control distribution of default information\n" "Distribute a default route\n" "Always advertise default route\n" diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 95fadde952..4e37871456 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1327,7 +1327,7 @@ DEFUN (no_rip_neighbor, DEFUN (ip_rip_receive_version, ip_rip_receive_version_cmd, - "ip rip receive version <1|2>", + "ip rip receive version (1-2)", IP_STR "Routing Information Protocol\n" "Advertisement reception\n" @@ -1400,7 +1400,7 @@ DEFUN (ip_rip_receive_version_2, DEFUN (no_ip_rip_receive_version, no_ip_rip_receive_version_cmd, - "no ip rip receive version [<1|2>]", + "no ip rip receive version [(1-2)]", NO_STR IP_STR "Routing Information Protocol\n" @@ -1422,7 +1422,7 @@ DEFUN (no_ip_rip_receive_version, DEFUN (ip_rip_send_version, ip_rip_send_version_cmd, - "ip rip send version <1|2>", + "ip rip send version (1-2)", IP_STR "Routing Information Protocol\n" "Advertisement transmission\n" @@ -1495,7 +1495,7 @@ DEFUN (ip_rip_send_version_2, DEFUN (no_ip_rip_send_version, no_ip_rip_send_version_cmd, - "no ip rip send version [<1|2>]", + "no ip rip send version [(1-2)]", NO_STR IP_STR "Routing Information Protocol\n" diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index de973cf4ce..8ab3243dbd 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1942,7 +1942,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_monitor, vtysh_log_monitor_cmd, - "log monitor [", + "log monitor []", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) From 8de197ce04e80b67054dfeae7ee4892d0173fd0f Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Sat, 1 Oct 2016 05:45:58 +0000 Subject: [PATCH 194/280] bgpd: fix << in command strings Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 18 +++++++++++++----- bgpd/bgp_vty.c | 12 +++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index bb1849e4b4..832a437790 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,14 +7732,17 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", + "show [ip] bgp [ WORD] [] [|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7857,13 +7860,15 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [] [json]", + "show [ip] bgp [ WORD] [] [] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -7923,7 +7928,7 @@ DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, - "show [ip] bgp all [< [unicast]|ipv4 multicast|vpnv4 unicast>] [json]", + "show [ip] bgp all [] [json]", SHOW_STR IP_STR BGP_STR @@ -9243,14 +9248,17 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [] WORD [< [unicast]|ipv4 multicast>] neighbors [] [json]", + "show [ip] bgp [] WORD [] neighbors [] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -9416,7 +9424,7 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] neighbors [json]", + "show [ip] bgp [ WORD] [] neighbors [json]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e188de6e76..4f04a97347 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5963,7 +5963,7 @@ bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [< [unicast]|ipv4 multicast>] []|in [prefix-filter]|out>]", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -5977,8 +5977,11 @@ DEFUN (clear_ip_bgp_all, "Clear all members of peer-group\n" "BGP peer-group name\n" "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -6830,14 +6833,17 @@ bgp_show_summary_vty (struct vty *vty, const char *name, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] summary [json]", + "show [ip] bgp [ WORD] [] summary [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" + "Address Family modifier\n" "Address family\n" "Address Family modifier\n" "Address family\n" @@ -8874,7 +8880,7 @@ bgp_show_update_groups(struct vty *vty, const char *name, DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] update-groups [SUBGROUP-ID]", + "show [ip] bgp [ WORD] [] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR From c5bd4620b0a6f37ceb44e004eceda1a708585e5b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 1 Oct 2016 20:05:10 +0000 Subject: [PATCH 195/280] lib: Fix command execution npe Caller may pass NULL if it does not care about what command was matched. Signed-off-by: Quentin Young --- lib/command.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/command.c b/lib/command.c index a74e967c94..9d68f33989 100644 --- a/lib/command.c +++ b/lib/command.c @@ -698,8 +698,13 @@ cmd_execute_command_real (vector vline, { struct list *argv_list; enum matcher_rv status; + struct cmd_element *matched_element = NULL; + struct graph *cmdgraph = cmd_node_graph (cmdvec, vty->node); - status = command_match (cmdgraph, vline, &argv_list, cmd); + status = command_match (cmdgraph, vline, &argv_list, &matched_element); + + if (cmd) + *cmd = matched_element; // if matcher error, return corresponding CMD_ERR if (MATCHER_ERROR(status)) @@ -724,10 +729,10 @@ cmd_execute_command_real (vector vline, int argc = argv_list->count; int ret; - if ((*cmd)->daemon) + if (matched_element->daemon) ret = CMD_SUCCESS_DAEMON; else - ret = (*cmd)->func (*cmd, vty, argc, argv); + ret = matched_element->func (matched_element, vty, argc, argv); // delete list and cmd_token's in it list_delete (argv_list); From 51d41d759bcd02506ec562018faace777dcee352 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 2 Oct 2016 03:27:58 +0000 Subject: [PATCH 196/280] lib: Null-terminate tab completions char*[] vtysh expects the result of a tab completion to have a null pointer as the last element Signed-off-by: Quentin Young --- lib/command.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/command.c b/lib/command.c index 9d68f33989..405cf6de66 100644 --- a/lib/command.c +++ b/lib/command.c @@ -618,8 +618,9 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) // get token completions vector comps = cmd_complete_command_real (shifted_vline, vty, status); - ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *)); - for (unsigned int i = 0; i < vector_active (comps); i++) + ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); + unsigned int i; + for (i = 0; i < vector_active (comps); i++) { struct cmd_token *token = vector_slot (comps, i); ret[i] = XSTRDUP (MTYPE_TMP, token->text); @@ -627,6 +628,7 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) del_cmd_token (token); } vector_free (comps); + ret[i] = NULL; vector_free(shifted_vline); vty->node = onode; @@ -635,14 +637,16 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) // get token completions vector comps = cmd_complete_command_real (vline, vty, status); - ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *)); - for (unsigned int i = 0; i < vector_active (comps); i++) + ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); + unsigned int i; + for (i = 0; i < vector_active (comps); i++) { struct cmd_token *token = vector_slot (comps, i); ret[i] = XSTRDUP (MTYPE_TMP, token->text); vector_unset (comps, i); del_cmd_token (token); } + ret[i] = NULL; vector_free (comps); return ret; From a78596c42d43a01de85c7ada95d15b165743f6ff Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 2 Oct 2016 04:47:31 +0000 Subject: [PATCH 197/280] lib: explicitly support the case of empty input for completions When the user tab- or ?-completes when the character prior to the position of the cursor is a space, completion logic is passed null. Explicitly handle this case instead of using partly_match, which has special logic associated with it to allow abbreviating certain tokens. Signed-off-by: Quentin Young --- lib/command_match.c | 24 +++++++----------------- lib/command_match.h | 7 ++++--- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index aa961d3514..85d627e1be 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -303,6 +303,7 @@ command_complete (struct graph *graph, struct cmd_token *token = gn->data; switch (match_token (token, input_token)) { + case trivial_match: case partly_match: if (idx == vector_active (vline) - 1) { @@ -526,6 +527,10 @@ del_arglist (struct list *list) static enum match_type match_token (struct cmd_token *token, char *input_token) { + // nothing trivially matches everything + if (!input_token) + return trivial_match; + switch (token->type) { case WORD_TKN: return match_word (token, input_token); @@ -557,9 +562,6 @@ match_ipv4 (const char *str) int dots = 0, nums = 0; char buf[4]; - if (str == NULL) - return partly_match; - for (;;) { memset (buf, 0, sizeof (buf)); @@ -614,9 +616,6 @@ match_ipv4_prefix (const char *str) int dots = 0; char buf[4]; - if (str == NULL) - return partly_match; - for (;;) { memset (buf, 0, sizeof (buf)); @@ -696,9 +695,6 @@ match_ipv6 (const char *str) struct sockaddr_in6 sin6_dummy; int ret; - if (str == NULL) - return partly_match; - if (strspn (str, IPV6_ADDR_STR) != strlen (str)) return no_match; @@ -718,9 +714,6 @@ match_ipv6_prefix (const char *str) char *tofree, *dupe, *prefix, *mask, *endptr; int nmask = -1; - if (str == NULL) - return partly_match; - if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) return no_match; @@ -763,9 +756,6 @@ match_range (struct cmd_token *token, const char *str) char *endptr = NULL; long long val; - if (str == NULL) - return 1; - val = strtoll (str, &endptr, 10); if (*endptr != '\0') return 0; @@ -781,8 +771,8 @@ match_word (struct cmd_token *token, const char *word) { assert (token->type == WORD_TKN); - // if the passed token is null or 0 length, partly match - if (!word || !strlen(word)) + // if the passed token is 0 length, partly match + if (!strlen(word)) return partly_match; // if the passed token is strictly a prefix of the full word, partly match diff --git a/lib/command_match.h b/lib/command_match.h index 728d9c1d95..ac4e70c316 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -50,9 +50,10 @@ enum matcher_rv /* completion match types */ enum match_type { - no_match, - partly_match, - exact_match + trivial_match, // the input is null + no_match, // the input does not match + partly_match, // the input matches but is incomplete + exact_match // the input matches and is complete }; /* Defines which matcher_rv values constitute an error. Should be used with From 96dcc565e6e590eddd124cdcf3634b68b9579a85 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 2 Oct 2016 19:13:59 +0000 Subject: [PATCH 198/280] tools: add command permutations generator Signed-off-by: Quentin Young --- tools/.gitignore | 3 ++- tools/Makefile.am | 8 +++++++ tools/permutations.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tools/permutations.c diff --git a/tools/.gitignore b/tools/.gitignore index dd5bf7c67c..60c4c0650f 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -3,4 +3,5 @@ *~ *.loT - +.libs +*.o diff --git a/tools/Makefile.am b/tools/Makefile.am index 125bfee2c2..c5dbba5a8b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,11 @@ +AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib +DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" +AM_CFLAGS = $(WERROR) + +bin_PROGRAMS = permutations +permutations_SOURCES = permutations.c +permutations_LDADD = ../lib/libzebra.la + sbin_SCRIPTS = quagga-reload.py quagga EXTRA_DIST = quagga.service quagga-reload.py quagga diff --git a/tools/permutations.c b/tools/permutations.c new file mode 100644 index 0000000000..4862781296 --- /dev/null +++ b/tools/permutations.c @@ -0,0 +1,57 @@ +#include "command.h" +#include "graph.h" +#include "command_parse.h" +#include "vector.h" + +void +pretty_print_graph (struct graph_node *); + +int main (int argc, char *argv[]) +{ + struct cmd_element *cmd = calloc (1, sizeof (struct cmd_element)); + cmd->string = strdup(argv[1]); + + struct graph *graph = graph_new(); + struct cmd_token *token = new_cmd_token (START_TKN, NULL, NULL); + graph_new_node (graph, token, NULL); + command_parse_format (graph, cmd); + + pretty_print_graph (vector_slot (graph->nodes, 0)); +} + +/** + * Pretty-prints a graph, assuming it is a tree. + * + * @param start the node to take as the root + * @param level indent level for recursive calls, always pass 0 + */ + +void +pretty_print_graph (struct graph_node *start) +{ + static struct list *position = NULL; + if (!position) position = list_new (); + + // recursive dfs + listnode_add (position, start); + for (unsigned int i = 0; i < vector_active (start->to); i++) + { + struct graph_node *gn = vector_slot (start->to, i); + struct cmd_token *tok = gn->data; + if (tok->type == END_TKN) + { + struct graph_node *gnn; + struct listnode *ln; + for (ALL_LIST_ELEMENTS_RO (position,ln,gnn)) + { + struct cmd_token *tt = gnn->data; + if (tt->type < SELECTOR_TKN) + fprintf (stdout, "%s ", tt->text); + } + fprintf (stdout, "\n"); + } + else + pretty_print_graph (gn); + } + list_delete_node (position, listtail(position)); +} From 4d12266b808b1208fb603406346025e1a2a66858 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 2 Oct 2016 19:14:40 +0000 Subject: [PATCH 199/280] lib: allow nesting selectors Signed-off-by: Quentin Young --- lib/command_parse.y | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/command_parse.y b/lib/command_parse.y index 2d8881689d..89c0e47f83 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -343,6 +343,7 @@ selector_token: $$->start = $$->end = $1; } | option +| selector ; /* [option] productions */ From 73baf6a3a66d783c89ad2efac556f2e3eb48c568 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 2 Oct 2016 19:30:08 +0000 Subject: [PATCH 200/280] tools: add copyright header & usage to permutations Signed-off-by: Quentin Young --- tools/.gitignore | 1 + tools/permutations.c | 46 +++++++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/tools/.gitignore b/tools/.gitignore index 60c4c0650f..066b0887ae 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -5,3 +5,4 @@ *.loT .libs *.o +permutations diff --git a/tools/permutations.c b/tools/permutations.c index 4862781296..819305e54e 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -1,13 +1,44 @@ +/* + * Generates all possible matching inputs for a command string. + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + #include "command.h" #include "graph.h" #include "command_parse.h" #include "vector.h" +#define USAGE "usage: permutations " + void -pretty_print_graph (struct graph_node *); +permute (struct graph_node *); int main (int argc, char *argv[]) { + if (argc < 2) + { + fprintf(stdout, USAGE"\n"); + exit(EXIT_SUCCESS); + } + struct cmd_element *cmd = calloc (1, sizeof (struct cmd_element)); cmd->string = strdup(argv[1]); @@ -16,18 +47,11 @@ int main (int argc, char *argv[]) graph_new_node (graph, token, NULL); command_parse_format (graph, cmd); - pretty_print_graph (vector_slot (graph->nodes, 0)); + permute (vector_slot (graph->nodes, 0)); } -/** - * Pretty-prints a graph, assuming it is a tree. - * - * @param start the node to take as the root - * @param level indent level for recursive calls, always pass 0 - */ - void -pretty_print_graph (struct graph_node *start) +permute (struct graph_node *start) { static struct list *position = NULL; if (!position) position = list_new (); @@ -51,7 +75,7 @@ pretty_print_graph (struct graph_node *start) fprintf (stdout, "\n"); } else - pretty_print_graph (gn); + permute (gn); } list_delete_node (position, listtail(position)); } From 268316d185899e7747670b7edf35c17eb7be046d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 3 Oct 2016 23:21:11 +0000 Subject: [PATCH 201/280] lib: Clean up completions code, fix segfault on no match Signed-off-by: Quentin Young --- lib/command.c | 82 ++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/lib/command.c b/lib/command.c index 405cf6de66..35b13fe8e0 100644 --- a/lib/command.c +++ b/lib/command.c @@ -597,57 +597,47 @@ cmd_describe_command (vector vline, struct vty *vty, int *status) char ** cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) { - char **ret; + char **ret = NULL; + int original_node = vty->node; + vector input_line = vector_init (vector_count (vline)); - if ( cmd_try_do_shortcut(vty->node, vector_slot(vline, 0) ) ) - { - enum node_type onode; - vector shifted_vline; - unsigned int index; + // if the first token is 'do' we'll want to execute the command in the enable node + int do_shortcut = cmd_try_do_shortcut (vty->node, vector_slot (vline, 0)); + vty->node = do_shortcut ? ENABLE_NODE : original_node; - onode = vty->node; - vty->node = ENABLE_NODE; - /* We can try it on enable node, cos' the vty is authenticated */ + // construct the input line we'll be matching on + unsigned int offset = (do_shortcut) ? 1 : 0; + for (unsigned index = 0; index + offset < vector_active (vline); index++) + vector_set_index (input_line, index + offset, vector_lookup (vline, index)); - shifted_vline = vector_init (vector_count(vline)); - /* use memcpy? */ - for (index = 1; index < vector_active (vline); index++) - { - vector_set_index (shifted_vline, index-1, vector_lookup(vline, index)); - } - - // get token completions - vector comps = cmd_complete_command_real (shifted_vline, vty, status); - ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); - unsigned int i; - for (i = 0; i < vector_active (comps); i++) - { - struct cmd_token *token = vector_slot (comps, i); - ret[i] = XSTRDUP (MTYPE_TMP, token->text); - vector_unset (comps, i); - del_cmd_token (token); - } - vector_free (comps); - ret[i] = NULL; - - vector_free(shifted_vline); - vty->node = onode; - return ret; + // get token completions -- this is a copying operation + vector comps = cmd_complete_command_real (input_line, vty, status); + if (!MATCHER_ERROR (*status)) + { + // copy completions text into an array of char* + ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); + unsigned int i; + for (i = 0; i < vector_active (comps); i++) + { + struct cmd_token *token = vector_slot (comps, i); + ret[i] = XSTRDUP (MTYPE_TMP, token->text); + vector_unset (comps, i); + del_cmd_token (token); + } + // set the last element to NULL, which vty/vtysh uses as a sentinel value + ret[i] = NULL; + vector_free (comps); + comps = NULL; } - // get token completions - vector comps = cmd_complete_command_real (vline, vty, status); - ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); - unsigned int i; - for (i = 0; i < vector_active (comps); i++) - { - struct cmd_token *token = vector_slot (comps, i); - ret[i] = XSTRDUP (MTYPE_TMP, token->text); - vector_unset (comps, i); - del_cmd_token (token); - } - ret[i] = NULL; - vector_free (comps); + // comps should always be null here + assert (!comps); + + // free the adjusted input line + vector_free (input_line); + + // reset vty->node to its original value + vty->node = original_node; return ret; } From 5daa3e5e599faae335d2298b68c1503d9bbfa6b2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 00:22:15 +0000 Subject: [PATCH 202/280] bgpd: Fix off-by-one in `clear [ip] bgp...` Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4f04a97347..7dc8774835 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6064,19 +6064,23 @@ DEFUN (clear_ip_bgp_all, /* afi safi */ idx_afi = idx_clr_sort + 1; idx_safi = idx_clr_sort + 2; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_soft_in_out); + idx_soft_in_out = 0; + if (argc > idx_afi) + bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_soft_in_out); - /* soft, soft in, or soft out */ - if (strmatch(argv[idx_soft_in_out]->text, "in")) - clr_type = BGP_CLEAR_SOFT_IN; - else if (strmatch(argv[idx_soft_in_out]->text, "out")) - clr_type = BGP_CLEAR_SOFT_OUT; - else if (strmatch(argv[idx_soft_in_out]->text, "soft")) - clr_type = BGP_CLEAR_SOFT_BOTH; - else if (strmatch(argv[idx_soft_in_out]->text, "prefix-filter")) - clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; - else - clr_type = BGP_CLEAR_SOFT_NONE; + clr_type = BGP_CLEAR_SOFT_NONE; + if (idx_soft_in_out && argc > idx_soft_in_out) + { + /* soft, soft in, or soft out */ + if (strmatch(argv[idx_soft_in_out]->text, "in")) + clr_type = BGP_CLEAR_SOFT_IN; + else if (strmatch(argv[idx_soft_in_out]->text, "out")) + clr_type = BGP_CLEAR_SOFT_OUT; + else if (strmatch(argv[idx_soft_in_out]->text, "soft")) + clr_type = BGP_CLEAR_SOFT_BOTH; + else if (strmatch(argv[idx_soft_in_out]->text, "prefix-filter")) + clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; + } return bgp_clear_vty (vty, vrf, afi, safi, clr_sort, clr_type, clr_arg); } From ccb8e0c7fb7cae7151fff87005ddd6a67e5e833c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 01:13:44 +0000 Subject: [PATCH 203/280] ospfd, ospf6d, ripd: Fix miscellaneous syntax errors Signed-off-by: Quentin Young --- ospf6d/ospf6_interface.c | 2 +- ospfd/ospf_vty.c | 4 ++-- ripd/rip_interface.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 27788745d0..3d65afc035 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1300,7 +1300,7 @@ DEFUN (auto_cost_reference_bandwidth, DEFUN (no_auto_cost_reference_bandwidth, no_auto_cost_reference_bandwidth_cmd, - "no auto-cost reference-bandwidth [1-4294967]", + "no auto-cost reference-bandwidth [(1-4294967)]", NO_STR "Calculate OSPF interface cost according to bandwidth\n" "Use reference bandwidth method to assign OSPF cost\n" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 3609299007..19c1c66746 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8146,7 +8146,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute (1-65535) [|route-map WORD>]", + "redistribute (1-65535) []", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -8218,7 +8218,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute (1-65535) [|route-map WORD>]", + "no redistribute (1-65535) []", NO_STR REDIST_STR "Open Shortest Path First\n" diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 4e37871456..5ee2c0f312 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1379,7 +1379,7 @@ DEFUN (ip_rip_receive_version_1, DEFUN (ip_rip_receive_version_2, ip_rip_receive_version_2_cmd, - "ip rip receive version 2 1", + "ip rip receive version (2-2) (1-1)", IP_STR "Routing Information Protocol\n" "Advertisement reception\n" @@ -1453,7 +1453,7 @@ DEFUN (ip_rip_send_version, DEFUN (ip_rip_send_version_1, ip_rip_send_version_1_cmd, - "ip rip send version 1 2", + "ip rip send version (1-1) (2-2)", IP_STR "Routing Information Protocol\n" "Advertisement transmission\n" @@ -1474,7 +1474,7 @@ DEFUN (ip_rip_send_version_1, DEFUN (ip_rip_send_version_2, ip_rip_send_version_2_cmd, - "ip rip send version 2 1", + "ip rip send version (2-2) (1-1)", IP_STR "Routing Information Protocol\n" "Advertisement transmission\n" From 98463e0ab752e3975f3f3ebb0ad99bbb205e1187 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 18:47:17 +0000 Subject: [PATCH 204/280] lib: fix password and enable password syntax Signed-off-by: Quentin Young --- lib/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/command.c b/lib/command.c index 35b13fe8e0..bbb6a566f1 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1373,7 +1373,7 @@ DEFUN (config_no_hostname, /* VTY interface password set. */ DEFUN (config_password, password_cmd, - "password [8] WORD", + "password [(8-8)] WORD", "Assign the terminal connection password\n" "Specifies a HIDDEN password will follow\n" "The password string\n") @@ -1417,7 +1417,7 @@ DEFUN (config_password, /* VTY enable password set. */ DEFUN (config_enable_password, enable_password_cmd, - "enable password [8] WORD", + "enable password [(8-8)] WORD", "Modify enable password parameters\n" "Assign the privileged level password\n" "Specifies a HIDDEN password will follow\n" From 12dcf78e0befd448804566438a754261ffbbd2e5 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 19:21:45 +0000 Subject: [PATCH 205/280] all: Fix various syntax errors Signed-off-by: Quentin Young --- bgpd/bgp_routemap.c | 24 +++++++++++++++++------- bgpd/bgp_vty.c | 2 +- isisd/isis_vty.c | 14 +++++++++++++- ospfd/ospf_vty.c | 2 +- ripd/rip_interface.c | 2 +- zebra/zebra_vty.c | 2 +- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d823b962b8..730dfbda79 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3698,15 +3698,13 @@ DEFUN (no_set_weight, } -DEFUN (set_aspath_prepend, - set_aspath_prepend_cmd, - "set as-path prepend <(1-4294967295)...|last-as (1-10)>", +DEFUN (set_aspath_prepend_asn, + set_aspath_prepend_asn_cmd, + "set as-path prepend (1-4294967295)...", SET_STR "Transform BGP AS_PATH attribute\n" "Prepend to the as-path\n" - "AS number\n" - "Use the peer's AS-number\n" - "Number of times to insert") + "AS number\n") { int idx_asn = 3; int ret; @@ -3719,6 +3717,17 @@ DEFUN (set_aspath_prepend, return ret; } +DEFUN (set_aspath_prepend_lastas, + set_aspath_prepend_lastas_cmd, + "set as-path prepend last-as (1-10)", + SET_STR + "Transform BGP AS_PATH attribute\n" + "Prepend to the as-path\n" + "Use the peer's AS-number\n" + "Number of times to insert") +{ + return set_aspath_prepend_asn (self, vty, argc, argv); +} DEFUN (no_set_aspath_prepend, no_set_aspath_prepend_cmd, @@ -4516,7 +4525,8 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &no_set_weight_cmd); install_element (RMAP_NODE, &set_metric_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &set_aspath_prepend_cmd); + install_element (RMAP_NODE, &set_aspath_prepend_asn_cmd); + install_element (RMAP_NODE, &set_aspath_prepend_lastas_cmd); install_element (RMAP_NODE, &set_aspath_exclude_cmd); install_element (RMAP_NODE, &no_set_aspath_prepend_cmd); install_element (RMAP_NODE, &no_set_aspath_exclude_cmd); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 7dc8774835..b5e2d9e36f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -943,7 +943,7 @@ DEFUN (no_bgp_confederation_identifier, DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, - "bgp confederation peers . (1-4294967295)", + "bgp confederation peers (1-4294967295)...", "BGP specific commands\n" "AS confederation parameters\n" "Peer ASs in BGP confederation\n" diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 93c5472609..7fe65e6ca7 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -55,7 +55,7 @@ isis_circuit_lookup (struct vty *vty) DEFUN (ip_router_isis, ip_router_isis_cmd, - " router isis WORD", + "ip router isis WORD", "Interface Internet Protocol config commands\n" "IP router interface commands\n" "IS-IS Routing for IP\n" @@ -108,6 +108,17 @@ DEFUN (ip_router_isis, return CMD_SUCCESS; } +DEFUN (ip6_router_isis, + ip6_router_isis_cmd, + "ipv6 router isis WORD", + "Interface Internet Protocol config commands\n" + "IP router interface commands\n" + "IS-IS Routing for IP\n" + "Routing process tag\n") +{ + return ip_router_isis (self, vty, argc, argv); +} + DEFUN (no_ip_router_isis, no_ip_router_isis_cmd, "no router isis WORD", @@ -2163,6 +2174,7 @@ void isis_vty_init (void) { install_element (INTERFACE_NODE, &ip_router_isis_cmd); + install_element (INTERFACE_NODE, &ip6_router_isis_cmd); install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); install_element (INTERFACE_NODE, &isis_passive_cmd); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 19c1c66746..359189b345 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8372,7 +8372,7 @@ DEFUN (ospf_default_information_originate, DEFUN (no_ospf_default_information_originate, no_ospf_default_information_originate_cmd, - "no default-information originate [|route-map WORD>]", + "no default-information originate []", NO_STR "Control distribution of default information\n" "Distribute a default route\n" diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 5ee2c0f312..6df219628c 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1358,7 +1358,7 @@ DEFUN (ip_rip_receive_version, DEFUN (ip_rip_receive_version_1, ip_rip_receive_version_1_cmd, - "ip rip receive version 1 2", + "ip rip receive version (1-1) (2-2)", IP_STR "Routing Information Protocol\n" "Advertisement reception\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 7f1a042f56..d755562759 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -3696,7 +3696,7 @@ zebra_ip_config (struct vty *vty) DEFUN (ip_zebra_import_table_distance, ip_zebra_import_table_distance_cmd, - "ip import-table (1-252) [distance (1-255)] [route-map WORD>]", + "ip import-table (1-252) [distance (1-255)] [route-map WORD]", IP_STR "import routes from non-main kernel table\n" "kernel routing table id\n" From 42debbb43df2b9c54933a690f1a747c6899902a0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 20:41:52 +0000 Subject: [PATCH 206/280] lib: Add logging for invalid commands Ticket: CM-6855 Signed-off-by: Quentin Young --- lib/command.c | 20 ++++++++++++++++++-- lib/command.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/command.c b/lib/command.c index bbb6a566f1..d2720e1161 100644 --- a/lib/command.c +++ b/lib/command.c @@ -281,6 +281,20 @@ cmd_free_strvec (vector v) vector_free (v); } +char * +cmd_concat_strvec (vector v) +{ + size_t strsize = 1; + for (unsigned int i = 0; i < vector_active (v); i++) + if (vector_slot (v, i)) + strsize += strlen ((char *) vector_slot (v, i)); + + char *concatenated = calloc (sizeof (char), strsize); + for (unsigned int i = 0; i < vector_active (v); i++) + strlcat (concatenated, (char *) vector_slot (v, i), strsize); + + return concatenated; +} /* Return prompt character of specified node. */ const char * @@ -311,7 +325,6 @@ install_element (enum node_type ntype, struct cmd_element *cmd) exit (EXIT_FAILURE); } - fprintf (stdout, "installing %s in node %d\n", cmd->string, ntype); // add node to command graph and command vector command_parse_format (cnode->cmdgraph, cmd); vector_set (cnode->cmd_vector, cmd); @@ -709,6 +722,10 @@ cmd_execute_command_real (vector vline, case MATCHER_AMBIGUOUS: return CMD_ERR_AMBIGUOUS; default: + {} // C... + char *inputline = cmd_concat_strvec (vline); + zlog_debug ("invalid command %s for node %d\n", inputline, vty->node); + free (inputline); return CMD_ERR_NO_MATCH; } @@ -2129,7 +2146,6 @@ host_config_set (const char *filename) void install_default (enum node_type node) { - fprintf (stdout, "installing default\n"); install_element (node, &config_exit_cmd); install_element (node, &config_quit_cmd); install_element (node, &config_end_cmd); diff --git a/lib/command.h b/lib/command.h index edbe69b71d..e411e9c18c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -398,6 +398,7 @@ extern char *argv_concat (struct cmd_token **argv, int argc, int shift); extern vector cmd_make_strvec (const char *); extern void cmd_free_strvec (vector); +extern char *cmd_concat_strvec (vector); extern vector cmd_describe_command (vector, struct vty *, int *status); extern char **cmd_complete_command (vector, struct vty *, int *status); extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib); From cc0a8be6336c8f074a7397d3810cc5efa037e5cb Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 4 Oct 2016 20:56:30 +0000 Subject: [PATCH 207/280] lib: Allow / and . to match VARIABLE_TKN, fix range matches Range matching function was returning 0 instead of no_match on failed match, causing all input to match ranges. Signed-off-by: Quentin Young --- lib/command_match.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 85d627e1be..dcad943619 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -758,7 +758,7 @@ match_range (struct cmd_token *token, const char *str) val = strtoll (str, &endptr, 10); if (*endptr != '\0') - return 0; + return no_match; if (val < token->min || val > token->max) return no_match; @@ -789,7 +789,7 @@ match_word (struct cmd_token *token, const char *word) } #define VARIABLE_ALPHABET \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:" +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/." static enum match_type match_variable (struct cmd_token *token, const char *word) From 49d73233c3d789e2176187d57b26ba9439dfce11 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 5 Oct 2016 23:02:57 +0000 Subject: [PATCH 208/280] zebra: Fix typo in zebra command desc Signed-off-by: Quentin Young --- zebra/zserv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zebra/zserv.c b/zebra/zserv.c index 5c4957a682..98908fb67e 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2326,7 +2326,7 @@ DEFUN (show_zebra_client, show_zebra_client_cmd, "show zebra client", SHOW_STR - "Zebra information" + "Zebra information\n" "Client information") { struct listnode *node; From 3871154b720569b12e037af88ac2ea9e8a0a1ace Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 5 Oct 2016 23:50:49 +0000 Subject: [PATCH 209/280] lib: Invalid commands are errors, fix msg formatting Signed-off-by: Quentin Young --- lib/command.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/command.c b/lib/command.c index d2720e1161..6368ebffe1 100644 --- a/lib/command.c +++ b/lib/command.c @@ -284,14 +284,17 @@ cmd_free_strvec (vector v) char * cmd_concat_strvec (vector v) { - size_t strsize = 1; + size_t strsize = 0; for (unsigned int i = 0; i < vector_active (v); i++) if (vector_slot (v, i)) - strsize += strlen ((char *) vector_slot (v, i)); + strsize += strlen ((char *) vector_slot (v, i)) + 1; char *concatenated = calloc (sizeof (char), strsize); for (unsigned int i = 0; i < vector_active (v); i++) + { strlcat (concatenated, (char *) vector_slot (v, i), strsize); + strlcat (concatenated, " ", strsize); + } return concatenated; } @@ -724,7 +727,7 @@ cmd_execute_command_real (vector vline, default: {} // C... char *inputline = cmd_concat_strvec (vline); - zlog_debug ("invalid command %s for node %d\n", inputline, vty->node); + zlog_err ("invalid command \"%s\" for node %d\n", inputline, vty->node); free (inputline); return CMD_ERR_NO_MATCH; } From b4f56274fa6aa7240e06a67da0e85bfd0e4b2052 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 5 Oct 2016 23:56:17 +0000 Subject: [PATCH 210/280] lib: Add tracing capabilities to command matcher Compile with -DTRACE_MATCHER to enable matcher debugging to stdout. Signed-off-by: Quentin Young --- lib/command_match.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/command_match.c b/lib/command_match.c index dcad943619..36efa3e76d 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -116,6 +116,13 @@ command_match (struct graph *cmdgraph, assert (*el); } +#ifdef TRACE_MATCHER + if (!*el) + fprintf (stdout, "No match\n"); + else + fprintf (stdout, "Matched command\n->string %s\n->desc %s\n", (*el)->string, (*el)->doc); +#endif + // free the leader token we alloc'd XFREE (MTYPE_TMP, vector_slot (vvline, 0)); // free vector @@ -184,6 +191,26 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // get the current operating input token char *input_token = vector_slot (vline, n); +#ifdef TRACE_MATCHER + fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); + switch (match_token (token, input_token)) + { + case trivial_match: + fprintf (stdout, "trivial_match "); + break; + case no_match: + fprintf (stdout, "no_match "); + break; + case partly_match: + fprintf (stdout, "partly_match "); + break; + case exact_match: + fprintf (stdout, "exact_match "); + break; + } + fprintf (stdout, "(minimum: %d)\n", minmatch); +#endif + // if we don't match this node, die if (match_token (token, input_token) < minmatch) return NULL; @@ -301,19 +328,35 @@ command_complete (struct graph *graph, for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { struct cmd_token *token = gn->data; +#ifdef TRACE_MATCHER + fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); +#endif + switch (match_token (token, input_token)) { case trivial_match: +#ifdef TRACE_MATCHER + fprintf (stdout, "trivial_match\n"); +#endif case partly_match: +#ifdef TRACE_MATCHER + fprintf (stdout, "partly_match\n"); +#endif if (idx == vector_active (vline) - 1) { listnode_add (next, gn); break; } case exact_match: +#ifdef TRACE_MATCHER + fprintf (stdout, "exact_match\n"); +#endif add_nexthops (next, gn); break; default: +#ifdef TRACE_MATCHER + fprintf (stdout, "no_match\n"); +#endif break; } } From 03ca8d3dffb45aa1f20bc06802ca227a6b4e36cf Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 6 Oct 2016 00:03:39 +0000 Subject: [PATCH 211/280] lib: Check match level when calculating completions Adds a missing check that resulted in partial token matches being accepted as exact matches when calculating input completions. Signed-off-by: Quentin Young --- lib/command_match.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/command_match.c b/lib/command_match.c index 36efa3e76d..ac6a6c813a 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -328,6 +328,7 @@ command_complete (struct graph *graph, for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { struct cmd_token *token = gn->data; + enum match_type minmatch = min_match_level (token->type); #ifdef TRACE_MATCHER fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); #endif @@ -347,6 +348,8 @@ command_complete (struct graph *graph, listnode_add (next, gn); break; } + if (minmatch > partly_match) + break; case exact_match: #ifdef TRACE_MATCHER fprintf (stdout, "exact_match\n"); From 6011c1b213fa8e08126e33852403845a39881072 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 6 Oct 2016 01:15:48 +0000 Subject: [PATCH 212/280] lib: Make appear first in completions When a command is complete and appears in tab- or ?-completions, make sure it appears first Signed-off-by: Quentin Young --- lib/command.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/command.c b/lib/command.c index 6368ebffe1..f51b2c69ee 100644 --- a/lib/command.c +++ b/lib/command.c @@ -498,7 +498,10 @@ compare_completions (const void *fst, const void *snd) /** * Takes a list of completions returned by command_complete, * dedeuplicates them based on both text and description, - * and returns them as a vector. + * sorts them, and returns them as a vector. + * + * @param completions linked list of cmd_token + * @return deduplicated and sorted vector with */ static vector completions_to_vec (struct list *completions) @@ -506,10 +509,13 @@ completions_to_vec (struct list *completions) vector comps = vector_init (VECTOR_MIN_SIZE); struct listnode *ln; - struct cmd_token *token; + struct cmd_token *token, *cr = NULL; unsigned int i, exists; for (ALL_LIST_ELEMENTS_RO(completions,ln,token)) { + if (token->type == END_TKN && (cr = token)) + continue; + // linear search for token in completions vector exists = 0; for (i = 0; i < vector_active (comps) && !exists; i++) @@ -529,6 +535,13 @@ completions_to_vec (struct list *completions) sizeof (void *), &compare_completions); + if (cr) + { + vector_set_index (comps, vector_active (comps), NULL); + memmove (comps->index + 1, comps->index, (comps->alloced - 1) * sizeof (void *)); + vector_set_index (comps, 0, copy_cmd_token (cr)); + } + return comps; } /** From 3c2caef9fd680437c9b85b91928b7fe6ef2a0905 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 6 Oct 2016 04:08:34 +0000 Subject: [PATCH 213/280] zebra: Fix static route helper function Signed-off-by: Quentin Young --- zebra/zebra_vty.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index d755562759..b3164839fa 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -312,25 +312,25 @@ zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], int idx_curr, char **tag, char **distance, char **vrf) { - if (argc > idx_curr) - { - if (strmatch (argv[idx_curr]->text, "tag")) - { - *tag = argv[idx_curr]->arg; - idx_curr++; - } - - if (strmatch (argv[idx_curr]->text, "vrf")) - { - *distance = NULL; - *vrf = argv[idx_curr]->arg; - } - else - { - *distance = argv[idx_curr]->arg; - *vrf = argv[++idx_curr]->arg; - } - } + *distance = NULL; + while (idx_curr < argc) + { + if (strmatch (argv[idx_curr]->text, "tag")) + { + *tag = argv[idx_curr+1]->arg; + idx_curr += 2; + } + else if (strmatch (argv[idx_curr]->text, "vrf")) + { + *vrf = argv[idx_curr+1]->arg; + idx_curr += 2; + } + else + { + *distance = argv[idx_curr]->arg; + idx_curr++; + } + } return; } From 56158e123546b04faf2ab8e009d41067d8cde5da Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 6 Oct 2016 13:51:52 +0000 Subject: [PATCH 214/280] vtysh: extract.pl <0-255> to (0-255) changes Signed-off-by: Daniel Walton --- vtysh/extract.pl.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index e777039b34..5c8e6a4d2e 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -34,7 +34,7 @@ print <"'} = "ignore"; +$ignore{'"interface IFNAME " "vrf (0-65535)"'} = "ignore"; $ignore{'"interface IFNAME " "vrf NAME"'} = "ignore"; $ignore{'"link-params"'} = "ignore"; $ignore{'"vrf NAME"'} = "ignore"; @@ -42,11 +42,11 @@ $ignore{'"ip vrf NAME"'} = "ignore"; $ignore{'"router rip"'} = "ignore"; $ignore{'"router ripng"'} = "ignore"; $ignore{'"router ospf"'} = "ignore"; -$ignore{'"router ospf <1-65535>"'} = "ignore"; +$ignore{'"router ospf (1-65535)"'} = "ignore"; $ignore{'"router ospf6"'} = "ignore"; $ignore{'"router bgp"'} = "ignore"; -$ignore{'"router bgp " "<1-4294967295>"'} = "ignore"; -$ignore{'"router bgp " "<1-4294967295>" " (view|vrf) WORD"'} = "ignore"; +$ignore{'"router bgp " "(1-4294967295)"'} = "ignore"; +$ignore{'"router bgp " "(1-4294967295)" " (view|vrf) WORD"'} = "ignore"; $ignore{'"router isis WORD"'} = "ignore"; $ignore{'"router zebra"'} = "ignore"; $ignore{'"address-family ipv4"'} = "ignore"; @@ -63,8 +63,8 @@ $ignore{'"address-family vpnv6"'} = "ignore"; $ignore{'"address-family vpnv6 unicast"'} = "ignore"; $ignore{'"exit-address-family"'} = "ignore"; $ignore{'"key chain WORD"'} = "ignore"; -$ignore{'"key <0-2147483647>"'} = "ignore"; -$ignore{'"route-map WORD (deny|permit) <1-65535>"'} = "ignore"; +$ignore{'"key (0-2147483647)"'} = "ignore"; +$ignore{'"route-map WORD (deny|permit) (1-65535)"'} = "ignore"; $ignore{'"show route-map"'} = "ignore"; $ignore{'"line vty"'} = "ignore"; $ignore{'"who"'} = "ignore"; From cbd7259d95886fe8438fd7d4e3ea75db2dae55f0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 6 Oct 2016 18:39:31 +0000 Subject: [PATCH 215/280] lib: Log invalid/unknown commands to log file Ticket: CM-6855 Signed-off-by: Quentin Young --- lib/command.c | 8 +++----- lib/vty.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/command.c b/lib/command.c index f51b2c69ee..96ce661e4a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -738,10 +738,6 @@ cmd_execute_command_real (vector vline, case MATCHER_AMBIGUOUS: return CMD_ERR_AMBIGUOUS; default: - {} // C... - char *inputline = cmd_concat_strvec (vline); - zlog_err ("invalid command \"%s\" for node %d\n", inputline, vty->node); - free (inputline); return CMD_ERR_NO_MATCH; } @@ -909,10 +905,12 @@ command_config_read_one_line (struct vty *vty, struct cmd_element **cmd, int use ret != CMD_WARNING) { vty->node = saved_node; - memcpy(vty->error_buf, vty->buf, VTY_BUFSIZ); } } + if (ret != CMD_SUCCESS && ret != CMD_WARNING) + memcpy (vty->error_buf, vty->buf, VTY_BUFSIZ); + cmd_free_strvec (vline); return ret; diff --git a/lib/vty.c b/lib/vty.c index 5a4f0fcbe7..ee7ea579a7 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2361,17 +2361,22 @@ vty_read_file (FILE *confp) if ( !((ret == CMD_SUCCESS) || (ret == CMD_ERR_NOTHING_TODO)) ) { + const char *message = NULL; switch (ret) { case CMD_ERR_AMBIGUOUS: - fprintf (stderr, "*** Error reading config: Ambiguous command.\n"); + message = "*** Error reading config: Ambiguous command."; break; case CMD_ERR_NO_MATCH: - fprintf (stderr, "*** Error reading config: There is no such command.\n"); + message = "*** Error reading config: There is no such command."; break; } - fprintf (stderr, "*** Error occured processing line %u, below:\n%s\n", + fprintf (stderr, "%s\n", message); + zlog_err ("%s", message); + fprintf (stderr, "*** Error occurred processing line %u, below:\n%s\n", line_num, vty->error_buf); + zlog_err ("*** Error occurred processing line %u, below:\n%s", + line_num, vty->error_buf); } vty_close (vty); From 82f97584fbc708f4089b1b4f7e6fdc7e07b2db4e Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 6 Oct 2016 19:56:13 +0000 Subject: [PATCH 216/280] all: removed all DEFUN command stomps Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp --- bgpd/bgp_route.c | 4 +- bgpd/bgp_routemap.c | 631 +++----------------- isisd/isis_routemap.c | 282 +-------- lib/routemap.c | 1138 ++++++++++++++++++++++++++++++++++++- lib/routemap.h | 165 ++++++ ospf6d/ospf6_asbr.c | 43 +- ospf6d/ospf6_zebra.c | 27 - ospf6d/ospf6d.c | 1 - ospfd/ospf_routemap.c | 266 +-------- ospfd/ospf_zebra.h | 2 - pimd/pim_routemap.c | 1 + ripd/rip_routemap.c | 433 +------------- ripd/rip_zebra.c | 42 -- ripd/ripd.h | 1 - ripngd/ripng_routemap.c | 289 +--------- ripngd/ripng_zebra.c | 26 - ripngd/ripngd.h | 1 - vtysh/extract.pl.in | 12 +- zebra/connected.c | 1 + zebra/kernel_null.c | 1 + zebra/redistribute_null.c | 1 + zebra/zebra_fpm_netlink.c | 1 + zebra/zebra_rnh_null.c | 1 + zebra/zebra_routemap.c | 256 +-------- zebra/zebra_static.c | 1 + zebra/zebra_vrf.c | 1 + zebra/zserv.h | 2 +- zebra/zserv_null.c | 1 + 28 files changed, 1514 insertions(+), 2116 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 832a437790..9f3c9baae5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,7 +7732,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [] [|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", + "show [ip] bgp [ WORD] [] [|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", SHOW_STR IP_STR BGP_STR @@ -7752,8 +7752,6 @@ DEFUN (show_ip_bgp_ipv4, "Display detailed information about dampening\n" "Display flap statistics of routes\n" "Display paths suppressed due to dampening\n" - "Display routes matching the AS path regular expression\n" - "A regular-expression to match the BGP AS paths\n" "Display routes matching the route-map\n" "A route-map to match on\n" "Display routes conforming to the prefix-list\n" diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 730dfbda79..33a29e8f4c 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -22,6 +22,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "prefix.h" #include "filter.h" +#include "vty.h" #include "routemap.h" #include "command.h" #include "linklist.h" @@ -2614,52 +2615,6 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -/* Add bgp route map rule. */ -static int -bgp_route_set_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -/* Delete bgp route map rule. */ -static int -bgp_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - /* * This is the workhorse routine for processing in/out routemap * modifications. @@ -3036,79 +2991,6 @@ DEFUN (no_match_peer, } - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 3; - return bgp_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg, - RMAP_EVENT_FILTER_ADDED); -} - - -DEFUN (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_word = 4; - if (argc <= idx_word) - return bgp_route_match_delete (vty, vty->index, "ip address", NULL, - RMAP_EVENT_FILTER_DELETED); - return bgp_route_match_delete (vty, vty->index, "ip address", argv[idx_word]->arg, - RMAP_EVENT_FILTER_DELETED); -} - - -DEFUN (match_ip_next_hop, - match_ip_next_hop_cmd, - "match ip next-hop <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 3; - return bgp_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, - RMAP_EVENT_FILTER_ADDED); -} - - -DEFUN (no_match_ip_next_hop, - no_match_ip_next_hop_cmd, - "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_word = 4; - if (argc <= idx_word) - return bgp_route_match_delete (vty, vty->index, "ip next-hop", NULL, - RMAP_EVENT_FILTER_DELETED); - return bgp_route_match_delete (vty, vty->index, "ip next-hop", argv[idx_word]->arg, - RMAP_EVENT_FILTER_DELETED); -} - - /* match probability */ DEFUN (match_probability, match_probability_cmd, @@ -3176,73 +3058,6 @@ DEFUN (no_match_ip_route_source, } -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return bgp_route_match_add (vty, vty->index, "ip address prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); -} - - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - if (argc <= idx_word) - return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", - NULL, RMAP_EVENT_PLIST_DELETED); - return bgp_route_match_delete (vty, vty->index, "ip address prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); -} - - -DEFUN (match_ip_next_hop_prefix_list, - match_ip_next_hop_prefix_list_cmd, - "match ip next-hop prefix-list WORD", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return bgp_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); -} - -DEFUN (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - if (argc <= idx_word) - return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - NULL, RMAP_EVENT_PLIST_DELETED); - return bgp_route_match_delete (vty, vty->index, "ip next-hop prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); -} - - DEFUN (match_ip_route_source_prefix_list, match_ip_route_source_prefix_list_cmd, "match ip route-source prefix-list WORD", @@ -3277,37 +3092,6 @@ DEFUN (no_match_ip_route_source_prefix_list, } -DEFUN (match_metric, - match_metric_cmd, - "match metric (0-4294967295)", - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - int idx_number = 2; - return bgp_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg, - RMAP_EVENT_MATCH_ADDED); -} - - -DEFUN (no_match_metric, - no_match_metric_cmd, - "no match metric [(0-4294967295)]", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - int idx_number = 3; - if (argc <= idx_number) - return bgp_route_match_delete (vty, vty->index, "metric", - NULL, RMAP_EVENT_MATCH_DELETED); - return bgp_route_match_delete (vty, vty->index, "metric", - argv[idx_number]->arg, - RMAP_EVENT_MATCH_DELETED); -} - - DEFUN (match_local_pref, match_local_pref_cmd, "match local-preference (0-4294967295)", @@ -3491,88 +3275,6 @@ DEFUN (no_match_origin, RMAP_EVENT_MATCH_DELETED); } - -DEFUN (match_interface, - match_interface_cmd, - "match interface WORD", - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - int idx_word = 2; - return bgp_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg, - RMAP_EVENT_MATCH_ADDED); -} - - -DEFUN (no_match_interface, - no_match_interface_cmd, - "no match interface [WORD]", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - return bgp_route_match_delete (vty, vty->index, "interface", argv[3]->arg, - RMAP_EVENT_MATCH_DELETED); -} - - -DEFUN (match_tag, - match_tag_cmd, - "match tag (1-65535)", - MATCH_STR - "Match tag of route\n" - "Tag value\n") -{ - int idx_number = 2; - return bgp_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg, - RMAP_EVENT_MATCH_ADDED); -} - - -DEFUN (no_match_tag, - no_match_tag_cmd, - "no match tag [(1-65535)]", - NO_STR - MATCH_STR - "Match tag of route\n" - "Tag value\n") -{ - return bgp_route_match_delete (vty, vty->index, "tag", argv[3]->arg, - RMAP_EVENT_MATCH_DELETED); -} - - -DEFUN (set_ip_nexthop, - set_ip_nexthop_cmd, - "set ip next-hop A.B.C.D", - SET_STR - IP_STR - "Next hop address\n" - "IP address of next hop\n") -{ - int idx_ipv4 = 3; - union sockunion su; - int ret; - - ret = str2sockunion (argv[idx_ipv4]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); - return CMD_WARNING; - } - if (su.sin.sin_addr.s_addr == 0 || - IPV4_CLASS_DE(su.sin.sin_addr.s_addr)) - { - vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast " - "or reserved%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); -} - DEFUN (set_ip_nexthop_peer, set_ip_nexthop_peer_cmd, "set ip next-hop peer-address", @@ -3581,7 +3283,7 @@ DEFUN (set_ip_nexthop_peer, "Next hop address\n" "Use peer address (for BGP only)\n") { - return bgp_route_set_add (vty, vty->index, "ip next-hop", "peer-address"); + return generic_set_add (vty, vty->index, "ip next-hop", "peer-address"); } DEFUN (set_ip_nexthop_unchanged, @@ -3592,55 +3294,7 @@ DEFUN (set_ip_nexthop_unchanged, "Next hop address\n" "Don't modify existing Next hop address\n") { - return bgp_route_set_add (vty, vty->index, "ip next-hop", "unchanged"); -} - - -DEFUN (no_set_ip_nexthop, - no_set_ip_nexthop_cmd, - "no set ip next-hop []", - NO_STR - SET_STR - "Next hop address\n" - "Use peer address (for BGP only)\n" - "IP address of next hop\n") -{ - int idx_peer = 4; - if (argc <= idx_peer) - return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL); - return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[idx_peer]->arg); -} - - -DEFUN (set_metric, - set_metric_cmd, - "set metric <(0-4294967295)|rtt|+rtt|-rtt|+metric|-metric>", - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n" - "Assign round trip time\n" - "Add round trip time\n" - "Subtract round trip time\n" - "Add metric\n" - "Subtract metric\n") -{ - int idx_number = 2; - return bgp_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); -} - - -DEFUN (no_set_metric, - no_set_metric_cmd, - "no set metric [(0-4294967295)]", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - int idx_number = 3; - if (argc <= idx_number) - return bgp_route_set_delete (vty, vty->index, "metric", NULL); - return bgp_route_set_delete (vty, vty->index, "metric", argv[idx_number]->arg); + return generic_set_add (vty, vty->index, "ip next-hop", "unchanged"); } @@ -3652,7 +3306,7 @@ DEFUN (set_local_pref, "Preference value\n") { int idx_number = 2; - return bgp_route_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg); + return generic_set_add (vty, vty->index, "local-preference", argv[idx_number]->arg); } @@ -3666,8 +3320,8 @@ DEFUN (no_set_local_pref, { int idx_localpref = 3; if (argc <= idx_localpref) - return bgp_route_set_delete (vty, vty->index, "local-preference", NULL); - return bgp_route_set_delete (vty, vty->index, "local-preference", argv[idx_localpref]->arg); + return generic_set_delete (vty, vty->index, "local-preference", NULL); + return generic_set_delete (vty, vty->index, "local-preference", argv[idx_localpref]->arg); } @@ -3679,7 +3333,7 @@ DEFUN (set_weight, "Weight value\n") { int idx_number = 2; - return bgp_route_set_add (vty, vty->index, "weight", argv[idx_number]->arg); + return generic_set_add (vty, vty->index, "weight", argv[idx_number]->arg); } @@ -3693,8 +3347,8 @@ DEFUN (no_set_weight, { int idx_weight = 3; if (argc <= idx_weight) - return bgp_route_set_delete (vty, vty->index, "weight", NULL); - return bgp_route_set_delete (vty, vty->index, "weight", argv[idx_weight]->arg); + return generic_set_delete (vty, vty->index, "weight", NULL); + return generic_set_delete (vty, vty->index, "weight", argv[idx_weight]->arg); } @@ -3711,7 +3365,7 @@ DEFUN (set_aspath_prepend_asn, char *str; str = argv_concat (argv, argc, idx_asn); - ret = bgp_route_set_add (vty, vty->index, "as-path prepend", str); + ret = generic_set_add (vty, vty->index, "as-path prepend", str); XFREE (MTYPE_TMP, str); return ret; @@ -3743,7 +3397,7 @@ DEFUN (no_set_aspath_prepend, char *str; str = argv_concat (argv, argc, idx_asn); - ret = bgp_route_set_delete (vty, vty->index, "as-path prepend", str); + ret = generic_set_delete (vty, vty->index, "as-path prepend", str); XFREE (MTYPE_TMP, str); return ret; } @@ -3762,7 +3416,7 @@ DEFUN (set_aspath_exclude, char *str; str = argv_concat (argv, argc, idx_asn); - ret = bgp_route_set_add (vty, vty->index, "as-path exclude", str); + ret = generic_set_add (vty, vty->index, "as-path exclude", str); XFREE (MTYPE_TMP, str); return ret; } @@ -3781,7 +3435,7 @@ DEFUN (no_set_aspath_exclude, char *str; str = argv_concat (argv, argc, idx_asn); - ret = bgp_route_set_delete (vty, vty->index, "as-path exclude", str); + ret = generic_set_delete (vty, vty->index, "as-path exclude", str); XFREE (MTYPE_TMP, str); return ret; } @@ -3870,11 +3524,11 @@ DEFUN (set_community, argstr = XCALLOC (MTYPE_TMP, strlen (str) + strlen (" additive") + 1); strcpy (argstr, str); strcpy (argstr + strlen (str), " additive"); - ret = bgp_route_set_add (vty, vty->index, "community", argstr); + ret = generic_set_add (vty, vty->index, "community", argstr); XFREE (MTYPE_TMP, argstr); } else - ret = bgp_route_set_add (vty, vty->index, "community", str); + ret = generic_set_add (vty, vty->index, "community", str); community_free (com); @@ -3888,7 +3542,7 @@ DEFUN (set_community_none, "BGP community attribute\n" "No community attribute\n") { - return bgp_route_set_add (vty, vty->index, "community", "none"); + return generic_set_add (vty, vty->index, "community", "none"); } DEFUN (no_set_community, @@ -3898,7 +3552,7 @@ DEFUN (no_set_community, SET_STR "BGP community attribute\n") { - return bgp_route_set_delete (vty, vty->index, "community", NULL); + return generic_set_delete (vty, vty->index, "community", NULL); } @@ -3920,7 +3574,7 @@ DEFUN (set_community_delete, strcpy (str, argv[idx_comm_list]->arg); strcpy (str + strlen (argv[idx_comm_list]->arg), " delete"); - bgp_route_set_add (vty, vty->index, "comm-list", str); + generic_set_add (vty, vty->index, "comm-list", str); XFREE (MTYPE_TMP, str); return CMD_SUCCESS; @@ -3933,7 +3587,7 @@ DEFUN (no_set_community_delete, SET_STR "set BGP community list (for deletion)\n") { - return bgp_route_set_delete (vty, vty->index, "comm-list", NULL); + return generic_set_delete (vty, vty->index, "comm-list", NULL); } @@ -3950,7 +3604,7 @@ DEFUN (set_ecommunity_rt, char *str; str = argv_concat (argv, argc, idx_asn_nn); - ret = bgp_route_set_add (vty, vty->index, "extcommunity rt", str); + ret = generic_set_add (vty, vty->index, "extcommunity rt", str); XFREE (MTYPE_TMP, str); return ret; @@ -3964,7 +3618,7 @@ DEFUN (no_set_ecommunity_rt, "BGP extended community attribute\n" "Route Target extended community\n") { - return bgp_route_set_delete (vty, vty->index, "extcommunity rt", NULL); + return generic_set_delete (vty, vty->index, "extcommunity rt", NULL); } @@ -3981,7 +3635,7 @@ DEFUN (set_ecommunity_soo, char *str; str = argv_concat (argv, argc, idx_asn_nn); - ret = bgp_route_set_add (vty, vty->index, "extcommunity soo", str); + ret = generic_set_add (vty, vty->index, "extcommunity soo", str); XFREE (MTYPE_TMP, str); return ret; } @@ -3995,7 +3649,7 @@ DEFUN (no_set_ecommunity_soo, "BGP extended community attribute\n" "Site-of-Origin extended community\n") { - return bgp_route_set_delete (vty, vty->index, "extcommunity soo", NULL); + return generic_set_delete (vty, vty->index, "extcommunity soo", NULL); } @@ -4010,11 +3664,11 @@ DEFUN (set_origin, { int idx_origin = 2; if (strncmp (argv[idx_origin]->arg, "igp", 2) == 0) - return bgp_route_set_add (vty, vty->index, "origin", "igp"); + return generic_set_add (vty, vty->index, "origin", "igp"); if (strncmp (argv[idx_origin]->arg, "egp", 1) == 0) - return bgp_route_set_add (vty, vty->index, "origin", "egp"); + return generic_set_add (vty, vty->index, "origin", "egp"); if (strncmp (argv[idx_origin]->arg, "incomplete", 2) == 0) - return bgp_route_set_add (vty, vty->index, "origin", "incomplete"); + return generic_set_add (vty, vty->index, "origin", "incomplete"); return CMD_WARNING; } @@ -4027,7 +3681,7 @@ DEFUN (no_set_origin, SET_STR "BGP origin code\n") { - return bgp_route_set_delete (vty, vty->index, "origin", NULL); + return generic_set_delete (vty, vty->index, "origin", NULL); } @@ -4037,7 +3691,7 @@ DEFUN (set_atomic_aggregate, SET_STR "BGP atomic aggregate attribute\n" ) { - return bgp_route_set_add (vty, vty->index, "atomic-aggregate", NULL); + return generic_set_add (vty, vty->index, "atomic-aggregate", NULL); } DEFUN (no_set_atomic_aggregate, @@ -4047,7 +3701,7 @@ DEFUN (no_set_atomic_aggregate, SET_STR "BGP atomic aggregate attribute\n" ) { - return bgp_route_set_delete (vty, vty->index, "atomic-aggregate", NULL); + return generic_set_delete (vty, vty->index, "atomic-aggregate", NULL); } DEFUN (set_aggregator_as, @@ -4077,7 +3731,7 @@ DEFUN (set_aggregator_as, sprintf (argstr, "%s %s", argv[idx_number]->arg, argv[idx_ipv4]->arg); - ret = bgp_route_set_add (vty, vty->index, "aggregator as", argstr); + ret = generic_set_add (vty, vty->index, "aggregator as", argstr); XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr); @@ -4102,7 +3756,7 @@ DEFUN (no_set_aggregator_as, char *argstr; if (argc <= idx_asn) - return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL); + return generic_set_delete (vty, vty->index, "aggregator as", NULL); ret = inet_aton (argv[idx_ip]->arg, &address); if (ret == 0) @@ -4116,7 +3770,7 @@ DEFUN (no_set_aggregator_as, sprintf (argstr, "%s %s", argv[idx_asn]->arg, argv[idx_ip]->arg); - ret = bgp_route_set_delete (vty, vty->index, "aggregator as", argstr); + ret = generic_set_delete (vty, vty->index, "aggregator as", argstr); XFREE (MTYPE_ROUTE_MAP_COMPILED, argstr); @@ -4124,62 +3778,7 @@ DEFUN (no_set_aggregator_as, } -DEFUN (set_tag, - set_tag_cmd, - "set tag (1-65535)", - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - int idx_number = 2; - return bgp_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - - -DEFUN (no_set_tag, - no_set_tag_cmd, - "no set tag [(1-65535)]", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - int idx_number = 3; - if (argc <= idx_number) - return bgp_route_set_delete (vty, vty->index, "tag", NULL); - return bgp_route_set_delete (vty, vty->index, "tag", argv[idx_number]->arg); -} - - - #ifdef HAVE_IPV6 -DEFUN (match_ipv6_address, - match_ipv6_address_cmd, - "match ipv6 address WORD", - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - int idx_word = 3; - return bgp_route_match_add (vty, vty->index, "ipv6 address", argv[idx_word]->arg, - RMAP_EVENT_FILTER_ADDED); -} - -DEFUN (no_match_ipv6_address, - no_match_ipv6_address_cmd, - "no match ipv6 address WORD", - NO_STR - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - int idx_word = 4; - return bgp_route_match_delete (vty, vty->index, "ipv6 address", argv[idx_word]->arg, - RMAP_EVENT_FILTER_DELETED); -} - DEFUN (match_ipv6_next_hop, match_ipv6_next_hop_cmd, "match ipv6 next-hop X:X::X:X", @@ -4207,34 +3806,6 @@ DEFUN (no_match_ipv6_next_hop, RMAP_EVENT_MATCH_DELETED); } -DEFUN (match_ipv6_address_prefix_list, - match_ipv6_address_prefix_list_cmd, - "match ipv6 address prefix-list WORD", - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return bgp_route_match_add (vty, vty->index, "ipv6 address prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); -} - -DEFUN (no_match_ipv6_address_prefix_list, - no_match_ipv6_address_prefix_list_cmd, - "no match ipv6 address prefix-list WORD", - NO_STR - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - return bgp_route_match_delete (vty, vty->index, "ipv6 address prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); -} DEFUN (set_ipv6_nexthop_peer, set_ipv6_nexthop_peer_cmd, @@ -4244,7 +3815,7 @@ DEFUN (set_ipv6_nexthop_peer, "Next hop address\n" "Use peer address (for BGP only)\n") { - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop peer-address", NULL); + return generic_set_add (vty, vty->index, "ipv6 next-hop peer-address", NULL); } DEFUN (no_set_ipv6_nexthop_peer, @@ -4256,7 +3827,7 @@ DEFUN (no_set_ipv6_nexthop_peer, "IPv6 next-hop address\n" "Use peer address (for BGP only)\n") { - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop peer-address", NULL); + return generic_set_delete (vty, vty->index, "ipv6 next-hop peer-address", NULL); } DEFUN (set_ipv6_nexthop_prefer_global, @@ -4267,7 +3838,7 @@ DEFUN (set_ipv6_nexthop_prefer_global, "IPv6 next-hop address\n" "Prefer global over link-local if both exist\n") { - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop prefer-global", NULL);; + return generic_set_add (vty, vty->index, "ipv6 next-hop prefer-global", NULL);; } DEFUN (no_set_ipv6_nexthop_prefer_global, @@ -4279,7 +3850,7 @@ DEFUN (no_set_ipv6_nexthop_prefer_global, "IPv6 next-hop address\n" "Prefer global over link-local if both exist\n") { - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop prefer-global", NULL); + return generic_set_delete (vty, vty->index, "ipv6 next-hop prefer-global", NULL); } DEFUN (set_ipv6_nexthop_global, @@ -4310,7 +3881,7 @@ DEFUN (set_ipv6_nexthop_global, return CMD_WARNING; } - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); + return generic_set_add (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); } @@ -4326,56 +3897,9 @@ DEFUN (no_set_ipv6_nexthop_global, { int idx_ipv6 = 5; if (argc <= idx_ipv6) - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); + return generic_set_delete (vty, vty->index, "ipv6 next-hop global", NULL); + return generic_set_delete (vty, vty->index, "ipv6 next-hop global", argv[idx_ipv6]->arg); } - - -DEFUN (set_ipv6_nexthop_local, - set_ipv6_nexthop_local_cmd, - "set ipv6 next-hop local X:X::X:X", - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") -{ - int idx_ipv6 = 4; - struct in6_addr addr; - int ret; - - ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr); - if (!ret) - { - vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); - return CMD_WARNING; - } - if (!IN6_IS_ADDR_LINKLOCAL(&addr)) - { - vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); -} - - -DEFUN (no_set_ipv6_nexthop_local, - no_set_ipv6_nexthop_local_cmd, - "no set ipv6 next-hop local [X:X::X:X]", - NO_STR - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") -{ - int idx_ipv6 = 5; - if (argc <= idx_ipv6) - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL); - return bgp_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); -} - #endif /* HAVE_IPV6 */ DEFUN (set_vpnv4_nexthop, @@ -4387,7 +3911,7 @@ DEFUN (set_vpnv4_nexthop, "IP address of next hop\n") { int idx_ipv4 = 3; - return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); + return generic_set_add (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); } @@ -4402,8 +3926,8 @@ DEFUN (no_set_vpnv4_nexthop, { int idx_ipv4 = 4; if (argc <= idx_ipv4) - return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); - return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); + return generic_set_delete (vty, vty->index, "vpnv4 next-hop", NULL); + return generic_set_delete (vty, vty->index, "vpnv4 next-hop", argv[idx_ipv4]->arg); } @@ -4415,7 +3939,7 @@ DEFUN (set_originator_id, "IP address of originator\n") { int idx_ipv4 = 2; - return bgp_route_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg); + return generic_set_add (vty, vty->index, "originator-id", argv[idx_ipv4]->arg); } @@ -4429,8 +3953,8 @@ DEFUN (no_set_originator_id, { int idx_id = 3; if (argc < idx_id) - return bgp_route_set_delete (vty, vty->index, "originator-id", NULL); - return bgp_route_set_delete (vty, vty->index, "originator-id", argv[idx_id]->arg); + return generic_set_delete (vty, vty->index, "originator-id", NULL); + return generic_set_delete (vty, vty->index, "originator-id", argv[idx_id]->arg); } @@ -4444,6 +3968,45 @@ bgp_route_map_init (void) route_map_delete_hook (bgp_route_map_delete); route_map_event_hook (bgp_route_map_event); + route_map_match_interface_hook (generic_match_add); + route_map_no_match_interface_hook (generic_match_delete); + + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); + + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); + + route_map_match_ip_next_hop_hook (generic_match_add); + route_map_no_match_ip_next_hop_hook (generic_match_delete); + + route_map_match_ip_next_hop_prefix_list_hook (generic_match_add); + route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete); + + route_map_match_ipv6_address_hook (generic_match_add); + route_map_no_match_ipv6_address_hook (generic_match_delete); + + route_map_match_ipv6_address_prefix_list_hook (generic_match_add); + route_map_no_match_ipv6_address_prefix_list_hook (generic_match_delete); + + route_map_match_metric_hook (generic_match_add); + route_map_no_match_metric_hook (generic_match_delete); + + route_map_match_tag_hook (generic_match_add); + route_map_no_match_tag_hook (generic_match_delete); + + route_map_set_ip_nexthop_hook (generic_set_add); + route_map_no_set_ip_nexthop_hook (generic_set_delete); + + route_map_set_ipv6_nexthop_local_hook (generic_set_add); + route_map_no_set_ipv6_nexthop_local_hook (generic_set_delete); + + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + + route_map_set_tag_hook (generic_set_add); + route_map_no_set_tag_hook (generic_set_delete); + route_map_install_match (&route_match_peer_cmd); route_map_install_match (&route_match_local_pref_cmd); route_map_install_match (&route_match_ip_address_cmd); @@ -4482,23 +4045,13 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &match_peer_cmd); install_element (RMAP_NODE, &match_peer_local_cmd); install_element (RMAP_NODE, &no_match_peer_cmd); - install_element (RMAP_NODE, &match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); install_element (RMAP_NODE, &match_ip_route_source_cmd); install_element (RMAP_NODE, &no_match_ip_route_source_cmd); - install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); install_element (RMAP_NODE, &match_ip_route_source_prefix_list_cmd); install_element (RMAP_NODE, &no_match_ip_route_source_prefix_list_cmd); install_element (RMAP_NODE, &match_aspath_cmd); install_element (RMAP_NODE, &no_match_aspath_cmd); - install_element (RMAP_NODE, &match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_cmd); install_element (RMAP_NODE, &match_local_pref_cmd); install_element (RMAP_NODE, &no_match_local_pref_cmd); install_element (RMAP_NODE, &match_community_cmd); @@ -4510,21 +4063,13 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &no_match_origin_cmd); install_element (RMAP_NODE, &match_probability_cmd); install_element (RMAP_NODE, &no_match_probability_cmd); - install_element (RMAP_NODE, &match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &set_ip_nexthop_cmd); install_element (RMAP_NODE, &set_ip_nexthop_peer_cmd); install_element (RMAP_NODE, &set_ip_nexthop_unchanged_cmd); - install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); install_element (RMAP_NODE, &set_local_pref_cmd); install_element (RMAP_NODE, &no_set_local_pref_cmd); install_element (RMAP_NODE, &set_weight_cmd); install_element (RMAP_NODE, &no_set_weight_cmd); - install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_cmd); install_element (RMAP_NODE, &set_aspath_prepend_asn_cmd); install_element (RMAP_NODE, &set_aspath_prepend_lastas_cmd); install_element (RMAP_NODE, &set_aspath_exclude_cmd); @@ -4549,8 +4094,6 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd); install_element (RMAP_NODE, &set_originator_id_cmd); install_element (RMAP_NODE, &no_set_originator_id_cmd); - install_element (RMAP_NODE, &set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_cmd); #ifdef HAVE_IPV6 route_map_install_match (&route_match_ipv6_address_cmd); @@ -4561,18 +4104,12 @@ bgp_route_map_init (void) route_map_install_set (&route_set_ipv6_nexthop_local_cmd); route_map_install_set (&route_set_ipv6_nexthop_peer_cmd); - install_element (RMAP_NODE, &match_ipv6_address_cmd); - install_element (RMAP_NODE, &no_match_ipv6_address_cmd); install_element (RMAP_NODE, &match_ipv6_next_hop_cmd); install_element (RMAP_NODE, &no_match_ipv6_next_hop_cmd); - install_element (RMAP_NODE, &match_ipv6_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_global_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_global_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_prefer_global_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd); - install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd); - install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd); #endif /* HAVE_IPV6 */ diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 72caa5a096..93267afe92 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -250,282 +250,30 @@ static struct route_map_rule_cmd route_set_metric_cmd = route_set_metric_free }; -/* ------------------------------------------------------------*/ - -static int -isis_route_match_add(struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -isis_route_match_delete(struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -isis_route_set_add(struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set(index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - -static int -isis_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - -/* ------------------------------------------------------------*/ - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 3; - return isis_route_match_add(vty, vty->index, "ip address", argv[idx_acl]->arg); -} - - -DEFUN (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 4; - if (argc == 4) - return isis_route_match_delete(vty, vty->index, "ip address", NULL); - return isis_route_match_delete(vty, vty->index, "ip address", argv[idx_acl]->arg); -} - - -/* ------------------------------------------------------------*/ - -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); -} - - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - if (argc == 5) - return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); -} - - -/* ------------------------------------------------------------*/ - -DEFUN (match_ipv6_address, - match_ipv6_address_cmd, - "match ipv6 address WORD", - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - int idx_word = 3; - return isis_route_match_add(vty, vty->index, "ipv6 address", argv[idx_word]->arg); -} - - -DEFUN (no_match_ipv6_address, - no_match_ipv6_address_val_cmd, - "no match ipv6 address [WORD]", - NO_STR - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - int idx_word = 4; - if (argc == 4) - return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); - return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[idx_word]->arg); -} - - -/* ------------------------------------------------------------*/ - -DEFUN (match_ipv6_address_prefix_list, - match_ipv6_address_prefix_list_cmd, - "match ipv6 address prefix-list WORD", - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); -} - -DEFUN (no_match_ipv6_address_prefix_list, - no_match_ipv6_address_prefix_list_cmd, - "no match ipv6 address prefix-list [WORD]", - NO_STR - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 5; - if (argc == 5) - return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); - return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg); -} - - -/* ------------------------------------------------------------*/ - -/* set metric already exists e.g. in the ospf routemap. vtysh doesn't cope well with different - * commands at the same node, therefore add set metric with the same 32-bit range as ospf and - * verify that the input is a valid isis metric */ -DEFUN (set_metric, - set_metric_cmd, - "set metric (0-4294967295)", - SET_STR - "Metric vale for destination routing protocol\n" - "Metric value\n") -{ - int idx_number = 2; - return isis_route_set_add(vty, vty->index, "metric", argv[idx_number]->arg); -} - -DEFUN (no_set_metric, - no_set_metric_val_cmd, - "no set metric [(0-4294967295)]", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - int idx_number = 3; - if (argc == 3) - return isis_route_set_delete(vty, vty->index, "metric", NULL); - return isis_route_set_delete(vty, vty->index, "metric", argv[idx_number]->arg); -} - void isis_route_map_init(void) { route_map_init(); route_map_init_vty(); + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); + + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); + + route_map_match_ipv6_address_hook (generic_match_add); + route_map_no_match_ipv6_address_hook (generic_match_delete); + + route_map_match_ipv6_address_prefix_list_hook (generic_match_add); + route_map_no_match_ipv6_address_prefix_list_hook (generic_match_delete); + + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + route_map_install_match(&route_match_ip_address_cmd); - install_element(RMAP_NODE, &match_ip_address_cmd); - install_element(RMAP_NODE, &no_match_ip_address_val_cmd); - route_map_install_match(&route_match_ip_address_prefix_list_cmd); - install_element(RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - route_map_install_match(&route_match_ipv6_address_cmd); - install_element(RMAP_NODE, &match_ipv6_address_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_val_cmd); - route_map_install_match(&route_match_ipv6_address_prefix_list_cmd); - install_element(RMAP_NODE, &match_ipv6_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); - route_map_install_set(&route_set_metric_cmd); - install_element(RMAP_NODE, &set_metric_cmd); - install_element(RMAP_NODE, &no_set_metric_val_cmd); } diff --git a/lib/routemap.c b/lib/routemap.c index 2e8637bcbe..a68b6210b3 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -24,9 +24,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "vector.h" #include "prefix.h" +#include "vty.h" #include "routemap.h" #include "command.h" -#include "vty.h" #include "log.h" #include "hash.h" @@ -44,6 +44,594 @@ static vector route_match_vec; /* Vector for route set rules. */ static vector route_set_vec; +struct route_map_match_set_hooks +{ + /* match interface */ + int (*match_interface) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match interface */ + int (*no_match_interface) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match ip address */ + int (*match_ip_address) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ip address */ + int (*no_match_ip_address) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match ip address prefix list */ + int (*match_ip_address_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ip address prefix list */ + int (*no_match_ip_address_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match ip next hop */ + int (*match_ip_next_hop) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ip next hop */ + int (*no_match_ip_next_hop) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match ip next hop prefix list */ + int (*match_ip_next_hop_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ip next hop prefix list */ + int (*no_match_ip_next_hop_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match ipv6 address */ + int (*match_ipv6_address) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ipv6 address */ + int (*no_match_ipv6_address) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + + /* match ipv6 address prefix list */ + int (*match_ipv6_address_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match ipv6 address prefix list */ + int (*no_match_ipv6_address_prefix_list) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match metric */ + int (*match_metric) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match metric */ + int (*no_match_metric) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* match tag */ + int (*match_tag) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* no match tag */ + int (*no_match_tag) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + + /* set ip nexthop */ + int (*set_ip_nexthop) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* no set ip nexthop */ + int (*no_set_ip_nexthop) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* set ipv6 nexthop local */ + int (*set_ipv6_nexthop_local) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* no set ipv6 nexthop local */ + int (*no_set_ipv6_nexthop_local) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* set metric */ + int (*set_metric) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* no set metric */ + int (*no_set_metric) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* set tag */ + int (*set_tag) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + + /* no set tag */ + int (*no_set_tag) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg); + +}; + +struct route_map_match_set_hooks rmap_match_set_hook; + +/* match interface */ +void +route_map_match_interface_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_interface = func; +} + +/* no match interface */ +void +route_map_no_match_interface_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_interface = func; +} + +/* match ip address */ +void +route_map_match_ip_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ip_address = func; +} + +/* no match ip address */ +void +route_map_no_match_ip_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ip_address = func; +} + +/* match ip address prefix list */ +void +route_map_match_ip_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ip_address_prefix_list = func; +} + +/* no match ip address prefix list */ +void +route_map_no_match_ip_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ip_address_prefix_list = func; +} + +/* match ip next hop */ +void +route_map_match_ip_next_hop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ip_next_hop = func; +} + +/* no match ip next hop */ +void +route_map_no_match_ip_next_hop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ip_next_hop = func; +} + +/* match ip next hop prefix list */ +void +route_map_match_ip_next_hop_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ip_next_hop_prefix_list = func; +} + +/* no match ip next hop prefix list */ +void +route_map_no_match_ip_next_hop_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ip_next_hop_prefix_list = func; +} + +/* match ipv6 address */ +void +route_map_match_ipv6_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ipv6_address = func; +} + +/* no match ipv6 address */ +void +route_map_no_match_ipv6_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ipv6_address = func; +} + + +/* match ipv6 address prefix list */ +void +route_map_match_ipv6_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_ipv6_address_prefix_list = func; +} + +/* no match ipv6 address prefix list */ +void +route_map_no_match_ipv6_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_ipv6_address_prefix_list = func; +} + +/* match metric */ +void +route_map_match_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_metric = func; +} + +/* no match metric */ +void +route_map_no_match_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_metric = func; +} + +/* match tag */ +void +route_map_match_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.match_tag = func; +} + +/* no match tag */ +void +route_map_no_match_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)) +{ + rmap_match_set_hook.no_match_tag = func; +} + +/* set ip nexthop */ +void +route_map_set_ip_nexthop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.set_ip_nexthop = func; +} + +/* no set ip nexthop */ +void +route_map_no_set_ip_nexthop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.no_set_ip_nexthop = func; +} + +/* set ipv6 nexthop local */ +void +route_map_set_ipv6_nexthop_local_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.set_ipv6_nexthop_local = func; +} + +/* no set ipv6 nexthop local */ +void +route_map_no_set_ipv6_nexthop_local_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.no_set_ipv6_nexthop_local = func; +} + +/* set metric */ +void +route_map_set_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.set_metric = func; +} + +/* no set metric */ +void +route_map_no_set_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.no_set_metric = func; +} + +/* set tag */ +void +route_map_set_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.set_tag = func; +} + +/* no set tag */ +void +route_map_no_set_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)) +{ + rmap_match_set_hook.no_set_tag = func; +} + +int +generic_match_add (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg, + route_map_event_t type) +{ + int ret; + + ret = route_map_add_match (index, command, arg); + if (ret) + { + switch (ret) + { + case RMAP_RULE_MISSING: + vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); + return CMD_WARNING; + case RMAP_COMPILE_ERROR: + vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + + if (type != RMAP_EVENT_MATCH_ADDED) + { + route_map_upd8_dependency (type, arg, index->map->name); + } + return CMD_SUCCESS; +} + +int +generic_match_delete (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg, + route_map_event_t type) +{ + int ret; + char *dep_name = NULL; + const char *tmpstr; + char *rmap_name = NULL; + + if (type != RMAP_EVENT_MATCH_DELETED) + { + /* ignore the mundane, the types without any dependency */ + if (arg == NULL) + { + if ((tmpstr = route_map_get_match_arg(index, command)) != NULL) + dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, tmpstr); + } + else + { + dep_name = XSTRDUP(MTYPE_ROUTE_MAP_RULE, arg); + } + rmap_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, index->map->name); + } + + ret = route_map_delete_match (index, command, dep_name); + if (ret) + { + switch (ret) + { + case RMAP_RULE_MISSING: + vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE); + break; + case RMAP_COMPILE_ERROR: + vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE); + break; + } + if (dep_name) + XFREE(MTYPE_ROUTE_MAP_RULE, dep_name); + if (rmap_name) + XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name); + return CMD_WARNING; + } + + if (type != RMAP_EVENT_MATCH_DELETED && dep_name) + route_map_upd8_dependency(type, dep_name, rmap_name); + + if (dep_name) + XFREE(MTYPE_ROUTE_MAP_RULE, dep_name); + if (rmap_name) + XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name); + + return CMD_SUCCESS; +} + +int +generic_set_add (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg) +{ + int ret; + + ret = route_map_add_set (index, command, arg); + if (ret) + { + switch (ret) + { + case RMAP_RULE_MISSING: + vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); + return CMD_WARNING; + case RMAP_COMPILE_ERROR: + vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + return CMD_SUCCESS; +} + +int +generic_set_delete (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg) +{ + int ret; + + ret = route_map_delete_set (index, command, arg); + if (ret) + { + switch (ret) + { + case RMAP_RULE_MISSING: + vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); + return CMD_WARNING; + case RMAP_COMPILE_ERROR: + vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + return CMD_SUCCESS; +} + + /* Route map rule. This rule has both `match' rule and `set' rule. */ struct route_map_rule { @@ -1396,7 +1984,515 @@ route_map_notify_dependencies (const char *affected_name, route_map_event_t even XFREE (MTYPE_ROUTE_MAP_NAME, name); } + /* VTY related functions. */ +DEFUN (match_interface, + match_interface_cmd, + "match interface WORD", + MATCH_STR + "match first hop interface of route\n" + "Interface name\n") +{ + int idx_word = 2; + + if (rmap_match_set_hook.match_interface) + return rmap_match_set_hook.match_interface (vty, vty->index, "interface", argv[idx_word]->arg, RMAP_EVENT_MATCH_ADDED); + return CMD_SUCCESS; +} + +DEFUN (no_match_interface, + no_match_interface_cmd, + "no match interface [INTERFACE]", + NO_STR + MATCH_STR + "Match first hop interface of route\n" + "Interface name\n") +{ + char *iface = (argc == 4) ? argv[3]->arg : NULL; + + if (rmap_match_set_hook.no_match_interface) + return rmap_match_set_hook.no_match_interface (vty, vty->index, "interface", iface, RMAP_EVENT_MATCH_DELETED); + return CMD_SUCCESS; +} + + +DEFUN (match_ip_address, + match_ip_address_cmd, + "match ip address <(1-199)|(1300-2699)|WORD>", + MATCH_STR + IP_STR + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") +{ + int idx_acl = 3; + + if (rmap_match_set_hook.match_ip_address) + return rmap_match_set_hook.match_ip_address (vty, vty->index, "ip address", argv[idx_acl]->arg, + RMAP_EVENT_FILTER_ADDED); + return CMD_SUCCESS; +} + + +DEFUN (no_match_ip_address, + no_match_ip_address_cmd, + "no match ip address [<(1-199)|(1300-2699)|WORD>]", + NO_STR + MATCH_STR + IP_STR + "Match address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") +{ + int idx_word = 4; + + if (rmap_match_set_hook.no_match_ip_address) + { + if (argc <= idx_word) + return rmap_match_set_hook.no_match_ip_address (vty, vty->index, "ip address", NULL, + RMAP_EVENT_FILTER_DELETED); + return rmap_match_set_hook.no_match_ip_address (vty, vty->index, "ip address", argv[idx_word]->arg, + RMAP_EVENT_FILTER_DELETED); + } + return CMD_SUCCESS; +} + + +DEFUN (match_ip_address_prefix_list, + match_ip_address_prefix_list_cmd, + "match ip address prefix-list WORD", + MATCH_STR + IP_STR + "Match address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 4; + if (rmap_match_set_hook.match_ip_address_prefix_list) + return rmap_match_set_hook.match_ip_address_prefix_list (vty, vty->index, "ip address prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); + return CMD_SUCCESS; +} + + +DEFUN (no_match_ip_address_prefix_list, + no_match_ip_address_prefix_list_cmd, + "no match ip address prefix-list [WORD]", + NO_STR + MATCH_STR + IP_STR + "Match address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 5; + + if (rmap_match_set_hook.no_match_ip_address_prefix_list) + { + if (argc <= idx_word) + return rmap_match_set_hook.no_match_ip_address_prefix_list (vty, vty->index, "ip address prefix-list", + NULL, RMAP_EVENT_PLIST_DELETED); + return rmap_match_set_hook.no_match_ip_address_prefix_list(vty, vty->index, "ip address prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); + } + return CMD_SUCCESS; +} + + +DEFUN (match_ip_next_hop, + match_ip_next_hop_cmd, + "match ip next-hop <(1-199)|(1300-2699)|WORD>", + MATCH_STR + IP_STR + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") +{ + int idx_acl = 3; + if (rmap_match_set_hook.match_ip_next_hop) + return rmap_match_set_hook.match_ip_next_hop (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, + RMAP_EVENT_FILTER_ADDED); + return CMD_SUCCESS; +} + + +DEFUN (no_match_ip_next_hop, + no_match_ip_next_hop_cmd, + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", + NO_STR + MATCH_STR + IP_STR + "Match next-hop address of route\n" + "IP access-list number\n" + "IP access-list number (expanded range)\n" + "IP Access-list name\n") +{ + int idx_word = 4; + + if (rmap_match_set_hook.no_match_ip_next_hop) + { + if (argc <= idx_word) + return rmap_match_set_hook.no_match_ip_next_hop (vty, vty->index, "ip next-hop", NULL, + RMAP_EVENT_FILTER_DELETED); + return rmap_match_set_hook.no_match_ip_next_hop (vty, vty->index, "ip next-hop", argv[idx_word]->arg, + RMAP_EVENT_FILTER_DELETED); + } + return CMD_SUCCESS; +} + + +DEFUN (match_ip_next_hop_prefix_list, + match_ip_next_hop_prefix_list_cmd, + "match ip next-hop prefix-list WORD", + MATCH_STR + IP_STR + "Match next-hop address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 4; + if (rmap_match_set_hook.match_ip_next_hop_prefix_list) + return rmap_match_set_hook.match_ip_next_hop_prefix_list (vty, vty->index, "ip next-hop prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); + return CMD_SUCCESS; +} + +DEFUN (no_match_ip_next_hop_prefix_list, + no_match_ip_next_hop_prefix_list_cmd, + "no match ip next-hop prefix-list [WORD]", + NO_STR + MATCH_STR + IP_STR + "Match next-hop address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 5; + + if (rmap_match_set_hook.no_match_ip_next_hop) + { + if (argc <= idx_word) + return rmap_match_set_hook.no_match_ip_next_hop (vty, vty->index, "ip next-hop prefix-list", + NULL, RMAP_EVENT_PLIST_DELETED); + return rmap_match_set_hook.no_match_ip_next_hop (vty, vty->index, "ip next-hop prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); + } + return CMD_SUCCESS; +} + + +DEFUN (match_ipv6_address, + match_ipv6_address_cmd, + "match ipv6 address WORD", + MATCH_STR + IPV6_STR + "Match IPv6 address of route\n" + "IPv6 access-list name\n") +{ + int idx_word = 3; + if (rmap_match_set_hook.match_ipv6_address) + return rmap_match_set_hook.match_ipv6_address (vty, vty->index, "ipv6 address", argv[idx_word]->arg, + RMAP_EVENT_FILTER_ADDED); + return CMD_SUCCESS; +} + +DEFUN (no_match_ipv6_address, + no_match_ipv6_address_cmd, + "no match ipv6 address WORD", + NO_STR + MATCH_STR + IPV6_STR + "Match IPv6 address of route\n" + "IPv6 access-list name\n") +{ + int idx_word = 4; + if (rmap_match_set_hook.no_match_ipv6_address) + return rmap_match_set_hook.no_match_ipv6_address (vty, vty->index, "ipv6 address", argv[idx_word]->arg, + RMAP_EVENT_FILTER_DELETED); + return CMD_SUCCESS; +} + + +DEFUN (match_ipv6_address_prefix_list, + match_ipv6_address_prefix_list_cmd, + "match ipv6 address prefix-list WORD", + MATCH_STR + IPV6_STR + "Match address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 4; + if (rmap_match_set_hook.match_ipv6_address_prefix_list) + return rmap_match_set_hook.match_ipv6_address_prefix_list (vty, vty->index, "ipv6 address prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); + return CMD_SUCCESS; +} + +DEFUN (no_match_ipv6_address_prefix_list, + no_match_ipv6_address_prefix_list_cmd, + "no match ipv6 address prefix-list WORD", + NO_STR + MATCH_STR + IPV6_STR + "Match address of route\n" + "Match entries of prefix-lists\n" + "IP prefix-list name\n") +{ + int idx_word = 5; + if (rmap_match_set_hook.no_match_ipv6_address_prefix_list) + return rmap_match_set_hook.no_match_ipv6_address_prefix_list(vty, vty->index, "ipv6 address prefix-list", + argv[idx_word]->arg, RMAP_EVENT_PLIST_DELETED); + return CMD_SUCCESS; +} + + +DEFUN (match_metric, + match_metric_cmd, + "match metric (0-4294967295)", + MATCH_STR + "Match metric of route\n" + "Metric value\n") +{ + int idx_number = 2; + if (rmap_match_set_hook.match_metric) + return rmap_match_set_hook.match_metric(vty, vty->index, "metric", argv[idx_number]->arg, + RMAP_EVENT_MATCH_ADDED); + return CMD_SUCCESS; +} + + +DEFUN (no_match_metric, + no_match_metric_cmd, + "no match metric [(0-4294967295)]", + NO_STR + MATCH_STR + "Match metric of route\n" + "Metric value\n") +{ + int idx_number = 3; + if (rmap_match_set_hook.no_match_metric) + { + if (argc <= idx_number) + return rmap_match_set_hook.no_match_metric (vty, vty->index, "metric", + NULL, RMAP_EVENT_MATCH_DELETED); + return rmap_match_set_hook.no_match_metric(vty, vty->index, "metric", + argv[idx_number]->arg, + RMAP_EVENT_MATCH_DELETED); + } + return CMD_SUCCESS; +} + + +DEFUN (match_tag, + match_tag_cmd, + "match tag (1-65535)", + MATCH_STR + "Match tag of route\n" + "Tag value\n") +{ + int idx_number = 2; + if (rmap_match_set_hook.match_tag) + return rmap_match_set_hook.match_tag(vty, vty->index, "tag", argv[idx_number]->arg, + RMAP_EVENT_MATCH_ADDED); + return CMD_SUCCESS; +} + + +DEFUN (no_match_tag, + no_match_tag_cmd, + "no match tag [(1-65535)]", + NO_STR + MATCH_STR + "Match tag of route\n" + "Tag value\n") +{ + if (rmap_match_set_hook.no_match_tag) + return rmap_match_set_hook.no_match_tag (vty, vty->index, "tag", argv[3]->arg, + RMAP_EVENT_MATCH_DELETED); + return CMD_SUCCESS; +} + + +DEFUN (set_ip_nexthop, + set_ip_nexthop_cmd, + "set ip next-hop A.B.C.D", + SET_STR + IP_STR + "Next hop address\n" + "IP address of next hop\n") +{ + int idx_ipv4 = 3; + union sockunion su; + int ret; + + ret = str2sockunion (argv[idx_ipv4]->arg, &su); + if (ret < 0) + { + vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); + return CMD_WARNING; + } + if (su.sin.sin_addr.s_addr == 0 || + IPV4_CLASS_DE(su.sin.sin_addr.s_addr)) + { + vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast " + "or reserved%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (rmap_match_set_hook.set_ip_nexthop) + return rmap_match_set_hook.set_ip_nexthop(vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); + return CMD_SUCCESS; +} + + +DEFUN (no_set_ip_nexthop, + no_set_ip_nexthop_cmd, + "no set ip next-hop []", + NO_STR + SET_STR + "Next hop address\n" + "Use peer address (for BGP only)\n" + "IP address of next hop\n") +{ + int idx_peer = 4; + + if (rmap_match_set_hook.no_set_ip_nexthop) + { + if (argc <= idx_peer) + return rmap_match_set_hook.no_set_ip_nexthop (vty, vty->index, "ip next-hop", NULL); + return rmap_match_set_hook.no_set_ip_nexthop (vty, vty->index, "ip next-hop", argv[idx_peer]->arg); + } + return CMD_SUCCESS; +} + + +DEFUN (set_ipv6_nexthop_local, + set_ipv6_nexthop_local_cmd, + "set ipv6 next-hop local X:X::X:X", + SET_STR + IPV6_STR + "IPv6 next-hop address\n" + "IPv6 local address\n" + "IPv6 address of next hop\n") +{ + int idx_ipv6 = 4; + struct in6_addr addr; + int ret; + + ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr); + if (!ret) + { + vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); + return CMD_WARNING; + } + if (!IN6_IS_ADDR_LINKLOCAL(&addr)) + { + vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (rmap_match_set_hook.set_ipv6_nexthop_local) + return rmap_match_set_hook.set_ipv6_nexthop_local (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); + return CMD_SUCCESS; +} + + +DEFUN (no_set_ipv6_nexthop_local, + no_set_ipv6_nexthop_local_cmd, + "no set ipv6 next-hop local [X:X::X:X]", + NO_STR + SET_STR + IPV6_STR + "IPv6 next-hop address\n" + "IPv6 local address\n" + "IPv6 address of next hop\n") +{ + int idx_ipv6 = 5; + if (rmap_match_set_hook.no_set_ipv6_nexthop_local) + { + if (argc <= idx_ipv6) + return rmap_match_set_hook.no_set_ipv6_nexthop_local (vty, vty->index, "ipv6 next-hop local", NULL); + return rmap_match_set_hook.no_set_ipv6_nexthop_local (vty, vty->index, "ipv6 next-hop local", argv[5]->arg); + } + return CMD_SUCCESS; +} + +DEFUN (set_metric, + set_metric_cmd, + "set metric <(0-4294967295)|rtt|+rtt|-rtt|+metric|-metric>", + SET_STR + "Metric value for destination routing protocol\n" + "Metric value\n" + "Assign round trip time\n" + "Add round trip time\n" + "Subtract round trip time\n" + "Add metric\n" + "Subtract metric\n") +{ + int idx_number = 2; + if (rmap_match_set_hook.set_metric) + return rmap_match_set_hook.set_metric (vty, vty->index, "metric", argv[idx_number]->arg); + return CMD_SUCCESS; +} + + +DEFUN (no_set_metric, + no_set_metric_cmd, + "no set metric [(0-4294967295)]", + NO_STR + SET_STR + "Metric value for destination routing protocol\n" + "Metric value\n") +{ + int idx_number = 3; + if (rmap_match_set_hook.no_set_metric) + { + if (argc <= idx_number) + return rmap_match_set_hook.no_set_metric (vty, vty->index, "metric", NULL); + return rmap_match_set_hook.no_set_metric (vty, vty->index, "metric", argv[idx_number]->arg); + } + return CMD_SUCCESS; +} + + +DEFUN (set_tag, + set_tag_cmd, + "set tag (1-65535)", + SET_STR + "Tag value for routing protocol\n" + "Tag value\n") +{ + int idx_number = 2; + if (rmap_match_set_hook.set_tag) + return rmap_match_set_hook.set_tag (vty, vty->index, "tag", argv[idx_number]->arg); + return CMD_SUCCESS; +} + + +DEFUN (no_set_tag, + no_set_tag_cmd, + "no set tag [(1-65535)]", + NO_STR + SET_STR + "Tag value for routing protocol\n" + "Tag value\n") +{ + int idx_number = 3; + if (rmap_match_set_hook.no_set_tag) + { + if (argc <= idx_number) + return rmap_match_set_hook.no_set_tag (vty, vty->index, "tag", NULL); + return rmap_match_set_hook.no_set_tag (vty, vty->index, "tag", argv[idx_number]->arg); + } + return CMD_SUCCESS; +} + + + DEFUN (route_map, route_map_cmd, "route-map WORD (1-65535)", @@ -1823,4 +2919,44 @@ route_map_init_vty (void) /* Install show command */ install_element (ENABLE_NODE, &rmap_show_name_cmd); + + install_element (RMAP_NODE, &match_interface_cmd); + install_element (RMAP_NODE, &no_match_interface_cmd); + + install_element (RMAP_NODE, &match_ip_address_cmd); + install_element (RMAP_NODE, &no_match_ip_address_cmd); + + install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); + install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); + + install_element (RMAP_NODE, &match_ip_next_hop_cmd); + install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); + + install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); + install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); + + install_element (RMAP_NODE, &match_ipv6_address_cmd); + install_element (RMAP_NODE, &no_match_ipv6_address_cmd); + + install_element (RMAP_NODE, &match_ipv6_address_prefix_list_cmd); + install_element (RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); + + install_element (RMAP_NODE, &match_metric_cmd); + install_element (RMAP_NODE, &no_match_metric_cmd); + + install_element (RMAP_NODE, &match_tag_cmd); + install_element (RMAP_NODE, &no_match_tag_cmd); + + install_element (RMAP_NODE, &set_ip_nexthop_cmd); + install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); + + install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd); + install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd); + + install_element (RMAP_NODE, &set_metric_cmd); + install_element (RMAP_NODE, &no_set_metric_cmd); + + install_element (RMAP_NODE, &set_tag_cmd); + install_element (RMAP_NODE, &no_set_tag_cmd); + } diff --git a/lib/routemap.h b/lib/routemap.h index 7006e43f66..a6d3123335 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -228,4 +228,169 @@ extern void route_map_upd8_dependency (route_map_event_t type, const char *arg, extern void route_map_notify_dependencies (const char *affected_name, route_map_event_t event); +extern int generic_match_add (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); + +extern int generic_match_delete (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type); +extern int generic_set_add (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg); +extern int generic_set_delete (struct vty *vty, struct route_map_index *index, + const char *command, const char *arg); + + +/* match interface */ +extern void route_map_match_interface_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match interface */ +extern void route_map_no_match_interface_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ip address */ +extern void route_map_match_ip_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ip address */ +extern void route_map_no_match_ip_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ip address prefix list */ +extern void route_map_match_ip_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ip address prefix list */ +extern void route_map_no_match_ip_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ip next hop */ +extern void route_map_match_ip_next_hop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ip next hop */ +extern void route_map_no_match_ip_next_hop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ip next hop prefix list */ +extern void route_map_match_ip_next_hop_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ip next hop prefix list */ +extern void route_map_no_match_ip_next_hop_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ipv6 address */ +extern void route_map_match_ipv6_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ipv6 address */ +extern void route_map_no_match_ipv6_address_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match ipv6 address prefix list */ +extern void route_map_match_ipv6_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match ipv6 address prefix list */ +extern void route_map_no_match_ipv6_address_prefix_list_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match metric */ +extern void route_map_match_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match metric */ +extern void route_map_no_match_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* match tag */ +extern void route_map_match_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* no match tag */ +extern void route_map_no_match_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg, + route_map_event_t type)); +/* set ip nexthop */ +extern void route_map_set_ip_nexthop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* no set ip nexthop */ +extern void route_map_no_set_ip_nexthop_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* set ipv6 nexthop local */ +extern void route_map_set_ipv6_nexthop_local_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* no set ipv6 nexthop local */ +extern void route_map_no_set_ipv6_nexthop_local_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* set metric */ +extern void route_map_set_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* no set metric */ +extern void route_map_no_set_metric_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* set tag */ +extern void route_map_set_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); +/* no set tag */ +extern void route_map_no_set_tag_hook (int (*func) (struct vty *vty, + struct route_map_index *index, + const char *command, + const char *arg)); #endif /* _ZEBRA_ROUTEMAP_H */ diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 8489d33661..07ddb9cc88 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1070,7 +1070,6 @@ DEFUN (ospf6_routemap_no_match_interface, return route_map_command_status (vty, ret); } - /* add "set metric-type" */ DEFUN (ospf6_routemap_set_metric_type, ospf6_routemap_set_metric_type_cmd, @@ -1102,41 +1101,6 @@ DEFUN (ospf6_routemap_no_set_metric_type, return route_map_command_status (vty, ret); } -/* add "set metric" */ -DEFUN (set_metric, - set_metric_cmd, - "set metric (0-4294967295)", - "Set value\n" - "Metric value\n" - "Metric value\n") -{ - int idx_number = 2; - int ret = route_map_add_set ((struct route_map_index *) vty->index, - "metric", argv[idx_number]->arg); - return route_map_command_status (vty, ret); -} - -/* delete "set metric" */ -DEFUN (no_set_metric, - no_set_metric_cmd, - "no set metric [(0-4294967295)]", - NO_STR - SET_STR - "Metric value for destination routing protocol\n") -{ - int idx_number = 3; - int ret = 0; - - if (argc == 3) - ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric", NULL); - else - ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric", argv[idx_number]->arg); - return route_map_command_status (vty, ret); -} - - /* add "set forwarding-address" */ DEFUN (ospf6_routemap_set_forwarding, ospf6_routemap_set_forwarding_cmd, @@ -1174,6 +1138,9 @@ ospf6_routemap_init (void) route_map_add_hook (ospf6_asbr_routemap_update); route_map_delete_hook (ospf6_asbr_routemap_update); + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + route_map_install_match (&ospf6_routemap_rule_match_address_prefixlist_cmd); route_map_install_match (&ospf6_routemap_rule_match_interface_cmd); @@ -1193,10 +1160,6 @@ ospf6_routemap_init (void) install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd); install_element (RMAP_NODE, &ospf6_routemap_no_set_metric_type_cmd); - /* ASE Metric */ - install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_cmd); - /* ASE Metric */ install_element (RMAP_NODE, &ospf6_routemap_set_forwarding_cmd); install_element (RMAP_NODE, &ospf6_routemap_no_set_forwarding_cmd); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index ded8041cb7..fd87c5a56f 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -318,30 +318,6 @@ DEFUN (show_zebra, return CMD_SUCCESS; } -DEFUN (router_zebra, - router_zebra_cmd, - "router zebra", - "Enable a routing process\n" - "Make connection to zebra daemon\n") -{ - vty->node = ZEBRA_NODE; - zclient->enable = 1; - zclient_start (zclient); - return CMD_SUCCESS; -} - -DEFUN (no_router_zebra, - no_router_zebra_cmd, - "no router zebra", - NO_STR - "Configure routing process\n" - "Disable connection to zebra daemon\n") -{ - zclient->enable = 0; - zclient_stop (zclient); - return CMD_SUCCESS; -} - /* Zebra configuration write function. */ static int config_write_ospf6_zebra (struct vty *vty) @@ -695,9 +671,6 @@ ospf6_zebra_init (struct thread_master *master) /* Install command element for zebra node. */ install_element (VIEW_NODE, &show_zebra_cmd); install_element (ENABLE_NODE, &show_zebra_cmd); - install_element (CONFIG_NODE, &router_zebra_cmd); - install_element (CONFIG_NODE, &no_router_zebra_cmd); - install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &redistribute_ospf6_cmd); install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd); diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 3e2db84a67..8042c73225 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -686,7 +686,6 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, u_int32_t id = 0; u_int32_t adv_router = 0; - // dwalton is this needed? OSPF6_CMD_CHECK_RUNNING (); type = parse_type_spec (idx_lsa, argc, argv); diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 33ddc67fcc..ebe426cee0 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -27,6 +27,7 @@ #include "memory.h" #include "prefix.h" #include "table.h" +#include "vty.h" #include "routemap.h" #include "command.h" #include "log.h" @@ -163,53 +164,6 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -static int -ospf_route_set_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - -/* Delete rip route map rule. */ -static int -ospf_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - /* `match ip netxthop ' */ /* Match function return 1 if match is success else return zero. */ static route_map_result_t @@ -720,161 +674,6 @@ DEFUN (no_match_ip_nexthop, } -DEFUN (match_ip_next_hop_prefix_list, - match_ip_next_hop_prefix_list_cmd, - "match ip next-hop prefix-list WORD", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return ospf_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[idx_word]->arg); -} - -DEFUN (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *pl = (argc == 6) ? argv[5]->arg : NULL; - return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", pl); -} - - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP access-list name\n") -{ - int idx_acl = 3; - return ospf_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); -} - -DEFUN (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP access-list name\n") -{ - char *al = (argc == 5) ? argv[4]->arg : NULL; - return ospf_route_match_delete (vty, vty->index, "ip address", al); -} - -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return ospf_route_match_add (vty, vty->index, "ip address prefix-list", - argv[idx_word]->arg); -} - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *pl = (argc == 6) ? argv[5]->arg : NULL; - return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl); -} - -DEFUN (match_interface, - match_interface_cmd, - "match interface WORD", - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - int idx_word = 2; - return ospf_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); -} - -DEFUN (no_match_interface, - no_match_interface_cmd, - "no match interface [INTERFACE]", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - char *iface = (argc == 4) ? argv[3]->arg : NULL; - return ospf_route_match_delete (vty, vty->index, "interface", iface); -} - -DEFUN (match_tag, - match_tag_cmd, - "match tag (1-65535)", - MATCH_STR - "Match tag of route\n" - "Tag value\n") -{ - int idx_number = 2; - return ospf_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_match_tag, - no_match_tag_cmd, - "no match tag [(1-65535)]", - NO_STR - MATCH_STR - "Match tag of route\n" - "Tag value\n") -{ - char *tag = (argc == 4) ? argv[3]->arg : NULL; - return ospf_route_match_delete (vty, vty->index, "tag", tag); -} - -DEFUN (set_metric, - set_metric_cmd, - "set metric (0-4294967295)", - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - int idx_number = 2; - return ospf_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); -} - -DEFUN (no_set_metric, - no_set_metric_cmd, - "no set metric [(0-4294967295)]", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return ospf_route_set_delete (vty, vty->index, "metric", mval); -} - DEFUN (set_metric_type, set_metric_type_cmd, "set metric-type ", @@ -884,7 +683,7 @@ DEFUN (set_metric_type, "OSPF[6] external type 2 metric\n") { char *ext = argv[2]->text; - return ospf_route_set_add (vty, vty->index, "metric-type", ext); + return generic_set_add (vty, vty->index, "metric-type", ext); } DEFUN (no_set_metric_type, @@ -897,33 +696,9 @@ DEFUN (no_set_metric_type, "OSPF[6] external type 2 metric\n") { char *ext = (argc == 4) ? argv[3]->text : NULL; - return ospf_route_set_delete (vty, vty->index, "metric-type", ext); + return generic_set_delete (vty, vty->index, "metric-type", ext); } -DEFUN (set_tag, - set_tag_cmd, - "set tag (1-65535)", - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - int idx_number = 2; - return ospf_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_set_tag, - no_set_tag_cmd, - "no set tag [(1-65535)]", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - char *tag = (argc == 4) ? argv[3]->arg : NULL; - return ospf_route_set_delete (vty, vty->index, "tag", tag); -} - - /* Route-map init */ void ospf_route_map_init (void) @@ -934,6 +709,27 @@ ospf_route_map_init (void) route_map_add_hook (ospf_route_map_update); route_map_delete_hook (ospf_route_map_update); route_map_event_hook (ospf_route_map_event); + + route_map_match_interface_hook (generic_match_add); + route_map_no_match_interface_hook (generic_match_delete); + + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); + + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); + + route_map_match_ip_next_hop_prefix_list_hook (generic_match_add); + route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete); + + route_map_match_tag_hook (generic_match_add); + route_map_no_match_tag_hook (generic_match_delete); + + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + + route_map_set_tag_hook (generic_set_add); + route_map_no_set_tag_hook (generic_set_delete); route_map_install_match (&route_match_ip_nexthop_cmd); route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd); @@ -948,21 +744,7 @@ ospf_route_map_init (void) install_element (RMAP_NODE, &match_ip_nexthop_cmd); install_element (RMAP_NODE, &no_match_ip_nexthop_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_cmd); install_element (RMAP_NODE, &set_metric_type_cmd); install_element (RMAP_NODE, &no_set_metric_type_cmd); - install_element (RMAP_NODE, &set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_cmd); } diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h index 7cfae417e3..8e93ed2691 100644 --- a/ospfd/ospf_zebra.h +++ b/ospfd/ospf_zebra.h @@ -42,8 +42,6 @@ struct ospf_distance }; /* Prototypes */ -extern void ospf_zclient_start (void); - extern void ospf_zebra_add (struct prefix_ipv4 *, struct ospf_route *); extern void ospf_zebra_delete (struct prefix_ipv4 *, struct ospf_route *); diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c index adfd4fd2c3..3689d23a8d 100644 --- a/pimd/pim_routemap.c +++ b/pimd/pim_routemap.c @@ -22,6 +22,7 @@ #include #include "if.h" +#include "vty.h" #include "routemap.h" #include "pimd.h" diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index e1017cfb27..3cdfd8adfc 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -24,6 +24,7 @@ #include "memory.h" #include "prefix.h" +#include "vty.h" #include "routemap.h" #include "command.h" #include "filter.h" @@ -45,104 +46,6 @@ struct rip_metric_modifier u_char metric; }; -/* Add rip route map rule. */ -static int -rip_route_match_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -/* Delete rip route map rule. */ -static int -rip_route_match_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -/* Add rip route map rule. */ -static int -rip_route_set_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - /* rip, ripng and other protocols share the set metric command - but only values from 0 to 16 are valid for rip and ripng - if metric is out of range for rip and ripng, it is not for - other protocols. Do not return an error */ - if (strcmp(command, "metric")) { - vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - } - return CMD_SUCCESS; -} - -/* Delete rip route map rule. */ -static int -rip_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% RIP Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% RIP Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - /* Hook function for updating route_map assignment. */ /* ARGSUSED */ static void @@ -735,288 +638,6 @@ static struct route_map_rule_cmd route_set_tag_cmd = #define MATCH_STR "Match values from routing table\n" #define SET_STR "Set values in destination routing protocol\n" -DEFUN (match_metric, - match_metric_cmd, - "match metric (0-4294967295)", - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - int idx_number = 2; - return rip_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); -} - -DEFUN (no_match_metric, - no_match_metric_cmd, - "no match metric [(0-4294967295)]", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "metric", mval); -} - - -DEFUN (match_interface, - match_interface_cmd, - "match interface WORD", - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - int idx_word = 2; - return rip_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); -} - -DEFUN (no_match_interface, - no_match_interface_cmd, - "no match interface [INTERFACE]", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - char *iface = (argc == 4) ? argv[3]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "interface", iface); -} - -DEFUN (match_ip_next_hop, - match_ip_next_hop_cmd, - "match ip next-hop <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 3; - return rip_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg); -} - -DEFUN (no_match_ip_next_hop, - no_match_ip_next_hop_cmd, - "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - char *al = (argc == 5) ? argv[4]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "ip next-hop", al); -} - -DEFUN (match_ip_next_hop_prefix_list, - match_ip_next_hop_prefix_list_cmd, - "match ip next-hop prefix-list WORD", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return rip_route_match_add (vty, vty->index, "ip next-hop prefix-list", argv[idx_word]->arg); -} - -DEFUN (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *plist = (argc == 6) ? argv[5]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist); -} - - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") - -{ - int idx_acl = 3; - return rip_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg); -} - -DEFUN (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - char *al = (argc == 5) ? argv[4]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "ip address", al); -} - - -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return rip_route_match_add (vty, vty->index, "ip address prefix-list", argv[idx_word]->arg); -} - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *plist = (argc == 6) ? argv[5]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist); -} - - -DEFUN (match_tag, - match_tag_cmd, - "match tag (1-65535)", - MATCH_STR - "Match tag of route\n" - "Metric value\n") -{ - int idx_number = 2; - return rip_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_match_tag, - no_match_tag_cmd, - "no match tag [(1-65535)]", - NO_STR - MATCH_STR - "Match tag of route\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return rip_route_match_delete (vty, vty->index, "tag", mval); -} - - -/* set functions */ - -DEFUN (set_metric, - set_metric_cmd, - "set metric <(0-4294967295)|+metric|-metric>", - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n" - "Add metric\n" - "Subtract metric\n") -{ - char *metric = argv[2]->type == WORD_TKN ? argv[2]->text : argv[2]->arg; - return rip_route_set_add (vty, vty->index, "metric", metric); -} - -DEFUN (no_set_metric, - no_set_metric_cmd, - "no set metric <(0-4294967295)|+metric|-metric>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n" - "Add metric\n" - "Subtract metric\n") -{ - char *metric = argv[3]->type == WORD_TKN ? argv[3]->text : argv[3]->arg; - return rip_route_set_delete (vty, vty->index, "metric", metric); -} - -DEFUN (set_ip_nexthop, - set_ip_nexthop_cmd, - "set ip next-hop A.B.C.D", - SET_STR - IP_STR - "Next hop address\n" - "IP address of next hop\n") -{ - int idx_ipv4 = 3; - union sockunion su; - int ret; - - ret = str2sockunion (argv[idx_ipv4]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE); - return CMD_WARNING; - } - if (su.sin.sin_addr.s_addr == 0 || - IPV4_CLASS_DE(su.sin.sin_addr.s_addr)) - { - vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast " - "or reserved%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return rip_route_set_add (vty, vty->index, "ip next-hop", argv[idx_ipv4]->arg); -} - -DEFUN (no_set_ip_nexthop, - no_set_ip_nexthop_cmd, - "no set ip next-hop [A.B.C.D]", - NO_STR - SET_STR - IP_STR - "Next hop address\n" - "IP address of next hop\n") -{ - char *addr = (argc == 5) ? argv[4]->arg : NULL; - return rip_route_set_delete (vty, vty->index, "ip next-hop", addr); -} - - -DEFUN (set_tag, - set_tag_cmd, - "set tag (1-65535)", - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - int idx_number = 2; - return rip_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_set_tag, - no_set_tag_cmd, - "no set tag [(1-65535)]", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - char *tag = (argc == 4) ? argv[3]->arg : NULL; - return rip_route_set_delete (vty, vty->index, "tag", tag); -} - void rip_route_map_reset () { @@ -1032,6 +653,36 @@ rip_route_map_init () route_map_add_hook (rip_route_map_update); route_map_delete_hook (rip_route_map_update); + route_map_match_interface_hook (generic_match_add); + route_map_no_match_interface_hook (generic_match_delete); + + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); + + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); + + route_map_match_ip_next_hop_hook (generic_match_add); + route_map_no_match_ip_next_hop_hook (generic_match_delete); + + route_map_match_ip_next_hop_prefix_list_hook (generic_match_add); + route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete); + + route_map_match_metric_hook (generic_match_add); + route_map_no_match_metric_hook (generic_match_delete); + + route_map_match_tag_hook (generic_match_add); + route_map_no_match_tag_hook (generic_match_delete); + + route_map_set_ip_nexthop_hook (generic_set_add); + route_map_no_set_ip_nexthop_hook (generic_set_delete); + + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + + route_map_set_tag_hook (generic_set_add); + route_map_no_set_tag_hook (generic_set_delete); + route_map_install_match (&route_match_metric_cmd); route_map_install_match (&route_match_interface_cmd); route_map_install_match (&route_match_ip_next_hop_cmd); @@ -1043,26 +694,4 @@ rip_route_map_init () route_map_install_set (&route_set_metric_cmd); route_map_install_set (&route_set_ip_nexthop_cmd); route_map_install_set (&route_set_tag_cmd); - - install_element (RMAP_NODE, &match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_cmd); - install_element (RMAP_NODE, &match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_cmd); - - install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &set_ip_nexthop_cmd); - install_element (RMAP_NODE, &no_set_ip_nexthop_cmd); - install_element (RMAP_NODE, &set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_cmd); } diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index f4cca7e8ab..756a77cff9 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -251,46 +251,6 @@ static struct { {0, 0, NULL} }; -DEFUN (router_zebra, - router_zebra_cmd, - "router zebra", - "Enable a routing process\n" - "Make connection to zebra daemon\n") -{ - vty->node = ZEBRA_NODE; - zclient->enable = 1; - zclient_start (zclient); - return CMD_SUCCESS; -} - -DEFUN (no_router_zebra, - no_router_zebra_cmd, - "no router zebra", - NO_STR - "Enable a routing process\n" - "Make connection to zebra daemon\n") -{ - zclient->enable = 0; - zclient_stop (zclient); - return CMD_SUCCESS; -} - -#if 0 -static int -rip_redistribute_set (int type) -{ - if (vrf_bitmap_check (zclient->redist[AFI_IP][type], VRF_DEFAULT)) - return CMD_SUCCESS; - - vrf_bitmap_set (zclient->redist[AFI_IP][type], VRF_DEFAULT); - - if (zclient->sock > 0) - zebra_redistribute_send (ZEBRA_REDISTRIBUTE_ADD, zclient, API_IP, type); - - return CMD_SUCCESS; -} -#endif - static int rip_redistribute_unset (int type) { @@ -747,8 +707,6 @@ rip_zclient_init (struct thread_master *master) install_node (&zebra_node, config_write_zebra); /* Install command elements to zebra node. */ - install_element (CONFIG_NODE, &router_zebra_cmd); - install_element (CONFIG_NODE, &no_router_zebra_cmd); install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &rip_redistribute_rip_cmd); install_element (ZEBRA_NODE, &no_rip_redistribute_rip_cmd); diff --git a/ripd/ripd.h b/ripd/ripd.h index 7c77b26d41..e6b18e3f04 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -392,7 +392,6 @@ extern void rip_route_map_init (void); extern void rip_route_map_reset (void); extern void rip_snmp_init (void); extern void rip_zclient_init(struct thread_master *); -extern void rip_zclient_start (void); extern void rip_zclient_reset (void); extern void rip_offset_init (void); extern int if_check_address (struct in_addr addr); diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 6ecf084660..9e032e97f2 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -24,6 +24,7 @@ #include "if.h" #include "memory.h" #include "prefix.h" +#include "vty.h" #include "routemap.h" #include "command.h" #include "sockunion.h" @@ -42,95 +43,6 @@ struct rip_metric_modifier u_char metric; }; - -static int -ripng_route_match_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -ripng_route_match_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -ripng_route_set_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -ripng_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - /* `match metric METRIC' */ /* Match function return 1 if match is success else return zero. */ static route_map_result_t @@ -500,172 +412,6 @@ static struct route_map_rule_cmd route_set_tag_cmd = #define MATCH_STR "Match values from routing table\n" #define SET_STR "Set values in destination routing protocol\n" -DEFUN (match_metric, - match_metric_cmd, - "match metric (0-4294967295)", - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - int idx_number = 2; - return ripng_route_match_add (vty, vty->index, "metric", argv[idx_number]->arg); -} - -DEFUN (no_match_metric, - no_match_metric_cmd, - "no match metric [(0-4294967295)]", - NO_STR - MATCH_STR - "Match metric of route\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return ripng_route_match_delete (vty, vty->index, "metric", mval); -} - - -DEFUN (match_interface, - match_interface_cmd, - "match interface WORD", - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - int idx_word = 2; - return ripng_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg); -} - -DEFUN (no_match_interface, - no_match_interface_cmd, - "no match interface [INTERFACE]", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - char *iface = (argc == 4) ? argv[3]->arg : NULL; - return ripng_route_match_delete (vty, vty->index, "interface", iface); -} - - -DEFUN (match_tag, - match_tag_cmd, - "match tag (1-65535)", - MATCH_STR - "Match tag of route\n" - "Metric value\n") -{ - int idx_number = 2; - return ripng_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_match_tag, - no_match_tag_cmd, - "no match tag [(1-65535)]", - NO_STR - MATCH_STR - "Match tag of route\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return ripng_route_match_delete (vty, vty->index, "tag", mval); -} - - -/* set functions */ - -DEFUN (set_metric, - set_metric_cmd, - "set metric (0-4294967295)", - "Set value\n" - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - int idx_number = 2; - return ripng_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg); -} - -DEFUN (no_set_metric, - no_set_metric_cmd, - "no set metric [(0-4294967295)]", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - char *mval = (argc == 4) ? argv[3]->arg : NULL; - return ripng_route_set_delete (vty, vty->index, "metric", mval); -} - - -DEFUN (set_ipv6_nexthop_local, - set_ipv6_nexthop_local_cmd, - "set ipv6 next-hop local X:X::X:X", - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") -{ - int idx_ipv6 = 4; - union sockunion su; - int ret; - - ret = str2sockunion (argv[idx_ipv6]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed next-hop local address%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (!IN6_IS_ADDR_LINKLOCAL(&su.sin6.sin6_addr)) - { - vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[idx_ipv6]->arg); -} - -DEFUN (no_set_ipv6_nexthop_local, - no_set_ipv6_nexthop_local_cmd, - "no set ipv6 next-hop local [X:X::X:X]", - NO_STR - SET_STR - IPV6_STR - "IPv6 next-hop address\n" - "IPv6 local address\n" - "IPv6 address of next hop\n") -{ - char *addr = (argc == 6) ? argv[5]->arg : NULL; - return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr); -} - - -DEFUN (set_tag, - set_tag_cmd, - "set tag (1-65535)", - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - int idx_number = 2; - return ripng_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg); -} - -DEFUN (no_set_tag, - no_set_tag_cmd, - "no set tag [(1-65535)]", - NO_STR - SET_STR - "Tag value for routing protocol\n" - "Tag value\n") -{ - char *tag = (argc == 4) ? argv[3]->arg : NULL; - return ripng_route_set_delete (vty, vty->index, "tag", tag); -} - - void ripng_route_map_reset () { @@ -679,25 +425,28 @@ ripng_route_map_init () route_map_init (); route_map_init_vty (); + route_map_match_interface_hook (generic_match_add); + route_map_no_match_interface_hook (generic_match_delete); + + route_map_match_metric_hook (generic_match_add); + route_map_no_match_metric_hook (generic_match_delete); + + route_map_match_tag_hook (generic_match_add); + route_map_no_match_tag_hook (generic_match_delete); + + route_map_set_ipv6_nexthop_local_hook (generic_set_add); + route_map_no_set_ipv6_nexthop_local_hook (generic_set_delete); + + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); + + route_map_set_tag_hook (generic_set_add); + route_map_no_set_tag_hook (generic_set_delete); + route_map_install_match (&route_match_metric_cmd); route_map_install_match (&route_match_interface_cmd); route_map_install_match (&route_match_tag_cmd); - route_map_install_set (&route_set_metric_cmd); route_map_install_set (&route_set_ipv6_nexthop_local_cmd); route_map_install_set (&route_set_tag_cmd); - - install_element (RMAP_NODE, &match_metric_cmd); - install_element (RMAP_NODE, &no_match_metric_cmd); - install_element (RMAP_NODE, &match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_cmd); - - install_element (RMAP_NODE, &set_metric_cmd); - install_element (RMAP_NODE, &no_set_metric_cmd); - install_element (RMAP_NODE, &set_ipv6_nexthop_local_cmd); - install_element (RMAP_NODE, &no_set_ipv6_nexthop_local_cmd); - install_element (RMAP_NODE, &set_tag_cmd); - install_element (RMAP_NODE, &no_set_tag_cmd); } diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index c8527539f8..1190b1873a 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -280,30 +280,6 @@ ripng_redistribute_clean () } } -DEFUN (router_zebra, - router_zebra_cmd, - "router zebra", - "Enable a routing process\n" - "Make connection to zebra daemon\n") -{ - vty->node = ZEBRA_NODE; - zclient->enable = 1; - zclient_start (zclient); - return CMD_SUCCESS; -} - -DEFUN (no_router_zebra, - no_router_zebra_cmd, - "no router zebra", - NO_STR - "Disable a routing process\n" - "Stop connection to zebra daemon\n") -{ - zclient->enable = 0; - zclient_stop (zclient); - return CMD_SUCCESS; -} - DEFUN (ripng_redistribute_ripng, ripng_redistribute_ripng_cmd, "redistribute ripng", @@ -556,8 +532,6 @@ zebra_init (struct thread_master *master) install_node (&zebra_node, zebra_config_write); /* Install command element for zebra node. */ - install_element (CONFIG_NODE, &router_zebra_cmd); - install_element (CONFIG_NODE, &no_router_zebra_cmd); install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &ripng_redistribute_ripng_cmd); install_element (ZEBRA_NODE, &no_ripng_redistribute_ripng_cmd); diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 5337eb88f3..031ca963d9 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -358,7 +358,6 @@ extern void ripng_route_map_reset (void); extern void ripng_terminate (void); /* zclient_init() is done by ripng_zebra.c:zebra_init() */ extern void zebra_init(struct thread_master *); -extern void ripng_zclient_start (void); extern void ripng_zclient_reset (void); extern void ripng_offset_init (void); diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 5c8e6a4d2e..bcebe2cc4e 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -212,11 +212,6 @@ foreach (@ARGV) { } } -my $bad_cli_stomps = 71; -# Currently we have $bad_cli_stomps. This was determined by -# running this script and counting up the collisions from what -# was returned. -# # When we have cli commands that map to the same function name, we # can introduce subtle bugs due to code not being called when # we think it is. @@ -224,12 +219,9 @@ my $bad_cli_stomps = 71; # If extract.pl fails with a error message and you've been # modifying the cli, then go back and fix your code to # not have cli command function collisions. -# -# If you've removed a cli overwrite, you can safely subtract -# one from $bad_cli_stomps. If you've added to the problem # please fix your code before submittal -if ($cli_stomp != $bad_cli_stomps) { - warn "Expected $bad_cli_stomps command line stomps, but got $cli_stomp instead\n"; +if ($cli_stomp) { + warn "There are $cli_stomp command line stomps\n"; exit $cli_stomp; } diff --git a/zebra/connected.c b/zebra/connected.c index 290973a5cb..97eb79d573 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -32,6 +32,7 @@ #include "memory.h" #include "zebra_memory.h" +#include "vty.h" #include "zebra/debug.h" #include "zebra/zserv.h" #include "zebra/redistribute.h" diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c index 17b3c7bc8d..0770ab0bb2 100644 --- a/zebra/kernel_null.c +++ b/zebra/kernel_null.c @@ -24,6 +24,7 @@ #include #include +#include "vty.h" #include "zebra/zserv.h" #include "zebra/rt.h" #include "zebra/redistribute.h" diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c index 85d3bd2f1b..4446627dd3 100644 --- a/zebra/redistribute_null.c +++ b/zebra/redistribute_null.c @@ -20,6 +20,7 @@ */ #include +#include "vty.h" #include "zebra/rib.h" #include "zebra/zserv.h" diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index f7d0136286..c5a6a49691 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -27,6 +27,7 @@ #include "log.h" #include "rib.h" +#include "vty.h" #include "zserv.h" #include "zebra_ns.h" diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c index 3ec8be027d..b7809d3145 100644 --- a/zebra/zebra_rnh_null.c +++ b/zebra/zebra_rnh_null.c @@ -1,4 +1,5 @@ #include +#include "vty.h" #include "zebra/rib.h" #include "zebra/zserv.h" #include "zebra/zebra_rnh.h" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 6b861d7804..fddc4fd7b1 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -25,6 +25,7 @@ #include "zebra_memory.h" #include "prefix.h" #include "rib.h" +#include "vty.h" #include "routemap.h" #include "command.h" #include "filter.h" @@ -56,6 +57,8 @@ struct nh_rmap_obj static void zebra_route_map_set_delay_timer(u_int32_t value); + + /* Add zebra route map rule */ static int zebra_route_match_add(struct vty *vty, struct route_map_index *index, @@ -136,52 +139,6 @@ zebra_route_match_delete (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -/* Add zebra route map rule. */ -static int -zebra_route_set_add (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_add_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -/* Delete zebra route map rule. */ -static int -zebra_route_set_delete (struct vty *vty, struct route_map_index *index, - const char *command, const char *arg) -{ - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - /* 'match tag TAG' * Match function return 1 if match is success else return 0 */ @@ -294,179 +251,6 @@ struct route_map_rule_cmd route_match_interface_cmd = route_match_interface_free }; -DEFUN (match_interface, - match_interface_cmd, - "match interface WORD", - MATCH_STR - "match first hop interface of route\n" - "Interface name\n") -{ - int idx_word = 2; - return zebra_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg, - RMAP_EVENT_MATCH_ADDED); -} - -DEFUN (no_match_interface, - no_match_interface_cmd, - "no match interface [WORD]", - NO_STR - MATCH_STR - "Match first hop interface of route\n" - "Interface name\n") -{ - char *iface = (argc == 4) ? argv[3]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, "interface", iface, RMAP_EVENT_MATCH_DELETED); -} - - -DEFUN (match_tag, - match_tag_cmd, - "match tag (1-65535)", - MATCH_STR - "Match tag of route\n" - "Tag value\n") -{ - int idx_number = 2; - return zebra_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg, - RMAP_EVENT_MATCH_ADDED); -} - -DEFUN (no_match_tag, - no_match_tag_cmd, - "no match tag [(1-65535)]", - NO_STR - MATCH_STR - "Match tag of route\n") -{ - char *tag = (argc == 4) ? argv[3]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, "tag", tag, RMAP_EVENT_MATCH_DELETED); -} - - -DEFUN (match_ip_next_hop, - match_ip_next_hop_cmd, - "match ip next-hop <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - int idx_acl = 3; - return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg, RMAP_EVENT_FILTER_ADDED); -} - -DEFUN (no_match_ip_next_hop, - no_match_ip_next_hop_cmd, - "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - char *al = (argc == 5) ? argv[4]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, "ip next-hop", al, RMAP_EVENT_FILTER_DELETED); -} - - -DEFUN (match_ip_next_hop_prefix_list, - match_ip_next_hop_prefix_list_cmd, - "match ip next-hop prefix-list WORD", - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); -} - -DEFUN (no_match_ip_next_hop_prefix_list, - no_match_ip_next_hop_prefix_list_cmd, - "no match ip next-hop prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match next-hop address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *plist = (argc == 6) ? argv[5]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, - "ip next-hop prefix-list", plist, - RMAP_EVENT_PLIST_DELETED); -} - - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address <(1-199)|(1300-2699)|WORD>", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") - -{ - int idx_acl = 3; - return zebra_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg, - RMAP_EVENT_FILTER_ADDED); -} - -DEFUN (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address [<(1-199)|(1300-2699)|WORD>]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - char *al = (argc == 5) ? argv[4]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, "ip address", al, RMAP_EVENT_FILTER_DELETED); -} - - -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - int idx_word = 4; - return zebra_route_match_add (vty, vty->index, "ip address prefix-list", - argv[idx_word]->arg, RMAP_EVENT_PLIST_ADDED); -} - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list [WORD]", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - char *plist = (argc == 6) ? argv[5]->arg : NULL; - return zebra_route_match_delete (vty, vty->index, - "ip address prefix-list", plist, - RMAP_EVENT_PLIST_DELETED); -} - - DEFUN (match_ip_address_prefix_len, match_ip_address_prefix_len_cmd, "match ip address prefix-len (0-32)", @@ -615,7 +399,7 @@ DEFUN (set_src, vty_out (vty, "%% not a local address%s", VTY_NEWLINE); return CMD_WARNING; } - return zebra_route_set_add (vty, vty->index, "src", argv[idx_ip]->arg); + return generic_set_add (vty, vty->index, "src", argv[idx_ip]->arg); } DEFUN (no_set_src, @@ -626,7 +410,7 @@ DEFUN (no_set_src, "Source address for route\n") { char *ip = (argc == 4) ? argv[3]->arg : NULL; - return zebra_route_set_delete (vty, vty->index, "src", ip); + return generic_set_delete (vty, vty->index, "src", ip); } DEFUN (zebra_route_map_timer, @@ -1729,6 +1513,24 @@ zebra_route_map_init () route_map_delete_hook (zebra_route_map_delete); route_map_event_hook (zebra_route_map_event); + route_map_match_interface_hook (generic_match_add); + route_map_no_match_interface_hook (generic_match_delete); + + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); + + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); + + route_map_match_ip_next_hop_hook (generic_match_add); + route_map_no_match_ip_next_hop_hook (generic_match_delete); + + route_map_match_ip_next_hop_prefix_list_hook (generic_match_add); + route_map_no_match_ip_next_hop_prefix_list_hook (generic_match_delete); + + route_map_match_tag_hook (generic_match_add); + route_map_no_match_tag_hook (generic_match_delete); + route_map_install_match (&route_match_tag_cmd); route_map_install_match (&route_match_interface_cmd); route_map_install_match (&route_match_ip_next_hop_cmd); @@ -1741,18 +1543,6 @@ zebra_route_map_init () /* */ route_map_install_set (&route_set_src_cmd); /* */ - install_element (RMAP_NODE, &match_tag_cmd); - install_element (RMAP_NODE, &no_match_tag_cmd); - install_element (RMAP_NODE, &match_interface_cmd); - install_element (RMAP_NODE, &no_match_interface_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_cmd); - install_element (RMAP_NODE, &match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd); - install_element (RMAP_NODE, &match_ip_address_cmd); - install_element (RMAP_NODE, &no_match_ip_address_cmd); - install_element (RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd); install_element (RMAP_NODE, &match_ip_nexthop_prefix_len_cmd); install_element (RMAP_NODE, &no_match_ip_nexthop_prefix_len_cmd); install_element (RMAP_NODE, &match_ip_address_prefix_len_cmd); diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 18efe26d9f..d05b6e13ac 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -25,6 +25,7 @@ #include #include +#include "vty.h" #include "zebra/debug.h" #include "zebra/rib.h" #include "zebra/zserv.h" diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 890d749ca4..7625b9676e 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -25,6 +25,7 @@ #include "linklist.h" #include "memory.h" +#include "vty.h" #include "zebra/debug.h" #include "zebra/zserv.h" #include "zebra/rib.h" diff --git a/zebra/zserv.h b/zebra/zserv.h index 3667f5b2b6..4487957a0c 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -25,10 +25,10 @@ #include "rib.h" #include "if.h" #include "workqueue.h" +#include "vrf.h" #include "routemap.h" #include "vty.h" #include "zclient.h" -#include "vrf.h" #include "zebra/zebra_ns.h" /* Default port information. */ diff --git a/zebra/zserv_null.c b/zebra/zserv_null.c index acab22d96f..4b52abb222 100644 --- a/zebra/zserv_null.c +++ b/zebra/zserv_null.c @@ -23,6 +23,7 @@ #include #include +#include #include #include From 5e6a74d811ec68b9424a0341716593e37a342ca5 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 6 Oct 2016 20:23:13 +0000 Subject: [PATCH 217/280] all: removed all DEFUN command stomps (fix build errors) Signed-off-by: Daniel Walton --- zebra/if_netlink.c | 1 + zebra/ioctl.c | 1 + zebra/rt_netlink.c | 1 + zebra/rtread_netlink.c | 1 + 4 files changed, 4 insertions(+) diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index dffa6568ea..09268d3518 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -22,6 +22,7 @@ #include +#include "vty.h" #include "zebra/zserv.h" #include "zebra/rt_netlink.h" diff --git a/zebra/ioctl.c b/zebra/ioctl.c index f91ee2438d..1835fb3102 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -29,6 +29,7 @@ #include "log.h" #include "privs.h" +#include "vty.h" #include "zebra/rib.h" #include "zebra/rt.h" #include "zebra/interface.h" diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index a6984f7f2f..a5f62dfa03 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -40,6 +40,7 @@ #include "privs.h" #include "nexthop.h" #include "vrf.h" +#include "vty.h" #include "zebra/zserv.h" #include "zebra/zebra_ns.h" diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c index c27e6e97f1..1d41861bbd 100644 --- a/zebra/rtread_netlink.c +++ b/zebra/rtread_netlink.c @@ -22,6 +22,7 @@ #include +#include "vty.h" #include "zebra/zserv.h" #include "zebra/rt_netlink.h" From 066242b5c6f4740b4c5beb80071428cee3ae7e70 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 02:33:37 +0000 Subject: [PATCH 218/280] lib: Fix `show running-config` and `write terminal` Signed-off-by: Quentin Young --- vtysh/vtysh.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 8ab3243dbd..70b0d7832e 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2160,34 +2160,41 @@ DEFUN (vtysh_write_terminal, vtysh_write_terminal_cmd, "write terminal []", "Write running configuration to memory, network, or terminal\n" - "Write to terminal\n") + "Write to terminal\n" + "For the zebra daemon\n" + "For the rip daemon\n" + "For the ripng daemon\n" + "For the ospf daemon\n" + "For the ospfv6 daemon\n" + "For the bgp daemon\n" + "For the isis daemon\n" + "For the pim daemon\n") { - if (argc == 3) - { - for (unsigned int i = 0; i < array_size(vtysh_client); i++) - if (begins_with(vtysh_client[i].name, argv[2]->arg)) - break; - } - + u_int i; + char line[] = "write terminal\n"; FILE *fp = NULL; if (vtysh_pager_name) { fp = popen (vtysh_pager_name, "w"); if (fp == NULL) - { - perror ("popen"); - exit (1); - } + { + perror ("popen"); + exit (1); + } } else fp = stdout; vty_out (vty, "Building configuration...%s", VTY_NEWLINE); vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, - VTY_NEWLINE); + VTY_NEWLINE); vty_out (vty, "!%s", VTY_NEWLINE); + for (i = 0; i < array_size(vtysh_client); i++) + if ((argc < 3 ) || (strmatch (vtysh_client[i].name, argv[2]->text))) + vtysh_client_config (&vtysh_client[i], line); + /* Integrate vtysh specific configuration. */ vtysh_config_write (); @@ -2197,15 +2204,14 @@ DEFUN (vtysh_write_terminal, { fflush (fp); if (pclose (fp) == -1) - { - perror ("pclose"); - exit (1); - } + { + perror ("pclose"); + exit (1); + } fp = NULL; } vty_out (vty, "end%s", VTY_NEWLINE); - return CMD_SUCCESS; } From 943624d733950fa7ff53715b44e274b387f15dbd Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 18:39:24 +0000 Subject: [PATCH 219/280] tools: Pretty print graph after input permutations Signed-off-by: Quentin Young --- tools/permutations.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tools/permutations.c b/tools/permutations.c index 819305e54e..a582101fdf 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -30,6 +30,8 @@ void permute (struct graph_node *); +void +pretty_print_graph (struct graph_node *start, int level); int main (int argc, char *argv[]) { @@ -38,7 +40,6 @@ int main (int argc, char *argv[]) fprintf(stdout, USAGE"\n"); exit(EXIT_SUCCESS); } - struct cmd_element *cmd = calloc (1, sizeof (struct cmd_element)); cmd->string = strdup(argv[1]); @@ -48,6 +49,7 @@ int main (int argc, char *argv[]) command_parse_format (graph, cmd); permute (vector_slot (graph->nodes, 0)); + pretty_print_graph (vector_slot (graph->nodes, 0), 0); } void @@ -79,3 +81,33 @@ permute (struct graph_node *start) } list_delete_node (position, listtail(position)); } + +void +pretty_print_graph (struct graph_node *start, int level) +{ + // print this node + struct cmd_token *tok = start->data; + fprintf (stdout, "%s[%d] ", tok->text, tok->type); + + int numto = vector_active (start->to); + if (numto) + { + if (numto > 1) + fprintf (stdout, "\n"); + for (unsigned int i = 0; i < vector_active (start->to); i++) + { + struct graph_node *adj = vector_slot (start->to, i); + // if we're listing multiple children, indent! + if (numto > 1) + for (int j = 0; j < level+1; j++) + fprintf (stdout, " "); + // if this node is a vararg, just print * + if (adj == start) + fprintf (stdout, "*"); + else + pretty_print_graph (adj, numto > 1 ? level+1 : level); + } + } + else + fprintf(stdout, "\n"); +} From faf2a19de0badaba9327ce1cd05c6a586d85a121 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 18:40:37 +0000 Subject: [PATCH 220/280] lib: Improve formatting for matcher tracing output Signed-off-by: Quentin Young --- lib/command_match.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index ac6a6c813a..e25bca2db8 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -192,8 +192,10 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) char *input_token = vector_slot (vline, n); #ifdef TRACE_MATCHER - fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); - switch (match_token (token, input_token)) + fprintf (stdout, "\"%-20s\" matches \"%-30s\" ? ", input_token, token->text); + enum match_type mt = match_token (token, input_token); + fprintf (stdout, "min: %d - ", minmatch); + switch (mt) { case trivial_match: fprintf (stdout, "trivial_match "); @@ -208,7 +210,8 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) fprintf (stdout, "exact_match "); break; } - fprintf (stdout, "(minimum: %d)\n", minmatch); + if (mt >= minmatch) fprintf (stdout, " MATCH"); + fprintf (stdout, "\n"); #endif // if we don't match this node, die From c0f9771dccaed58109b891f1928c896c30748b0d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 18:41:41 +0000 Subject: [PATCH 221/280] lib: Add naive deduplication checks when installing commands Since not all duplicate commands can be caught during graph construction, do a linear search over all commands before installing. Signed-off-by: Quentin Young --- lib/command.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/command.c b/lib/command.c index 96ce661e4a..d1de9ef2aa 100644 --- a/lib/command.c +++ b/lib/command.c @@ -329,6 +329,17 @@ install_element (enum node_type ntype, struct cmd_element *cmd) } // add node to command graph and command vector + // idiotic O(n) deduplication logic, should just use a merkle tree + for (unsigned int i = 0; i < vector_active (cnode->cmd_vector); i++) + { + struct cmd_element *existing = vector_slot (cnode->cmd_vector, i); + if (strmatch (existing->string, cmd->string)) + { + zlog_warn ("Duplicate command: %s\n", cmd->string); + return; + } + } + command_parse_format (cnode->cmdgraph, cmd); vector_set (cnode->cmd_vector, cmd); } From a2454870d6eaf318249babe0f4307ef061b8633f Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 21:44:10 +0000 Subject: [PATCH 222/280] lib: Remove `show commandtree`, add `list permutations` Signed-off-by: Quentin Young --- lib/command.c | 110 +++++++++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/lib/command.c b/lib/command.c index d1de9ef2aa..2f83a7fa5e 100644 --- a/lib/command.c +++ b/lib/command.c @@ -465,14 +465,6 @@ config_write_host (struct vty *vty) return 1; } -/* Utility function for getting command vector. */ -static vector -cmd_node_vector (vector v, enum node_type ntype) -{ - struct cmd_node *cnode = vector_slot (v, ntype); - return cnode->cmd_vector; -} - /* Utility function for getting command graph. */ static struct graph * cmd_node_graph (vector v, enum node_type ntype) @@ -1154,25 +1146,74 @@ argument.%s\ return CMD_SUCCESS; } +static void +permute (struct graph_node *start, struct vty *vty) +{ + static struct list *position = NULL; + if (!position) position = list_new (); + + // recursive dfs + listnode_add (position, start); + for (unsigned int i = 0; i < vector_active (start->to); i++) + { + struct graph_node *gn = vector_slot (start->to, i); + struct cmd_token *tok = gn->data; + if (tok->type == END_TKN || gn == start) + { + struct graph_node *gnn; + struct listnode *ln; + vty_out (vty, " "); + for (ALL_LIST_ELEMENTS_RO (position,ln,gnn)) + { + struct cmd_token *tt = gnn->data; + if (tt->type < SELECTOR_TKN) + vty_out (vty, " %s", tt->text); + } + if (gn == start) + vty_out (vty, "..."); + vty_out (vty, VTY_NEWLINE); + } + else + permute (gn, vty); + } + list_delete_node (position, listtail(position)); +} + /* Help display function for all node. */ DEFUN (config_list, config_list_cmd, - "list", - "Print command list\n") + "list [permutations]", + "Print command list\n" + "Print all possible command permutations\n") { - unsigned int i; - struct cmd_node *cnode = vector_slot (cmdvec, vty->node); - struct cmd_element *cmd; + vty_out (vty, "Current node id: %d%s", vty->node, VTY_NEWLINE); + struct cmd_node *node = vector_slot (cmdvec, vty->node); - for (i = 0; i < vector_active (cnode->cmd_vector); i++) - if ((cmd = vector_slot (cnode->cmd_vector, i)) != NULL - && !(cmd->attr == CMD_ATTR_DEPRECATED - || cmd->attr == CMD_ATTR_HIDDEN)) - vty_out (vty, " %s%s", cmd->string, - VTY_NEWLINE); + if ((strmatch (argv[0]->text, "list") && argc == 2) || + (strmatch (argv[0]->text, "show") && argc == 3)) + permute (vector_slot (node->cmdgraph->nodes, 0), vty); + else + { + /* loop over all commands at this node */ + struct cmd_element *element = NULL; + for (unsigned int i = 0; i < vector_active(node->cmd_vector); i++) + if ((element = vector_slot (node->cmd_vector, i)) && + element->attr != CMD_ATTR_DEPRECATED && + element->attr != CMD_ATTR_HIDDEN) + vty_out (vty, " %s%s", element->string, VTY_NEWLINE); + } return CMD_SUCCESS; } +DEFUN (show_commandtree, + show_commandtree_cmd, + "show commandtree [permutations]", + SHOW_STR + "Show command tree\n") +{ + return config_list (self, vty, argc, argv); +} + /* Write current configuration into file. */ DEFUN (config_write, @@ -2128,37 +2169,6 @@ DEFUN (no_banner_motd, return CMD_SUCCESS; } -DEFUN (show_commandtree, - show_commandtree_cmd, - "show commandtree", - NO_STR - "Show command tree\n") -{ - /* TBD */ - vector cmd_vector; - unsigned int i; - - vty_out (vty, "Current node id: %d%s", vty->node, VTY_NEWLINE); - - /* vector of all commands installed at this node */ - cmd_vector = vector_copy (cmd_node_vector (cmdvec, vty->node)); - - /* loop over all commands at this node */ - for (i = 0; i < vector_active(cmd_vector); ++i) - { - struct cmd_element *cmd_element; - - /* A cmd_element (seems to be) is an individual command */ - if ((cmd_element = vector_slot (cmd_vector, i)) == NULL) - continue; - - vty_out (vty, " %s%s", cmd_element->string, VTY_NEWLINE); - } - - vector_free (cmd_vector); - return CMD_SUCCESS; -} - /* Set config filename. Called from vty.c */ void host_config_set (const char *filename) From 2de8b19c5a0c7c7cce1ec23a34f830fa101b6833 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 12 Oct 2016 01:44:50 +0000 Subject: [PATCH 223/280] vtysh: Update extract.pl.in CLI stomps updated. Need to be eliminated. Signed-off-by: Quentin Young --- vtysh/extract.pl.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index bcebe2cc4e..f9ed832f98 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -46,13 +46,13 @@ $ignore{'"router ospf (1-65535)"'} = "ignore"; $ignore{'"router ospf6"'} = "ignore"; $ignore{'"router bgp"'} = "ignore"; $ignore{'"router bgp " "(1-4294967295)"'} = "ignore"; -$ignore{'"router bgp " "(1-4294967295)" " (view|vrf) WORD"'} = "ignore"; +$ignore{'"router bgp " "(1-4294967295)" " WORD"'} = "ignore"; $ignore{'"router isis WORD"'} = "ignore"; $ignore{'"router zebra"'} = "ignore"; $ignore{'"address-family ipv4"'} = "ignore"; -$ignore{'"address-family ipv4 (unicast|multicast)"'} = "ignore"; +$ignore{'"address-family ipv4 "'} = "ignore"; $ignore{'"address-family ipv6"'} = "ignore"; -$ignore{'"address-family ipv6 (unicast|multicast)"'} = "ignore"; +$ignore{'"address-family ipv6 "'} = "ignore"; $ignore{'"address-family vpnv4"'} = "ignore"; $ignore{'"address-family vpnv4 unicast"'} = "ignore"; $ignore{'"address-family ipv4 vrf NAME"'} = "ignore"; @@ -64,7 +64,7 @@ $ignore{'"address-family vpnv6 unicast"'} = "ignore"; $ignore{'"exit-address-family"'} = "ignore"; $ignore{'"key chain WORD"'} = "ignore"; $ignore{'"key (0-2147483647)"'} = "ignore"; -$ignore{'"route-map WORD (deny|permit) (1-65535)"'} = "ignore"; +$ignore{'"route-map WORD (1-65535)"'} = "ignore"; $ignore{'"show route-map"'} = "ignore"; $ignore{'"line vty"'} = "ignore"; $ignore{'"who"'} = "ignore"; From d2aaa2e556001b5a5f36b3065e46c0301e870879 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 12 Oct 2016 04:21:18 +0000 Subject: [PATCH 224/280] vtysh: Add missing stomps Signed-off-by: Quentin Young --- vtysh/extract.pl.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index f9ed832f98..2b0f50cb2f 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -47,6 +47,7 @@ $ignore{'"router ospf6"'} = "ignore"; $ignore{'"router bgp"'} = "ignore"; $ignore{'"router bgp " "(1-4294967295)"'} = "ignore"; $ignore{'"router bgp " "(1-4294967295)" " WORD"'} = "ignore"; +$ignore{'"router bgp [(1-4294967295) [ WORD]]"'} = "ignore"; $ignore{'"router isis WORD"'} = "ignore"; $ignore{'"router zebra"'} = "ignore"; $ignore{'"address-family ipv4"'} = "ignore"; @@ -71,6 +72,7 @@ $ignore{'"who"'} = "ignore"; $ignore{'"terminal monitor"'} = "ignore"; $ignore{'"terminal no monitor"'} = "ignore"; $ignore{'"show history"'} = "ignore"; +$ignore{'"router ospf [(1-65535)]"'} = "ignore"; my $cli_stomp = 0; From b2d4d0393a51a90c3a4c2aca47d4777dfed42fbd Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 12 Oct 2016 21:20:15 -0300 Subject: [PATCH 225/280] *: rename all instances of OSPFv6 to OSPF6 or OSPFv3 Signed-off-by: Renato Westphal --- lib/route_types.txt | 2 +- ospf6d/ospf6_area.c | 32 ++++++++++++++++---------------- ospf6d/ospf6_interface.c | 2 +- ospf6d/ospf6_top.c | 2 +- ospfd/ospf_te.h | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/route_types.txt b/lib/route_types.txt index 8fc3092cac..42f3b8f324 100644 --- a/lib/route_types.txt +++ b/lib/route_types.txt @@ -48,7 +48,7 @@ ZEBRA_ROUTE_STATIC, static, zebra, 'S', 1, 1, "static" ZEBRA_ROUTE_RIP, rip, ripd, 'R', 1, 0, "RIP" ZEBRA_ROUTE_RIPNG, ripng, ripngd, 'R', 0, 1, "RIPng" ZEBRA_ROUTE_OSPF, ospf, ospfd, 'O', 1, 0, "OSPF" -ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, "OSPFv6" +ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, "OSPFv3" ZEBRA_ROUTE_ISIS, isis, isisd, 'I', 1, 1, "IS-IS" ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, "BGP" ZEBRA_ROUTE_PIM, pim, pimd, 'P', 1, 0, "PIM" diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 45e7f720f3..1bb0458b30 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -617,10 +617,10 @@ ospf6_area_config_write (struct vty *vty) DEFUN (area_filter_list, area_filter_list_cmd, "area A.B.C.D filter-list prefix WORD ", - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" - "Filter networks between OSPFv6 areas\n" - "Filter prefixes between OSPFv6 areas\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" + "Filter networks between OSPF6 areas\n" + "Filter prefixes between OSPF6 areas\n" "Name of an IPv6 prefix-list\n" "Filter networks sent to this area\n" "Filter networks sent from this area\n") @@ -659,10 +659,10 @@ DEFUN (no_area_filter_list, no_area_filter_list_cmd, "no area A.B.C.D filter-list prefix WORD ", NO_STR - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" - "Filter networks between OSPFv6 areas\n" - "Filter prefixes between OSPFv6 areas\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" + "Filter networks between OSPF6 areas\n" + "Filter prefixes between OSPF6 areas\n" "Name of an IPv6 prefix-list\n" "Filter networks sent to this area\n" "Filter networks sent from this area\n") @@ -706,8 +706,8 @@ DEFUN (no_area_filter_list, DEFUN (area_import_list, area_import_list_cmd, "area A.B.C.D import-list NAME", - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" "Set the filter for networks from other areas announced to the specified one\n" "Name of the acess-list\n") { @@ -734,8 +734,8 @@ DEFUN (area_import_list, DEFUN (no_area_import_list, no_area_import_list_cmd, "no area A.B.C.D import-list NAME", - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" "Unset the filter for networks announced to other areas\n" "NAme of the access-list\n") { @@ -758,8 +758,8 @@ DEFUN (no_area_import_list, DEFUN (area_export_list, area_export_list_cmd, "area A.B.C.D export-list NAME", - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" "Set the filter for networks announced to other areas\n" "Name of the acess-list\n") { @@ -786,8 +786,8 @@ DEFUN (area_export_list, DEFUN (no_area_export_list, no_area_export_list_cmd, "no area A.B.C.D export-list NAME", - "OSPFv6 area parameters\n" - "OSPFv6 area ID in IP address format\n" + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" "Unset the filter for networks announced to other areas\n" "Name of the access-list\n") { diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 3d65afc035..17c701f10f 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1685,7 +1685,7 @@ DEFUN (ipv6_ospf6_network, IP6_STR OSPF6_STR "Network Type\n" - "Specify OSPFv6 broadcast network\n" + "Specify OSPF6 broadcast network\n" "Specify OSPF6 point-to-point network\n" ) { diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index ccffa131a6..48b6cb949a 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -864,7 +864,7 @@ config_write_ospf6 (struct vty *vty) struct ospf6_area *oa; struct ospf6_interface *oi; - /* OSPFv6 configuration. */ + /* OSPFv3 configuration. */ if (ospf6 == NULL) return CMD_SUCCESS; diff --git a/ospfd/ospf_te.h b/ospfd/ospf_te.h index 8bb77c40c5..36f2d8241c 100644 --- a/ospfd/ospf_te.h +++ b/ospfd/ospf_te.h @@ -253,7 +253,7 @@ struct te_link_subtlv_llri /* Inter-RA Export Upward sub-TLV (12) and Inter-RA Export Downward sub-TLV (13) (RFC6827bis) are not yet supported */ /* SUBTLV 14-16 (RFC4203) are not yet supported */ /* Bandwidth Constraints sub-TLV (17) (RFC4124) is not yet supported */ -/* SUBLV 18-20 are for OSPFv6 TE (RFC5329). see ospf6d */ +/* SUBLV 18-20 are for OSPFv3 TE (RFC5329). see ospf6d */ /* For RFC 5392 */ /* Remote AS Number sub-TLV */ From 6fbde29dafeaf7c6aab9789d3eaf0234e99eefb6 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 12 Oct 2016 21:20:16 -0300 Subject: [PATCH 226/280] ospf6d: fix a few vty help strings Signed-off-by: Renato Westphal --- ospf6d/ospf6_area.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 1bb0458b30..3449ec3ff7 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -436,8 +436,9 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) DEFUN (area_range, area_range_cmd, "area range X:X::X:X/M []", - "OSPF area parameters\n" - OSPF6_AREA_ID_STR + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" + "OSPF6 area ID as a decimal value\n" "Configured address range\n" "Specify IPv6 prefix\n" "Advertise\n" @@ -513,7 +514,7 @@ DEFUN (no_area_range, no_area_range_cmd, "no area A.B.C.D range X:X::X:X/M [] [cost (0-16777215)]", NO_STR - "OSPF area parameters\n" + "OSPF6 area parameters\n" OSPF6_AREA_ID_STR "Configured address range\n" "Specify IPv6 prefix\n") @@ -734,10 +735,11 @@ DEFUN (area_import_list, DEFUN (no_area_import_list, no_area_import_list_cmd, "no area A.B.C.D import-list NAME", + NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" "Unset the filter for networks announced to other areas\n" - "NAme of the access-list\n") + "Name of the access-list\n") { int idx_ipv4 = 2; struct ospf6_area *area; @@ -786,6 +788,7 @@ DEFUN (area_export_list, DEFUN (no_area_export_list, no_area_export_list_cmd, "no area A.B.C.D export-list NAME", + NO_STR "OSPF6 area parameters\n" "OSPF6 area ID in IP address format\n" "Unset the filter for networks announced to other areas\n" From e0a467872b307021477ea7b4ba27ffc5d20aedd0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 20 Oct 2016 19:17:36 +0000 Subject: [PATCH 227/280] lib: Allow '_' in arguments to VARIABLE_TKN Signed-off-by: Quentin Young --- command_lex.c | 1854 +++++++++++++++++++++++++++++++++++++++++++ lib/command_lex.l | 2 +- lib/command_match.c | 2 +- 3 files changed, 1856 insertions(+), 2 deletions(-) create mode 100644 command_lex.c diff --git a/command_lex.c b/command_lex.c new file mode 100644 index 0000000000..4ddee50bbb --- /dev/null +++ b/command_lex.c @@ -0,0 +1,1854 @@ +#line 2 "command_lex.c" + +#line 4 "command_lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap() 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 10 +#define YY_END_OF_BUFFER 11 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[81] = + { 0, + 0, 0, 11, 9, 10, 1, 9, 2, 9, 9, + 9, 9, 1, 0, 0, 2, 2, 7, 0, 7, + 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 0, 7, 0, 0, 0, 7, + 0, 0, 3, 7, 0, 0, 0, 5, 0, 0, + 4, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, + 5, 6, 7, 1, 8, 9, 10, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 12, 1, 1, + 1, 1, 1, 1, 13, 14, 15, 16, 17, 17, + 17, 17, 17, 17, 17, 17, 18, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 19, 17, 17, + 1, 1, 1, 1, 20, 1, 21, 21, 21, 21, + + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, + 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[23] = + { 0, + 1, 1, 1, 1, 1, 2, 2, 3, 4, 1, + 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3 + } ; + +static yyconst flex_int16_t yy_base[83] = + { 0, + 0, 0, 168, 169, 169, 169, 16, 0, 19, 158, + 152, 17, 0, 149, 25, 0, 0, 149, 143, 23, + 139, 40, 27, 127, 22, 38, 114, 39, 49, 99, + 44, 169, 50, 51, 94, 49, 58, 62, 76, 55, + 61, 68, 70, 65, 70, 74, 60, 77, 78, 85, + 169, 21, 86, 87, 169, 89, 96, 97, 98, 100, + 107, 108, 109, 111, 118, 119, 120, 122, 129, 130, + 131, 133, 140, 141, 142, 144, 151, 151, 32, 169, + 161, 162 + } ; + +static yyconst flex_int16_t yy_def[83] = + { 0, + 80, 1, 80, 80, 80, 80, 80, 81, 80, 82, + 82, 82, 81, 80, 80, 81, 81, 82, 80, 82, + 80, 80, 80, 80, 82, 80, 80, 80, 80, 80, + 82, 80, 80, 80, 80, 82, 80, 80, 80, 82, + 80, 80, 80, 82, 80, 80, 80, 82, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, + 80, 80 + } ; + +static yyconst flex_int16_t yy_nxt[192] = + { 0, + 4, 5, 6, 7, 4, 8, 9, 9, 4, 6, + 4, 4, 10, 11, 11, 11, 11, 11, 12, 4, + 8, 13, 14, 14, 17, 80, 15, 21, 20, 21, + 80, 80, 22, 31, 22, 23, 32, 29, 55, 17, + 17, 25, 26, 32, 27, 27, 27, 27, 28, 33, + 28, 21, 80, 21, 32, 36, 22, 80, 22, 34, + 37, 38, 32, 80, 21, 32, 44, 40, 41, 22, + 21, 45, 42, 80, 32, 22, 21, 51, 46, 47, + 49, 22, 32, 48, 50, 80, 52, 21, 53, 21, + 32, 43, 22, 32, 22, 54, 56, 57, 21, 58, + + 21, 32, 39, 22, 32, 22, 59, 60, 61, 21, + 62, 21, 32, 35, 22, 32, 22, 63, 64, 65, + 21, 66, 21, 32, 28, 22, 32, 22, 67, 68, + 69, 21, 70, 21, 32, 30, 22, 32, 22, 71, + 72, 73, 21, 74, 21, 32, 22, 22, 32, 22, + 75, 76, 77, 21, 78, 32, 24, 80, 22, 15, + 80, 79, 16, 16, 18, 18, 19, 80, 3, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80 + + } ; + +static yyconst flex_int16_t yy_chk[192] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 7, 7, 9, 12, 7, 15, 12, 23, + 25, 20, 15, 25, 23, 15, 79, 23, 52, 9, + 9, 20, 22, 28, 26, 26, 22, 22, 26, 28, + 22, 29, 31, 34, 33, 31, 29, 36, 34, 29, + 33, 34, 37, 40, 38, 41, 40, 36, 37, 38, + 42, 41, 38, 44, 45, 42, 46, 47, 42, 43, + 45, 46, 49, 44, 46, 48, 48, 50, 49, 54, + 53, 39, 50, 56, 54, 50, 53, 54, 57, 56, + + 59, 58, 35, 57, 60, 59, 57, 58, 59, 61, + 60, 63, 62, 30, 61, 64, 63, 61, 62, 63, + 65, 64, 67, 66, 27, 65, 68, 67, 65, 66, + 67, 69, 68, 71, 70, 24, 69, 72, 71, 69, + 70, 71, 73, 72, 75, 74, 21, 73, 76, 75, + 73, 74, 75, 77, 76, 78, 19, 18, 77, 14, + 11, 78, 81, 81, 82, 82, 10, 3, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "lib/command_lex.l" +/* + * Command format string lexer for CLI backend. + * + * -- + * Copyright (C) 2015 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +#line 26 "lib/command_lex.l" +#include "command_parse.h" + +extern void set_lexer_string (const char *); +extern void cleanup_lexer (void); +YY_BUFFER_STATE buffer; +/* yytext shall be a pointer */ +#define YY_NO_INPUT 1 +#line 561 "command_lex.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +yy_size_t yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 49 "lib/command_lex.l" + +#line 775 "command_lex.c" + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 169 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 50 "lib/command_lex.l" +/* ignore whitespace */; + YY_BREAK +case 2: +YY_RULE_SETUP +#line 51 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return WORD;} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 52 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4;} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 53 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4_PREFIX;} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 54 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 55 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 56 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 57 "lib/command_lex.l" +{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 58 "lib/command_lex.l" +{return yytext[0];} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 59 "lib/command_lex.l" +ECHO; + YY_BREAK +#line 882 "command_lex.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 80); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +yy_size_t yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 58 "lib/command_lex.l" + + + +void +set_lexer_string (const char *string) +{ + buffer = yy_scan_string (string); +} + +void +cleanup_lexer () +{ + yy_delete_buffer (buffer); +} + diff --git a/lib/command_lex.l b/lib/command_lex.l index 5c709dce22..b9b6582788 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -30,7 +30,7 @@ extern void cleanup_lexer (void); YY_BUFFER_STATE buffer; %} -WORD (\-|\+)?[a-z\*][-+_a-zA-Z0-9\*]* +WORD (\-|\+)?[a-z\*][-+a-zA-Z0-9\*_]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X diff --git a/lib/command_match.c b/lib/command_match.c index e25bca2db8..42788ecb01 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -838,7 +838,7 @@ match_word (struct cmd_token *token, const char *word) } #define VARIABLE_ALPHABET \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/." +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/._" static enum match_type match_variable (struct cmd_token *token, const char *word) From 8c9474817e73383bcf88ea700c9d83819660623d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 20 Oct 2016 19:21:37 +0000 Subject: [PATCH 228/280] Revert "lib: Allow '_' in arguments to VARIABLE_TKN" This reverts commit e0a467872b307021477ea7b4ba27ffc5d20aedd0. --- command_lex.c | 1854 ------------------------------------------- lib/command_lex.l | 2 +- lib/command_match.c | 2 +- 3 files changed, 2 insertions(+), 1856 deletions(-) delete mode 100644 command_lex.c diff --git a/command_lex.c b/command_lex.c deleted file mode 100644 index 4ddee50bbb..0000000000 --- a/command_lex.c +++ /dev/null @@ -1,1854 +0,0 @@ -#line 2 "command_lex.c" - -#line 4 "command_lex.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define yywrap() 1 -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 10 -#define YY_END_OF_BUFFER 11 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[81] = - { 0, - 0, 0, 11, 9, 10, 1, 9, 2, 9, 9, - 9, 9, 1, 0, 0, 2, 2, 7, 0, 7, - 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, - 7, 8, 0, 0, 0, 7, 0, 0, 0, 7, - 0, 0, 3, 7, 0, 0, 0, 5, 0, 0, - 4, 0, 0, 0, 6, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, - 5, 6, 7, 1, 8, 9, 10, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 12, 1, 1, - 1, 1, 1, 1, 13, 14, 15, 16, 17, 17, - 17, 17, 17, 17, 17, 17, 18, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 19, 17, 17, - 1, 1, 1, 1, 20, 1, 21, 21, 21, 21, - - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, - 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[23] = - { 0, - 1, 1, 1, 1, 1, 2, 2, 3, 4, 1, - 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3 - } ; - -static yyconst flex_int16_t yy_base[83] = - { 0, - 0, 0, 168, 169, 169, 169, 16, 0, 19, 158, - 152, 17, 0, 149, 25, 0, 0, 149, 143, 23, - 139, 40, 27, 127, 22, 38, 114, 39, 49, 99, - 44, 169, 50, 51, 94, 49, 58, 62, 76, 55, - 61, 68, 70, 65, 70, 74, 60, 77, 78, 85, - 169, 21, 86, 87, 169, 89, 96, 97, 98, 100, - 107, 108, 109, 111, 118, 119, 120, 122, 129, 130, - 131, 133, 140, 141, 142, 144, 151, 151, 32, 169, - 161, 162 - } ; - -static yyconst flex_int16_t yy_def[83] = - { 0, - 80, 1, 80, 80, 80, 80, 80, 81, 80, 82, - 82, 82, 81, 80, 80, 81, 81, 82, 80, 82, - 80, 80, 80, 80, 82, 80, 80, 80, 80, 80, - 82, 80, 80, 80, 80, 82, 80, 80, 80, 82, - 80, 80, 80, 82, 80, 80, 80, 82, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, - 80, 80 - } ; - -static yyconst flex_int16_t yy_nxt[192] = - { 0, - 4, 5, 6, 7, 4, 8, 9, 9, 4, 6, - 4, 4, 10, 11, 11, 11, 11, 11, 12, 4, - 8, 13, 14, 14, 17, 80, 15, 21, 20, 21, - 80, 80, 22, 31, 22, 23, 32, 29, 55, 17, - 17, 25, 26, 32, 27, 27, 27, 27, 28, 33, - 28, 21, 80, 21, 32, 36, 22, 80, 22, 34, - 37, 38, 32, 80, 21, 32, 44, 40, 41, 22, - 21, 45, 42, 80, 32, 22, 21, 51, 46, 47, - 49, 22, 32, 48, 50, 80, 52, 21, 53, 21, - 32, 43, 22, 32, 22, 54, 56, 57, 21, 58, - - 21, 32, 39, 22, 32, 22, 59, 60, 61, 21, - 62, 21, 32, 35, 22, 32, 22, 63, 64, 65, - 21, 66, 21, 32, 28, 22, 32, 22, 67, 68, - 69, 21, 70, 21, 32, 30, 22, 32, 22, 71, - 72, 73, 21, 74, 21, 32, 22, 22, 32, 22, - 75, 76, 77, 21, 78, 32, 24, 80, 22, 15, - 80, 79, 16, 16, 18, 18, 19, 80, 3, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - - } ; - -static yyconst flex_int16_t yy_chk[192] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 7, 7, 9, 12, 7, 15, 12, 23, - 25, 20, 15, 25, 23, 15, 79, 23, 52, 9, - 9, 20, 22, 28, 26, 26, 22, 22, 26, 28, - 22, 29, 31, 34, 33, 31, 29, 36, 34, 29, - 33, 34, 37, 40, 38, 41, 40, 36, 37, 38, - 42, 41, 38, 44, 45, 42, 46, 47, 42, 43, - 45, 46, 49, 44, 46, 48, 48, 50, 49, 54, - 53, 39, 50, 56, 54, 50, 53, 54, 57, 56, - - 59, 58, 35, 57, 60, 59, 57, 58, 59, 61, - 60, 63, 62, 30, 61, 64, 63, 61, 62, 63, - 65, 64, 67, 66, 27, 65, 68, 67, 65, 66, - 67, 69, 68, 71, 70, 24, 69, 72, 71, 69, - 70, 71, 73, 72, 75, 74, 21, 73, 76, 75, - 73, 74, 75, 77, 76, 78, 19, 18, 77, 14, - 11, 78, 81, 81, 82, 82, 10, 3, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80 - - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "lib/command_lex.l" -/* - * Command format string lexer for CLI backend. - * - * -- - * Copyright (C) 2015 Cumulus Networks, Inc. - * - * This file is part of GNU Zebra. - * - * GNU Zebra is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * GNU Zebra is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ -#line 26 "lib/command_lex.l" -#include "command_parse.h" - -extern void set_lexer_string (const char *); -extern void cleanup_lexer (void); -YY_BUFFER_STATE buffer; -/* yytext shall be a pointer */ -#define YY_NO_INPUT 1 -#line 561 "command_lex.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { -#line 49 "lib/command_lex.l" - -#line 775 "command_lex.c" - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 169 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 50 "lib/command_lex.l" -/* ignore whitespace */; - YY_BREAK -case 2: -YY_RULE_SETUP -#line 51 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return WORD;} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 52 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4;} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 53 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4_PREFIX;} - YY_BREAK -case 5: -YY_RULE_SETUP -#line 54 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;} - YY_BREAK -case 6: -YY_RULE_SETUP -#line 55 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;} - YY_BREAK -case 7: -YY_RULE_SETUP -#line 56 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;} - YY_BREAK -case 8: -YY_RULE_SETUP -#line 57 "lib/command_lex.l" -{yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;} - YY_BREAK -case 9: -YY_RULE_SETUP -#line 58 "lib/command_lex.l" -{return yytext[0];} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 59 "lib/command_lex.l" -ECHO; - YY_BREAK -#line 882 "command_lex.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 80); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 58 "lib/command_lex.l" - - - -void -set_lexer_string (const char *string) -{ - buffer = yy_scan_string (string); -} - -void -cleanup_lexer () -{ - yy_delete_buffer (buffer); -} - diff --git a/lib/command_lex.l b/lib/command_lex.l index b9b6582788..5c709dce22 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -30,7 +30,7 @@ extern void cleanup_lexer (void); YY_BUFFER_STATE buffer; %} -WORD (\-|\+)?[a-z\*][-+a-zA-Z0-9\*_]* +WORD (\-|\+)?[a-z\*][-+_a-zA-Z0-9\*]* IPV4 A\.B\.C\.D IPV4_PREFIX A\.B\.C\.D\/M IPV6 X:X::X:X diff --git a/lib/command_match.c b/lib/command_match.c index 42788ecb01..e25bca2db8 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -838,7 +838,7 @@ match_word (struct cmd_token *token, const char *word) } #define VARIABLE_ALPHABET \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/._" +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/." static enum match_type match_variable (struct cmd_token *token, const char *word) From e8d5696d45a0f713b080f8b06f462febb5d38057 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 20 Oct 2016 19:24:36 +0000 Subject: [PATCH 229/280] lib: Allow '_' in arguments to VARIABLE_TKN second attempt Signed-off-by: Quentin Young --- lib/command_match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_match.c b/lib/command_match.c index e25bca2db8..42788ecb01 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -838,7 +838,7 @@ match_word (struct cmd_token *token, const char *word) } #define VARIABLE_ALPHABET \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/." +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/._" static enum match_type match_variable (struct cmd_token *token, const char *word) From ae19d7dd48477ea14dcadb94f07374a5fb2b5fda Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 20 Oct 2016 20:31:24 +0000 Subject: [PATCH 230/280] lib: Add helper function for working with argv, update bgpd to use it Signed-off-by: Quentin Young --- bgpd/bgp_route.c | 261 +++++++++++++++++++++++++++++------------------ bgpd/bgp_vty.c | 199 ++++++++++++++++++++++-------------- lib/command.c | 20 ++++ lib/command.h | 1 + 4 files changed, 304 insertions(+), 177 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6362b48b54..b03b296ea8 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8015,7 +8015,20 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [] [|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", + "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>]\ + [<\ + cidr-only\ + |community\ + |dampening \ + |route-map WORD\ + |prefix-list WORD\ + |filter-list WORD\ + |community [exact-match]\ + |community-list <(1-500)|WORD> [exact-match]\ + |A.B.C.D/M longer-prefixes\ + |X:X::X:X/M longer-prefixes\ + >]\ + [json]", SHOW_STR IP_STR BGP_STR @@ -8056,92 +8069,108 @@ DEFUN (show_ip_bgp_ipv4, "Display route and more specific routes\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - int idx_sh_type; - int exact_match = 0; char *vrf = NULL; - afi_t afi; - safi_t safi; + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; + int exact_match; enum bgp_show_type sh_type = bgp_show_type_normal; - struct bgp *bgp; - u_char uj = use_json(argc, argv); - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_sh_type); + int idx = 0; - bgp = bgp_lookup_by_name (vrf); + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + + int uj = use_json (argc, argv); + if (uj) argc--; + + struct bgp *bgp = bgp_lookup_by_name (vrf); if (bgp == NULL) { vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE); return CMD_WARNING; } - if (strmatch(argv[idx_sh_type]->text, "cidr-only")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); + if (++idx < argc) + { + if (strmatch(argv[idx]->text, "cidr-only")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); - else if (strmatch(argv[idx_sh_type]->text, "dampening")) - { - if (strmatch(argv[idx_sh_type + 1]->text, "dampened-paths")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); - - else if (strmatch(argv[idx_sh_type + 1]->text, "flap-statistics")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); - } - - else if (strmatch(argv[idx_sh_type]->text, "dampened-paths")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); - - else if (strmatch(argv[idx_sh_type]->text, "flap-statistics")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); - - else if (strmatch(argv[idx_sh_type]->text, "regexp")) - return bgp_show_regexp (vty, argc, argv, afi, safi, bgp_show_type_regexp); - - else if (strmatch(argv[idx_sh_type]->text, "prefix-list")) - return bgp_show_prefix_list (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_prefix_list); - - else if (strmatch(argv[idx_sh_type]->text, "filter-list")) - return bgp_show_filter_list (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_filter_list); - - else if (strmatch(argv[idx_sh_type]->text, "route-map")) - return bgp_show_route_map (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_route_map); - - else if (strmatch(argv[idx_sh_type]->text, "community")) - /* show a specific community */ - if (argv[idx_sh_type + 1]->type == VARIABLE_TKN || - strmatch(argv[idx_sh_type + 1]->text, "local-AS") || - strmatch(argv[idx_sh_type + 1]->text, "no-advertise") || - strmatch(argv[idx_sh_type + 1]->text, "no-export")) + else if (strmatch(argv[idx]->text, "dampening")) { - if (strmatch(argv[idx_sh_type + 2]->text, "exact_match")) - exact_match = 1; - return bgp_show_community (vty, vrf, argc, argv, exact_match, afi, safi); + if (strmatch(argv[idx + 1]->text, "dampened-paths")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); + + else if (strmatch(argv[idx + 1]->text, "flap-statistics")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); } - /* show all communities */ - else - return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, uj); - else if (strmatch(argv[idx_sh_type]->text, "community-list")) + else if (strmatch(argv[idx]->text, "dampened-paths")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); + + else if (strmatch(argv[idx]->text, "flap-statistics")) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); + + else if (strmatch(argv[idx]->text, "regexp")) + return bgp_show_regexp (vty, argc, argv, afi, safi, bgp_show_type_regexp); + + else if (strmatch(argv[idx]->text, "prefix-list")) + return bgp_show_prefix_list (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_list); + + else if (strmatch(argv[idx]->text, "filter-list")) + return bgp_show_filter_list (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_filter_list); + + else if (strmatch(argv[idx]->text, "route-map")) + return bgp_show_route_map (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_route_map); + + else if (strmatch(argv[idx]->text, "community")) { - if (strmatch(argv[idx_sh_type + 2]->text, "exact_match")) - exact_match = 1; - return bgp_show_community_list (vty, vrf, argv[idx_sh_type + 1]->arg, exact_match, afi, safi); + /* show a specific community */ + if (argv[idx + 1]->type == VARIABLE_TKN || + strmatch(argv[idx + 1]->text, "local-AS") || + strmatch(argv[idx + 1]->text, "no-advertise") || + strmatch(argv[idx + 1]->text, "no-export")) + { + if (strmatch(argv[idx + 2]->text, "exact_match")) + exact_match = 1; + return bgp_show_community (vty, vrf, argc, argv, exact_match, afi, safi); + } + /* show all communities */ + else + return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, uj); } - - /* prefix-longer */ - else if (argv[idx_sh_type]->type == IPV4_TKN || argv[idx_sh_type]->type == IPV6_TKN) - return bgp_show_prefix_longer (vty, vrf, argv[idx_sh_type + 1]->arg, afi, safi, bgp_show_type_prefix_longer); + else if (strmatch(argv[idx]->text, "community-list")) + { + if (strmatch(argv[idx + 2]->text, "exact_match")) + exact_match = 1; + return bgp_show_community_list (vty, vrf, argv[idx + 1]->arg, exact_match, afi, safi); + } + /* prefix-longer */ + else if (argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV6_TKN) + return bgp_show_prefix_longer (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_longer); + } return bgp_show (vty, bgp, afi, safi, sh_type, NULL, uj); } DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [] [] [json]", + "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>]" + " [] [json]", SHOW_STR IP_STR BGP_STR @@ -8165,68 +8194,102 @@ DEFUN (show_ip_bgp_route, "Display only multipaths\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - int idx_prefix; - int idx_path_type; int prefix_check = 0; + + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; char *vrf = NULL; - afi_t afi; - safi_t safi; + char *prefix = NULL; + enum bgp_path_type path_type; - struct prefix_rd prd; - struct prefix_rd *prd_ptr = NULL; u_char uj = use_json(argc, argv); - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_prefix); + int idx = 0; - if (strmatch(argv[idx_afi]->text, "encap") && strmatch(argv[idx_safi + 1]->text, "rd")) - { - str2prefix_rd (argv[idx_safi + 2]->arg, &prd); - prd_ptr = &prd; - } + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } - if (argv[idx_prefix]->type == IPV4_TKN || argv[idx_prefix]->type == IPV6_TKN) + /* */ + if (argv_find (argv, argc, "A.B.C.D", &idx) || argv_find (argv, argc, "X:X::X:X", &idx)) prefix_check = 0; - else if (argv[idx_prefix]->type == IPV4_PREFIX_TKN || argv[idx_prefix]->type == IPV6_PREFIX_TKN) + else if (argv_find (argv, argc, "A.B.C.D/M", &idx) || argv_find (argv, argc, "X:X::X:X/M", &idx)) prefix_check = 1; - idx_path_type = idx_prefix + 1; + if ((argv[idx]->type == IPV6_TKN || argv[idx]->type == IPV6_PREFIX_TKN) && afi != AFI_IP6) + { + vty_out (vty, "%% Cannot specify IPv6 address or prefix with IPv4 AFI%s", VTY_NEWLINE); + return CMD_WARNING; + } + if ((argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV4_PREFIX_TKN) && afi != AFI_IP) + { + vty_out (vty, "%% Cannot specify IPv4 address or prefix with IPv6 AFI%s", VTY_NEWLINE); + return CMD_WARNING; + } - if (strmatch(argv[idx_path_type]->text, "bestpath")) + prefix = argv[idx]->arg; + + /* [] */ + if (argv_find (argv, argc, "bestpath", &idx)) path_type = BGP_PATH_BESTPATH; - else if (strmatch(argv[idx_path_type]->text, "bestpath")) + else if (argv_find (argv, argc, "multipath", &idx)) path_type = BGP_PATH_MULTIPATH; else path_type = BGP_PATH_ALL; - return bgp_show_route (vty, vrf, argv[idx_prefix]->arg, afi, safi, prd_ptr, prefix_check, path_type, uj); + return bgp_show_route (vty, vrf, prefix, afi, safi, NULL, prefix_check, path_type, uj); } DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, - "show [ip] bgp all [] [json]", + "show [ip] bgp all []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - afi_t afi; - safi_t safi; + afi_t afi = AFI_IP; + safi_t safi = SAFI_UNICAST; + + int idx = 0; + + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } u_char uj = use_json(argc, argv); - bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, NULL); bgp_show_all_instances_routes_vty (vty, afi, safi, uj); return CMD_SUCCESS; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0f8d0c76dd..cd61252a0c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5969,7 +5969,7 @@ bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [] []|in [prefix-filter]|out>]", + "clear [ip] bgp [ WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -6002,63 +6002,57 @@ DEFUN (clear_ip_bgp_all, BGP_SOFT_IN_STR BGP_SOFT_OUT_STR) { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_clr_sort = 5; - int idx_soft_in_out; - int idx_afi; - int idx_safi; char *vrf = NULL; - afi_t afi; - safi_t safi; + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; enum clear_sort clr_sort = clear_peer; enum bgp_clear_type clr_type; char *clr_arg = NULL; - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_clr_sort); + int idx = 0; - /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external> */ - if (strmatch(argv[idx_clr_sort]->text, "*")) + /* clear [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + { + vrf = argv[idx + 1]->arg; + idx += 2; + } + /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */ + if (argv_find (argv, argc, "*", &idx)) { clr_sort = clear_all; } - else if (argv[idx_clr_sort]->type == IPV4_TKN) + else if (argv_find (argv, argc, "A.B.C.D", &idx)) { clr_sort = clear_peer; - clr_arg = argv[idx_clr_sort]->arg; + clr_arg = argv[idx]->arg; } - else if (argv[idx_clr_sort]->type == IPV6_TKN) + else if (argv_find (argv, argc, "X:X::X:X", &idx)) { clr_sort = clear_peer; - clr_arg = argv[idx_clr_sort]->arg; + clr_arg = argv[idx]->arg; } - else if (argv[idx_clr_sort]->type == RANGE_TKN) - { - clr_sort = clear_as; - clr_arg = argv[idx_clr_sort]->arg; - } - else if (strmatch(argv[idx_clr_sort]->text, "external")) - { - clr_sort = clear_external; - } - else if (strmatch(argv[idx_clr_sort]->text, "peer-group")) + else if (argv_find (argv, argc, "peer-group", &idx)) { clr_sort = clear_group; - idx_clr_sort++; - clr_arg = argv[idx_clr_sort]->arg; + idx++; + clr_arg = argv[idx]->arg; if (! peer_group_lookup (vty->index, clr_arg)) { vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE); - return CMD_WARNING; + return CMD_WARNING; } } - else if (argv[idx_clr_sort]->type == WORD_TKN) + else if (argv_find (argv, argc, "WORD", &idx)) { - if (peer_lookup_by_conf_if (vty->index, argv[idx_clr_sort]->arg)) + if (peer_lookup_by_conf_if (vty->index, argv[idx]->arg)) { clr_sort = clear_peer; - clr_arg = argv[idx_clr_sort]->arg; + clr_arg = argv[idx]->arg; } else { @@ -6066,27 +6060,47 @@ DEFUN (clear_ip_bgp_all, return CMD_WARNING; } } - - /* afi safi */ - idx_afi = idx_clr_sort + 1; - idx_safi = idx_clr_sort + 2; - idx_soft_in_out = 0; - if (argc > idx_afi) - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_soft_in_out); - - clr_type = BGP_CLEAR_SOFT_NONE; - if (idx_soft_in_out && argc > idx_soft_in_out) - { - /* soft, soft in, or soft out */ - if (strmatch(argv[idx_soft_in_out]->text, "in")) - clr_type = BGP_CLEAR_SOFT_IN; - else if (strmatch(argv[idx_soft_in_out]->text, "out")) + else if (argv_find (argv, argc, "(1-4294967295)", &idx)) + { + clr_sort = clear_as; + clr_arg = argv[idx]->arg; + } + else if (argv_find (argv, argc, "external", &idx)) + { + clr_sort = clear_external; + } + /* []|ipv6 []|encap [unicast]||vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + /* []|in [prefix-filter]|out>] */ + if (argv_find (argv, argc, "soft", &idx)) + { + if (argv_find (argv, argc, "in", &idx) || argv_find (argv, argc, "out", &idx)) + clr_type = strmatch (argv[idx]->text, "in") ? BGP_CLEAR_SOFT_IN : BGP_CLEAR_SOFT_OUT; + else + clr_type = BGP_CLEAR_SOFT_BOTH; + } + else if (argv_find (argv, argc, "in", &idx)) + { + clr_type = argv_find (argv, argc, "prefix-filter", &idx) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX : BGP_CLEAR_SOFT_IN; + } + else if (argv_find (argv, argc, "out", &idx)) + { clr_type = BGP_CLEAR_SOFT_OUT; - else if (strmatch(argv[idx_soft_in_out]->text, "soft")) - clr_type = BGP_CLEAR_SOFT_BOTH; - else if (strmatch(argv[idx_soft_in_out]->text, "prefix-filter")) - clr_type = BGP_CLEAR_SOFT_IN_ORF_PREFIX; - } + } + else + clr_type = BGP_CLEAR_SOFT_NONE; return bgp_clear_vty (vty, vrf, afi, safi, clr_sort, clr_type, clr_arg); } @@ -6843,7 +6857,7 @@ bgp_show_summary_vty (struct vty *vty, const char *name, /* `show ip bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show [ip] bgp [ WORD] [] summary [json]", + "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] summary [json]", SHOW_STR IP_STR BGP_STR @@ -6861,18 +6875,33 @@ DEFUN (show_ip_bgp_summary, "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; char *vrf = NULL; - afi_t afi; - safi_t safi; - u_char uj = use_json(argc, argv); + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, NULL); + int idx = 0; + + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + int uj = use_json (argc, argv); return bgp_show_summary_vty (vty, vrf, afi, safi, uj); } @@ -8889,7 +8918,7 @@ bgp_show_update_groups(struct vty *vty, const char *name, DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show [ip] bgp [ WORD] [] update-groups [SUBGROUP-ID]", + "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR @@ -8907,24 +8936,38 @@ DEFUN (show_ip_bgp_updgrps, "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - int idx_updgrp; - int idx_subgroup_id; char *vrf = NULL; - afi_t afi; - safi_t safi; + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; uint64_t subgrp_id = 0; - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_updgrp); - idx_subgroup_id = idx_updgrp + 1; + int idx = 0; - if (! strmatch(argv[idx_subgroup_id]->text, "update-groups")) - VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg); + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + + /* get subgroup id, if provided */ + idx = argc - 1; + if (argv[idx]->type == VARIABLE_TKN) + VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx]->arg); return (bgp_show_update_groups(vty, vrf, afi, safi, subgrp_id)); } diff --git a/lib/command.c b/lib/command.c index 914641724f..3416bcd1c7 100644 --- a/lib/command.c +++ b/lib/command.c @@ -193,6 +193,26 @@ argv_concat (struct cmd_token **argv, int argc, int shift) return str; } +/** + * Convenience function for accessing argv data. + * + * @param argc + * @param argv + * @param text definition snippet of the desired token + * @param index the starting index, and where to store the + * index of the found token if it exists + * @return 1 if found, 0 otherwise + */ +int +argv_find (struct cmd_token **argv, int argc, const char *text, int *index) +{ + int found = 0; + for (int i = *index; i < argc && found == 0; i++) + if ((found = strmatch (text, argv[i]->text))) + *index = i; + return found; +} + /* Install top node of command vector. */ void install_node (struct cmd_node *node, diff --git a/lib/command.h b/lib/command.h index aad0c6b3e6..0e2d27f19c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -408,6 +408,7 @@ extern void install_element (enum node_type, struct cmd_element *); string with a space between each element (allocated using XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ extern char *argv_concat (struct cmd_token **argv, int argc, int shift); +extern int argv_find (struct cmd_token **argv, int argc, const char *text, int *index); extern vector cmd_make_strvec (const char *); extern void cmd_free_strvec (vector); From 630a298ca76a0e37c263dc1d2c3053cbddc9ccb3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 21 Oct 2016 00:45:17 +0000 Subject: [PATCH 231/280] lib: Clean up some bgp show functions Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 58 +++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index cd61252a0c..b22dcfac1e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6003,6 +6003,7 @@ DEFUN (clear_ip_bgp_all, BGP_SOFT_OUT_STR) { char *vrf = NULL; + afi_t afi = AFI_IP6; safi_t safi = SAFI_UNICAST; enum clear_sort clr_sort = clear_peer; @@ -6115,25 +6116,18 @@ DEFUN (clear_ip_bgp_prefix, "Clear bestpath and re-advertise\n" "IP prefix /, e.g., 35.0.0.0/8\n") { - int idx_ip = 1; - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_ipv4_prefixlen = 6; char *vrf = NULL; + char *prefix = NULL; - if (!strmatch(argv[idx_ip]->text, "ip")) - { - idx_view_vrf--; - idx_vrf--; - idx_ipv4_prefixlen--; - } + int idx = 0; - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; - else - idx_ipv4_prefixlen -= 2; + /* [ WORD] */ + if (argv_find (argv, argc, "WORD", &idx)) + vrf = argv[idx]->arg; + + prefix = argv[argc-1]->arg; - return bgp_clear_prefix (vty, vrf, argv[idx_ipv4_prefixlen]->arg, AFI_IP, SAFI_UNICAST, NULL); + return bgp_clear_prefix (vty, vrf, prefix, AFI_IP, SAFI_UNICAST, NULL); } DEFUN (clear_bgp_ipv6_safi_prefix, @@ -8758,39 +8752,25 @@ DEFUN (show_ip_bgp_neighbors, "Neighbor on bgp configured interface\n" "JavaScript Object Notation\n") { - int idx_ip = 1; - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_peer; char *vrf = NULL; char *sh_arg = NULL; enum show_type sh_type; u_char uj = use_json(argc, argv); - if (!strmatch(argv[idx_ip]->text, "ip")) - { - idx_view_vrf--; - idx_vrf--; - } + int idx = 0; - if (strmatch(argv[idx_view_vrf]->text, "view") || strmatch(argv[idx_view_vrf]->text, "vrf")) - vrf = argv[idx_vrf]->arg; + if (argv_find (argv, argc, "WORD", &idx)) + vrf = argv[idx]->arg; - if (uj) - idx_peer = argc - 2; + if (argv_find (argv, argc, "A.B.C.D", &idx) || argv_find (argv, argc, "X:X::X:X", &idx) || + argv_find (argv, argc, "WORD", &idx)) + { + sh_type = show_peer; + sh_arg = argv[idx]->arg; + } else - idx_peer = argc - 1; - - if (strmatch(argv[idx_peer]->text, "neighbors")) - { - sh_type = show_all; - } - else - { - sh_type = show_peer; - sh_arg = argv[idx_peer]->arg; - } + sh_type = show_all; return bgp_show_neighbor_vty (vty, vrf, sh_type, sh_arg, uj); } From 8c3deaae5179988a422dd7942b7e1c78c0c21e38 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 24 Oct 2016 22:24:40 +0000 Subject: [PATCH 232/280] bgpd: Fixup / add back some BGP show commands Signed-off-by: Quentin Young --- bgpd/bgp_route.c | 370 ++++++++++++++++++++++++++++------------------- bgpd/bgp_vty.c | 179 +++++------------------ bgpd/bgp_vty.h | 8 - 3 files changed, 257 insertions(+), 300 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 7977bed4ab..229e6f5b29 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7430,7 +7430,7 @@ bgp_show_prefix_longer (struct vty *vty, const char *name, const char *prefix, afi_t afi, safi_t safi, enum bgp_show_type type); static int -bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, +bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi, safi_t safi, enum bgp_show_type type); static int bgp_show_community (struct vty *vty, const char *view_name, int argc, @@ -8029,7 +8029,7 @@ DEFUN (show_ip_bgp_ipv4, [<\ cidr-only\ |community\ - |dampening \ + |dampening \ |route-map WORD\ |prefix-list WORD\ |filter-list WORD\ @@ -8043,15 +8043,15 @@ DEFUN (show_ip_bgp_ipv4, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" "Address Family modifier\n" "Display only routes with non-natural netmasks\n" "Display routes matching the communities\n" @@ -8061,7 +8061,7 @@ DEFUN (show_ip_bgp_ipv4, "Display routes matching the route-map\n" "A route-map to match on\n" "Display routes conforming to the prefix-list\n" - "prefix-list name\n" + "Prefix-list name\n" "Display routes conforming to the filter-list\n" "Regular expression access list name\n" "Display routes matching the communities\n" @@ -8075,6 +8075,7 @@ DEFUN (show_ip_bgp_ipv4, "community-list name\n" "Exact match of the communities\n" "IPv4 prefix /, e.g., 35.0.0.0/8\n" + "Display route and more specific routes\n" "IPv6 prefix /\n" "Display route and more specific routes\n" "JavaScript Object Notation\n") @@ -8120,14 +8121,15 @@ DEFUN (show_ip_bgp_ipv4, if (strmatch(argv[idx]->text, "cidr-only")) return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj); - else if (strmatch(argv[idx]->text, "dampened-paths")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); - - else if (strmatch(argv[idx]->text, "flap-statistics")) - return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); - - else if (strmatch(argv[idx]->text, "regexp")) - return bgp_show_regexp (vty, argc, argv, afi, safi, bgp_show_type_regexp); + else if (strmatch(argv[idx]->text, "dampening")) + { + if (argv_find (argv, argc, "dampened-paths", &idx)) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj); + else if (argv_find (argv, argc, "flap-statistics", &idx)) + return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj); + else if (argv_find (argv, argc, "parameters", &idx)) + return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST); + } else if (strmatch(argv[idx]->text, "prefix-list")) return bgp_show_prefix_list (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_list); @@ -8156,9 +8158,10 @@ DEFUN (show_ip_bgp_ipv4, } else if (strmatch(argv[idx]->text, "community-list")) { - if (strmatch(argv[idx + 2]->text, "exact_match")) + const char *clist_number_or_name = argv[++idx]->arg; + if (++idx < argc && strmatch (argv[idx]->arg, "exact-match")) exact_match = 1; - return bgp_show_community_list (vty, vrf, argv[idx + 1]->arg, exact_match, afi, safi); + return bgp_show_community_list (vty, vrf, clist_number_or_name, exact_match, afi, safi); } /* prefix-longer */ else if (argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV6_TKN) @@ -8176,20 +8179,19 @@ DEFUN (show_ip_bgp_route, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" "Address Family modifier\n" - "Display information for a route distinguisher\n" - "VPN Route Distinguisher\n" "Network in the BGP routing table to display\n" "IP prefix /, e.g., 35.0.0.0/8\n" + "Network in the BGP routing table to display\n" "IPv6 prefix /\n" "Display only the bestpath\n" "Display only multipaths\n" @@ -8258,6 +8260,55 @@ DEFUN (show_ip_bgp_route, return bgp_show_route (vty, vrf, prefix, afi, safi, NULL, prefix_check, path_type, uj); } +DEFUN (show_ip_bgp_regexp, + show_ip_bgp_regexp_cmd, + "show [ip] bgp []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] regexp REGEX...", + SHOW_STR + IP_STR + BGP_STR + "Address Family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Display routes matching the AS path regular expression\n" + "A regular-expression to match the BGP AS paths\n") +{ + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; + + int idx = 0; + + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + + // get index of regex + argv_find (argv, argc, "regexp", &idx); + idx++; + + char *regstr = argv_concat (argv, argc, idx); + int rc = bgp_show_regexp (vty, (const char *) regstr, afi, safi, bgp_show_type_regexp); + XFREE (MTYPE_TMP, regstr); + return rc; +} + DEFUN (show_ip_bgp_instance_all, show_ip_bgp_instance_all_cmd, "show [ip] bgp all []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] [json]", @@ -8265,6 +8316,16 @@ DEFUN (show_ip_bgp_instance_all, IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR + "Address Family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" "JavaScript Object Notation\n") { afi_t afi = AFI_IP; @@ -8298,52 +8359,24 @@ DEFUN (show_ip_bgp_instance_all, static int -bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi, +bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi, safi_t safi, enum bgp_show_type type) { return CMD_SUCCESS; -/* XXX(vtysh-grammar): Needs updating for new CLI backend. - int i; - struct buffer *b; - char *regstr; - int first; regex_t *regex; int rc; - first = 0; - b = buffer_new (1024); - for (i = 0; i < argc; i++) - { - if (first) - buffer_putc (b, ' '); - else - { - if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0)) - continue; - first = 1; - } - - buffer_putstr (b, argv[i]->arg); - } - buffer_putc (b, '\0'); - - regstr = buffer_getstr (b); - buffer_free (b); - regex = bgp_regcomp (regstr); - XFREE(MTYPE_TMP, regstr); if (! regex) { - vty_out (vty, "Can't compile regexp %s%s", argv[0]->arg, - VTY_NEWLINE); + vty_out (vty, "Can't compile regexp %s%s", regstr, VTY_NEWLINE); return CMD_WARNING; } rc = bgp_show (vty, NULL, afi, safi, type, regex, 0); bgp_regex_free (regex); return rc; -*/ } static int @@ -8414,7 +8447,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters, SHOW_STR IP_STR BGP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Display detailed information about dampening\n" @@ -8975,8 +9008,8 @@ DEFUN (show_bgp_statistics, "show bgp statistics", SHOW_STR BGP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" @@ -8994,8 +9027,8 @@ DEFUN (show_bgp_statistics_view, SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" @@ -9253,7 +9286,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, "show bgp ipv6 neighbors prefix-counts [json]", SHOW_STR BGP_STR - "Address family\n" + "Address Family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -9278,7 +9311,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -9304,7 +9337,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, SHOW_STR IP_STR BGP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" @@ -9335,7 +9368,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, SHOW_STR IP_STR BGP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" @@ -9598,52 +9631,70 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [] WORD [] neighbors [] [json]", + "show [ip] bgp [] WORD []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] neighbors [ [route-map WORD]] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" + "Neighbor on bgp configured interface\n" "Display the received routes from neighbor\n" - "Route-map to modify the attributes\n" - "Name of the route map\n" "Display the routes advertised to a BGP neighbor\n" "Route-map to modify the attributes\n" "Name of the route map\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi = 5; - int idx_safi = 6; - int idx_peer; - int idx_adv_recv; - int idx_rmap; - int rcvd = 0; + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; char *vrf = NULL; char *rmap_name = NULL; + char *peerstr = NULL; + int rcvd; + struct peer *peer; - afi_t afi; - safi_t safi; + + int idx = 0; + + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + + /* neighbors */ + argv_find (argv, argc, "neighbors", &idx); + peerstr = argv[++idx]->arg; + u_char uj = use_json(argc, argv); - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer); - - peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj); + peer = peer_lookup_in_view (vty, vrf, peerstr, uj); if (! peer) { @@ -9651,32 +9702,24 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, return CMD_WARNING; } - idx_adv_recv = idx_peer + 1; - idx_rmap = idx_adv_recv + 2; - - if (argc > idx_adv_recv) - { - if (strmatch(argv[idx_adv_recv]->text, "received-routes")) - rcvd = 1; - else if (strmatch(argv[idx_adv_recv]->text, "advertised-routes")) - rcvd = 0; - - if (argc > idx_rmap) - rmap_name = argv[idx_rmap]->arg; - } + if (argv_find (argv, argc, "received-routes", &idx)) + rcvd = 1; + if (argv_find (argv, argc, "advertised-routes", &idx)) + rcvd = 0; + if (argv_find (argv, argc, "route-map", &idx)) + rmap_name = argv[++idx]->arg; return peer_adj_routes (vty, peer, afi, safi, rcvd, rmap_name, uj); } DEFUN (show_ip_bgp_neighbor_received_prefix_filter, show_ip_bgp_neighbor_received_prefix_filter_cmd, - "show [ip] bgp [ WORD] [ [unicast]] neighbors received prefix-filter [json]", + "show [ip] bgp [ [unicast]] neighbors received prefix-filter [json]", SHOW_STR IP_STR BGP_STR - BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" @@ -9686,35 +9729,41 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, "Display the prefixlist filter\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - int idx_neighbors; - int idx_peer; - afi_t afi; - safi_t safi; + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; + char *peerstr = NULL; + char name[BUFSIZ]; union sockunion su; struct peer *peer; int count, ret; + + int idx = 0; + + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ [unicast]] */ + if (argv_find (argv, argc, "ipv4", &idx)) + afi = AFI_IP; + if (argv_find (argv, argc, "ipv6", &idx)) + afi = AFI_IP6; + /* neighbors */ + argv_find (argv, argc, "neighbors", &idx); + peerstr = argv[++idx]->arg; + u_char uj = use_json(argc, argv); - bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_neighbors); - idx_peer = idx_neighbors + 1; - - ret = str2sockunion (argv[idx_peer]->arg, &su); + ret = str2sockunion (peerstr, &su); if (ret < 0) { - peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg); + peer = peer_lookup_by_conf_if (NULL, peerstr); if (! peer) { if (uj) vty_out (vty, "{}%s", VTY_NEWLINE); else - vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); + vty_out (vty, "%% Malformed address or name: %s%s", peerstr, VTY_NEWLINE); return CMD_WARNING; } } @@ -9736,7 +9785,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, if (count) { if (!uj) - vty_out (vty, "Address family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE); + vty_out (vty, "Address Family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE); prefix_bgp_show_prefix_list (vty, afi, name, uj); } else @@ -9774,61 +9823,79 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show [ip] bgp [ WORD] [] neighbors [json]", + "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] neighbors [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" - "Address family\n" - "Address family\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family modifier\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" "Neighbor on bgp configured interface\n" - "Display routes learned from neighbor\n" - "Display the dampened routes received from neighbor\n" "Display flap statistics of the routes learned from neighbor\n" + "Display the dampened routes received from neighbor\n" + "Display routes learned from neighbor\n" "JavaScript Object Notation\n") { - int idx_view_vrf = 3; - int idx_vrf = 4; - int idx_afi; - int idx_safi; - int idx_peer; - int idx_sh_type; char *vrf = NULL; - afi_t afi; - safi_t safi; + char *peerstr = NULL; + + afi_t afi = AFI_IP6; + safi_t safi = SAFI_UNICAST; struct peer *peer; enum bgp_show_type sh_type = bgp_show_type_neighbor; + + int idx = 0; + + /* show [ip] bgp */ + if (argv_find (argv, argc, "ip", &idx)) + afi = AFI_IP; + /* [ WORD] */ + if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) + vrf = argv[++idx]->arg; + /* []|ipv6 []|encap [unicast]|vpnv4 [unicast]>] */ + if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) + { + afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; + if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) + safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; + } + else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + { + afi = AFI_IP; + safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; + // advance idx if necessary + argv_find (argv, argc, "unicast", &idx); + } + /* neighbors */ + argv_find (argv, argc, "neighbors", &idx); + peerstr = argv[++idx]->arg; + u_char uj = use_json(argc, argv); - vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi); - idx_safi = idx_afi + 1; - bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer); - - peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj); + peer = peer_lookup_in_view (vty, vrf, peerstr, uj); if (! peer) { vty_out (vty, "No such neighbor%s", VTY_NEWLINE); return CMD_WARNING; } - idx_sh_type = idx_peer + 1; - - if (strmatch(argv[idx_sh_type]->text, "routes")) - sh_type = bgp_show_type_neighbor; - - else if (strmatch(argv[idx_sh_type]->text, "dampened-routes")) - sh_type = bgp_show_type_damp_neighbor; - - else if (strmatch(argv[idx_sh_type]->text, "flap-statistics")) + if (argv_find (argv, argc, "flap-statistics", &idx)) sh_type = bgp_show_type_flap_neighbor; + else if (argv_find (argv, argc, "dampened-routes", &idx)) + sh_type = bgp_show_type_damp_neighbor; + else if (argv_find (argv, argc, "routes", &idx)) + sh_type = bgp_show_type_neighbor; return bgp_show_neighbor_route (vty, peer, afi, safi, sh_type, uj); } @@ -10672,6 +10739,7 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_cmd); + install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9589cde841..b780814bc8 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -5673,12 +5673,12 @@ DEFUN (no_neighbor_addpath_tx_bestpath_per_as, } -/* Address family configuration. */ +/* Address Family configuration. */ DEFUN (address_family_ipv4, address_family_ipv4_cmd, "address-family ipv4", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_IPV4_NODE; return CMD_SUCCESS; @@ -5688,7 +5688,7 @@ DEFUN (address_family_ipv4_safi, address_family_ipv4_safi_cmd, "address-family ipv4 ", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n") { @@ -5705,7 +5705,7 @@ DEFUN (address_family_ipv6, address_family_ipv6_cmd, "address-family ipv6", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_IPV6_NODE; return CMD_SUCCESS; @@ -5715,7 +5715,7 @@ DEFUN (address_family_ipv6_safi, address_family_ipv6_safi_cmd, "address-family ipv6 ", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n") { @@ -5732,7 +5732,7 @@ DEFUN (address_family_vpnv4, address_family_vpnv4_cmd, "address-family vpnv4 [unicast]", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_VPNV4_NODE; @@ -5743,7 +5743,7 @@ DEFUN (address_family_vpnv6, address_family_vpnv6_cmd, "address-family vpnv6 [unicast]", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_VPNV6_NODE; @@ -5754,8 +5754,8 @@ DEFUN (address_family_encap, address_family_encap_cmd, "address-family ", "Enter Address Family command mode\n" - "Address family\n" - "Address family\n") + "Address Family\n" + "Address Family\n") { vty->node = BGP_ENCAP_NODE; return CMD_SUCCESS; @@ -5766,7 +5766,7 @@ DEFUN (address_family_encapv6, address_family_encapv6_cmd, "address-family encapv6", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_ENCAPV6_NODE; return CMD_SUCCESS; @@ -5870,109 +5870,6 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, return CMD_SUCCESS; } -char * -bgp_get_argv_vrf (int argc, struct cmd_token **argv, afi_t *afi, safi_t *safi, - int *idx_view_vrf, int *idx_vrf, int *idx_next_token) -{ - /* - * The DEFUN that calls this MUST begin with one of the following - * clear [ip] bgp [ WORD] - * show [ip] bgp [ WORD] - * - * We will do the following - * - set the afi/safi - * - decrement the idx_view_vrf and idx_vrf pointers if needed - * - return a pointer to the vrf name - */ - int idx_ip = 1; - - /* - * If the user does " ip bgp" then we default the afi safi to ipv4 unicast. - * If the user does " bgp" then we default the afi safi to ipv6 unicast. - * This may be over-written later in the command if they explicitly - * specify an afi safi. - */ - if (strmatch(argv[idx_ip]->text, "ip")) - { - *afi = AFI_IP; - *safi = SAFI_UNICAST; - } - else - { - *afi = AFI_IP6; - *safi = SAFI_UNICAST; - *idx_view_vrf = *idx_view_vrf - 1; - *idx_vrf = *idx_vrf - 1; - } - - if (argc > *idx_vrf) - if (strmatch(argv[*idx_view_vrf]->text, "view") || strmatch(argv[*idx_view_vrf]->text, "vrf")) - { - *idx_next_token = *idx_vrf + 1; - return argv[*idx_vrf]->arg; - } - - *idx_next_token = *idx_view_vrf; - return NULL; -} - -void -bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, - int idx_afi, int idx_safi, - afi_t *afi, safi_t *safi, - int *idx_next_token) -{ - /* - * The DEFUN that calls this must use - * - */ - if (strmatch(argv[idx_afi]->text, "ipv4")) - { - *afi = AFI_IP; - - if (strmatch(argv[idx_safi]->text, "unicast")) - *safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - *safi = SAFI_MULTICAST; - - if (idx_next_token) - *idx_next_token = idx_safi + 1; - } - else if (strmatch(argv[idx_afi]->text, "ipv6")) - { - *afi = AFI_IP6; - - if (strmatch(argv[idx_safi]->text, "unicast")) - *safi = SAFI_UNICAST; - else if (strmatch(argv[idx_safi]->text, "multicast")) - *safi = SAFI_MULTICAST; - - if (idx_next_token) - *idx_next_token = idx_safi + 1; - } - else if (strmatch(argv[idx_afi]->text, "encap")) - { - *afi = AFI_IP; - *safi = SAFI_ENCAP; - - if (idx_next_token) - *idx_next_token = idx_safi + 1; - } - else if (strmatch(argv[idx_afi]->text, "vpnv4")) - { - *afi = AFI_IP; - - if (idx_next_token) - *idx_next_token = idx_safi + 1; - *safi = SAFI_MPLS_VPN; - } - else - { - if (idx_next_token) - *idx_next_token = idx_afi; - } -} - /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, @@ -5989,24 +5886,21 @@ DEFUN (clear_ip_bgp_all, "Clear all external peers\n" "Clear all members of peer-group\n" "BGP peer-group name\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" + "Address Family modifier\n" + "Address Family\n" "Address Family modifier\n" - BGP_SOFT_STR BGP_SOFT_STR BGP_SOFT_IN_STR - BGP_SOFT_STR BGP_SOFT_OUT_STR BGP_SOFT_IN_STR "Push out prefix-list ORF and do inbound soft reconfig\n" - BGP_SOFT_IN_STR BGP_SOFT_OUT_STR) { char *vrf = NULL; @@ -6142,7 +6036,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, "clear bgp ipv6 prefix X:X::X:X/M", CLEAR_STR BGP_STR - "Address family\n" + "Address Family\n" "Address Family Modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") @@ -6161,7 +6055,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, CLEAR_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family Modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix /, e.g., 3ffe::/16\n") @@ -6863,15 +6757,15 @@ DEFUN (show_ip_bgp_summary, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Summary of BGP neighbor status\n" "JavaScript Object Notation\n") @@ -8046,7 +7940,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) { - vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); + vty_out (vty, " Address Family %s:", afi_safi_print (afi, safi)); if (p->afc_adv[afi][safi]) vty_out (vty, " advertised"); if (p->afc_recv[afi][safi]) @@ -8751,8 +8645,8 @@ DEFUN (show_ip_bgp_neighbors, IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -8804,7 +8698,7 @@ DEFUN (show_ip_bgp_ipv4_paths, SHOW_STR IP_STR BGP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "Path information\n") @@ -8910,15 +8804,15 @@ DEFUN (show_ip_bgp_updgrps, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" - "Address family\n" + "Address Family\n" "Address Family modifier\n" "Detailed info about dynamic update groups\n" "Specific subgroup to display detailed info for\n") @@ -9071,8 +8965,8 @@ DEFUN (show_bgp_updgrps_afi_adj, "show bgp update-groups ", SHOW_STR BGP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "BGP update groups\n" @@ -9178,8 +9072,8 @@ DEFUN (show_bgp_updgrps_afi_adj_s, "show bgp update-groups SUBGROUP-ID ", SHOW_STR BGP_STR - "Address family\n" - "Address family\n" + "Address Family\n" + "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" "BGP update groups\n" @@ -10104,6 +9998,7 @@ bgp_vty_init (void) /* "bgp config-type" commands. */ install_element (CONFIG_NODE, &bgp_config_type_cmd); + install_element (CONFIG_NODE, &no_bgp_config_type_cmd); /* bgp route-map delay-timer commands. */ install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); @@ -11053,6 +10948,8 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); + install_element (VIEW_NODE, &show_bgp_updgrps_stats_cmd); + install_element (VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd); /* "show ip bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 936d66131f..382af0984f 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -33,14 +33,6 @@ extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp); extern int bgp_vty_return (struct vty *vty, int ret); -extern char *bgp_get_argv_vrf (int argc, struct cmd_token **argv, - afi_t *afi, safi_t *safi, - int *idx_view_vrf, int *idx_vrf, - int *idx_next_token); -extern void bgp_get_argv_afi_safi (int argc, struct cmd_token **argv, - int idx_afi, int idx_safi, - afi_t *afi, safi_t *safi, - int *idx_next_token); extern struct peer * peer_and_group_lookup_vty (struct vty *vty, const char *peer_str); From a99586748f046a36d8a8de9e64af962588ce7252 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 27 Oct 2016 22:08:10 +0000 Subject: [PATCH 233/280] lib: Log warning when commands have underfull doc string Signed-off-by: Quentin Young --- lib/command_parse.y | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 89c0e47f83..8da08c36d1 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -36,6 +36,7 @@ #include "stdlib.h" #include "string.h" #include "command.h" + #include "log.h" #include "graph.h" extern int @@ -106,7 +107,7 @@ /* helper functions for parser */ static char * - doc_next (void); + doc_next (struct cmd_element *); static struct graph_node * node_adjacent (struct graph_node *, struct graph_node *); @@ -146,7 +147,17 @@ set_lexer_string (element->string); /* copy docstring and keep a pointer to the copy */ - docstr = element->doc ? strdup(element->doc) : NULL; + if (element->doc) + { + // allocate a new buffer, making room for a flag + size_t length = (size_t) strlen (element->doc) + 2; + docstr = malloc (length); + memcpy (docstr, element->doc, strlen (element->doc)); + // set the flag so doc_next knows when to print a warning + docstr[length - 2] = 0x03; + // null terminate + docstr[length - 1] = 0x00; + } docstr_start = docstr; } @@ -164,7 +175,7 @@ start: graph_delete_node (graph, $3); // adding a node as a child of itself accepts any number - // of the same token, which is what we want for varags + // of the same token, which is what we want for variadics add_edge_dedup (currnode, currnode); // tack on the command element @@ -175,7 +186,7 @@ start: sentence_root: WORD { struct graph_node *root = - new_token_node (graph, WORD_TKN, strdup ($1), doc_next()); + new_token_node (graph, WORD_TKN, strdup ($1), doc_next(element)); if ((currnode = add_edge_dedup (startnode, root)) != root) graph_delete_node (graph, root); @@ -216,7 +227,7 @@ compound_token: literal_token: WORD { - $$ = new_token_node (graph, WORD_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, WORD_TKN, strdup($1), doc_next(element)); free ($1); } ; @@ -224,32 +235,32 @@ literal_token: WORD placeholder_token: IPV4 { - $$ = new_token_node (graph, IPV4_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, IPV4_TKN, strdup($1), doc_next(element)); free ($1); } | IPV4_PREFIX { - $$ = new_token_node (graph, IPV4_PREFIX_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, IPV4_PREFIX_TKN, strdup($1), doc_next(element)); free ($1); } | IPV6 { - $$ = new_token_node (graph, IPV6_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, IPV6_TKN, strdup($1), doc_next(element)); free ($1); } | IPV6_PREFIX { - $$ = new_token_node (graph, IPV6_PREFIX_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, IPV6_PREFIX_TKN, strdup($1), doc_next(element)); free ($1); } | VARIABLE { - $$ = new_token_node (graph, VARIABLE_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, VARIABLE_TKN, strdup($1), doc_next(element)); free ($1); } | RANGE { - $$ = new_token_node (graph, RANGE_TKN, strdup($1), doc_next()); + $$ = new_token_node (graph, RANGE_TKN, strdup($1), doc_next(element)); struct cmd_token *token = $$->data; // get the numbers out @@ -443,11 +454,15 @@ terminate_graph (struct graph *graph, struct graph_node *finalnode, struct cmd_e } static char * -doc_next() +doc_next (struct cmd_element *el) { - char *piece = NULL; - if (!docstr || !(piece = strsep (&docstr, "\n"))) - return strdup (""); + const char *piece = docstr ? strsep (&docstr, "\n") : ""; + if (*piece == 0x03) + { + zlog_warn ("Ran out of docstring while parsing '%s'", el->string); + piece = ""; + } + return strdup (piece); } From 0c7b1b01c862b44ed4181cf8ecb12d95096f6a77 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 27 Oct 2016 23:18:26 +0000 Subject: [PATCH 234/280] bgpd: Clean up cli help strings Signed-off-by: Quentin Young --- bgpd/bgp_debug.c | 24 ++++++++++++------------ bgpd/bgp_encap.c | 4 ++-- bgpd/bgp_mplsvpn.c | 22 +++++++++++----------- bgpd/bgp_route.c | 29 ++++++++++++++--------------- bgpd/bgp_vty.c | 38 +++++++++++++++++++------------------- 5 files changed, 58 insertions(+), 59 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 4619a08d55..f6b0500433 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -863,8 +863,8 @@ DEFUN (debug_bgp_bestpath_prefix, DEBUG_STR BGP_STR "BGP bestpath\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 3; @@ -912,8 +912,8 @@ DEFUN (no_debug_bgp_bestpath_prefix, DEBUG_STR BGP_STR "BGP bestpath\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 4; @@ -1279,8 +1279,8 @@ DEFUN (debug_bgp_update_prefix, BGP_STR "BGP updates\n" "Specify a prefix to debug\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 4; @@ -1329,8 +1329,8 @@ DEFUN (no_debug_bgp_update_prefix, BGP_STR "BGP updates\n" "Specify a prefix to debug\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 5; @@ -1428,8 +1428,8 @@ DEFUN (debug_bgp_zebra_prefix, BGP_STR "BGP Zebra messages\n" "Specify a prefix to debug\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 4; @@ -1495,8 +1495,8 @@ DEFUN (no_debug_bgp_zebra_prefix, BGP_STR "BGP Zebra messages\n" "Specify a prefix to debug\n" - "IP prefix /, e.g., 35.0.0.0/8\n" - "IPv6 prefix /\n") + "IPv4 prefix\n" + "IPv6 prefix\n") { int idx_ipv4_ipv6_prefixlen = 5; diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 499401bd4f..e956f84e2f 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -218,7 +218,7 @@ DEFUN (encap_network, encap_network_cmd, "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify Route Distinguisher\n" "ENCAP Route Distinguisher\n" "BGP tag\n" @@ -236,7 +236,7 @@ DEFUN (no_encap_network, "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", NO_STR "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify Route Distinguisher\n" "ENCAP Route Distinguisher\n" "BGP tag\n" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5d6dc4c2cf..9c8e0d54c6 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -438,7 +438,7 @@ DEFUN (vpnv4_network, vpnv4_network_cmd, "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" "BGP tag\n" @@ -454,7 +454,7 @@ DEFUN (vpnv4_network_route_map, vpnv4_network_route_map_cmd, "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" "BGP tag\n" @@ -475,7 +475,7 @@ DEFUN (no_vpnv4_network, "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", NO_STR "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" "BGP tag\n" @@ -965,7 +965,7 @@ DEFUN (show_ip_bgp_vpnv4_all, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information about all VPNv4 NLRIs\n") { return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0); @@ -977,7 +977,7 @@ DEFUN (show_ip_bgp_vpnv4_rd, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n") { @@ -1000,7 +1000,7 @@ DEFUN (show_ip_bgp_vpnv4_all_tags, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information about all VPNv4 NLRIs\n" "Display BGP tags for prefixes\n") { @@ -1013,7 +1013,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" "Display BGP tags for prefixes\n") @@ -1037,7 +1037,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information about all VPNv4 NLRIs\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" @@ -1091,7 +1091,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" "Detailed information on TCP and BGP neighbor connections\n" @@ -1164,7 +1164,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information about all VPNv4 NLRIs\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" @@ -1217,7 +1217,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, SHOW_STR IP_STR BGP_STR - "Display VPNv4 NLRI specific information\n" + "Address Family\n" "Display information for a route distinguisher\n" "VPN Route Distinguisher\n" "Detailed information on TCP and BGP neighbor connections\n" diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 15d58ab064..b4eafd13fe 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4562,7 +4562,7 @@ DEFUN (bgp_network, bgp_network_cmd, "network A.B.C.D/M", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n") + "IPv4 prefix\n") { int idx_ipv4_prefixlen = 1; return bgp_static_set (vty, vty->index, argv[idx_ipv4_prefixlen]->arg, @@ -4573,7 +4573,7 @@ DEFUN (bgp_network_route_map, bgp_network_route_map_cmd, "network A.B.C.D/M route-map WORD", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Route-map to modify the attributes\n" "Name of the route map\n") { @@ -4587,7 +4587,7 @@ DEFUN (bgp_network_backdoor, bgp_network_backdoor_cmd, "network A.B.C.D/M backdoor", "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify a BGP backdoor route\n") { int idx_ipv4_prefixlen = 1; @@ -4743,7 +4743,7 @@ DEFUN (no_bgp_network, "no network A.B.C.D/M []", NO_STR "Specify a network to announce via BGP\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Specify a BGP backdoor route\n" "Route-map to modify the attributes\n" "Name of the route map\n") @@ -4810,7 +4810,7 @@ DEFUN (ipv6_bgp_network, ipv6_bgp_network_cmd, "network X:X::X:X/M", "Specify a network to announce via BGP\n" - "IPv6 prefix /\n") + "IPv6 prefix\n") { int idx_ipv6_prefixlen = 1; return bgp_static_set (vty, vty->index, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, bgp_node_safi(vty), @@ -4821,7 +4821,7 @@ DEFUN (ipv6_bgp_network_route_map, ipv6_bgp_network_route_map_cmd, "network X:X::X:X/M route-map WORD", "Specify a network to announce via BGP\n" - "IPv6 prefix /\n" + "IPv6 prefix\n" "Route-map to modify the attributes\n" "Name of the route map\n") { @@ -4836,7 +4836,7 @@ DEFUN (no_ipv6_bgp_network, "no network X:X::X:X/M [route-map WORD]", NO_STR "Specify a network to announce via BGP\n" - "IPv6 prefix /\n" + "IPv6 prefix\n" "Route-map to modify the attributes\n" "Name of the route map\n") { @@ -8014,12 +8014,11 @@ DEFUN (show_ip_bgp_ipv4, "show [ip] bgp [ WORD] []|ipv6 []|encap [unicast]|vpnv4 [unicast]>]\ [<\ cidr-only\ - |community\ |dampening \ |route-map WORD\ |prefix-list WORD\ |filter-list WORD\ - |community [exact-match]\ + |community [ [exact-match]]\ |community-list <(1-500)|WORD> [exact-match]\ |A.B.C.D/M longer-prefixes\ |X:X::X:X/M longer-prefixes\ @@ -8040,10 +8039,10 @@ DEFUN (show_ip_bgp_ipv4, "Address Family\n" "Address Family modifier\n" "Display only routes with non-natural netmasks\n" - "Display routes matching the communities\n" "Display detailed information about dampening\n" "Display flap statistics of routes\n" "Display paths suppressed due to dampening\n" + "Display dampening parameters\n" "Display routes matching the route-map\n" "A route-map to match on\n" "Display routes conforming to the prefix-list\n" @@ -8060,9 +8059,9 @@ DEFUN (show_ip_bgp_ipv4, "community-list number\n" "community-list name\n" "Exact match of the communities\n" - "IPv4 prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Display route and more specific routes\n" - "IPv6 prefix /\n" + "IPv6 prefix\n" "Display route and more specific routes\n" "JavaScript Object Notation\n") { @@ -8176,9 +8175,9 @@ DEFUN (show_ip_bgp_route, "Address Family\n" "Address Family modifier\n" "Network in the BGP routing table to display\n" - "IP prefix /, e.g., 35.0.0.0/8\n" + "IPv4 prefix\n" "Network in the BGP routing table to display\n" - "IPv6 prefix /\n" + "IPv6 prefix\n" "Display only the bestpath\n" "Display only multipaths\n" "JavaScript Object Notation\n") @@ -10412,7 +10411,7 @@ DEFUN (clear_ip_bgp_dampening_prefix, IP_STR BGP_STR "Clear route flap dampening information\n" - "IP prefix /, e.g., 35.0.0.0/8\n") + "IPv4 prefix\n") { int idx_ipv4_prefixlen = 4; return bgp_clear_damp_route (vty, NULL, argv[idx_ipv4_prefixlen]->arg, AFI_IP, diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5322f2a034..cd043d07ac 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6015,7 +6015,7 @@ DEFUN (clear_ip_bgp_prefix, BGP_STR BGP_INSTANCE_HELP_STR "Clear bestpath and re-advertise\n" - "IP prefix /, e.g., 35.0.0.0/8\n") + "IPv4 prefix\n") { char *vrf = NULL; char *prefix = NULL; @@ -6025,7 +6025,7 @@ DEFUN (clear_ip_bgp_prefix, /* [ WORD] */ if (argv_find (argv, argc, "WORD", &idx)) vrf = argv[idx]->arg; - + prefix = argv[argc-1]->arg; return bgp_clear_prefix (vty, vrf, prefix, AFI_IP, SAFI_UNICAST, NULL); @@ -6039,7 +6039,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, "Address Family\n" "Address Family Modifier\n" "Clear bestpath and re-advertise\n" - "IPv6 prefix /, e.g., 3ffe::/16\n") + "IPv6 prefix\n") { int idx_safi = 3; int idx_ipv6_prefixlen = 5; @@ -6058,7 +6058,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, "Address Family\n" "Address Family Modifier\n" "Clear bestpath and re-advertise\n" - "IPv6 prefix /, e.g., 3ffe::/16\n") + "IPv6 prefix\n") { int idx_word = 3; int idx_safi = 5; @@ -6787,10 +6787,10 @@ DEFUN (show_ip_bgp_summary, BGP_INSTANCE_HELP_STR "Address Family\n" "Address Family modifier\n" - "Address Family\n" "Address Family modifier\n" "Address Family\n" "Address Family modifier\n" + "Address Family modifier\n" "Address Family\n" "Address Family modifier\n" "Address Family\n" @@ -8834,10 +8834,10 @@ DEFUN (show_ip_bgp_updgrps, BGP_INSTANCE_HELP_STR "Address Family\n" "Address Family modifier\n" - "Address Family\n" "Address Family modifier\n" "Address Family\n" "Address Family modifier\n" + "Address Family modifier\n" "Address Family\n" "Address Family modifier\n" "Address Family\n" @@ -8887,7 +8887,7 @@ DEFUN (show_bgp_instance_all_ipv6_updgrps, SHOW_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR - "Detailed info about v6 dynamic update groups\n") + "Detailed info about dynamic update groups\n") { bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); return CMD_SUCCESS; @@ -8898,7 +8898,7 @@ DEFUN (show_bgp_updgrps_stats, "show bgp update-groups statistics", SHOW_STR BGP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Statistics\n") { struct bgp *bgp; @@ -8916,7 +8916,7 @@ DEFUN (show_bgp_instance_updgrps_stats, SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Statistics\n") { int idx_word = 3; @@ -8958,7 +8958,7 @@ DEFUN (show_ip_bgp_updgrps_adj, SHOW_STR IP_STR BGP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Advertisement queue\n" "Announced routes\n" "Packet queue\n") @@ -8976,7 +8976,7 @@ DEFUN (show_ip_bgp_instance_updgrps_adj, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Advertisement queue\n" "Announced routes\n" "Packet queue\n") @@ -8997,7 +8997,7 @@ DEFUN (show_bgp_updgrps_afi_adj, "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Advertisement queue\n" "Announced routes\n" "Packet queue\n" @@ -9020,7 +9020,7 @@ DEFUN (show_bgp_updgrps_adj, "show bgp update-groups ", SHOW_STR BGP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Advertisement queue\n" "Announced routes\n" "Packet queue\n") @@ -9036,7 +9036,7 @@ DEFUN (show_bgp_instance_updgrps_adj, SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Advertisement queue\n" "Announced routes\n" "Packet queue\n") @@ -9053,7 +9053,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, SHOW_STR IP_STR BGP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" "Advertisement queue\n" "Announced routes\n" @@ -9077,7 +9077,7 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" "Advertisement queue\n" "Announced routes\n" @@ -9104,7 +9104,7 @@ DEFUN (show_bgp_updgrps_afi_adj_s, "Address Family\n" "Address Family modifier\n" "Address Family modifier\n" - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" "Advertisement queue\n" "Announced routes\n" @@ -9132,7 +9132,7 @@ DEFUN (show_bgp_updgrps_adj_s, "show bgp update-groups SUBGROUP-ID ", SHOW_STR BGP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" "Advertisement queue\n" "Announced routes\n" @@ -9154,7 +9154,7 @@ DEFUN (show_bgp_instance_updgrps_adj_s, SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP update groups\n" + "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" "Advertisement queue\n" "Announced routes\n" From d6e3c605025e16670cb416e59357a6435ba727c9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 27 Oct 2016 23:52:48 +0000 Subject: [PATCH 235/280] bgpd: Unify `show bgp` and `show ip bgp` trees Hear ye, hear ye. `ip` is now a vestigial keyword for bgpd's show commands. Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 62 ++++++++++++-------------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index cd043d07ac..e6aa2d2de8 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6071,8 +6071,9 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, DEFUN (show_bgp_views, show_bgp_views_cmd, - "show bgp views", + "show [ip] bgp views", SHOW_STR + IP_STR BGP_STR "Show the defined BGP views\n") { @@ -6102,8 +6103,9 @@ DEFUN (show_bgp_views, DEFUN (show_bgp_vrfs, show_bgp_vrfs_cmd, - "show bgp vrfs [json]", + "show [ip] bgp vrfs [json]", SHOW_STR + IP_STR BGP_STR "Show BGP VRFs\n" "JavaScript Object Notation\n") @@ -9334,55 +9336,24 @@ bgp_show_peer_group_vty (struct vty *vty, const char *name, DEFUN (show_ip_bgp_peer_groups, show_ip_bgp_peer_groups_cmd, - "show ip bgp peer-group", - SHOW_STR - IP_STR - BGP_STR - "Detailed information on all BGP peer groups\n") -{ - return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); -} - -DEFUN (show_ip_bgp_instance_peer_groups, - show_ip_bgp_instance_peer_groups_cmd, - "show ip bgp WORD peer-group", + "show [ip] bgp [ VRFNAME] peer-group [PGNAME]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "Detailed information on all BGP peer groups\n") + "Detailed information on BGP peer groups\n" + "Peer group name\n") { - int idx_word = 4; - return bgp_show_peer_group_vty (vty, argv[idx_word]->arg, show_all_groups, NULL); + char *vrf, *pg; + vrf = pg = NULL; + int idx = 0; + + vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL; + pg = argv_find (argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL; + + return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg); } -DEFUN (show_ip_bgp_peer_group, - show_ip_bgp_peer_group_cmd, - "show ip bgp peer-group WORD", - SHOW_STR - IP_STR - BGP_STR - "BGP peer-group name\n" - "Detailed information on a BGP peer group\n") -{ - int idx_word = 4; - return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[idx_word]->arg); -} - -DEFUN (show_ip_bgp_instance_peer_group, - show_ip_bgp_instance_peer_group_cmd, - "show ip bgp WORD peer-group WORD", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP peer-group name\n" - "Detailed information on a BGP peer group\n") -{ - int idx_word = 4; - int idx_word_2 = 6; - return bgp_show_peer_group_vty (vty, argv[idx_word]->arg, show_peer_group, argv[idx_word_2]->arg); -} /* Redistribute VTY commands. */ @@ -10984,9 +10955,6 @@ bgp_vty_init (void) /* "show ip bgp peer-group" commands. */ install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); - install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); /* "show ip bgp paths" commands. */ install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); From bec37ba594856e0fac7fd20baa08d50d0e3fe86a Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 28 Oct 2016 00:10:10 +0000 Subject: [PATCH 236/280] bgpd: Vestigialize `show ip bgp`, this time for real Missed a couple. Signed-off-by: Quentin Young --- bgpd/bgp_nexthop.c | 48 ++++++---------------------------------------- bgpd/bgp_vty.c | 4 ++-- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index fadad3c452..493655d7fa 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -494,42 +494,22 @@ bgp_show_all_instances_nexthops_vty (struct vty *vty) DEFUN (show_ip_bgp_nexthop, show_ip_bgp_nexthop_cmd, - "show ip bgp nexthop", - SHOW_STR - IP_STR - BGP_STR - "BGP nexthop table\n") -{ - return show_ip_bgp_nexthop_table (vty, NULL, 0); -} - -DEFUN (show_ip_bgp_nexthop_detail, - show_ip_bgp_nexthop_detail_cmd, - "show ip bgp nexthop detail", - SHOW_STR - IP_STR - BGP_STR - "BGP nexthop table\n") -{ - return show_ip_bgp_nexthop_table (vty, NULL, 1); -} - -DEFUN (show_ip_bgp_instance_nexthop, - show_ip_bgp_instance_nexthop_cmd, - "show ip bgp WORD nexthop", + "show [ip] bgp [ VRFNAME] nexthop [detail]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR "BGP nexthop table\n") { - int idx_word = 4; - return show_ip_bgp_nexthop_table (vty, argv[idx_word]->arg, 0); + int idx = 0; + char *vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL; + int detail = argv_find (argv, argc, "detail", &idx) ? 1 : 0; + return show_ip_bgp_nexthop_table (vty, vrf, detail); } DEFUN (show_ip_bgp_instance_all_nexthop, show_ip_bgp_instance_all_nexthop_cmd, - "show ip bgp all nexthop", + "show [ip] bgp all nexthop", SHOW_STR IP_STR BGP_STR @@ -540,19 +520,6 @@ DEFUN (show_ip_bgp_instance_all_nexthop, return CMD_SUCCESS; } -DEFUN (show_ip_bgp_instance_nexthop_detail, - show_ip_bgp_instance_nexthop_detail_cmd, - "show ip bgp WORD nexthop detail", - SHOW_STR - IP_STR - BGP_STR - BGP_INSTANCE_HELP_STR - "BGP nexthop table\n") -{ - int idx_word = 4; - return show_ip_bgp_nexthop_table (vty, argv[idx_word]->arg, 1); -} - void bgp_scan_init (struct bgp *bgp) { @@ -573,10 +540,7 @@ void bgp_scan_vty_init (void) { install_element (VIEW_NODE, &show_ip_bgp_nexthop_cmd); - install_element (VIEW_NODE, &show_ip_bgp_nexthop_detail_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_cmd); install_element (VIEW_NODE, &show_ip_bgp_instance_all_nexthop_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_detail_cmd); } void diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e6aa2d2de8..788eb76e78 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -8754,7 +8754,7 @@ community_show_all_iterator (struct hash_backet *backet, struct vty *vty) /* Show BGP's community internal data. */ DEFUN (show_ip_bgp_community_info, show_ip_bgp_community_info_cmd, - "show ip bgp community-info", + "show [ip] bgp community-info", SHOW_STR IP_STR BGP_STR @@ -8772,7 +8772,7 @@ DEFUN (show_ip_bgp_community_info, DEFUN (show_ip_bgp_attr_info, show_ip_bgp_attr_info_cmd, - "show ip bgp attribute-info", + "show [ip] bgp attribute-info", SHOW_STR IP_STR BGP_STR From ebacb4edce50ef418e46b090288223adea89b2d0 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 29 Oct 2016 04:43:04 +0000 Subject: [PATCH 237/280] lib: Various minor improvements & bugfixes to CLI backend - Do not allow tab-completion on anything except words - Rewrite cmd_make_strvec to use strsep - Remove a few trailing whitespaces - Remove cmd_complete_command_lib Signed-off-by: Quentin Young --- lib/command.c | 124 +++++++++++++++++++++++++++----------------------- lib/command.h | 6 +-- lib/vty.c | 2 +- 3 files changed, 68 insertions(+), 64 deletions(-) diff --git a/lib/command.c b/lib/command.c index f9c4107745..a12591a8bc 100644 --- a/lib/command.c +++ b/lib/command.c @@ -240,56 +240,41 @@ install_node (struct cmd_node *node, node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp); } -/* Breaking up string into each command piece. I assume given - character is separated by a space character. Return value is a - vector which includes char ** data element. */ +/** + * Tokenizes a string, storing tokens in a vector. + * Whitespace is ignored. + * + * Delimiter string = " \n\r\t". + * + * @param string to tokenize + * @return tokenized string + */ vector cmd_make_strvec (const char *string) { - const char *cp, *start; - char *token; - int strlen; - vector strvec; + if (!string) return NULL; - if (string == NULL) + char *copy, *copystart; + copystart = copy = XSTRDUP (MTYPE_TMP, string); + + // skip leading whitespace + while (isspace ((int) *copy) && *copy != '\0') copy++; + + // if the entire string was whitespace or a comment, return + if (*copy == '\0' || *copy == '!' || *copy == '#') return NULL; - cp = string; + vector strvec = vector_init (VECTOR_MIN_SIZE); + const char *delim = " \n\r\t", *tok = NULL; + while (copy) + { + tok = strsep (©, delim); + if (*tok != '\0') + vector_set (strvec, XSTRDUP (MTYPE_STRVEC, tok)); + } - /* Skip white spaces. */ - while (isspace ((int) *cp) && *cp != '\0') - cp++; - - /* Return if there is only white spaces */ - if (*cp == '\0') - return NULL; - - if (*cp == '!' || *cp == '#') - return NULL; - - /* Prepare return vector. */ - strvec = vector_init (VECTOR_MIN_SIZE); - - /* Copy each command piece and set into vector. */ - while (1) - { - start = cp; - while (!(isspace ((int) *cp) || *cp == '\r' || *cp == '\n') && - *cp != '\0') - cp++; - strlen = cp - start; - token = XMALLOC (MTYPE_STRVEC, strlen + 1); - memcpy (token, start, strlen); - *(token + strlen) = '\0'; - vector_set (strvec, token); - - while ((isspace ((int) *cp) || *cp == '\n' || *cp == '\r') && - *cp != '\0') - cp++; - - if (*cp == '\0') - return strvec; - } + XFREE (MTYPE_TMP, copystart); + return strvec; } /* Free allocated string vector. */ @@ -350,7 +335,7 @@ install_element (enum node_type ntype, struct cmd_element *cmd) __func__); return; } - + cnode = vector_slot (cmdvec, ntype); if (cnode == NULL) @@ -359,17 +344,17 @@ install_element (enum node_type ntype, struct cmd_element *cmd) ntype); exit (EXIT_FAILURE); } - + if (hash_lookup (cnode->cmd_hash, cmd) != NULL) { - fprintf (stderr, + fprintf (stderr, "Multiple command installs to node %d of command:\n%s\n", ntype, cmd->string); return; } - + assert (hash_get (cnode->cmd_hash, cmd, hash_alloc_intern)); - + command_parse_format (cnode->cmdgraph, cmd); vector_set (cnode->cmd_vector, cmd); @@ -570,6 +555,7 @@ completions_to_vec (struct list *completions) sizeof (void *), &compare_completions); + // make the first element, if it is present if (cr) { vector_set_index (comps, vector_active (comps), NULL); @@ -586,6 +572,7 @@ completions_to_vec (struct list *completions) * @param vline the vectorized input line * @param vty the vty with the node to match on * @param status pointer to matcher status code + * @return vector of struct cmd_token * with possible completions */ static vector cmd_complete_command_real (vector vline, struct vty *vty, int *status) @@ -658,8 +645,20 @@ cmd_describe_command (vector vline, struct vty *vty, int *status) return cmd_complete_command_real (vline, vty, status); } +/** + * Generate possible tab-completions for the given input. This function only + * returns results that would result in a valid command if used as Readline + * completions (as is the case in vtysh). For instance, if the passed vline ends + * with '4.3.2', the strings 'A.B.C.D' and 'A.B.C.D/M' will _not_ be returned. + * + * @param vline vectorized input line + * @param vty the vty + * @param status location to store matcher status code in + * @return set of valid strings for use with Readline as tab-completions. + */ + char ** -cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) +cmd_complete_command (vector vline, struct vty *vty, int *status) { char **ret = NULL; int original_node = vty->node; @@ -675,7 +674,21 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) vector_set_index (input_line, index + offset, vector_lookup (vline, index)); // get token completions -- this is a copying operation - vector comps = cmd_complete_command_real (input_line, vty, status); + vector comps, initial_comps; + initial_comps = cmd_complete_command_real (input_line, vty, status); + + // filter out everything that is not suitable for a tab-completion + comps = vector_init (VECTOR_MIN_SIZE); + for (unsigned int i = 0; i < vector_active(initial_comps); i++) + { + struct cmd_token *token = vector_slot (initial_comps, i); + if (token->type == WORD_TKN) + vector_set (comps, token); + else + del_cmd_token (token); + } + vector_free (initial_comps); + if (!MATCHER_ERROR (*status)) { // copy completions text into an array of char* @@ -688,7 +701,9 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) vector_unset (comps, i); del_cmd_token (token); } - // set the last element to NULL, which vty/vtysh uses as a sentinel value + // set the last element to NULL, because this array is used in + // a Readline completion_generator function which expects NULL + // as a sentinel value ret[i] = NULL; vector_free (comps); comps = NULL; @@ -706,12 +721,6 @@ cmd_complete_command_lib (vector vline, struct vty *vty, int *status, int islib) return ret; } -char ** -cmd_complete_command (vector vline, struct vty *vty, int *status) -{ - return cmd_complete_command_lib (vline, vty, status, 0); -} - /* return parent node */ /* MUST eventually converge on CONFIG_NODE */ enum node_type @@ -1578,7 +1587,6 @@ DEFUN (config_enable_password, "Modify enable password parameters\n" "Assign the privileged level password\n" "Specifies a HIDDEN password will follow\n" - "dummy string \n" "The HIDDEN 'enable' password string\n") { int idx_8 = 2; diff --git a/lib/command.h b/lib/command.h index 4d60c5b4fe..bdf30b6f3c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -187,13 +187,10 @@ enum cmd_token_type */ struct cmd_token { - enum cmd_token_type type; // token type - + enum cmd_token_type type; // token type char *text; // token text char *desc; // token description - long long min, max; // for ranges - char *arg; // user input that matches this token }; @@ -419,7 +416,6 @@ extern void cmd_free_strvec (vector); extern char *cmd_concat_strvec (vector); extern vector cmd_describe_command (vector, struct vty *, int *status); extern char **cmd_complete_command (vector, struct vty *, int *status); -extern char **cmd_complete_command_lib (vector, struct vty *, int *status, int islib); extern const char *cmd_prompt (enum node_type); extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node); extern int config_from_file (struct vty *, FILE *, unsigned int *line_num); diff --git a/lib/vty.c b/lib/vty.c index 78bf0e720d..53a04851d5 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -923,7 +923,7 @@ vty_complete_command (struct vty *vty) if (isspace ((int) vty->buf[vty->length - 1])) vector_set (vline, NULL); - matched = cmd_complete_command_lib (vline, vty, &ret, 1); + matched = cmd_complete_command (vline, vty, &ret); cmd_free_strvec (vline); From e3e6107d9a159fa61c01274b7925e8e9ed580094 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 29 Oct 2016 05:34:10 +0000 Subject: [PATCH 238/280] bgpd: Consolidate aggregate-address commands Signed-off-by: Quentin Young --- bgpd/bgp_route.c | 241 +++++++++++------------------------------------ 1 file changed, 56 insertions(+), 185 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index b4eafd13fe..90b75080f1 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5447,130 +5447,27 @@ bgp_aggregate_set (struct vty *vty, const char *prefix_str, DEFUN (aggregate_address, aggregate_address_cmd, - "aggregate-address A.B.C.D/M", + "aggregate-address A.B.C.D/M []", "Configure BGP aggregate entries\n" - "Aggregate prefix\n") + "Aggregate prefix\n" + "Generate AS set path information\n" + "Filter more specific routes from updates\n" + "Filter more specific routes from updates\n" + "Generate AS set path information\n") { - int idx_ipv4_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), 0, 0); + int idx = 0; + argv_find (argv, argc, "A.B.C.D/M", &idx); + char *prefix = argv[idx]->arg; + int as_set = argv_find (argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0; + idx = 0; + int summary_only = argv_find (argv, argc, "summary-only", &idx) ? AGGREGATE_SUMMARY_ONLY : 0; + + return bgp_aggregate_set (vty, prefix, AFI_IP, bgp_node_safi (vty), summary_only, as_set); } DEFUN (aggregate_address_mask, aggregate_address_mask_cmd, - "aggregate-address A.B.C.D A.B.C.D", - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n") -{ - int idx_ipv4 = 1; - int idx_ipv4_2 = 2; - int ret; - char prefix_str[BUFSIZ]; - - ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); - - if (! ret) - { - vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_aggregate_set (vty, prefix_str, AFI_IP, bgp_node_safi (vty), - 0, 0); -} - -DEFUN (aggregate_address_summary_only, - aggregate_address_summary_only_cmd, - "aggregate-address A.B.C.D/M summary-only", - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n") -{ - int idx_ipv4_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), - AGGREGATE_SUMMARY_ONLY, 0); -} - -DEFUN (aggregate_address_mask_summary_only, - aggregate_address_mask_summary_only_cmd, - "aggregate-address A.B.C.D A.B.C.D summary-only", - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Filter more specific routes from updates\n") -{ - int idx_ipv4 = 1; - int idx_ipv4_2 = 2; - int ret; - char prefix_str[BUFSIZ]; - - ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); - - if (! ret) - { - vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_aggregate_set (vty, prefix_str, AFI_IP, bgp_node_safi (vty), - AGGREGATE_SUMMARY_ONLY, 0); -} - -DEFUN (aggregate_address_as_set, - aggregate_address_as_set_cmd, - "aggregate-address A.B.C.D/M as-set", - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Generate AS set path information\n") -{ - int idx_ipv4_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), - 0, AGGREGATE_AS_SET); -} - -DEFUN (aggregate_address_mask_as_set, - aggregate_address_mask_as_set_cmd, - "aggregate-address A.B.C.D A.B.C.D as-set", - "Configure BGP aggregate entries\n" - "Aggregate address\n" - "Aggregate mask\n" - "Generate AS set path information\n") -{ - int idx_ipv4 = 1; - int idx_ipv4_2 = 2; - int ret; - char prefix_str[BUFSIZ]; - - ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); - - if (! ret) - { - vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_aggregate_set (vty, prefix_str, AFI_IP, bgp_node_safi (vty), - 0, AGGREGATE_AS_SET); -} - -DEFUN (aggregate_address_as_set_summary, - aggregate_address_as_set_summary_cmd, - "aggregate-address A.B.C.D/M ", - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Generate AS set path information\n" - "Filter more specific routes from updates\n" - "Filter more specific routes from updates\n" - "Generate AS set path information\n") -{ - int idx_ipv4_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty), - AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); -} - -DEFUN (aggregate_address_mask_as_set_summary, - aggregate_address_mask_as_set_summary_cmd, - "aggregate-address A.B.C.D A.B.C.D ", + "aggregate-address A.B.C.D A.B.C.D []", "Configure BGP aggregate entries\n" "Aggregate address\n" "Aggregate mask\n" @@ -5579,12 +5476,17 @@ DEFUN (aggregate_address_mask_as_set_summary, "Filter more specific routes from updates\n" "Generate AS set path information\n") { - int idx_ipv4 = 1; - int idx_ipv4_2 = 2; - int ret; - char prefix_str[BUFSIZ]; + int idx = 0; + argv_find (argv, argc, "A.B.C.D", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "A.B.C.D", &idx); + char *mask = argv[idx]->arg; + int as_set = argv_find (argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0; + idx = 0; + int summary_only = argv_find (argv, argc, "summary-only", &idx) ? AGGREGATE_SUMMARY_ONLY : 0; - ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); + char prefix_str[BUFSIZ]; + int ret = netmask_str2prefix_str (prefix, mask, prefix_str); if (! ret) { @@ -5592,39 +5494,46 @@ DEFUN (aggregate_address_mask_as_set_summary, return CMD_WARNING; } - return bgp_aggregate_set (vty, prefix_str, AFI_IP, bgp_node_safi (vty), - AGGREGATE_SUMMARY_ONLY, AGGREGATE_AS_SET); + return bgp_aggregate_set (vty, prefix_str, AFI_IP, bgp_node_safi (vty), summary_only, as_set); } DEFUN (no_aggregate_address, no_aggregate_address_cmd, - "no aggregate-address A.B.C.D/M [as-set] [summary-only]", + "no aggregate-address A.B.C.D/M []", NO_STR "Configure BGP aggregate entries\n" "Aggregate prefix\n" "Generate AS set path information\n" - "Filter more specific routes from updates\n") + "Filter more specific routes from updates\n" + "Filter more specific routes from updates\n" + "Generate AS set path information\n") { - int idx_ipv4_prefixlen = 2; - return bgp_aggregate_unset (vty, argv[idx_ipv4_prefixlen]->arg, AFI_IP, bgp_node_safi (vty)); + int idx = 0; + argv_find (argv, argc, "A.B.C.D/M", &idx); + char *prefix = argv[idx]->arg; + return bgp_aggregate_unset (vty, prefix, AFI_IP, bgp_node_safi (vty)); } DEFUN (no_aggregate_address_mask, no_aggregate_address_mask_cmd, - "no aggregate-address A.B.C.D A.B.C.D [as-set] [summary-only]", + "no aggregate-address A.B.C.D A.B.C.D []", NO_STR "Configure BGP aggregate entries\n" "Aggregate address\n" "Aggregate mask\n" "Generate AS set path information\n" - "Filter more specific routes from updates\n") + "Filter more specific routes from updates\n" + "Filter more specific routes from updates\n" + "Generate AS set path information\n") { - int idx_ipv4 = 2; - int idx_ipv4_2 = 3; - int ret; - char prefix_str[BUFSIZ]; + int idx = 0; + argv_find (argv, argc, "A.B.C.D", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "A.B.C.D", &idx); + char *mask = argv[idx]->arg; - ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str); + char prefix_str[BUFSIZ]; + int ret = netmask_str2prefix_str (prefix, mask, prefix_str); if (! ret) { @@ -5637,47 +5546,29 @@ DEFUN (no_aggregate_address_mask, DEFUN (ipv6_aggregate_address, ipv6_aggregate_address_cmd, - "aggregate-address X:X::X:X/M", - "Configure BGP aggregate entries\n" - "Aggregate prefix\n") -{ - int idx_ipv6_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, 0, 0); -} - -DEFUN (ipv6_aggregate_address_summary_only, - ipv6_aggregate_address_summary_only_cmd, - "aggregate-address X:X::X:X/M summary-only", + "aggregate-address X:X::X:X/M [summary-only]", "Configure BGP aggregate entries\n" "Aggregate prefix\n" "Filter more specific routes from updates\n") { - int idx_ipv6_prefixlen = 1; - return bgp_aggregate_set (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST, - AGGREGATE_SUMMARY_ONLY, 0); + int idx = 0; + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + int sum_only = argv_find (argv, argc, "summary-only", &idx) ? AGGREGATE_SUMMARY_ONLY : 0; + return bgp_aggregate_set (vty, prefix, AFI_IP6, SAFI_UNICAST, sum_only, 0); } DEFUN (no_ipv6_aggregate_address, no_ipv6_aggregate_address_cmd, - "no aggregate-address X:X::X:X/M", + "no aggregate-address X:X::X:X/M [summary-only]", NO_STR "Configure BGP aggregate entries\n" "Aggregate prefix\n") { - int idx_ipv6_prefixlen = 2; - return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); -} - -DEFUN (no_ipv6_aggregate_address_summary_only, - no_ipv6_aggregate_address_summary_only_cmd, - "no aggregate-address X:X::X:X/M summary-only", - NO_STR - "Configure BGP aggregate entries\n" - "Aggregate prefix\n" - "Filter more specific routes from updates\n") -{ - int idx_ipv6_prefixlen = 2; - return bgp_aggregate_unset (vty, argv[idx_ipv6_prefixlen]->arg, AFI_IP6, SAFI_UNICAST); + int idx = 0; + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + return bgp_aggregate_unset (vty, prefix, AFI_IP6, SAFI_UNICAST); } /* Redistribute route treatment. */ @@ -10665,12 +10556,6 @@ bgp_route_init (void) install_element (BGP_NODE, &aggregate_address_cmd); install_element (BGP_NODE, &aggregate_address_mask_cmd); - install_element (BGP_NODE, &aggregate_address_summary_only_cmd); - install_element (BGP_NODE, &aggregate_address_mask_summary_only_cmd); - install_element (BGP_NODE, &aggregate_address_as_set_cmd); - install_element (BGP_NODE, &aggregate_address_mask_as_set_cmd); - install_element (BGP_NODE, &aggregate_address_as_set_summary_cmd); - install_element (BGP_NODE, &aggregate_address_mask_as_set_summary_cmd); install_element (BGP_NODE, &no_aggregate_address_cmd); install_element (BGP_NODE, &no_aggregate_address_mask_cmd); @@ -10689,12 +10574,6 @@ bgp_route_init (void) install_element (BGP_IPV4_NODE, &aggregate_address_cmd); install_element (BGP_IPV4_NODE, &aggregate_address_mask_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_summary_only_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_mask_summary_only_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_as_set_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_mask_as_set_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_as_set_summary_cmd); - install_element (BGP_IPV4_NODE, &aggregate_address_mask_as_set_summary_cmd); install_element (BGP_IPV4_NODE, &no_aggregate_address_cmd); install_element (BGP_IPV4_NODE, &no_aggregate_address_mask_cmd); @@ -10712,12 +10591,6 @@ bgp_route_init (void) install_element (BGP_IPV4M_NODE, &no_bgp_network_mask_natural_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_cmd); install_element (BGP_IPV4M_NODE, &aggregate_address_mask_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_summary_only_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_mask_summary_only_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_as_set_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_mask_as_set_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_as_set_summary_cmd); - install_element (BGP_IPV4M_NODE, &aggregate_address_mask_as_set_summary_cmd); install_element (BGP_IPV4M_NODE, &no_aggregate_address_cmd); install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_cmd); @@ -10767,9 +10640,7 @@ bgp_route_init (void) install_element (BGP_IPV6_NODE, &no_ipv6_bgp_network_cmd); install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_cmd); - install_element (BGP_IPV6_NODE, &ipv6_aggregate_address_summary_only_cmd); install_element (BGP_IPV6_NODE, &no_ipv6_aggregate_address_cmd); - install_element (BGP_IPV6_NODE, &no_ipv6_aggregate_address_summary_only_cmd); install_element (BGP_IPV6M_NODE, &ipv6_bgp_network_cmd); install_element (BGP_IPV6M_NODE, &no_ipv6_bgp_network_cmd); From 5b5231b091e69da604d1f28303dcc2cc3fc02976 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 31 Oct 2016 03:34:27 +0000 Subject: [PATCH 239/280] lib: Fix segfault on erroneous command Command completion vector should only be copied if it is non-null. Signed-off-by: Quentin Young --- lib/command.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/command.c b/lib/command.c index a12591a8bc..5e493a1c01 100644 --- a/lib/command.c +++ b/lib/command.c @@ -677,20 +677,21 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) vector comps, initial_comps; initial_comps = cmd_complete_command_real (input_line, vty, status); - // filter out everything that is not suitable for a tab-completion - comps = vector_init (VECTOR_MIN_SIZE); - for (unsigned int i = 0; i < vector_active(initial_comps); i++) - { - struct cmd_token *token = vector_slot (initial_comps, i); - if (token->type == WORD_TKN) - vector_set (comps, token); - else - del_cmd_token (token); - } - vector_free (initial_comps); - if (!MATCHER_ERROR (*status)) { + assert (initial_comps); + // filter out everything that is not suitable for a tab-completion + comps = vector_init (VECTOR_MIN_SIZE); + for (unsigned int i = 0; i < vector_active(initial_comps); i++) + { + struct cmd_token *token = vector_slot (initial_comps, i); + if (token->type == WORD_TKN) + vector_set (comps, token); + else + del_cmd_token (token); + } + vector_free (initial_comps); + // copy completions text into an array of char* ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); unsigned int i; From 42f914d4dd6e5e4452ade170fe2900d0fedb7803 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 31 Oct 2016 20:19:49 +0000 Subject: [PATCH 240/280] bgpd: Refactor community-list commands Part of an ongoing campaign to remove argv parsing helper functions. Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 400 ++++++++++++++++++++++++------------------------- 1 file changed, 192 insertions(+), 208 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 788eb76e78..cada6c3a7f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -11063,111 +11063,6 @@ community_list_perror (struct vty *vty, int ret) /* "community-list" keyword help string. */ #define COMMUNITY_LIST_STR "Add a community list entry\n" -static int -community_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style) -{ - int idx_number = 2; - int idx_name = 3; - int idx_permit_deny = 4; - int idx_aa_nn = 5; - int direct; - int ret; - char *str; - char *name; - - /* Check the list type. */ - if (strmatch(argv[idx_permit_deny]->text, "permit")) - direct = COMMUNITY_PERMIT; - else - direct = COMMUNITY_DENY; - - if (argv[idx_number]->type == RANGE_TKN) - { - name = argv[idx_number]->arg; - idx_permit_deny--; - idx_aa_nn--; - } - else - { - name = argv[idx_name]->arg; - - /* All digit name check. */ - if (all_digit (name)) - { - vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - /* Concat community string argument. */ - if (argc > idx_aa_nn) - str = argv_concat (argv, argc, idx_aa_nn); - else - str = NULL; - - /* When community_list_set() return nevetive value, it means - malformed community string. */ - ret = community_list_set (bgp_clist, name, str, direct, style); - - /* Free temporary community list string allocated by - argv_concat(). */ - if (str) - XFREE (MTYPE_TMP, str); - - if (ret < 0) - { - /* Display error string. */ - community_list_perror (vty, ret); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -static int -community_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style) -{ - /* CHECK ME dwalton finish this - int ret; - int direct = 0; - char *str = NULL; - - if (argc > 1) - { - // Check the list direct. - if (strncmp (argv[1], "p", 1) == 0) - direct = COMMUNITY_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) - direct = COMMUNITY_DENY; - else - { - vty_out (vty, "%% Matching condition must be permit or deny%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - // Concat community string argument. - str = argv_concat (argv, argc, 2); - } - - // Unset community list - ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); - - // Free temporary community list string allocated by argv_concat(). - if (str) - XFREE (MTYPE_TMP, str); - - if (ret < 0) - { - community_list_perror (vty, ret); - return CMD_WARNING; - } - * */ - - return CMD_SUCCESS; -} /* ip community-list standard */ DEFUN (ip_community_list_standard, @@ -11182,7 +11077,30 @@ DEFUN (ip_community_list_standard, "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); + char *cl_name_or_number = NULL; + int direct = 0; + int style = COMMUNITY_LIST_STANDARD; + + int idx = 0; + argv_find (argv, argc, "(1-99)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_name_or_number = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = community_list_set (bgp_clist, cl_name_or_number, str, direct, style); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + /* Display error string. */ + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } DEFUN (no_ip_community_list_standard_all, @@ -11198,13 +11116,35 @@ DEFUN (no_ip_community_list_standard_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); + int delete_all = 0; + + char *cl_name_or_number = NULL; + int direct = 0; + int style = COMMUNITY_LIST_STANDARD; + + int idx = 0; + argv_find (argv, argc, "(1-99)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_name_or_number = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } /* ip community-list expanded */ DEFUN (ip_community_list_expanded_all, ip_community_list_expanded_all_cmd, - "ip community-list <(100-500)|expanded WORD> LINE...", + "ip community-list <(100-500)|expanded WORD> AA:NN...", IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" @@ -11214,12 +11154,35 @@ DEFUN (ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); + char *cl_name_or_number = NULL; + int direct = 0; + int style = COMMUNITY_LIST_EXPANDED; + + int idx = 0; + argv_find (argv, argc, "(100-500)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_name_or_number = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = community_list_set (bgp_clist, cl_name_or_number, str, direct, style); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + /* Display error string. */ + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } DEFUN (no_ip_community_list_expanded_all, no_ip_community_list_expanded_all_cmd, - "no ip community-list <(100-500)|expanded WORD> LINE...", + "no ip community-list <(100-500)|expanded WORD> AA:NN...", NO_STR IP_STR COMMUNITY_LIST_STR @@ -11230,7 +11193,29 @@ DEFUN (no_ip_community_list_expanded_all, "Specify community to accept\n" COMMUNITY_VAL_STR) { - return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); + int delete_all = 0; + + char *cl_name_or_number = NULL; + int direct = 0; + int style = COMMUNITY_LIST_EXPANDED; + + int idx = 0; + argv_find (argv, argc, "(100-500)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_name_or_number = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = community_list_unset (bgp_clist, cl_name_or_number, str, direct, style, delete_all); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } static void @@ -11312,99 +11297,6 @@ DEFUN (show_ip_community_list_arg, return CMD_SUCCESS; } -static int -extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style) -{ - /* CHECK ME dwalton finish this - int ret; - int direct; - char *str; - - // Check the list type. - if (strncmp (argv[1], "p", 1) == 0) - direct = COMMUNITY_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) - direct = COMMUNITY_DENY; - else - { - vty_out (vty, "%% Matching condition must be permit or deny%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - // All digit name check. - if (reject_all_digit_name && all_digit (argv[0])) - { - vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); - return CMD_WARNING; - } - - // Concat community string argument. - if (argc > 1) - str = argv_concat (argv, argc, 2); - else - str = NULL; - - ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); - - // Free temporary community list string allocated by argv_concat(). - if (str) - XFREE (MTYPE_TMP, str); - - if (ret < 0) - { - community_list_perror (vty, ret); - return CMD_WARNING; - } - */ - return CMD_SUCCESS; -} - -static int -extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, - int style) -{ - /* CHECK ME dwalton finish this - int ret; - int direct = 0; - char *str = NULL; - - if (argc > 1) - { - // Check the list direct - if (strncmp (argv[1], "p", 1) == 0) - direct = COMMUNITY_PERMIT; - else if (strncmp (argv[1], "d", 1) == 0) - direct = COMMUNITY_DENY; - else - { - vty_out (vty, "%% Matching condition must be permit or deny%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - // Concat community string argument. - str = argv_concat (argv, argc, 2); - } - - // Unset community list. - ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, EXTCOMMUNITY_LIST_STANDARD, delete_all); - - // Free temporary community list string allocated by argv_concat(). - if (str) - XFREE (MTYPE_TMP, str); - - if (ret < 0) - { - community_list_perror (vty, ret); - return CMD_WARNING; - } - - */ - return CMD_SUCCESS; -} - /* "extcommunity-list" keyword help string. */ #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" @@ -11421,7 +11313,29 @@ DEFUN (ip_extcommunity_list_standard, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); + int style = EXTCOMMUNITY_LIST_STANDARD; + int direct = 0; + char *cl_number_or_name = NULL; + + int idx = 0; + argv_find (argv, argc, "(1-99)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_number_or_name = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = extcommunity_list_set (bgp_clist, cl_number_or_name, str, direct, style); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } DEFUN (ip_extcommunity_list_name_expanded, @@ -11436,7 +11350,29 @@ DEFUN (ip_extcommunity_list_name_expanded, "Specify community to accept\n" "An ordered list as a regular-expression\n") { - return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); + int style = EXTCOMMUNITY_LIST_EXPANDED; + int direct = 0; + char *cl_number_or_name = NULL; + + int idx = 0; + argv_find (argv, argc, "(100-500)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_number_or_name = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "LINE", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = extcommunity_list_set (bgp_clist, cl_number_or_name, str, direct, style); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } DEFUN (no_ip_extcommunity_list_standard_all, @@ -11452,7 +11388,31 @@ DEFUN (no_ip_extcommunity_list_standard_all, "Specify community to accept\n" EXTCOMMUNITY_VAL_STR) { - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); + int deleteall = 0; + + int style = EXTCOMMUNITY_LIST_STANDARD; + int direct = 0; + char *cl_number_or_name = NULL; + + int idx = 0; + argv_find (argv, argc, "(1-99)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_number_or_name = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "AA:NN", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = extcommunity_list_unset (bgp_clist, cl_number_or_name, str, direct, style, deleteall); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } DEFUN (no_ip_extcommunity_list_expanded_all, @@ -11468,7 +11428,31 @@ DEFUN (no_ip_extcommunity_list_expanded_all, "Specify community to accept\n" "An ordered list as a regular-expression\n") { - return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); + int deleteall = 0; + + int style = EXTCOMMUNITY_LIST_EXPANDED; + int direct = 0; + char *cl_number_or_name = NULL; + + int idx = 0; + argv_find (argv, argc, "(100-500)", &idx); + argv_find (argv, argc, "WORD", &idx); + cl_number_or_name = argv[idx]->arg; + direct = argv_find (argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; + argv_find (argv, argc, "LINE", &idx); + char *str = argv_concat (argv, argc, idx); + + int ret = extcommunity_list_unset (bgp_clist, cl_number_or_name, str, direct, style, deleteall); + + XFREE (MTYPE_TMP, str); + + if (ret < 0) + { + community_list_perror (vty, ret); + return CMD_WARNING; + } + + return CMD_SUCCESS; } static void From 921e4a7cae4ae2d32cbf3138244a4b3ca806f439 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 3 Nov 2016 19:16:42 +0000 Subject: [PATCH 241/280] bgpd: Fix off-by-one when extracting netmask Signed-off-by: Quentin Young --- bgpd/bgp_route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 90b75080f1..22081e0ff7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5478,7 +5478,7 @@ DEFUN (aggregate_address_mask, { int idx = 0; argv_find (argv, argc, "A.B.C.D", &idx); - char *prefix = argv[idx]->arg; + char *prefix = argv[idx++]->arg; argv_find (argv, argc, "A.B.C.D", &idx); char *mask = argv[idx]->arg; int as_set = argv_find (argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0; @@ -5528,7 +5528,7 @@ DEFUN (no_aggregate_address_mask, { int idx = 0; argv_find (argv, argc, "A.B.C.D", &idx); - char *prefix = argv[idx]->arg; + char *prefix = argv[idx++]->arg; argv_find (argv, argc, "A.B.C.D", &idx); char *mask = argv[idx]->arg; From 40e718b50f702f78ffa89d1ea4e3203700326b11 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 3 Nov 2016 19:17:33 +0000 Subject: [PATCH 242/280] bgpd: Condense `neighbor ... attribute-unchanged` commands Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 309 +++++++------------------------------------------ 1 file changed, 42 insertions(+), 267 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index cada6c3a7f..e738d1ec6d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3990,237 +3990,84 @@ DEFUN (no_neighbor_nexthop_local_unchanged, DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, - "neighbor attribute-unchanged", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n") -{ - int idx_peer = 1; - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), - (PEER_FLAG_AS_PATH_UNCHANGED | - PEER_FLAG_NEXTHOP_UNCHANGED | - PEER_FLAG_MED_UNCHANGED)); -} - -DEFUN (neighbor_attr_unchanged1, - neighbor_attr_unchanged1_cmd, - "neighbor attribute-unchanged ", + "neighbor attribute-unchanged [] [] []", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n") -{ - int idx_peer = 1; - int idx_attribute = 3; - u_int16_t flags = 0; - - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) - SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) - SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) - SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); -} - -DEFUN (neighbor_attr_unchanged2, - neighbor_attr_unchanged2_cmd, - "neighbor attribute-unchanged as-path ", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") -{ - int idx_peer = 1; - int idx_attribute = 4; - u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - - if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) - SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) - SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); - -} - -DEFUN (neighbor_attr_unchanged3, - neighbor_attr_unchanged3_cmd, - "neighbor attribute-unchanged next-hop ", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n") -{ - int idx_peer = 1; - int idx_attribute = 4; - u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) - SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) - SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); -} - -DEFUN (neighbor_attr_unchanged4, - neighbor_attr_unchanged4_cmd, - "neighbor attribute-unchanged med ", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" "Med attribute\n" "As-path attribute\n" - "Nexthop attribute\n") + "Nexthop attribute\n" + "Med attribute\n" + "As-path attribute\n" + "Nexthop attribute\n" + "Med attribute\n") { - int idx_peer = 1; - int idx_attribute = 4; - u_int16_t flags = PEER_FLAG_MED_UNCHANGED; + int idx = 0; + char *peer = argv[1]->arg; + u_int16_t flags = 0; - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) + if (argv_find (argv, argc, "as-path", &idx)) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) + idx = 0; + if (argv_find (argv, argc, "next-hop", &idx)) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); + idx = 0; + if (argv_find (argv, argc, "med", &idx)) + SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); + if (!flags) // no flags means all of them! + { + SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); + SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); + SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); + } + + return peer_af_flag_set_vty (vty, peer, bgp_node_afi (vty), bgp_node_safi (vty), flags); } DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor attribute-unchanged [as-path] [next-hop] [med]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Med attribute\n" - "Nexthop attribute\n") -{ - int idx_peer = 2; - return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), - (PEER_FLAG_AS_PATH_UNCHANGED | - PEER_FLAG_NEXTHOP_UNCHANGED | - PEER_FLAG_MED_UNCHANGED)); -} - -DEFUN (no_neighbor_attr_unchanged1, - no_neighbor_attr_unchanged1_cmd, - "no neighbor attribute-unchanged ", + "no neighbor attribute-unchanged [] [] []", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" + "Med attribute\n" + "As-path attribute\n" + "Nexthop attribute\n" + "Med attribute\n" + "As-path attribute\n" + "Nexthop attribute\n" "Med attribute\n") { - int idx_peer = 2; - int idx_attribute = 4; + int idx = 0; + char *peer = argv[2]->arg; u_int16_t flags = 0; - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) + if (argv_find (argv, argc, "as-path", &idx)) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) + idx = 0; + if (argv_find (argv, argc, "next-hop", &idx)) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) + idx = 0; + if (argv_find (argv, argc, "med", &idx)) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); -} - -DEFUN (no_neighbor_attr_unchanged2, - no_neighbor_attr_unchanged2_cmd, - "no neighbor attribute-unchanged as-path ", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") -{ - int idx_peer = 2; - int idx_attribute = 5; - u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; - - if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) - SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) - SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - - return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); -} - -DEFUN (no_neighbor_attr_unchanged3, - no_neighbor_attr_unchanged3_cmd, - "no neighbor attribute-unchanged next-hop ", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Nexthop attribute\n" - "As-path attribute\n" - "Med attribute\n") -{ - int idx_peer = 2; - int idx_attribute = 5; - u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; - - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) + if (!flags) // no flags means all of them! + { SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "med", 1) == 0) - SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); - - return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); -} - -DEFUN (no_neighbor_attr_unchanged4, - no_neighbor_attr_unchanged4_cmd, - "no neighbor attribute-unchanged med ", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "Med attribute\n" - "As-path attribute\n" - "Nexthop attribute\n") -{ - int idx_peer = 2; - int idx_attribute = 5; - u_int16_t flags = PEER_FLAG_MED_UNCHANGED; - - if (strncmp (argv[idx_attribute]->arg, "as-path", 1) == 0) - SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); - else if (strncmp (argv[idx_attribute]->arg, "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); + SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); + } - return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), flags); + return peer_af_flag_unset_vty (vty, peer, bgp_node_afi (vty), bgp_node_safi (vty), flags); } - - - - - /* EBGP multihop configuration. */ static int peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, @@ -10263,97 +10110,25 @@ bgp_vty_init (void) /* "neighbor attribute-unchanged" commands. */ install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); /* "nexthop-local unchanged" commands */ install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); From 34f1f6dc78ab1a8a5ee9c372d0a42fb15d3dc9a1 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 3 Nov 2016 19:18:02 +0000 Subject: [PATCH 243/280] lib: Remove node debug message on `list` output Signed-off-by: Quentin Young --- lib/command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/command.c b/lib/command.c index 5e493a1c01..8eee923144 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1270,7 +1270,6 @@ DEFUN (config_list, "Print command list\n" "Print all possible command permutations\n") { - vty_out (vty, "Current node id: %d%s", vty->node, VTY_NEWLINE); struct cmd_node *node = vector_slot (cmdvec, vty->node); if ((strmatch (argv[0]->text, "list") && argc == 2) || From 843d75b1a8fe63053a2efdbbb92bc4f48af95f18 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 3 Nov 2016 23:02:21 +0000 Subject: [PATCH 244/280] vtysh: Condense a few address-family commands Signed-off-by: Quentin Young --- vtysh/vtysh.c | 60 +++++++++++---------------------------------------- 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 6e6a361ff4..708eb85b15 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1094,20 +1094,9 @@ DEFUNSH (VTYSH_BGPD, DEFUNSH (VTYSH_BGPD, address_family_vpnv4, address_family_vpnv4_cmd, - "address-family vpnv4", + "address-family vpnv4 [unicast]", "Enter Address Family command mode\n" - "Address family\n") -{ - vty->node = BGP_VPNV4_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, - address_family_vpnv4_unicast, - address_family_vpnv4_unicast_cmd, - "address-family vpnv4 unicast", - "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_VPNV4_NODE; @@ -1117,20 +1106,9 @@ DEFUNSH (VTYSH_BGPD, DEFUNSH (VTYSH_BGPD, address_family_vpnv6, address_family_vpnv6_cmd, - "address-family vpnv6", + "address-family vpnv6 [unicast]", "Enter Address Family command mode\n" - "Address family\n") -{ - vty->node = BGP_VPNV6_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, - address_family_vpnv6_unicast, - address_family_vpnv6_unicast_cmd, - "address-family vpnv6 unicast", - "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_VPNV6_NODE; @@ -1142,7 +1120,7 @@ DEFUNSH (VTYSH_BGPD, address_family_encap_cmd, "address-family encap", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_ENCAP_NODE; return CMD_SUCCESS; @@ -1153,7 +1131,7 @@ DEFUNSH (VTYSH_BGPD, address_family_encapv4_cmd, "address-family encapv4", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_ENCAP_NODE; return CMD_SUCCESS; @@ -1164,7 +1142,7 @@ DEFUNSH (VTYSH_BGPD, address_family_encapv6_cmd, "address-family encapv6", "Enter Address Family command mode\n" - "Address family\n") + "Address Family\n") { vty->node = BGP_ENCAPV6_NODE; return CMD_SUCCESS; @@ -1175,7 +1153,7 @@ DEFUNSH (VTYSH_BGPD, address_family_ipv4_unicast_cmd, "address-family ipv4 unicast", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_IPV4_NODE; @@ -1187,7 +1165,7 @@ DEFUNSH (VTYSH_BGPD, address_family_ipv4_multicast_cmd, "address-family ipv4 multicast", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_IPV4M_NODE; @@ -1197,20 +1175,9 @@ DEFUNSH (VTYSH_BGPD, DEFUNSH (VTYSH_BGPD, address_family_ipv6, address_family_ipv6_cmd, - "address-family ipv6", + "address-family ipv6 [unicast]", "Enter Address Family command mode\n" - "Address family\n") -{ - vty->node = BGP_IPV6_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, - address_family_ipv6_unicast, - address_family_ipv6_unicast_cmd, - "address-family ipv6 unicast", - "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_IPV6_NODE; @@ -1222,7 +1189,7 @@ DEFUNSH (VTYSH_BGPD, address_family_ipv6_multicast_cmd, "address-family ipv6 multicast", "Enter Address Family command mode\n" - "Address family\n" + "Address Family\n" "Address Family Modifier\n") { vty->node = BGP_IPV6M_NODE; @@ -3252,9 +3219,7 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &router_isis_cmd); install_element (CONFIG_NODE, &router_bgp_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); - install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); install_element (BGP_NODE, &address_family_encap_cmd); install_element (BGP_NODE, &address_family_encapv6_cmd); #if defined(ENABLE_BGP_VNC) @@ -3264,7 +3229,6 @@ vtysh_init_vty (void) install_element (BGP_NODE, &address_family_ipv4_unicast_cmd); install_element (BGP_NODE, &address_family_ipv4_multicast_cmd); install_element (BGP_NODE, &address_family_ipv6_cmd); - install_element (BGP_NODE, &address_family_ipv6_unicast_cmd); install_element (BGP_NODE, &address_family_ipv6_multicast_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); From fa496b0a2e5e980664365fd34ba3d066e79f2a94 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 3 Nov 2016 23:06:59 +0000 Subject: [PATCH 245/280] vtysh: Add address-family stomps Signed-off-by: Quentin Young --- vtysh/extract.pl.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 0c06aee4f4..8850ec0e84 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -79,6 +79,8 @@ $ignore{'"terminal monitor"'} = "ignore"; $ignore{'"terminal no monitor"'} = "ignore"; $ignore{'"show history"'} = "ignore"; $ignore{'"router ospf [(1-65535)]"'} = "ignore"; +$ignore{'"address-family vpnv6 [unicast]"'} = "ignore"; +$ignore{'"address-family vpnv4 [unicast]"'} = "ignore"; my $cli_stomp = 0; From 2328428d2004fc83f3d3ca31d4a482d64ec149f3 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 4 Nov 2016 20:16:07 +0000 Subject: [PATCH 246/280] ospfd, lib: Fix `no pce address` syntax And change parser debugging messages to zlog_debug Signed-off-by: Quentin Young --- lib/command_parse.y | 2 +- ospfd/ospf_ri.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/command_parse.y b/lib/command_parse.y index 8da08c36d1..680a74ccd2 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -459,7 +459,7 @@ doc_next (struct cmd_element *el) const char *piece = docstr ? strsep (&docstr, "\n") : ""; if (*piece == 0x03) { - zlog_warn ("Ran out of docstring while parsing '%s'", el->string); + zlog_debug ("Ran out of docstring while parsing '%s'", el->string); piece = ""; } diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 30d203f5b5..28957e04c6 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -1307,7 +1307,7 @@ DEFUN (pce_address, DEFUN (no_pce_address, no_pce_address_cmd, - "no pce address {A.B.C.D}", + "no pce address [A.B.C.D]", NO_STR PCE_STR "Disable PCE address\n" @@ -1358,7 +1358,7 @@ DEFUN (pce_path_scope, DEFUN (no_pce_path_scope, no_pce_path_scope_cmd, - "no pce scope {BITPATTERN}", + "no pce scope [BITPATTERN]", NO_STR PCE_STR "Disable PCE path scope\n" From 16cedbb01f6d59b28c704278efc72afbfb5abfd2 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 4 Nov 2016 23:03:03 +0000 Subject: [PATCH 247/280] all: Fix underfull doc strings, part 1 Add missing docstrings and separating \n. Also eat some low-hanging refactoring fruit. Signed-off-by: Quentin Young --- bgpd/bgp_route.c | 9 ++- bgpd/bgp_vty.c | 38 ++++++---- isisd/isis_vty.c | 167 +++++++++++++---------------------------- isisd/isisd.c | 14 ++++ lib/command.h | 8 -- ospf6d/ospf6_lsa.c | 11 ++- ospf6d/ospf6_route.c | 4 +- ospf6d/ospf6_top.c | 11 +-- ospf6d/ospf6d.c | 4 +- ospfd/ospf_dump.c | 6 +- ospfd/ospf_vty.c | 3 +- vtysh/vtysh.c | 4 +- zebra/debug.c | 87 ++++++--------------- zebra/zebra_routemap.c | 35 +++++++-- 14 files changed, 177 insertions(+), 224 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 351c6ca55b..6c71fd525c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5502,7 +5502,8 @@ DEFUN (no_ipv6_aggregate_address, "no aggregate-address X:X::X:X/M [summary-only]", NO_STR "Configure BGP aggregate entries\n" - "Aggregate prefix\n") + "Aggregate prefix\n" + "Filter more specific routes from updates\n") { int idx = 0; argv_find (argv, argc, "X:X::X:X/M", &idx); @@ -10112,7 +10113,11 @@ DEFUN (bgp_damp_unset, "no bgp dampening [(1-45) [(1-20000) (1-20000) (1-255)]]", NO_STR "BGP Specific commands\n" - "Enable route-flap dampening\n") + "Enable route-flap dampening\n" + "Half-life time for the penalty\n" + "Value to start reusing a route\n" + "Value to start suppressing a route\n" + "Maximum duration to suppress a stable route\n") { struct bgp *bgp; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e738d1ec6d..715c84aa03 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2387,7 +2387,9 @@ DEFUN (bgp_listen_range, "BGP specific commands\n" "Configure BGP Dynamic Neighbors\n" "add a listening range for Dynamic Neighbors\n" - LISTEN_RANGE_ADDR_STR) + NEIGHBOR_ADDR_STR + "Member of the peer-group\n" + "Peer-group name\n") { int idx_ipv4_ipv6_prefixlen = 3; int idx_word = 5; @@ -2762,7 +2764,7 @@ DEFUN (neighbor_interface_config, "Interface name or neighbor tag\n" "Enable BGP on interface\n" "Member of the peer-group\n" - "peer-group name\n") + "Peer-group name\n") { int idx_word = 1; int idx_peer_group_word = 4; @@ -2783,7 +2785,7 @@ DEFUN (neighbor_interface_config_v6only, "Enable BGP on interface\n" "Enable BGP with v6 link-local only\n" "Member of the peer-group\n" - "peer-group name\n") + "Peer-group name\n") { int idx_word = 1; int idx_peer_group_word = 5; @@ -2920,7 +2922,8 @@ DEFUN (no_neighbor_interface_config, "Configure BGP on interface\n" "Enable BGP with v6 link-local only\n" "Member of the peer-group\n" - "peer-group name\n" + "Peer-group name\n" + "Specify remote AS\n" AS_STR) { int idx_word = 2; @@ -3155,7 +3158,8 @@ DEFUN (no_neighbor_password, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Set a password\n") + "Set a password\n" + "The password\n") { int idx_peer = 2; struct peer *peer; @@ -3222,7 +3226,7 @@ DEFUN (neighbor_set_peer_group, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Member of the peer-group\n" - "peer-group name\n") + "Peer-group name\n") { int idx_peer = 1; int idx_word = 3; @@ -3290,7 +3294,7 @@ DEFUN (no_neighbor_set_peer_group, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Member of the peer-group\n" - "peer-group name\n") + "Peer-group name\n") { int idx_peer = 2; int idx_word = 4; @@ -3708,7 +3712,7 @@ DEFUN (neighbor_remove_private_as_all_replace_as, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers" + "Apply to all AS numbers\n" "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 1; @@ -3738,7 +3742,7 @@ DEFUN (no_neighbor_remove_private_as_all, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers") + "Apply to all AS numbers\n") { int idx_peer = 2; return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), @@ -3768,7 +3772,7 @@ DEFUN (no_neighbor_remove_private_as_all_replace_as, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers" + "Apply to all AS numbers\n" "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 2; @@ -4771,7 +4775,7 @@ DEFUN (no_neighbor_interface, "no neighbor interface WORD", NO_STR NEIGHBOR_STR - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR2 "Interface\n" "Interface name\n") { @@ -5311,11 +5315,11 @@ DEFUN (neighbor_maximum_prefix_threshold_restart, "neighbor maximum-prefix (1-4294967295) (1-100) restart (1-65535)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" + "Maximum number of prefixes to accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes") + "Restart interval in minutes\n") { int idx_peer = 1; int idx_number = 3; @@ -5331,11 +5335,11 @@ DEFUN (no_neighbor_maximum_prefix, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" + "Maximum number of prefixes to accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes" + "Restart interval in minutes\n" "Only give warning message when limit is exceeded\n") { int idx_peer = 2; @@ -5409,6 +5413,7 @@ DEFUN (neighbor_ttl_security, "neighbor ttl-security hops (1-254)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP ttl-security parameters\n" "Specify the maximum number of hops to the BGP peer\n") { int idx_peer = 1; @@ -5441,6 +5446,7 @@ DEFUN (no_neighbor_ttl_security, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP ttl-security parameters\n" "Specify the maximum number of hops to the BGP peer\n") { int idx_peer = 2; @@ -5885,6 +5891,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, BGP_STR "Address Family\n" "Address Family Modifier\n" + "Address Family Modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix\n") { @@ -5904,6 +5911,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix, BGP_INSTANCE_HELP_STR "Address Family\n" "Address Family Modifier\n" + "Address Family Modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix\n") { diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 492572bddf..df13696b20 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -1394,6 +1394,7 @@ DEFUN (set_attached_bit, DEFUN (no_set_attached_bit, no_set_attached_bit_cmd, "no set-attached-bit", + NO_STR "Reset attached bit\n") { VTY_DECLVAR_CONTEXT (isis_area, area); @@ -1807,69 +1808,45 @@ area_max_lsp_lifetime_set(struct vty *vty, int level, DEFUN (max_lsp_lifetime, max_lsp_lifetime_cmd, - "max-lsp-lifetime (350-65535)", - "Maximum LSP lifetime\n" + "max-lsp-lifetime [] (350-65535)", + "Maximum LSP lifetime for Level 1 only\n" + "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime in seconds\n") { - int idx_number = 1; - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; + + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; + + argv_find (argv, argc, "(350-65535)", &idx); + int lifetime = atoi(argv[idx]->arg); + + return area_max_lsp_lifetime_set(vty, level, lifetime); } DEFUN (no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, - "no max-lsp-lifetime [(350-65535)]", + "no max-lsp-lifetime [] [(350-65535)]", NO_STR - "Maximum LSP lifetime\n" + "Maximum LSP lifetime for Level 1 only\n" + "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, - DEFAULT_LSP_LIFETIME); + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; + + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; + + return area_max_lsp_lifetime_set(vty, level, DEFAULT_LSP_LIFETIME); } - -DEFUN (max_lsp_lifetime_l1, - max_lsp_lifetime_l1_cmd, - "max-lsp-lifetime level-1 (350-65535)", - "Maximum LSP lifetime for Level 1 only\n" - "LSP lifetime for Level 1 only in seconds\n") -{ - int idx_number = 2; - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); -} - - -DEFUN (no_max_lsp_lifetime_l1, - no_max_lsp_lifetime_l1_cmd, - "no max-lsp-lifetime level-1 [(350-65535)]", - NO_STR - "LSP lifetime for Level 1 only in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, DEFAULT_LSP_LIFETIME); -} - - -DEFUN (max_lsp_lifetime_l2, - max_lsp_lifetime_l2_cmd, - "max-lsp-lifetime level-2 (350-65535)", - "Maximum LSP lifetime for Level 2 only\n" - "LSP lifetime for Level 2 only in seconds\n") -{ - int idx_number = 2; - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); -} - - -DEFUN (no_max_lsp_lifetime_l2, - no_max_lsp_lifetime_l2_cmd, - "no max-lsp-lifetime level-2 [(350-65535)]", - NO_STR - "LSP lifetime for Level 2 only in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, DEFAULT_LSP_LIFETIME); -} - - static int area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) { @@ -1910,73 +1887,45 @@ area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) DEFUN (lsp_refresh_interval, lsp_refresh_interval_cmd, - "lsp-refresh-interval (1-65235)", + "lsp-refresh-interval [] (1-65235)", "LSP refresh interval\n" + "LSP refresh interval for Level 1 only\n" + "LSP refresh interval for Level 2 only\n" "LSP refresh interval in seconds\n") { - int idx_number = 1; - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg)); -} + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; + unsigned int interval = 0; + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; + + interval = atoi(argv[argc-1]->arg); + return area_lsp_refresh_interval_set(vty, level, interval); +} DEFUN (no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, - "no lsp-refresh-interval [(1-65235)]", + "no lsp-refresh-interval [] [(1-65235)]", NO_STR "LSP refresh interval\n" + "LSP refresh interval for Level 1 only\n" + "LSP refresh interval for Level 2 only\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, - DEFAULT_MAX_LSP_GEN_INTERVAL); + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; + + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; + + return area_lsp_refresh_interval_set(vty, level, DEFAULT_MAX_LSP_GEN_INTERVAL); } - -DEFUN (lsp_refresh_interval_l1, - lsp_refresh_interval_l1_cmd, - "lsp-refresh-interval level-1 (1-65235)", - "LSP refresh interval for Level 1 only\n" - "LSP refresh interval for Level 1 only in seconds\n") -{ - int idx_number = 2; - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg)); -} - - -DEFUN (no_lsp_refresh_interval_l1, - no_lsp_refresh_interval_l1_cmd, - "no lsp-refresh-interval level-1 [(1-65235)]", - NO_STR - "LSP refresh interval for Level 1 only\n" - "LSP refresh interval for Level 1 only in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, - DEFAULT_MAX_LSP_GEN_INTERVAL); -} - - -DEFUN (lsp_refresh_interval_l2, - lsp_refresh_interval_l2_cmd, - "lsp-refresh-interval level-2 (1-65235)", - "LSP refresh interval for Level 2 only\n" - "LSP refresh interval for Level 2 only in seconds\n") -{ - int idx_number = 2; - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg)); -} - - -DEFUN (no_lsp_refresh_interval_l2, - no_lsp_refresh_interval_l2_cmd, - "no lsp-refresh-interval level-2 [(1-65235)]", - NO_STR - "LSP refresh interval for Level 2 only\n" - "LSP refresh interval for Level 2 only in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, - DEFAULT_MAX_LSP_GEN_INTERVAL); -} - - static int area_passwd_set(struct vty *vty, int level, int (*type_set)(struct isis_area *area, int level, @@ -2192,17 +2141,9 @@ isis_vty_init (void) install_element (ISIS_NODE, &max_lsp_lifetime_cmd); install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd); - install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd); - install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd); install_element (ISIS_NODE, &lsp_refresh_interval_cmd); install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd); - install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd); - install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd); install_element (ISIS_NODE, &area_passwd_md5_cmd); install_element (ISIS_NODE, &area_passwd_clear_cmd); diff --git a/isisd/isisd.c b/isisd/isisd.c index 143e380016..ff3d9c791b 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -907,6 +907,7 @@ DEFUN (debug_isis_adj, DEFUN (no_debug_isis_adj, no_debug_isis_adj_cmd, "no debug isis adj-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Adjacency related packets\n") @@ -933,6 +934,7 @@ DEFUN (debug_isis_csum, DEFUN (no_debug_isis_csum, no_debug_isis_csum_cmd, "no debug isis checksum-errors", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS LSP checksum errors\n") @@ -959,6 +961,7 @@ DEFUN (debug_isis_lupd, DEFUN (no_debug_isis_lupd, no_debug_isis_lupd_cmd, "no debug isis local-updates", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS local update packets\n") @@ -985,6 +988,7 @@ DEFUN (debug_isis_err, DEFUN (no_debug_isis_err, no_debug_isis_err_cmd, "no debug isis protocol-errors", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS LSP protocol errors\n") @@ -1011,6 +1015,7 @@ DEFUN (debug_isis_snp, DEFUN (no_debug_isis_snp, no_debug_isis_snp_cmd, "no debug isis snp-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS CSNP/PSNP packets\n") @@ -1037,6 +1042,7 @@ DEFUN (debug_isis_upd, DEFUN (no_debug_isis_upd, no_debug_isis_upd_cmd, "no debug isis update-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Update related packets\n") @@ -1063,6 +1069,7 @@ DEFUN (debug_isis_spfevents, DEFUN (no_debug_isis_spfevents, no_debug_isis_spfevents_cmd, "no debug isis spf-events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Shortest Path First Events\n") @@ -1089,6 +1096,7 @@ DEFUN (debug_isis_spfstats, DEFUN (no_debug_isis_spfstats, no_debug_isis_spfstats_cmd, "no debug isis spf-statistics", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS SPF Timing and Statistic Data\n") @@ -1115,6 +1123,7 @@ DEFUN (debug_isis_spftrigg, DEFUN (no_debug_isis_spftrigg, no_debug_isis_spftrigg_cmd, "no debug isis spf-triggers", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS SPF triggering events\n") @@ -1141,6 +1150,7 @@ DEFUN (debug_isis_rtevents, DEFUN (no_debug_isis_rtevents, no_debug_isis_rtevents_cmd, "no debug isis route-events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Route related events\n") @@ -1167,6 +1177,7 @@ DEFUN (debug_isis_events, DEFUN (no_debug_isis_events, no_debug_isis_events_cmd, "no debug isis events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Events\n") @@ -1193,6 +1204,7 @@ DEFUN (debug_isis_packet_dump, DEFUN (no_debug_isis_packet_dump, no_debug_isis_packet_dump_cmd, "no debug isis packet-dump", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS packet dump\n") @@ -1219,6 +1231,7 @@ DEFUN (debug_isis_lsp_gen, DEFUN (no_debug_isis_lsp_gen, no_debug_isis_lsp_gen_cmd, "no debug isis lsp-gen", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS generation of own LSPs\n") @@ -1245,6 +1258,7 @@ DEFUN (debug_isis_lsp_sched, DEFUN (no_debug_isis_lsp_sched, no_debug_isis_lsp_sched_cmd, "no debug isis lsp-sched", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS scheduling of LSP generation\n") diff --git a/lib/command.h b/lib/command.h index bdf30b6f3c..7b1f7d9fb5 100644 --- a/lib/command.h +++ b/lib/command.h @@ -363,7 +363,6 @@ struct cmd_element #define IFNAME_STR "Interface name(e.g. ep0)\n" #define IP6_STR "IPv6 Information\n" #define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" -#define OSPF6_ROUTER_STR "Enable a routing process\n" #define OSPF6_INSTANCE_STR "(1-65535) Instance ID\n" #define SECONDS_STR "(1-65535) Seconds\n" #define ROUTE_STR "Routing Table\n" @@ -393,13 +392,6 @@ struct cmd_element #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ -/* Dynamic neighbor (listen range) configuration */ -#ifdef HAVE_IPV6 -#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" -#else -#define LISTEN_RANGE_ADDR_STR "Neighbor address\n" -#endif /* HAVE_IPV6 */ - /* Prototypes. */ extern void install_node (struct cmd_node *, int (*) (struct vty *)); extern void install_default (enum node_type); diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 87e50bcf86..ef56028a3b 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -866,8 +866,15 @@ DEFUN (no_debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n" - ) + "Display Router LSAs\n" + "Display Network LSAs\n" + "Display Inter-Area-Prefix LSAs\n" + "Display As-External LSAs\n" + "Display Link LSAs\n" + "Display Intra-Area-Prefix LSAs\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { int idx_lsa = 4; int idx_type = 5; diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 3263f4a06c..2f416e2689 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -1567,8 +1567,8 @@ DEFUN (debug_ospf6_route, "debug ospf6 route ", DEBUG_STR OSPF6_STR + "Debug routes\n" "Debug route table calculation\n" - "Debug detail\n" "Debug intra-area route calculation\n" "Debug inter-area route calculation\n" "Debug route memory use\n" @@ -1595,8 +1595,10 @@ DEFUN (no_debug_ospf6_route, NO_STR DEBUG_STR OSPF6_STR + "Debug routes\n" "Debug route table calculation\n" "Debug intra-area route calculation\n" + "Debug inter-area route calculation\n" "Debug route memory use\n") { int idx_type = 4; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 5471e58622..32ec2731d6 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -305,16 +305,9 @@ DEFUN (no_router_ospf6, no_router_ospf6_cmd, "no router ospf6", NO_STR - OSPF6_ROUTER_STR) + ROUTER_STR + OSPF6_STR) { - if (ospf6 == NULL) - vty_out (vty, "OSPFv3 is not configured%s", VNL); - else - { - ospf6_delete (ospf6); - ospf6 = NULL; - } - /* return to config node . */ vty->node = CONFIG_NODE; vty->index = NULL; diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 349dae5c76..c3b4005d1d 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -815,6 +815,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, SHOW_STR IPV6_STR OSPF6_STR + "Display Link state database\n" "Display Self-originated LSAs\n" "Display details of LSAs\n" "Dump LSAs\n" @@ -1092,7 +1093,8 @@ DEFUN (show_ipv6_ospf6_border_routers, IP6_STR OSPF6_STR "Display routing table for ABR and ASBR\n" - ) + "Router ID\n" + "Show detailed output\n") { int idx_ipv4 = 4; u_int32_t adv_router; diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 0b3267a233..93baac5988 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -969,6 +969,7 @@ DEFUN (debug_ospf_ism, DEFUN (no_debug_ospf_ism, no_debug_ospf_ism_cmd, "no debug ospf [(1-65535)] ism []", + NO_STR DEBUG_STR OSPF_STR "Instance ID\n" @@ -1093,6 +1094,7 @@ DEFUN (debug_ospf_instance_nsm, static int no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv) { + /* XXX qlyoung */ if (vty->node == CONFIG_NODE) { if (argc == arg_base + 0) @@ -1132,7 +1134,7 @@ DEFUN (no_debug_ospf_nsm, NO_STR DEBUG_STR OSPF_STR - "OSPF Neighbor State Machine" + "OSPF Neighbor State Machine\n" "NSM Status Information\n" "NSM Event Information\n" "NSM Timer Information\n") @@ -1148,7 +1150,7 @@ DEFUN (no_debug_ospf_instance_nsm, DEBUG_STR OSPF_STR "Instance ID\n" - "OSPF Neighbor State Machine" + "OSPF Neighbor State Machine\n" "NSM Status Information\n" "NSM Event Information\n" "NSM Timer Information\n") diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index f5f07944c5..a920730669 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -5799,7 +5799,8 @@ DEFUN (show_ip_ospf_database_type_adv_router, "Database summary\n" OSPF_LSA_TYPES_DESC "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") + "Advertising Router (as an IP address)\n" + "Self-originated link states\n") { struct ospf *ospf; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 708eb85b15..e4c3ce76f7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1294,7 +1294,7 @@ DEFUNSH (VTYSH_OSPF6D, router_ospf6, router_ospf6_cmd, "router ospf6", - OSPF6_ROUTER_STR + ROUTER_STR OSPF6_STR) { vty->node = OSPF6_NODE; @@ -2304,7 +2304,7 @@ DEFUN (vtysh_write_terminal, "For the ripng daemon\n" "For the ospf daemon\n" "For the ospfv6 daemon\n" - "For the ldpd daemon" + "For the ldpd daemon\n" "For the bgp daemon\n" "For the isis daemon\n" "For the pim daemon\n") diff --git a/zebra/debug.c b/zebra/debug.c index 65ae3fd174..2e9fef292b 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -124,54 +124,31 @@ DEFUN (debug_zebra_mpls, DEFUN (debug_zebra_packet, debug_zebra_packet_cmd, - "debug zebra packet", - DEBUG_STR - "Zebra configuration\n" - "Debug option set for zebra packet\n") -{ - zebra_debug_packet = ZEBRA_DEBUG_PACKET; - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - return CMD_SUCCESS; -} - -DEFUN (debug_zebra_packet_direct, - debug_zebra_packet_direct_cmd, - "debug zebra packet ", - DEBUG_STR - "Zebra configuration\n" - "Debug option set for zebra packet\n" - "Debug option set for receive packet\n" - "Debug option set for send packet\n") -{ - int idx_recv_send = 3; - zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - if (strncmp ("detail", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); - return CMD_SUCCESS; -} - -DEFUN (debug_zebra_packet_detail, - debug_zebra_packet_detail_cmd, - "debug zebra packet detail", + "debug zebra packet [] [detail]", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra packet\n" "Debug option set for receive packet\n" "Debug option set for send packet\n" - "Debug option set detailed information\n") + "Debug option set for detailed info\n") { - int idx_recv_send = 3; + int idx = 0; zebra_debug_packet = ZEBRA_DEBUG_PACKET; - if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) + + if (argv_find (argv, argc, "send", &idx)) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) + idx = 0; + if (argv_find (argv, argc, "recv", &idx)) SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); - SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); + idx = 0; + if (argv_find (argv, argc, "detail", &idx)) + SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_DETAIL); + + if (!(zebra_debug_packet & ZEBRA_DEBUG_SEND & ZEBRA_DEBUG_RECV)) + { + SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); + SET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); + } return CMD_SUCCESS; } @@ -276,19 +253,7 @@ DEFUN (no_debug_zebra_mpls, DEFUN (no_debug_zebra_packet, no_debug_zebra_packet_cmd, - "no debug zebra packet", - NO_STR - DEBUG_STR - "Zebra configuration\n" - "Debug option set for zebra packet\n") -{ - zebra_debug_packet = 0; - return CMD_SUCCESS; -} - -DEFUN (no_debug_zebra_packet_direct, - no_debug_zebra_packet_direct_cmd, - "no debug zebra packet ", + "no debug zebra packet []", NO_STR DEBUG_STR "Zebra configuration\n" @@ -296,10 +261,10 @@ DEFUN (no_debug_zebra_packet_direct, "Debug option set for receive packet\n" "Debug option set for send packet\n") { - int idx_recv_send = 4; - if (strncmp ("send", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) + int idx = 0; + if (argc == 4 || argv_find (argv, argc, "send", &idx)) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_SEND); - if (strncmp ("recv", argv[idx_recv_send]->arg, strlen (argv[idx_recv_send]->arg)) == 0) + if (argc == 4 || argv_find (argv, argc, "recv", &idx)) UNSET_FLAG(zebra_debug_packet, ZEBRA_DEBUG_RECV); return CMD_SUCCESS; } @@ -319,6 +284,7 @@ DEFUN (no_debug_zebra_kernel, DEFUN (no_debug_zebra_kernel_msgdump, no_debug_zebra_kernel_msgdump_cmd, "no debug zebra kernel msgdump []", + NO_STR DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" @@ -326,11 +292,12 @@ DEFUN (no_debug_zebra_kernel_msgdump, "Dump raw netlink messages received\n" "Dump raw netlink messages sent\n") { - int idx_recv_send = 5; - if (!argv[1] || (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "recv", strlen(argv[idx_recv_send]->arg)) == 0)) + int idx = 0; + if (argc == 5 || argv_find (argv, argc, "recv", &idx)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV); - if (!argv[idx_recv_send]->arg || (argv[idx_recv_send]->arg && strncmp(argv[idx_recv_send]->arg, "send", strlen(argv[idx_recv_send]->arg)) == 0)) + if (argc == 5 || argv_find (argv, argc, "send", &idx)) UNSET_FLAG(zebra_debug_kernel, ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND); + return CMD_SUCCESS; } @@ -458,8 +425,6 @@ zebra_debug_init (void) install_element (ENABLE_NODE, &debug_zebra_nht_cmd); install_element (ENABLE_NODE, &debug_zebra_mpls_cmd); install_element (ENABLE_NODE, &debug_zebra_packet_cmd); - install_element (ENABLE_NODE, &debug_zebra_packet_direct_cmd); - install_element (ENABLE_NODE, &debug_zebra_packet_detail_cmd); install_element (ENABLE_NODE, &debug_zebra_kernel_cmd); install_element (ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd); install_element (ENABLE_NODE, &debug_zebra_rib_cmd); @@ -479,8 +444,6 @@ zebra_debug_init (void) install_element (CONFIG_NODE, &debug_zebra_nht_cmd); install_element (CONFIG_NODE, &debug_zebra_mpls_cmd); install_element (CONFIG_NODE, &debug_zebra_packet_cmd); - install_element (CONFIG_NODE, &debug_zebra_packet_direct_cmd); - install_element (CONFIG_NODE, &debug_zebra_packet_detail_cmd); install_element (CONFIG_NODE, &debug_zebra_kernel_cmd); install_element (CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd); install_element (CONFIG_NODE, &debug_zebra_rib_cmd); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 59725561f5..af69a9d0e0 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -240,7 +240,8 @@ DEFUN (no_match_ip_address_prefix_len, NO_STR MATCH_STR IP_STR - "Match prefixlen of ip address of route\n" + "Match prefix length of ip address\n" + "Match prefix length of ip address\n" "Prefix length\n") { char *plen = (argc == 6) ? argv[5]->arg : NULL; @@ -284,7 +285,17 @@ DEFUN (match_source_protocol, match_source_protocol_cmd, "match source-protocol ", MATCH_STR - "Match protocol via which the route was learnt\n") + "Match protocol via which the route was learnt\n" + "BGP protocol\n" + "OSPF protocol\n" + "RIP protocol\n" + "RIPNG protocol\n" + "ISIS protocol\n" + "OSPF6 protocol\n" + "Routes from directly connected peer\n" + "Routes from system configuration\n" + "Routes from kernel\n" + "Statically configured routes\n") { char *proto = argv[2]->text; int i; @@ -304,7 +315,16 @@ DEFUN (no_match_source_protocol, NO_STR MATCH_STR "No match protocol via which the route was learnt\n" - ) + "BGP protocol\n" + "OSPF protocol\n" + "RIP protocol\n" + "RIPNG protocol\n" + "ISIS protocol\n" + "OSPF6 protocol\n" + "Routes from directly connected peer\n" + "Routes from system configuration\n" + "Routes from kernel\n" + "Statically configured routes\n") { char *proto = (argc == 4) ? argv[3]->text : NULL; return zebra_route_match_delete (vty, "source-protocol", proto, RMAP_EVENT_MATCH_DELETED); @@ -317,7 +337,8 @@ DEFUN (set_src, "set src ", SET_STR "src address for route\n" - "src address\n") + "IPv4 src address\n" + "IPv6 src address\n") { int idx_ip = 2; union g_addr src; @@ -389,6 +410,8 @@ DEFUN (no_set_src, DEFUN (zebra_route_map_timer, zebra_route_map_timer_cmd, "zebra route-map delay-timer (0-600)", + "Zebra information\n" + "Set route-map parameters\n" "Time to wait before route-map updates are processed\n" "0 means event-driven updates are disabled\n") { @@ -405,10 +428,10 @@ DEFUN (no_zebra_route_map_timer, no_zebra_route_map_timer_cmd, "no zebra route-map delay-timer [(0-600)]", NO_STR - "Time to wait before route-map updates are processed\n" + "Zebra information\n" + "Set route-map parameters\n" "Reset delay-timer to default value, 30 secs\n" "0 means event-driven updates are disabled\n") - { zebra_route_map_set_delay_timer(ZEBRA_RMAP_DEFAULT_UPDATE_TIMER); From bc7d452fe6c6d8127a19166f0b9ee644cc5939df Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 6 Nov 2016 07:17:54 +0000 Subject: [PATCH 248/280] ospfd: Update ospf area vlink interval commands Signed-off-by: Quentin Young --- ospfd/ospf_vty.c | 171 +++++++++++++---------------------------------- 1 file changed, 47 insertions(+), 124 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index a920730669..48c0de5f69 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1163,101 +1163,63 @@ DEFUN (ospf_area_vlink, DEFUN (ospf_area_vlink_intervals, ospf_area_vlink_intervals_cmd, - "area virtual-link A.B.C.D [ (1-65535)] [ (1-65535)] [ (1-65535)] [ (1-65535)] ", + "area virtual-link A.B.C.D" + " (1-65535)" + "[ (1-65535)" + "[ (1-65535)" + "[ (1-65535)" + "]]]", VLINK_HELPSTR_IPADDR VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM) { - int idx_ipv4_number = 1; - int idx_ipv4 = 3; struct ospf *ospf = vty->index; struct ospf_vl_config_data vl_config; - int i; - int ret; + int ret = 0; if (!ospf) return CMD_SUCCESS; ospf_vl_config_data_init(&vl_config, vty); - /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format); + char *area_id = argv[1]->arg; + char *router_id = argv[3]->arg; + + ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); return CMD_WARNING; } - ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); + ret = inet_aton (router_id, &vl_config.vl_peer); if (! ret) { - vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", - VTY_NEWLINE); + vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE); return CMD_WARNING; } - - if (argc <=4) + for (unsigned int i = 0; i < 4; i++) { - /* Thats all folks! - BUGS B. strikes again!!!*/ - - return ospf_vl_set (ospf, &vl_config); + int idx = 0; + if (argv_find (argv, argc, "hello-interval", &idx)) + vl_config.hello_interval = strtol(argv[idx+1]->arg, NULL, 10); + else if (argv_find (argv, argc, "retransmit-interval", &idx)) + vl_config.retransmit_interval = strtol(argv[idx+1]->arg, NULL, 10); + else if (argv_find (argv, argc, "transmit-delay", &idx)) + vl_config.transmit_delay = strtol(argv[idx+1]->arg, NULL, 10); + else if (argv_find (argv, argc, "dead-interval", &idx)) + vl_config.dead_interval = strtol(argv[idx+1]->arg, NULL, 10); } - /* Deal with other parameters */ - for (i=5; i < argc; i++) - { - - /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->arg, VTY_NEWLINE); */ - - switch (argv[i]->arg[0]) - { - - case 'h': - /* Hello interval */ - i++; - vl_config.hello_interval = strtol (argv[i]->arg, NULL, 10); - if (vl_config.hello_interval < 0) - return CMD_WARNING; - break; - - case 'r': - /* Retransmit Interval */ - i++; - vl_config.retransmit_interval = strtol (argv[i]->arg, NULL, 10); - if (vl_config.retransmit_interval < 0) - return CMD_WARNING; - break; - - case 't': - /* Transmit Delay */ - i++; - vl_config.transmit_delay = strtol (argv[i]->arg, NULL, 10); - if (vl_config.transmit_delay < 0) - return CMD_WARNING; - break; - - case 'd': - /* Dead Interval */ - i++; - vl_config.dead_interval = strtol (argv[i]->arg, NULL, 10); - if (vl_config.dead_interval < 0) - return CMD_WARNING; - break; - } - } - - /* Action configuration */ - return ospf_vl_set (ospf, &vl_config); - } DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, - "area virtual-link A.B.C.D [authentication] [] []", + "no area virtual-link A.B.C.D [authentication] [] []", NO_STR VLINK_HELPSTR_IPADDR "Enable authentication on this virtual link\n" \ @@ -1365,97 +1327,58 @@ DEFUN (no_ospf_area_vlink, DEFUN (no_ospf_area_vlink_intervals, no_ospf_area_vlink_intervals_cmd, - "area virtual-link A.B.C.D [ (1-65535)] [ (1-65535)] [ (1-65535)] [ (1-65535)]", + "no area virtual-link A.B.C.D" + " (1-65535)" + "[ (1-65535)" + "[ (1-65535)" + "[ (1-65535)" + "]]]", VLINK_HELPSTR_IPADDR VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM) { - int idx_ipv4_number = 2; - int idx_ipv4 = 4; struct ospf *ospf = vty->index; - struct ospf_area *area; struct ospf_vl_config_data vl_config; - struct ospf_vl_data *vl_data = NULL; - int i; - int ret, format; + int ret = 0; if (!ospf) return CMD_SUCCESS; ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); + char *area_id = argv[2]->arg; + char *router_id = argv[4]->arg; + + ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); return CMD_WARNING; } - area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); - if (!area) - { - vty_out (vty, "Area does not exist%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer); + ret = inet_aton (router_id, &vl_config.vl_peer); if (! ret) { - vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", - VTY_NEWLINE); + vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE); return CMD_WARNING; } - if (argc <=5) + for (unsigned int i = 0; i < 4; i++) { - /* Basic VLink no command */ - /* Thats all folks! - BUGS B. strikes again!!!*/ - if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) - ospf_vl_delete (ospf, vl_data); - - ospf_area_check_free (ospf, vl_config.area_id); - - return CMD_SUCCESS; + int idx = 0; + if (argv_find (argv, argc, "hello-interval", &idx)) + vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; + else if (argv_find (argv, argc, "retransmit-interval", &idx)) + vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; + else if (argv_find (argv, argc, "transmit-delay", &idx)) + vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; + else if (argv_find (argv, argc, "dead-interval", &idx)) + vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; } - /* If we are down here, we are reseting parameters */ - - /* Deal with other parameters */ - for (i=6; i < argc; i++) - { - /* vty_out (vty, "argv[%d] - %s%s", i, argv[i]->arg, VTY_NEWLINE); */ - - switch (argv[i]->arg[0]) - { - - case 'h': - /* Hello interval */ - vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; - break; - - case 'r': - /* Retransmit Interval */ - vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; - break; - - case 't': - /* Transmit Delay */ - vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; - break; - - case 'd': - /* Dead Interval */ - i++; - vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; - break; - } - } - - /* Action configuration */ - return ospf_vl_set (ospf, &vl_config); } From dff6764af2a8884d538219aae2d1bca9103e1341 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 6 Nov 2016 07:38:50 +0000 Subject: [PATCH 249/280] bgpd: Fix `maximum-paths (1-255)` Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 715c84aa03..f222161952 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1007,7 +1007,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, u_int16_t options, int set) { struct bgp *bgp; - u_int16_t maxpaths = 0; + u_int16_t maxpaths = strtol(mpaths, NULL, 10); int ret; afi_t afi; safi_t safi; @@ -1017,12 +1017,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, safi = bgp_node_safi (vty); if (set) - { - VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, - MULTIPATH_NUM); - ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, - options); - } + ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, options); else ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); From d7fa34c1bc00b5704fefd0dc1cafc1bd314a3ea9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 8 Nov 2016 01:46:04 +0000 Subject: [PATCH 250/280] all: Fix underfull doc strings, part 2 Add missing docstrings and separating \n. Also eat some low-hanging refactoring fruit. Signed-off-by: Quentin Young --- bgpd/bgp_bfd.c | 3 +- bgpd/bgp_routemap.c | 14 +++++++-- bgpd/bgp_vty.c | 66 +++++++++++++++++++++++++----------------- isisd/isisd.c | 1 + ospf6d/ospf6_area.c | 6 ++-- pimd/pim_cmd.c | 1 + zebra/irdp_interface.c | 2 ++ zebra/zebra_vty.c | 7 +++-- 8 files changed, 66 insertions(+), 34 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 684694d0bc..670d959fe5 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -619,7 +619,8 @@ DEFUN_HIDDEN (neighbor_bfd_type, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" - "Session type\n") + "Multihop session\n" + "Single hop session\n") { int idx_peer = 1; int idx_hop = 3; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 1ddae3cd88..0701415146 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3490,7 +3490,8 @@ DEFUN (no_set_community, "no set community AA:NN...", NO_STR SET_STR - "BGP community attribute\n") + "BGP community attribute\n" + COMMUNITY_VAL_STR) { return generic_set_delete (vty, vty->index, "community", NULL); } @@ -3525,7 +3526,11 @@ DEFUN (no_set_community_delete, "no set comm-list [<(1-99)|(100-500)|WORD> delete]", NO_STR SET_STR - "set BGP community list (for deletion)\n") + "set BGP community list (for deletion)\n" + "Community-list number (standard)\n" + "Community-list number (expanded)\n" + "Community-list name\n" + "Delete matching communities\n") { return generic_set_delete (vty, vty->index, "comm-list", NULL); } @@ -3619,7 +3624,10 @@ DEFUN (no_set_origin, "no set origin []", NO_STR SET_STR - "BGP origin code\n") + "BGP origin code\n" + "remote EGP\n" + "local IGP\n" + "unknown heritage\n") { return generic_set_delete (vty, vty->index, "origin", NULL); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f222161952..f9d845dcd1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1307,6 +1307,7 @@ DEFUN (bgp_wpkt_quanta, DEFUN (no_bgp_wpkt_quanta, no_bgp_wpkt_quanta_cmd, "no write-quanta (1-10000)", + NO_STR "How many packets to write to peer socket per run\n" "Number of packets\n") { @@ -2380,26 +2381,29 @@ DEFUN (bgp_listen_range, bgp_listen_range_cmd, "bgp listen range peer-group WORD", "BGP specific commands\n" - "Configure BGP Dynamic Neighbors\n" - "add a listening range for Dynamic Neighbors\n" + "Configure BGP dynamic neighbors listen range\n" + "Configure BGP dynamic neighbors listen range\n" NEIGHBOR_ADDR_STR "Member of the peer-group\n" "Peer-group name\n") { - int idx_ipv4_ipv6_prefixlen = 3; - int idx_word = 5; struct bgp *bgp; struct prefix range; struct peer_group *group, *existing_group; afi_t afi; int ret; + int idx = 0; + + argv_find (argv, argc, "A.B.C.D/M", &idx); + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "WORD", &idx); + char *peergroup = argv[idx]->arg; bgp = vty->index; - //VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_ipv6_prefixlen]->arg); - /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, &range); + ret = str2prefix (prefix, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2408,14 +2412,12 @@ DEFUN (bgp_listen_range, afi = family2afi(range.family); -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) { vty_out (vty, "%% Malformed listen range (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&range); @@ -2423,7 +2425,7 @@ DEFUN (bgp_listen_range, existing_group = listen_range_exists (bgp, &range, 1); if (existing_group) { - if (strcmp (existing_group->name, argv[idx_word]->arg) == 0) + if (strcmp (existing_group->name, peergroup) == 0) return CMD_SUCCESS; else { @@ -2441,7 +2443,7 @@ DEFUN (bgp_listen_range, return CMD_WARNING; } - group = peer_group_lookup (bgp, argv[idx_word]->arg); + group = peer_group_lookup (bgp, peergroup); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -2454,26 +2456,34 @@ DEFUN (bgp_listen_range, DEFUN (no_bgp_listen_range, no_bgp_listen_range_cmd, - "no bgp listen range A.B.C.D/M peer-group WORD", + "no bgp listen range peer-group WORD", + NO_STR "BGP specific commands\n" - "Configure BGP defaults\n" - "delete a listening range for Dynamic Neighbors\n" - "Remove Dynamic Neighbors listening range\n") + "Unconfigure BGP dynamic neighbors listen range\n" + "Unconfigure BGP dynamic neighbors listen range\n" + NEIGHBOR_ADDR_STR + "Member of the peer-group\n" + "Peer-group name\n") { - int idx_ipv4_prefixlen = 4; - int idx_word = 6; struct bgp *bgp; struct prefix range; struct peer_group *group; afi_t afi; int ret; + int idx = 0; + + argv_find (argv, argc, "A.B.C.D/M", &idx); + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "WORD", &idx); + char *peergroup = argv[idx]->arg; bgp = vty->index; // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &range); + ret = str2prefix (prefix, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2482,19 +2492,16 @@ DEFUN (no_bgp_listen_range, afi = family2afi(range.family); -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) { vty_out (vty, "%% Malformed listen range (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&range); - - group = peer_group_lookup (bgp, argv[idx_word]->arg); + group = peer_group_lookup (bgp, peergroup); if (! group) { vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); @@ -2643,7 +2650,9 @@ DEFUN (neighbor_remote_as, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_peer = 1; int idx_remote_as = 3; @@ -2800,7 +2809,9 @@ DEFUN (neighbor_interface_config_remote_as, NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_word = 1; int idx_remote_as = 4; @@ -2814,7 +2825,9 @@ DEFUN (neighbor_interface_v6only_config_remote_as, NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_word = 1; int idx_remote_as = 5; @@ -5409,7 +5422,8 @@ DEFUN (neighbor_ttl_security, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP ttl-security parameters\n" - "Specify the maximum number of hops to the BGP peer\n") + "Specify the maximum number of hops to the BGP peer\n" + "Number of hops to BGP peer\n") { int idx_peer = 1; int idx_number = 4; diff --git a/isisd/isisd.c b/isisd/isisd.c index ff3d9c791b..c3bc33eb22 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1906,6 +1906,7 @@ DEFUN (log_adj_changes, DEFUN (no_log_adj_changes, no_log_adj_changes_cmd, "no log-adjacency-changes", + NO_STR "Stop logging changes in adjacency state\n") { VTY_DECLVAR_CONTEXT (isis_area, area); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index de395e8b57..9ba7287656 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -898,9 +898,11 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, SHOW_STR IP6_STR OSPF6_STR - "Shortest Path First caculation\n" + "Shortest Path First calculation\n" "Show SPF tree\n" - "Specify root's router-id to calculate another router's SPF tree\n") + "Specify root's router-id to calculate another router's SPF tree\n" + "OSPF6 area parameters\n" + OSPF6_AREA_ID_STR) { int idx_ipv4 = 5; int idx_ipv4_2 = 7; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 318bd1ba1c..afc42a9561 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3189,6 +3189,7 @@ DEFUN (interface_ip_pim_drprio, DEFUN (interface_no_ip_pim_drprio, interface_no_ip_pim_drprio_cmd, "no ip pim drpriority [(1-4294967295)]", + NO_STR IP_STR PIM_STR "Revert the Designated Router Priority to default\n" diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 3e244f5af3..fde759df98 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -415,6 +415,7 @@ DEFUN (ip_irdp_shutdown, ip_irdp_shutdown_cmd, "ip irdp shutdown", IP_STR + "ICMP Router discovery on this interface\n" "ICMP Router discovery shutdown on this interface\n") { VTY_DECLVAR_CONTEXT (interface, ifp); @@ -428,6 +429,7 @@ DEFUN (no_ip_irdp_shutdown, "no ip irdp shutdown", NO_STR IP_STR + "ICMP Router discovery on this interface\n" "ICMP Router discovery no shutdown on this interface\n") { VTY_DECLVAR_CONTEXT (interface, ifp); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 667dfd031a..05356b3d0a 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -230,6 +230,7 @@ DEFUN (ip_mroute_dist, DEFUN (no_ip_mroute_dist, no_ip_mroute_dist_cmd, "no ip mroute A.B.C.D/M [(1-255)]", + NO_STR IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1195,7 +1196,8 @@ DEFUN (show_ip_route, "show ip route [json]", SHOW_STR IP_STR - "IP routing table\n") + "IP routing table\n" + "JavaScript Object Notation\n") { return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); } @@ -1290,7 +1292,8 @@ DEFUN (show_ip_route_vrf, SHOW_STR IP_STR "IP routing table\n" - VRF_CMD_HELP_STR) + VRF_CMD_HELP_STR + "JavaScript Object Notation\n") { int idx_vrf = 4; u_char uj = use_json(argc, argv); From 4c9dee98789834e86b8649b9c1c162860b698f35 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 8 Nov 2016 20:42:30 +0000 Subject: [PATCH 251/280] bgpd: don't call strtol on null pointer Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f9d845dcd1..0203f3647d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1007,7 +1007,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, u_int16_t options, int set) { struct bgp *bgp; - u_int16_t maxpaths = strtol(mpaths, NULL, 10); + u_int16_t maxpaths = 0; int ret; afi_t afi; safi_t safi; @@ -1017,7 +1017,10 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, safi = bgp_node_safi (vty); if (set) + { + strtol(mpaths, NULL, 10); ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, options); + } else ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); From c59f2066b636fde5110ea5d16ea5dc4647ea04f1 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 8 Nov 2016 20:46:47 +0000 Subject: [PATCH 252/280] bgpd: actually set maxpaths Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0203f3647d..5cc4a4f7e1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1018,7 +1018,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, if (set) { - strtol(mpaths, NULL, 10); + maxpaths = strtol(mpaths, NULL, 10); ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, options); } else From 4c4ff4c13693ff2beb18931577423edcdc4a0403 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 9 Nov 2016 07:24:51 +0000 Subject: [PATCH 253/280] bgpd, vtysh: Fix failing bgp cli * bgp bestpath as-path multipath-relax * address-family encap * address-family encapv4 Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 33 +++++++++++++++++---------------- vtysh/extract.pl.in | 3 +-- vtysh/vtysh.c | 16 +++------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5cc4a4f7e1..707fc0d9fa 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1919,7 +1919,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, "Generate an AS_SET\n" "Do not generate an AS_SET\n") { - int idx_as_set = 4; + int idx = 0; struct bgp *bgp; bgp = vty->index; @@ -1927,7 +1927,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax, /* no-as-set is now the default behavior so we can silently * ignore it */ - if (argv[idx_as_set]->arg != NULL && strncmp (argv[idx_as_set]->arg, "a", 1) == 0) + if (argv_find (argv, argc, "as-set", &idx)) bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); else bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; @@ -3832,21 +3832,22 @@ DEFUN (neighbor_send_community_type, "Send Extended Community attributes\n" "Send Standard Community attributes\n") { - int idx_peer = 1; - int idx_type = 3; - if (strncmp (argv[idx_type]->arg, "s", 1) == 0) - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), - PEER_FLAG_SEND_COMMUNITY); - if (strncmp (argv[idx_type]->arg, "e", 1) == 0) - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), - PEER_FLAG_SEND_EXT_COMMUNITY); + int idx = 0; + u_int32_t flag = 0; - return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty), - bgp_node_safi (vty), - (PEER_FLAG_SEND_COMMUNITY| - PEER_FLAG_SEND_EXT_COMMUNITY)); + char *peer = argv[1]->arg; + + if (argv_find (argv, argc, "standard", &idx)) + SET_FLAG (flag, PEER_FLAG_SEND_COMMUNITY); + else if (argv_find (argv, argc, "extended", &idx)) + SET_FLAG (flag, PEER_FLAG_SEND_EXT_COMMUNITY); + else + { + SET_FLAG (flag, PEER_FLAG_SEND_COMMUNITY); + SET_FLAG (flag, PEER_FLAG_SEND_EXT_COMMUNITY); + } + + return peer_af_flag_set_vty (vty, peer, bgp_node_afi (vty), bgp_node_safi (vty), flag); } DEFUN (no_neighbor_send_community_type, diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 8850ec0e84..6709826599 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -60,8 +60,7 @@ $ignore{'"address-family ipv6 "'} = "ignore"; $ignore{'"address-family vpnv4"'} = "ignore"; $ignore{'"address-family vpnv4 unicast"'} = "ignore"; $ignore{'"address-family ipv4 vrf NAME"'} = "ignore"; -$ignore{'"address-family encap"'} = "ignore"; -$ignore{'"address-family encapv4"'} = "ignore"; +$ignore{'"address-family "'} = "ignore"; $ignore{'"address-family encapv6"'} = "ignore"; $ignore{'"address-family vpnv6"'} = "ignore"; $ignore{'"address-family vpnv6 unicast"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index e4c3ce76f7..36ec565ec3 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1115,22 +1115,12 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } -DEFUNSH (VTYSH_BGPD, - address_family_encap, - address_family_encap_cmd, - "address-family encap", - "Enter Address Family command mode\n" - "Address Family\n") -{ - vty->node = BGP_ENCAP_NODE; - return CMD_SUCCESS; -} - DEFUNSH (VTYSH_BGPD, address_family_encapv4, address_family_encapv4_cmd, - "address-family encapv4", + "address-family ", "Enter Address Family command mode\n" + "Address Family\n" "Address Family\n") { vty->node = BGP_ENCAP_NODE; @@ -3220,7 +3210,7 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &router_bgp_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_encap_cmd); + install_element (BGP_NODE, &address_family_encapv4_cmd); install_element (BGP_NODE, &address_family_encapv6_cmd); #if defined(ENABLE_BGP_VNC) install_element (BGP_NODE, &vnc_defaults_cmd); From ce882f81683f6b3547d4bad17aeee8ce7b5bdda1 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 10 Nov 2016 23:17:07 +0000 Subject: [PATCH 254/280] lib: Implement hidden and deprecated commands Each token now knows whether it is part of a hidden or deprecated command. Command completion logic hides such tokens when generating completions. Command matching logic works as before and will still match on hidden and deprecated commands. Signed-off-by: Quentin Young --- lib/command.c | 7 ++--- lib/command.h | 21 ++++++++------- lib/command_match.c | 4 +++ lib/command_parse.y | 63 +++++++++++++++++++++++++++------------------ 4 files changed, 57 insertions(+), 38 deletions(-) diff --git a/lib/command.c b/lib/command.c index 8eee923144..c0b9ee4e10 100644 --- a/lib/command.c +++ b/lib/command.c @@ -235,7 +235,7 @@ install_node (struct cmd_node *node, node->cmdgraph = graph_new (); node->cmd_vector = vector_init (VECTOR_MIN_SIZE); // add start node - struct cmd_token *token = new_cmd_token (START_TKN, NULL, NULL); + struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); graph_new_node (node->cmdgraph, token, (void (*)(void *)) &del_cmd_token); node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp); } @@ -2383,10 +2383,11 @@ cmd_init (int terminal) } struct cmd_token * -new_cmd_token (enum cmd_token_type type, char *text, char *desc) +new_cmd_token (enum cmd_token_type type, u_char attr, char *text, char *desc) { struct cmd_token *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token)); token->type = type; + token->attr = attr; token->text = text; token->desc = desc; token->arg = NULL; @@ -2412,7 +2413,7 @@ del_cmd_token (struct cmd_token *token) struct cmd_token * copy_cmd_token (struct cmd_token *token) { - struct cmd_token *copy = new_cmd_token (token->type, NULL, NULL); + struct cmd_token *copy = new_cmd_token (token->type, token->attr, NULL, NULL); copy->max = token->max; copy->min = token->min; copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; diff --git a/lib/command.h b/lib/command.h index 7b1f7d9fb5..51f7f78085 100644 --- a/lib/command.h +++ b/lib/command.h @@ -182,24 +182,25 @@ enum cmd_token_type END_TKN, // last token in line }; -/** - * Token struct. - */ +/* Command attributes */ +enum +{ + CMD_ATTR_NORMAL, + CMD_ATTR_DEPRECATED, + CMD_ATTR_HIDDEN, +}; + +/* Comamand token struct. */ struct cmd_token { enum cmd_token_type type; // token type + u_char attr; // token attributes char *text; // token text char *desc; // token description long long min, max; // for ranges char *arg; // user input that matches this token }; -enum -{ - CMD_ATTR_DEPRECATED = 1, - CMD_ATTR_HIDDEN, -}; - /* Structure of command element. */ struct cmd_element { @@ -425,7 +426,7 @@ copy_cmd_element(struct cmd_element *cmd); /* memory management for cmd_token */ struct cmd_token * -new_cmd_token (enum cmd_token_type, char *, char *); +new_cmd_token (enum cmd_token_type, u_char attr, char *, char *); void del_cmd_token (struct cmd_token *); struct cmd_token * diff --git a/lib/command_match.c b/lib/command_match.c index 42788ecb01..8fa8da6b10 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -331,6 +331,10 @@ command_complete (struct graph *graph, for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { struct cmd_token *token = gn->data; + + if (token->attr == CMD_ATTR_HIDDEN || token->attr == CMD_ATTR_DEPRECATED) + continue; + enum match_type minmatch = min_match_level (token->type); #ifdef TRACE_MATCHER fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); diff --git a/lib/command_parse.y b/lib/command_parse.y index 680a74ccd2..3ef0b42ebe 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -121,7 +121,8 @@ static struct graph_node * new_token_node (struct graph *, enum cmd_token_type type, - char *text, char *doc); + u_char attr, char *text, + char *doc); static void terminate_graph (struct graph *, @@ -134,7 +135,7 @@ /* yyparse parameters */ %parse-param { struct graph *graph } -%parse-param { struct cmd_element *element } +%parse-param { struct cmd_element *el } /* called automatically before yyparse */ %initial-action { @@ -144,15 +145,15 @@ startnode = vector_slot (graph->nodes, 0); /* set string to parse */ - set_lexer_string (element->string); + set_lexer_string (el->string); /* copy docstring and keep a pointer to the copy */ - if (element->doc) + if (el->doc) { // allocate a new buffer, making room for a flag - size_t length = (size_t) strlen (element->doc) + 2; + size_t length = (size_t) strlen (el->doc) + 2; docstr = malloc (length); - memcpy (docstr, element->doc, strlen (element->doc)); + memcpy (docstr, el->doc, strlen (el->doc)); // set the flag so doc_next knows when to print a warning docstr[length - 2] = 0x03; // null terminate @@ -167,7 +168,7 @@ start: sentence_root cmd_token_seq { // tack on the command element - terminate_graph (graph, currnode, element); + terminate_graph (graph, currnode, el); } | sentence_root cmd_token_seq placeholder_token '.' '.' '.' { @@ -179,14 +180,14 @@ start: add_edge_dedup (currnode, currnode); // tack on the command element - terminate_graph (graph, currnode, element); + terminate_graph (graph, currnode, el); } ; sentence_root: WORD { struct graph_node *root = - new_token_node (graph, WORD_TKN, strdup ($1), doc_next(element)); + new_token_node (graph, WORD_TKN, el->attr, strdup ($1), doc_next(el)); if ((currnode = add_edge_dedup (startnode, root)) != root) graph_delete_node (graph, root); @@ -227,7 +228,7 @@ compound_token: literal_token: WORD { - $$ = new_token_node (graph, WORD_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, WORD_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } ; @@ -235,32 +236,32 @@ literal_token: WORD placeholder_token: IPV4 { - $$ = new_token_node (graph, IPV4_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, IPV4_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } | IPV4_PREFIX { - $$ = new_token_node (graph, IPV4_PREFIX_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, IPV4_PREFIX_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } | IPV6 { - $$ = new_token_node (graph, IPV6_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, IPV6_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } | IPV6_PREFIX { - $$ = new_token_node (graph, IPV6_PREFIX_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, IPV6_PREFIX_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } | VARIABLE { - $$ = new_token_node (graph, VARIABLE_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, VARIABLE_TKN, el->attr, strdup($1), doc_next(el)); free ($1); } | RANGE { - $$ = new_token_node (graph, RANGE_TKN, strdup($1), doc_next(element)); + $$ = new_token_node (graph, RANGE_TKN, el->attr, strdup($1), doc_next(el)); struct cmd_token *token = $$->data; // get the numbers out @@ -270,7 +271,7 @@ placeholder_token: token->max = strtoll (yylval.string, &yylval.string, 10); // validate range - if (token->min > token->max) yyerror (graph, element, "Invalid range."); + if (token->min > token->max) yyerror (graph, el, "Invalid range."); free ($1); } @@ -279,8 +280,8 @@ placeholder_token: selector: '<' selector_seq_seq '>' { $$ = malloc (sizeof (struct subgraph)); - $$->start = new_token_node (graph, SELECTOR_TKN, NULL, NULL); - $$->end = new_token_node (graph, NUL_TKN, NULL, NULL); + $$->start = new_token_node (graph, SELECTOR_TKN, el->attr, NULL, NULL); + $$->end = new_token_node (graph, NUL_TKN, el->attr, NULL, NULL); for (unsigned int i = 0; i < vector_active ($2->start->to); i++) { struct graph_node *sn = vector_slot ($2->start->to, i), @@ -362,8 +363,8 @@ option: '[' option_token_seq ']' { // make a new option $$ = malloc (sizeof (struct subgraph)); - $$->start = new_token_node (graph, OPTION_TKN, NULL, NULL); - $$->end = new_token_node (graph, NUL_TKN, NULL, NULL); + $$->start = new_token_node (graph, OPTION_TKN, el->attr, NULL, NULL); + $$->end = new_token_node (graph, NUL_TKN, el->attr, NULL, NULL); // add a path through the sequence to the end graph_add_edge ($$->start, $2->start); graph_add_edge ($2->end, $$->end); @@ -434,13 +435,15 @@ cleanup() } static void -terminate_graph (struct graph *graph, struct graph_node *finalnode, struct cmd_element *element) +terminate_graph (struct graph *graph, struct graph_node *finalnode, + struct cmd_element *element) { // end of graph should look like this // * -> finalnode -> END_TKN -> cmd_element struct graph_node *end_token_node = new_token_node (graph, END_TKN, + element->attr, strdup (CMD_CR_TEXT), strdup ("")); struct graph_node *end_element_node = @@ -467,9 +470,10 @@ doc_next (struct cmd_element *el) } static struct graph_node * -new_token_node (struct graph *graph, enum cmd_token_type type, char *text, char *doc) +new_token_node (struct graph *graph, enum cmd_token_type type, + u_char attr, char *text, char *doc) { - struct cmd_token *token = new_cmd_token (type, text, doc); + struct cmd_token *token = new_cmd_token (type, attr, text, doc); return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); } @@ -507,7 +511,16 @@ static struct graph_node * add_edge_dedup (struct graph_node *from, struct graph_node *to) { struct graph_node *existing = node_adjacent (from, to); - return existing ? existing : graph_add_edge (from, to); + if (existing) + { + struct cmd_token *ex_tok = existing->data; + struct cmd_token *to_tok = to->data; + // NORMAL takes precedence over DEPRECATED takes precedence over HIDDEN + ex_tok->attr = (ex_tok->attr < to_tok->attr) ? ex_tok->attr : to_tok->attr; + return existing; + } + else + return graph_add_edge (from, to); } /** From 14fe9c15254206a262a11f3eeccd2a59bdac0c07 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 10 Nov 2016 23:21:06 +0000 Subject: [PATCH 255/280] tools: Update permutations generator for hidden/deprecated Signed-off-by: Quentin Young --- tools/permutations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/permutations.c b/tools/permutations.c index a582101fdf..49f9416b21 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -44,7 +44,7 @@ int main (int argc, char *argv[]) cmd->string = strdup(argv[1]); struct graph *graph = graph_new(); - struct cmd_token *token = new_cmd_token (START_TKN, NULL, NULL); + struct cmd_token *token = new_cmd_token (START_TKN, cmd->attr, NULL, NULL); graph_new_node (graph, token, NULL); command_parse_format (graph, cmd); From 7a4662b4a924909210a7b38c2ca9da7c8fbbc574 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 10 Nov 2016 23:30:20 +0000 Subject: [PATCH 256/280] lib: Update `list [permutations]` Don't show hidden or deprecated commands. Signed-off-by: Quentin Young --- lib/command.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/command.c b/lib/command.c index c0b9ee4e10..9eb43db94f 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1242,7 +1242,10 @@ permute (struct graph_node *start, struct vty *vty) { struct graph_node *gn = vector_slot (start->to, i); struct cmd_token *tok = gn->data; - if (tok->type == END_TKN || gn == start) + if (tok->attr == CMD_ATTR_HIDDEN || + tok->attr == CMD_ATTR_DEPRECATED) + continue; + else if (tok->type == END_TKN || gn == start) { struct graph_node *gnn; struct listnode *ln; From 33e1e4eacb81c803b5a7c936c6eaf6837e37b86b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 11 Nov 2016 00:46:38 +0000 Subject: [PATCH 257/280] bgpd: Fix ambiguous command definition * neighbor ... attribute-unchanged Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 707fc0d9fa..781c2f6078 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4006,7 +4006,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged, DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, - "neighbor attribute-unchanged [] [] []", + "neighbor attribute-unchanged [ [ []]]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -4045,7 +4045,7 @@ DEFUN (neighbor_attr_unchanged, DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor attribute-unchanged [] [] []", + "no neighbor attribute-unchanged [ [ []]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 From 6cbd1915d2a7ad64d4dfe6116e392f8f4ff3d67d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 11 Nov 2016 20:20:36 +0000 Subject: [PATCH 258/280] bgpd: Fix `bgp bestpath med ...` commands Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 74 ++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 59 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 781c2f6078..faa013ed91 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1989,31 +1989,7 @@ DEFUN (no_bgp_log_neighbor_changes, /* "bgp bestpath med" configuration. */ DEFUN (bgp_bestpath_med, bgp_bestpath_med_cmd, - "bgp bestpath med ", - "BGP specific commands\n" - "Change the default bestpath selection\n" - "MED attribute\n" - "Compare MED among confederation paths\n" - "Treat missing MED as the least preferred one\n") -{ - int idx_med_knob = 3; - struct bgp *bgp; - - bgp = vty->index; - - if (strncmp (argv[idx_med_knob]->arg, "confed", 1) == 0) - bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); - else - bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); - - bgp_recalculate_all_bestpaths (bgp); - - return CMD_SUCCESS; -} - -DEFUN (bgp_bestpath_med2, - bgp_bestpath_med2_cmd, - "bgp bestpath med ", + "bgp bestpath med []", "BGP specific commands\n" "Change the default bestpath selection\n" "MED attribute\n" @@ -2022,20 +1998,23 @@ DEFUN (bgp_bestpath_med2, "Treat missing MED as the least preferred one\n" "Compare MED among confederation paths\n") { - struct bgp *bgp; + struct bgp *bgp = vty->index; + + int idx = 0; + if (argv_find (argv, argc, "confed", &idx)) + bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); + idx = 0; + if (argv_find (argv, argc, "missing-as-worst", &idx)) + bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); - bgp = vty->index; - bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); - bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); bgp_recalculate_all_bestpaths (bgp); return CMD_SUCCESS; } - DEFUN (no_bgp_bestpath_med, no_bgp_bestpath_med_cmd, - "no bgp bestpath med ", + "no bgp bestpath med []", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" @@ -2043,14 +2022,13 @@ DEFUN (no_bgp_bestpath_med, "Compare MED among confederation paths\n" "Treat missing MED as the least preferred one\n") { - int idx_med_knob = 4; - struct bgp *bgp; + struct bgp *bgp = vty->index; - bgp = vty->index; - - if (strncmp (argv[idx_med_knob]->arg, "confed", 1) == 0) + int idx = 0; + if (argv_find (argv, argc, "confed", &idx)) bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); - else + idx = 0; + if (argv_find (argv, argc, "missing-as-worst", &idx)) bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); bgp_recalculate_all_bestpaths (bgp); @@ -2058,26 +2036,6 @@ DEFUN (no_bgp_bestpath_med, return CMD_SUCCESS; } -DEFUN (no_bgp_bestpath_med2, - no_bgp_bestpath_med2_cmd, - "no bgp bestpath med [confed] missing-as-worst", - NO_STR - "BGP specific commands\n" - "Change the default bestpath selection\n" - "MED attribute\n" - "Compare MED among confederation paths\n" - "Treat missing MED as the least preferred one\n") -{ - struct bgp *bgp; - - bgp = vty->index; - bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); - bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); - bgp_recalculate_all_bestpaths (bgp); - - return CMD_SUCCESS; -} - /* "no bgp default ipv4-unicast". */ DEFUN (no_bgp_default_ipv4_unicast, no_bgp_default_ipv4_unicast_cmd, @@ -9995,9 +9953,7 @@ bgp_vty_init (void) /* "bgp bestpath med" commands */ install_element (BGP_NODE, &bgp_bestpath_med_cmd); - install_element (BGP_NODE, &bgp_bestpath_med2_cmd); install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); - install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); /* "no bgp default ipv4-unicast" commands. */ install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); From 90e9905f07695fd32696f3d543cbe4ed432263b6 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 11 Nov 2016 20:37:43 +0000 Subject: [PATCH 259/280] lib: Allow '-' to match VARIABLE_TKN Signed-off-by: Quentin Young --- lib/command_match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_match.c b/lib/command_match.c index 8fa8da6b10..ce03563acd 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -842,7 +842,7 @@ match_word (struct cmd_token *token, const char *word) } #define VARIABLE_ALPHABET \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/._" +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890:/._-" static enum match_type match_variable (struct cmd_token *token, const char *word) From 17aca20bfbb9d7e980a04c9b017f87f027901839 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 12 Nov 2016 01:06:32 +0000 Subject: [PATCH 260/280] lib, vtysh: Fix memory leaks, change cmd_element to const Fix a few memory issues: * Not freeing tab-completions upon input match failure * Invalid write when null-terminating tab-completions * Not freeing argv[] itself in additinon to elements * Use XFREE() instead of free() as appropriate * Not freeing final token of an [option] during parsing Make a few minor changes to CLI internals: * Improve documentation on matching & completion functions * Only make one copy of cmd_token's when building argv, instead of three * Don't make a copy of the matching cmd_element Make one major(ish) change to CLI internals: * Change all pointers to struct cmd_element to const Code outside of the core CLI units should never have an occasion to modify the internal state of the command system. Doing so could easily amount to having a CLI interface that changes during runtime, and could conceivably lead to security issues. Explicitly disallowing this removes any chance of confusion. Signed-off-by: Quentin Young --- lib/command.c | 50 ++++++++++++++++++++++----------------------- lib/command.h | 14 ++++++------- lib/command_match.c | 30 +++++++++++++++++---------- lib/command_match.h | 27 +++++++++++++++++++----- lib/command_parse.y | 1 + vtysh/vtysh.c | 6 +++--- 6 files changed, 76 insertions(+), 52 deletions(-) diff --git a/lib/command.c b/lib/command.c index 9eb43db94f..593822a66e 100644 --- a/lib/command.c +++ b/lib/command.c @@ -262,7 +262,10 @@ cmd_make_strvec (const char *string) // if the entire string was whitespace or a comment, return if (*copy == '\0' || *copy == '!' || *copy == '#') + { + XFREE (MTYPE_TMP, copystart); return NULL; + } vector strvec = vector_init (VECTOR_MIN_SIZE); const char *delim = " \n\r\t", *tok = NULL; @@ -546,7 +549,7 @@ completions_to_vec (struct list *completions) } if (!exists) - vector_set (comps, copy_cmd_token (token)); + vector_set (comps, token); } // sort completions @@ -560,7 +563,7 @@ completions_to_vec (struct list *completions) { vector_set_index (comps, vector_active (comps), NULL); memmove (comps->index + 1, comps->index, (comps->alloced - 1) * sizeof (void *)); - vector_set_index (comps, 0, copy_cmd_token (cr)); + vector_set_index (comps, 0, cr); } return comps; @@ -584,13 +587,7 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status) if (MATCHER_ERROR(rv)) { - switch (rv) - { - case MATCHER_AMBIGUOUS: - *status = CMD_ERR_AMBIGUOUS; - default: - *status = CMD_ERR_NO_MATCH; - } + *status = CMD_ERR_NO_MATCH; return NULL; } @@ -687,20 +684,17 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) struct cmd_token *token = vector_slot (initial_comps, i); if (token->type == WORD_TKN) vector_set (comps, token); - else - del_cmd_token (token); } vector_free (initial_comps); // copy completions text into an array of char* - ret = XMALLOC (MTYPE_TMP, vector_active (comps) * sizeof (char *) + 1); + ret = XMALLOC (MTYPE_TMP, (vector_active (comps)+1) * sizeof (char *)); unsigned int i; for (i = 0; i < vector_active (comps); i++) { struct cmd_token *token = vector_slot (comps, i); ret[i] = XSTRDUP (MTYPE_TMP, token->text); vector_unset (comps, i); - del_cmd_token (token); } // set the last element to NULL, because this array is used in // a Readline completion_generator function which expects NULL @@ -778,11 +772,11 @@ static int cmd_execute_command_real (vector vline, enum filter_type filter, struct vty *vty, - struct cmd_element **cmd) + const struct cmd_element **cmd) { struct list *argv_list; enum matcher_rv status; - struct cmd_element *matched_element = NULL; + const struct cmd_element *matched_element = NULL; struct graph *cmdgraph = cmd_node_graph (cmdvec, vty->node); status = command_match (cmdgraph, vline, &argv_list, &matched_element); @@ -792,6 +786,7 @@ cmd_execute_command_real (vector vline, // if matcher error, return corresponding CMD_ERR if (MATCHER_ERROR(status)) + { switch (status) { case MATCHER_INCOMPLETE: @@ -801,6 +796,7 @@ cmd_execute_command_real (vector vline, default: return CMD_ERR_NO_MATCH; } + } // build argv array from argv list struct cmd_token **argv = XMALLOC (MTYPE_TMP, argv_list->count * sizeof (struct cmd_token *)); @@ -820,6 +816,7 @@ cmd_execute_command_real (vector vline, // delete list and cmd_token's in it list_delete (argv_list); + XFREE (MTYPE_TMP, argv); return ret; } @@ -840,14 +837,16 @@ cmd_execute_command_real (vector vline, * as to why no command could be executed. */ int -cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, - int vtysh) { +cmd_execute_command (vector vline, struct vty *vty, + const struct cmd_element **cmd, + int vtysh) +{ int ret, saved_ret = 0; enum node_type onode, try_node; onode = try_node = vty->node; - if ( cmd_try_do_shortcut(vty->node, vector_slot(vline, 0) ) ) + if (cmd_try_do_shortcut(vty->node, vector_slot(vline, 0))) { vector shifted_vline; unsigned int index; @@ -867,7 +866,6 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, return ret; } - saved_ret = ret = cmd_execute_command_real (vline, FILTER_RELAXED, vty, cmd); if (vtysh) @@ -907,7 +905,7 @@ cmd_execute_command (vector vline, struct vty *vty, struct cmd_element **cmd, */ int cmd_execute_command_strict (vector vline, struct vty *vty, - struct cmd_element **cmd) + const struct cmd_element **cmd) { return cmd_execute_command_real(vline, FILTER_STRICT, vty, cmd); } @@ -925,7 +923,7 @@ cmd_execute_command_strict (vector vline, struct vty *vty, * as to why no command could be executed. */ int -command_config_read_one_line (struct vty *vty, struct cmd_element **cmd, int use_daemon) +command_config_read_one_line (struct vty *vty, const struct cmd_element **cmd, int use_daemon) { vector vline; int saved_node; @@ -2404,13 +2402,13 @@ del_cmd_token (struct cmd_token *token) if (!token) return; if (token->text) - free (token->text); + XFREE (MTYPE_CMD_TOKENS, token->text); if (token->desc) - free (token->desc); + XFREE (MTYPE_CMD_TOKENS, token->desc); if (token->arg) - free (token->arg); + XFREE (MTYPE_CMD_TOKENS, token->arg); - free (token); + XFREE (MTYPE_CMD_TOKENS, token); } struct cmd_token * @@ -2436,7 +2434,7 @@ del_cmd_element(struct cmd_element *cmd) } struct cmd_element * -copy_cmd_element(struct cmd_element *cmd) +copy_cmd_element(const struct cmd_element *cmd) { struct cmd_element *el = XMALLOC(MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); el->string = cmd->string ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->string) : NULL; diff --git a/lib/command.h b/lib/command.h index 51f7f78085..3bcd66468d 100644 --- a/lib/command.h +++ b/lib/command.h @@ -210,7 +210,7 @@ struct cmd_element u_char attr; /* Command attributes */ /* handler function for command */ - int (*func) (struct cmd_element *, struct vty *, int, struct cmd_token *[]); + int (*func) (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); }; /* Return value of the commands. */ @@ -245,11 +245,11 @@ struct cmd_element }; #define DEFUN_CMD_FUNC_DECL(funcname) \ - static int funcname (struct cmd_element *, struct vty *, int, struct cmd_token *[]); + static int funcname (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); #define DEFUN_CMD_FUNC_TEXT(funcname) \ static int funcname \ - (struct cmd_element *self __attribute__ ((unused)), \ + (const struct cmd_element *self __attribute__ ((unused)), \ struct vty *vty __attribute__ ((unused)), \ int argc __attribute__ ((unused)), \ struct cmd_token *argv[] __attribute__ ((unused)) ) @@ -410,11 +410,11 @@ extern char *cmd_concat_strvec (vector); extern vector cmd_describe_command (vector, struct vty *, int *status); extern char **cmd_complete_command (vector, struct vty *, int *status); extern const char *cmd_prompt (enum node_type); -extern int command_config_read_one_line (struct vty *vty, struct cmd_element **, int use_config_node); +extern int command_config_read_one_line (struct vty *vty, const struct cmd_element **, int use_config_node); extern int config_from_file (struct vty *, FILE *, unsigned int *line_num); extern enum node_type node_parent (enum node_type); -extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int); -extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **); +extern int cmd_execute_command (vector, struct vty *, const struct cmd_element **, int); +extern int cmd_execute_command_strict (vector, struct vty *, const struct cmd_element **); extern void cmd_init (int); extern void cmd_terminate (void); @@ -422,7 +422,7 @@ extern void cmd_terminate (void); void del_cmd_element(struct cmd_element *); struct cmd_element * -copy_cmd_element(struct cmd_element *cmd); +copy_cmd_element(const struct cmd_element *cmd); /* memory management for cmd_token */ struct cmd_token * diff --git a/lib/command_match.c b/lib/command_match.c index ce03563acd..82090be732 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -87,7 +87,7 @@ enum matcher_rv command_match (struct graph *cmdgraph, vector vline, struct list **argv, - struct cmd_element **el) + const struct cmd_element **el) { matcher_rv = MATCHER_NO_MATCH; @@ -171,13 +171,16 @@ command_match (struct graph *cmdgraph, * In the event that two children are found to match with the same precedence, * then the input is ambiguous for the passed cmd_element and NULL is returned. * - * The ultimate return value is an ordered linked list of nodes that comprise - * the best match for the command, each with their `arg` fields pointing to the - * matching token string. - * * @param[in] start the start node. * @param[in] vline the vectorized input line. * @param[in] n the index of the first input token. + * @return A linked list of n elements. The first n-1 elements are pointers to + * struct cmd_token and represent the sequence of tokens matched by the input. + * The ->arg field of each token points to a copy of the input matched on it. + * The final nth element is a pointer to struct cmd_element, which is the + * command that was matched. + * + * If no match was found, the return value is NULL. */ static struct list * command_match_r (struct graph_node *start, vector vline, unsigned int n) @@ -246,7 +249,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // deleting this list the last node must be // manually deleted struct cmd_element *el = leaf->data; - listnode_add (currbest, copy_cmd_element (el)); + listnode_add (currbest, el); currbest->del = (void (*)(void *)) &del_cmd_token; break; } @@ -385,10 +388,14 @@ command_complete (struct graph *graph, MATCHER_OK : MATCHER_NO_MATCH; - // extract cmd_token into list - *completions = list_new (); - for (ALL_LIST_ELEMENTS_RO (next,node,gn)) - listnode_add (*completions, gn->data); + *completions = NULL; + if (!MATCHER_ERROR(matcher_rv)) + { + // extract cmd_token into list + *completions = list_new (); + for (ALL_LIST_ELEMENTS_RO (next,node,gn)) + listnode_add (*completions, gn->data); + } list_delete (current); list_delete (next); @@ -560,6 +567,8 @@ disambiguate (struct list *first, * but arglists have cmd_element as the data for the tail, this function * manually deletes the tail before deleting the rest of the list as usual. * + * The cmd_element at the end is *not* a copy. It is the one and only. + * * @param list the arglist to delete */ static void @@ -567,7 +576,6 @@ del_arglist (struct list *list) { // manually delete last node struct listnode *tail = listtail (list); - del_cmd_element (tail->data); tail->data = NULL; list_delete_node (list, tail); diff --git a/lib/command_match.h b/lib/command_match.h index ac4e70c316..9e18b8d905 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -70,23 +70,40 @@ enum match_type * * @param[in] cmdgraph command graph to match against * @param[in] vline vectorized input string - * @param[out] argv pointer to argument list if successful match - * @param[out] element pointer to matched cmd_element if successful match + * @param[out] argv pointer to argument list if successful match, NULL + * otherwise. The elements of this list are pointers to struct cmd_token + * and represent the sequence of tokens matched by the inpu. The ->arg + * field of each token points to a copy of the input matched on it. These + * may be safely deleted or modified. + * @param[out] element pointer to matched cmd_element if successful match, + * or NULL when MATCHER_ERROR(rv) is true. The cmd_element may *not* be + * safely deleted or modified; it is the instance initialized on startup. * @return matcher status */ enum matcher_rv command_match (struct graph *cmdgraph, vector vline, struct list **argv, - struct cmd_element **element); + const struct cmd_element **element); /** * Compiles possible completions for a given line of user input. * * @param[in] start the start node of the DFA to match against * @param[in] vline vectorized input string - * @param[in] completions pointer to list of cmd_token representing - * acceptable next inputs + * @param[out] completions pointer to list of cmd_token representing + * acceptable next inputs, or NULL when MATCHER_ERROR(rv) is true. + * The elements of this list are pointers to struct cmd_token and take on a + * variety of forms depending on the passed vline. If the last element in vline + * is NULL, all previous elements are considered to be complete words (the case + * when a space is the last token of the line) and completions are generated + * based on what could follow that input. If the last element in vline is not + * NULL and each sequential element matches the corresponding tokens of one or + * more commands exactly (e.g. 'encapv4' and not 'en') the same result is + * generated. If the last element is not NULL and the best possible match is a + * partial match, then the result generated will be all possible continuations + * of that element (e.g. 'encapv4', 'encapv6', etc for input 'en'). + * @return matcher status */ enum matcher_rv command_complete (struct graph *cmdgraph, diff --git a/lib/command_parse.y b/lib/command_parse.y index 3ef0b42ebe..6348643b8b 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -383,6 +383,7 @@ option_token_seq: $$->start = $1->start; $$->end = $2->end; free ($1); + free ($2); } ; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 36ec565ec3..e8cf5aa23f 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -272,7 +272,7 @@ vtysh_execute_func (const char *line, int pager) int ret, cmd_stat; u_int i; vector vline; - struct cmd_element *cmd; + const struct cmd_element *cmd; FILE *fp = NULL; int closepager = 0; int tried = 0; @@ -483,7 +483,7 @@ vtysh_mark_file (const char *filename) int ret; vector vline; int tried = 0; - struct cmd_element *cmd; + const struct cmd_element *cmd; int saved_ret, prev_node; int lineno = 0; char *vty_buf_copy = NULL; @@ -651,7 +651,7 @@ int vtysh_config_from_file (struct vty *vty, FILE *fp) { int ret; - struct cmd_element *cmd; + const struct cmd_element *cmd; int lineno = 0; int retcode = CMD_SUCCESS; From 2d8c1a4d002a2d080df03a2b92f8c2e006676e01 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 12 Nov 2016 05:55:05 +0000 Subject: [PATCH 261/280] bgpd: Require `confed` or `missing-as-worst` Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index faa013ed91..52b7da1d50 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1989,7 +1989,7 @@ DEFUN (no_bgp_log_neighbor_changes, /* "bgp bestpath med" configuration. */ DEFUN (bgp_bestpath_med, bgp_bestpath_med_cmd, - "bgp bestpath med []", + "bgp bestpath med ", "BGP specific commands\n" "Change the default bestpath selection\n" "MED attribute\n" @@ -2014,7 +2014,7 @@ DEFUN (bgp_bestpath_med, DEFUN (no_bgp_bestpath_med, no_bgp_bestpath_med_cmd, - "no bgp bestpath med []", + "no bgp bestpath med ", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" From b6ffa87818890ba881153ac99a13f1482a016fcb Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sat, 12 Nov 2016 09:17:48 +0000 Subject: [PATCH 262/280] tools: Remove CLI refactoring tools No longer need automatic refactoring tools for CLI backend. Signed-off-by: Quentin Young --- tools/alias_destroyer.py | 273 ----- tools/argv_translator.py | 958 ---------------- tools/quagga_parser_to_network_docopt.py | 1327 ---------------------- 3 files changed, 2558 deletions(-) delete mode 100755 tools/alias_destroyer.py delete mode 100755 tools/argv_translator.py delete mode 100755 tools/quagga_parser_to_network_docopt.py diff --git a/tools/alias_destroyer.py b/tools/alias_destroyer.py deleted file mode 100755 index 0eec78e463..0000000000 --- a/tools/alias_destroyer.py +++ /dev/null @@ -1,273 +0,0 @@ -#!/usr/bin/env python - -import re -import sys -import os -from pprint import pformat, pprint - - -class DEFUN(object): - - def __init__(self, lines): - # name, name_cmd, command_string, help_strings, guts): - self.name = None - self.name_cmd = None - self.command_string = None - self.help_strings = [] - self.guts = [] - self.aliases = [] - - ''' -DEFUN (no_bgp_maxmed_onstartup, - no_bgp_maxmed_onstartup_cmd, - "no bgp max-med on-startup", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n") - - ''' - state = 'HEADER' - for (line_number, line) in enumerate(lines): - - if state == 'HEADER': - if line_number == 0: - re_name = re.search('DEFUN \((.*),', line.strip()) - self.name = re_name.group(1) - - elif line_number == 1: - self.name_cmd = line.strip()[0:-1] # chop the trailing comma - - elif line_number == 2: - self.command_string = line - state = 'HELP' - - elif state == 'HELP': - if line.strip() == '{': - self.guts.append(line) - state = 'BODY' - else: - self.help_strings.append(line) - - elif state == 'BODY': - if line.rstrip() == '}': - self.guts.append(line) - state = None - else: - self.guts.append(line) - - else: - raise Exception("invalid state %s" % state) - - # print "%d %7s: %s" % (line_number, state, line.rstrip()) - - assert self.command_string, "No command string for\n%s" % pformat(lines) - - def __str__(self): - return self.name - - def dump(self): - lines = [] - - if self.aliases: - lines.append("/*\n") - lines.append(" * CHECK ME - The following ALIASes need to be implemented in this DEFUN\n") - - for alias in self.aliases: - lines.append(" * %s\n" % alias.command_string.strip()) - for line in alias.help_strings: - lines.append(" * %s\n" % line) - lines.append(" *\n") - - lines.append(" */\n") - - lines.append("DEFUN (%s,\n" % self.name) - lines.append(" %s,\n" % self.name_cmd) - lines.append(self.command_string) - lines.extend(self.help_strings) - lines.extend(self.guts) - return ''.join(lines) - - -class ALIAS(object): - - def __init__(self, lines): - self.name = None - self.name_cmd = None - self.command_string = None - self.help_strings = [] - - ''' -ALIAS (no_bgp_maxmed_onstartup, - no_bgp_maxmed_onstartup_period_cmd, - "no bgp max-med on-startup <5-86400>", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n" - "Time (seconds) period for max-med\n") - ''' - state = 'HEADER' - for (line_number, line) in enumerate(lines): - - if state == 'HEADER': - if line_number == 0: - re_name = re.search('ALIAS \((.*),', line) - - try: - self.name = re_name.group(1) - except AttributeError: - pprint(lines) - raise - - elif line_number == 1: - self.name_cmd = line.strip()[0:-1] # chop the trailing comma - - elif line_number == 2: - self.command_string = line - state = 'HELP' - - elif state == 'HELP': - if line.strip() == '{': - raise Exception("should not see { in an ALIAS") - else: - line = line.strip() - if line.endswith(')'): - line = line[0:-1] # strip the trailing ) - self.help_strings.append(line) - - else: - raise Exception("invalid state %s" % state) - - assert self.command_string, "No command string for\n%s" % pformat(lines) - - def __str__(self): - return self.name_cmd - - -def alias_destroy(filename): - lines = [] - defuns = {} - aliases = {} - - with open(filename, 'r') as fh: - state = None - defun_lines = [] - alias_lines = [] - - for (line_number, line) in enumerate(fh.readlines()): - - if state is None: - if line.startswith('DEFUN ('): - assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) - defun_lines.append(line) - state = 'DEFUN_HEADER' - - elif line.startswith('ALIAS ('): - assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) - alias_lines.append(line) - state = 'ALIAS_HEADER' - - elif state == 'DEFUN_HEADER': - defun_lines.append(line) - - if line.startswith('DEFUN'): - raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number) - - elif line.startswith('ALIAS'): - raise Exception("ERROR on line %d, found ALIAS inside DEFUN" % line_number) - - elif line.strip() == '{': - state = 'DEFUN_BODY' - - elif state == 'ALIAS_HEADER': - alias_lines.append(line) - - if line.startswith('ALIAS'): - raise Exception("ERROR on line %d, found ALIAS inside ALIAS" % line_number) - - elif line.startswith('DEFUN'): - raise Exception("ERROR on line %d, found DEFUN inside ALIAS" % line_number) - - if line.rstrip().endswith(')'): - new_alias = ALIAS(alias_lines) - aliases[new_alias.name_cmd] = new_alias - state = None - alias_lines = [] - - elif state == 'DEFUN_BODY': - defun_lines.append(line) - - if line.rstrip() == '}': - new_defun = DEFUN(defun_lines) - defuns[new_defun.name] = new_defun - state = None - defun_lines = [] - - # uncomment to debug state machine - print "%5d %12s: %s" % (line_number, state, line.rstrip()) - - lines.append(line) - - - # At this point we know all of the aliases and all of the tokens - # Assign each ALIAS to its parent DEFUN - for alias in aliases.itervalues(): - defun = defuns.get(alias.name) - assert defun, "Could not find DEFUN for %s" % alias - defun.aliases.append(alias) - - # Now write the file but: - # - do not write any ALIASes - # - do not write the install_element for any ALIASes - # - when you write the DEFUN include a comment that contains the ALIAS command strings it needs to cover - with open(filename, 'w') as fh: - state = None - - for line in lines: - - if state is None: - if line.startswith('DEFUN ('): - state = 'DEFUN_HEADER' - re_name = re.search('DEFUN \((.*),', line.strip()) - name = re_name.group(1) - defun = defuns.get(name) - fh.write(defun.dump()) - - elif line.startswith('ALIAS ('): - state = 'ALIAS_HEADER' - - else: - if 'install_element' in line: - # install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); - re_install_element = re.search('install_element\s*\(\w+,\s*&(.*)\s*\)', line.strip()) - - if re_install_element: - cmd = re_install_element.group(1) - if cmd not in aliases: - fh.write(line) - else: - fh.write(line) - else: - fh.write(line) - - elif state == 'DEFUN_HEADER': - if line.strip() == '{': - state = 'DEFUN_BODY' - - elif state == 'ALIAS_HEADER': - if line.rstrip().endswith(')'): - state = None - - elif state == 'DEFUN_BODY': - if line.rstrip() == '}': - state = None - - -if __name__ == '__main__': - - filename = sys.argv[1] - if os.path.exists(filename): - alias_destroy(filename) - else: - print "ERROR: could not find file %s" % filename diff --git a/tools/argv_translator.py b/tools/argv_translator.py deleted file mode 100755 index 5325969fdf..0000000000 --- a/tools/argv_translator.py +++ /dev/null @@ -1,958 +0,0 @@ -#!/usr/bin/env python - -""" -Usage: - - argv_translator.py rebuild-defuns [] - -Help: - rebuild-defuns : foo - -""" - -# This script did different things at different times as we migrated code -# to quentin's parse engine. The following were its rebuild-defuns phases: -# -# - originally was used to change all of the argv[2] to argv[4]->arg. This -# calculated the new argv index and added the ->arg. -# - next it was used to replace the 4 in argv[4]->arg with an idx_foo variable -# -# idx-logic -# - used to take a command string and build out an idx_ logic skeleton -# - -import argparse -import re -import sys -import os -import subprocess -from collections import OrderedDict -from copy import deepcopy -from pprint import pformat, pprint -from network_docopt import NetworkDocopt, get_network_docopt_info - - -def token_is_variable(line_number, token): - - if token.isdigit(): - return True - - if token.startswith('('): - assert token.endswith(')') or token.endswith(')...'), "%d: token %s should end with )" % (line_number, token) - return True - - if token.startswith('['): - assert token.endswith(']'), "%d: token %s should end with ]" % (line_number, token) - return True - - if token.startswith('<'): - assert token.endswith('>'), "%d: token %s should end with >" % (line_number, token) - return True - - if token.startswith('{'): - # I don't really care about checking for this I just put - # these asserts in here to bug sharpd - assert token.endswith('}'), "%d: token %s should end with }" % (line_number, token) - return True - - assert '|' not in token, "%d: Weird token %s has a | but does not start with [ or (" % (line_number, token) - - if token in ('WORD', - '.LINE', - '.AA:NN', - 'A.B.C.D', - 'A.B.C.D/M', - 'X:X::X:X', - 'X:X::X:X/M', - 'ASN:nn_or_IP-address:nn'): - return True - - # Anything in all caps in a variable - if token.upper() == token: - return True - - re_number_range = re.search('^<\d+-\d+>$', token) - if re_number_range: - return True - - return False - - -def line_to_tokens(line_number, text): - """ - Most of the time whitespace can be used to split tokens - (set|clear) clagd-enable (no|yes) - - tokens - - (set|clear) - - - - clagd-enable - - (no|yes) - - But if we are dealing with multiword keywords, such as "soft in", that approach - does not work. We can only split on whitespaces if we are not inside a () or [] - bgp (|||*) [soft in|soft out] - - tokens: - - bgp - - (|||*) - - [soft in|soft out] - """ - tokens = [] - token_index = 0 - token_text = [] - parens = 0 - curlys = 0 - brackets = 0 - less_greater = 0 - - for char in text: - if char == ' ': - if parens == 0 and brackets == 0 and curlys == 0 and less_greater == 0: - if token_text: - tokens.append(''.join(token_text)) - token_index += 1 - token_text = [] - else: - token_text.append(char) - else: - if char == '(': - parens += 1 - - elif char == ')': - parens -= 1 - - elif char == '[': - brackets += 1 - - elif char == ']': - brackets -= 1 - - elif char == '{': - curlys += 1 - - elif char == '}': - curlys -= 1 - - elif char == '<': - less_greater += 1 - - elif char == '>': - less_greater -= 1 - - if char: - token_text.append(char) - - if token_text: - tokens.append(''.join(token_text)) - - return tokens - - -''' -# No longer used now that all indexes have been updated -def get_argv_translator(line_number, line): - table = {} - line = line.strip() - assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line) - assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line) - - line = line[1:-2] - - funky_chars = ('+', '"') - for char in funky_chars: - if char in line: - raise Exception("%d: Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % (line_number, line)) - - old_style_index = 0 - for (token_index, token) in enumerate(line_to_tokens(line)): - if not token: - continue - - if token_is_variable(line_number, token): - # print "%s is a token" % token - table[old_style_index] = token_index - old_style_index += 1 - else: - # print "%s is NOT a token" % token - pass - - return table -''' - -def get_command_string_variable_indexes(line_number, line): - indexes = {} - - line = line.strip() - assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line) - assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line) - line = line[1:-2] - max_index = 0 - - for (token_index, token) in enumerate(line_to_tokens(line_number, line)): - if not token: - raise Exception("%d: empty token" % line_number) - - if token_is_variable(line_number, token): - # print "%s is a token" % token - indexes[token_index] = True - max_index = token_index - - return (max_index, indexes) - - -def get_token_index_variable_name(line_number, token): - - re_range = re.search('\(\d+-\d+\)', token) - - if token.startswith('['): - assert token.endswith(']'), "Token %s should end with ]" % token - token = token[1:-1] - - if token.startswith('<'): - assert token.endswith('>'), "Token %s should end with >" % token - token = token[1:-1] - - if token == 'A.B.C.D': - return 'idx_ipv4' - - elif token == 'A.B.C.D/M': - return 'idx_ipv4_prefixlen' - - elif token == 'X:X::X:X': - return 'idx_ipv6' - - elif token == 'X:X::X:X/M': - return 'idx_ipv6_prefixlen' - - elif token == 'ASN:nn_or_IP-address:nn': - return 'idx_ext_community' - - elif token == '.AA:NN': - return 'idx_community' - - elif token == 'WORD': - return 'idx_word' - - elif token == 'json': - return 'idx_json' - - elif token == '.LINE': - return 'idx_regex' - - elif token == 'A.B.C.D|INTERFACE': - return 'idx_ipv4_ifname' - - elif token == 'A.B.C.D|INTERFACE|null0': - return 'idx_ipv4_ifname_null' - - elif token == 'X:X::X:X|INTERFACE': - return 'idx_ipv6_ifname' - - elif token == 'reject|blackhole': - return 'idx_reject_blackhole' - - elif token == 'route-map NAME': - return 'idx_route_map' - - elif token == 'recv|send|detail': - return 'idx_recv_send' - - elif token == 'recv|send': - return 'idx_recv_send' - - elif token == 'up|down': - return 'idx_up_down' - - elif token == 'off-link': - return 'idx_off_link' - - elif token == 'no-autoconfig': - return 'idx_no_autoconfig' - - elif token == 'router-address': - return 'idx_router_address' - - elif token == 'high|medium|low': - return 'idx_high_medium_low' - - elif token == '(0-4294967295)|infinite': - return 'idx_number_infinite' - - elif token == '(1-199)|(1300-2699)|WORD': - return 'idx_acl' - - elif token == 'A.B.C.D|X:X::X:X': - return 'idx_ip' - - elif token == 'in|out': - return 'idx_in_out' - - elif token == 'deny|permit': - return 'idx_permit_deny' - - elif token == 'view|vrf': - return 'idx_view_vrf' - - elif token == 'unicast|multicast': - return 'idx_safi' - - elif token == 'bestpath|multipath': - return 'idx_bestpath' - - elif token == 'egp|igp|incomplete': - return 'idx_origin' - - elif token == 'cisco|zebra' or token == 'cisco|ibm|shortcut|standard': - return 'idx_vendor' - - elif token == 'as-set|no-as-set': - return 'idx_as_set' - - elif token == 'confed|missing-as-worst': - return 'idx_med_knob' - - elif token == 'both|send|receive' or token == 'send|recv': - return 'idx_send_recv' - - elif token == 'both|extended|standard' or token == '1|2': - return 'idx_type' - - elif token == 'A.B.C.D|WORD' or token == 'A.B.C.D/M|WORD': - return 'idx_ipv4_word' - - elif token == 'advertise-queue|advertised-routes|packet-queue': - return 'idx_type' - - elif token == 'ospf|table': - return 'idx_ospf_table' - - elif token == 'as-path|next-hop|med' or token == 'next-hop|med' or token == 'as-path|med' or token == 'as-path|next-hop': - return 'idx_attribute' - - elif token == '(1-4294967295)|external|internal' or token == '(1-4294967295)|internal|external': - return 'idx_remote_as' - - elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD': - return 'idx_comm_list' - - elif token == 'ipv4|ipv6' or token == 'ip|ipv6': - return 'idx_afi' - - elif token == 'md5|clear' or token == 'null|message-digest' or token == 'md5|text': - return 'idx_encryption' - - elif token == 'IFNAME|default': - return 'idx_ifname' - - elif token == 'type-1|type-2': - return 'idx_external' - - elif token == 'table|intra-area|inter-area|memory': - return 'idx_type' - - elif token == 'translate-candidate|translate-never|translate-always': - return 'idx_translate' - - elif token == 'intra-area (1-255)|inter-area (1-255)|external (1-255)': - return 'idx_area_distance' - - elif token == 'metric (0-16777214)|metric-type <1|2>|route-map WORD' or token == 'always|metric (0-16777214)|metric-type <1|2>|route-map WORD': - return 'idx_redist_param' - - elif token == 'default|enable|disable' or token == 'enable|disable': - return 'idx_enable_disable' - - elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all' or token == 'hello|dd|ls-request|ls-update|ls-ack|all': - return 'idx_packet' - - elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix' or token == 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as': - return 'idx_lsa' - - elif token == 'broadcast|point-to-point' or token == 'broadcast|non-broadcast|point-to-multipoint|point-to-point': - return 'idx_network' - - elif token == 'A.B.C.D|(0-4294967295)': - return 'idx_ipv4_number' - - elif token == 'narrow|transition|wide': - return 'idx_metric_style' - - elif token == 'area-password|domain-password': - return 'idx_password' - - elif token == 'param': - return 'idx_param' - - elif token == 'advertised-routes|received-routes': - return 'idx_adv_rcvd_routes' - - elif token == 'encap|multicast|unicast|vpn' or token == 'unicast|multicast|vpn|encap': - return 'idx_safi' - - elif token == 'AA:NN|local-AS|no-advertise|no-export': - return 'idx_community' - - elif token == 'all|all-et|updates|updates-et|routes-mrt': - return 'idx_dump_routes' - - elif token == 'A.B.C.D|X:X::X:X|WORD': - return 'idx_peer' - - elif token == 'A.B.C.D/M|X:X::X:X/M': - return 'idx_ipv4_ipv6_prefixlen' - - elif token == 'level-1|level-2' or token == 'level-1|level-1-2|level-2-only': - return 'idx_level' - - elif token == 'metric (0-16777215)|route-map WORD' or token == 'always|metric (0-16777215)|route-map WORD': - return 'idx_metric_rmap' - - elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': - return 'idx_rpf_lookup_mode' - - elif token == 'hello|joins': - return 'idx_hello_join' - - elif token == 'nocache|wrongvif|wholepkt': - return 'idx_type' - - elif token == 'file|memory|terminal': - return 'idx_type' - - elif token == 'prefix': - return 'idx_prefix' - - elif token == 'A.B.C.D/M|any': - return 'idx_ipv4_any' - - elif token == 'X:X::X:X/M|any': - return 'idx_ipv6_any' - - elif token == '(1-99)|(1300-1999)' or token == '(100-199)|(2000-2699)' or token == '(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD': - return 'idx_acl' - - elif token == 'kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7': - return 'idx_target' - - - elif token in ('kernel|connected|static|rip|ospf|isis|pim|table', - 'kernel|connected|static|ripng|ospf6|isis|table', - 'kernel|connected|static|rip|isis|bgp|pim|table', - 'kernel|connected|static|rip|ospf|isis|bgp|pim|table', - 'kernel|connected|static|rip|ospf|isis|bgp|pim|table', - 'kernel|connected|static|rip|ospf|isis|bgp|pim|table|any', - 'kernel|connected|static|ripng|ospf6|isis|bgp|table|any', - 'kernel|connected|static|ripng|ospf6|isis|bgp|table', - 'kernel|connected|static|ospf6|isis|bgp|table', - 'kernel|connected|static|ospf|isis|bgp|pim|table', - 'kernel|connected|static|ripng|isis|bgp|table', - # '', - 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd', - 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd', - 'bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static', - 'kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table'): - return 'idx_protocol' - - elif '|' in token: - raise Exception("%d: what variable name for %s" % (line_number, token)) - - elif re_range: - return 'idx_number' - - elif token.upper() == token: - return 'idx_%s' % token.lower() - - else: - raise Exception("%d: what variable name for %s" % (line_number, token)) - - -def get_command_string_index_variable_table(line_number, line): - """ - Return a table that maps an index position to a variable name such as 'idx_ipv4' - """ - indexes = OrderedDict() - - line = line.strip() - assert line.startswith('"'), "line does not start with \"\n%s" % (line) - assert line.endswith('",'), "line does not end with \",\n%s" % (line) - line = line[1:-2] - max_index = 0 - - for (token_index, token) in enumerate(line_to_tokens(line_number, line)): - if not token: - raise Exception("%d: empty token" % line_number) - - if token_is_variable(line_number, token): - # print "%s is a token" % token - idx_variable_name = get_token_index_variable_name(line_number, token) - count = 0 - for tmp in indexes.itervalues(): - if tmp == idx_variable_name: - count += 1 - elif re.search('^%s_\d+' % idx_variable_name, tmp): - count += 1 - if count: - idx_variable_name = "%s_%d" % (idx_variable_name, count + 1) - indexes[token_index] = idx_variable_name - - return indexes - - -def expand_command_string(line): - - # in the middle - line = line.replace('" CMD_AS_RANGE "', '(1-4294967295)') - line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '(1-5000)') - line = line.replace('" BGP_INSTANCE_CMD "', ' WORD') - line = line.replace('" BGP_INSTANCE_ALL_CMD "', ' all') - line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '(1-255)') - line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '') - line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '') - line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') - line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '') - line = line.replace('" VRF_CMD_STR "', 'vrf NAME') - line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all') - line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '') - line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '') - line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '') - line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '') - line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '') - line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '') - line = line.replace('" LOG_FACILITIES "', '') - line = line.replace('" LOG_LEVELS "', ' ') - - # endswith - line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",') - line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' (1-5000)",') - line = line.replace('" BGP_INSTANCE_CMD,', ' WORD",') - line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' all",') - line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '(1-255)",') - line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '(1-255)",') - line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '(2-255) (50-60000) (50-60000)",') - line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', - ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",') - line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' ",') - line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' [A.B.C.D|X:X::X:X|WORD]",') - line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' ",') - line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' ",') - line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' ",') - line = line.replace('" VRF_CMD_STR,', ' vrf NAME",') - line = line.replace('" VRF_ALL_CMD_STR,', ' vrf all",') - line = line.replace('" QUAGGA_IP_REDIST_STR_ZEBRA,', ' ",') - line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' ",') - line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' ",') - line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' ",') - line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' ",') - line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' ",') - line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') - line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') - line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' ",') - line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' ",') - line = line.replace('" LOG_FACILITIES,', ' ",') - line = line.replace('" LOG_LEVELS,', ' ",') - - # startswith - line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range ') - line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor ') - line = line.replace('NEIGHBOR_CMD2 "', '"neighbor ') - line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor ') - line = line.replace('NEIGHBOR_CMD "', '"neighbor ') - line = line.replace('PIM_CMD_NO "', '"no ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') - line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') - line = line.replace('LOG_LEVELS "', '" ') - - # solo - line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor ",') - line = line.replace('NEIGHBOR_CMD2,', '"neighbor ",') - line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor ",') - line = line.replace('NEIGHBOR_CMD,', '"neighbor ",') - line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",') - - if line.rstrip().endswith('" ,'): - line = line.replace('" ,', '",') - - # compress duplicate white spaces - re_space = re.search('^(\s*).*(\s*)$', line) - line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) - - return line - - -class DEFUN(object): - - def __init__(self, line_number, command_string_expanded, lines): - # name, name_cmd, command_string, help_strings, guts): - self.line_number = line_number - self.name = None - self.name_cmd = None - self.command_string = None - self.command_string_expanded = command_string_expanded - self.help_strings = [] - self.guts = [] - - ''' -DEFUN (no_bgp_maxmed_onstartup, - no_bgp_maxmed_onstartup_cmd, - "no bgp max-med on-startup", - NO_STR - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n") - - ''' - state = 'HEADER' - for (line_number, line) in enumerate(lines): - - if state == 'HEADER': - if line_number == 0: - re_name = re.search('DEFUN \((.*),', line.strip()) - self.name = re_name.group(1) - - elif line_number == 1: - self.name_cmd = line.strip()[0:-1] # chop the trailing comma - - elif line_number == 2: - self.command_string = line - state = 'HELP' - - elif state == 'HELP': - if line.strip() == '{': - # self.guts.append(line) - state = 'BODY' - else: - self.help_strings.append(line) - - elif state == 'BODY': - if line.rstrip() == '}': - # self.guts.append(line) - state = None - else: - self.guts.append(line) - - else: - raise Exception("invalid state %s" % state) - - # print "%d %7s: %s" % (line_number, state, line.rstrip()) - - assert self.command_string, "No command string for\n%s" % pformat(lines) - - def __str__(self): - return self.name - - def sanity_check(self): - (max_index, variable_indexes) = get_command_string_variable_indexes(self.line_number, self.command_string_expanded) - - # sanity check that each argv index matches a variable in the command string - for line in self.guts: - if 'argv[' in line and '->arg' in line: - tmp_line = deepcopy(line) - re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line) - - while re_argv: - index = int(re_argv.group(1)) - if index not in variable_indexes and index <= max_index: - print "%d: index %s is not a variable in the command string" % (self.line_number, index) - tmp_line = re_argv.group(2) - re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line) - - def get_new_command_string(self): - line = self.command_string - # Change <1-255> to (1-255) - # Change (foo|bar) to - # Change {wazzup} to [wazzup]....there shouldn't be many of these - - line = line.replace('(', '<') - line = line.replace(')', '>') - line = line.replace('{', '[') - line = line.replace('}', ']') - re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) - - # A one off to handle "CMD_RANGE_STR(1, MULTIPATH_NUM)" - if 'CMD_RANGE_STR<' in line: - line = line.replace('CMD_RANGE_STR<', 'CMD_RANGE_STR(') - line = line.replace('>', ')') - - while re_range: - line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3)) - re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) - - if not line.endswith('\n'): - line += '\n' - - if '|<' in line: - print "%d: ERROR |< is illegal in '%s'" % (self.line_number, line) - - if '|[' in line: - print "%d: ERROR |[ is illegal in '%s'" % (self.line_number, line) - - # compress duplicate whitespaces - re_space = re.search('^(\s*).*(\s*)$', line) - line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) - - ''' - # I ran this once and cleaned them all up...this spews many - # false positives so we don't want to leave this on - for token in line_to_tokens(self.line_number, line): - token = token.strip() - - if token.endswith('",'): - token = token[0:-2] - - if token.startswith('[') and '|' in token: - if not token.startswith('[<') or not token.endswith('>]'): - print "%s: suspend token '%s'" % (self.line_number, token) - ''' - - return line - - def get_used_idx_variables(self, idx_table): - used = {} - - # sanity check that each argv index matches a variable in the command string - for line in self.guts: - if 'argv[' in line and '->arg' in line: - tmp_line = deepcopy(line) - re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line) - - while re_argv: - index = re_argv.group(1) - - if index.isdigit(): - index = int(index) - if index in idx_table: - used[index] = idx_table[index] - else: - print "%d: could not find idx variable for %d" % (self.line_number, index) - else: - for (key, value) in idx_table.iteritems(): - if value == index: - used[key] = value - break - - tmp_line = re_argv.group(2) - re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line) - - return used - - def uses_argc(self): - for line in self.guts: - if 'CHECK ME argc referenced below' in line: - return False - - if 'use_json (argc, argv)' in line: - continue - - if 'use_json(argc, argv)' in line: - continue - - if 'bgp_get_argv_vrf (argc,)' in line: - continue - - if 'bgp_get_argv_afi_safi (argc,' in line: - continue - - if 'zebra_vty_ip_route_tdv_helper (argc,' in line: - continue - - if 'argc' in line: - return True - return False - - def dump(self): - # new_command_string = self.get_new_command_string() - # new_command_string_expanded = expand_command_string(new_command_string) - new_command_string_expanded = self.get_new_command_string() - lines = [] - - lines.append("DEFUN (%s,\n" % self.name) - lines.append(" %s,\n" % self.name_cmd) - # lines.append(new_command_string) - lines.append(new_command_string_expanded) - lines.extend(self.help_strings) - lines.append('{\n') - - # if self.uses_argc(): - # lines.append(" /* CHECK ME argc referenced below */\n") - lines.extend(self.guts) - - ''' - This is no longer used but was used to do the "- next it was used to - replace the 4 in argv[4]->arg with an idx_foo variable" run mentioned - at the top of this file. - - # only print the variables that will be used else we get a compile error - idx_table = get_command_string_index_variable_table(self.line_number, new_command_string_expanded) - idx_table_used = self.get_used_idx_variables(idx_table) - - for index in sorted(idx_table_used.keys()): - idx_variable = idx_table_used[index] - lines.append(" int %s = %d;\n" % (idx_variable, index)) - - # sanity check that each argv index matches a variable in the command string - for line in self.guts: - if line.startswith(' int idx_'): - pass - elif 'argv[' in line and '->arg' in line: - for (index, idx_variable) in idx_table.iteritems(): - line = line.replace("argv[%d]->arg" % index, "argv[%s]->arg" % idx_variable) - lines.append(line) - else: - lines.append(line) - ''' - - lines.append('}\n') - return ''.join(lines) - - -def update_argvs(filename): - lines = [] - - with open(filename, 'r') as fh: - state = None - defun_line_number = None - cmd_string = None - # argv_translator = {} - # print_translator = False - variable_indexes = {} - max_index = 0 - defun_lines = [] - defuns = {} - command_string = None - - for (line_number, line) in enumerate(fh.readlines()): - # new_line = line - - if state is None: - if line.startswith('DEFUN ('): - assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line) - state = 'DEFUN_HEADER' - defun_line_number = line_number - defun_lines.append(line) - - elif state == 'DEFUN_HEADER': - defun_lines.append(line) - - if line.startswith('DEFUN'): - raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number) - - elif line.startswith('ALIAS'): - raise Exception("ERROR on line %d, found ALIAS inside DEFUN" % line_number) - - elif line.strip() == '{': - state = 'DEFUN_BODY' - - elif line_number == defun_line_number + 2: - line = expand_command_string(line) - command_string = line - - ''' - # No longer used now that all indexes have been updated - argv_translator = get_argv_translator(line_number, line) - print_translator = True - ''' - - elif state == 'DEFUN_BODY': - defun_lines.append(line) - - if line.rstrip() == '}': - new_defun = DEFUN(defun_line_number, command_string, defun_lines) - defuns[new_defun.name] = new_defun - state = None - command_string = None - defun_lines = [] - - # cmd_string = None - # defun_line_number = None - # argv_translator = {} - - ''' - # No longer used now that all indexes have been updated - elif 'argv[' in new_line and '->arg' not in new_line: - for index in reversed(argv_translator.keys()): - old_argv = "argv[%d]" % index - new_argv = "argv[%d]->arg" % argv_translator[index] - new_line = new_line.replace(old_argv, new_argv) - ''' - - # uncomment to debug state machine - # print "%5d %12s: %s" % (line_number, state, line.rstrip()) - - ''' - # No longer used now that all indexes have been updated - if print_translator: - print "%s\n" % pformat(argv_translator) - print_translator = False - ''' - - lines.append(line) - - for defun in defuns.itervalues(): - defun.sanity_check() - - # Now write the file but allow the DEFUN object to update the contents of the DEFUN () - with open(filename, 'w') as fh: - state = None - - for (line_number, line) in enumerate(lines): - - if state is None: - if 'The following ALIASes need to be implemented in this DEFUN' in line: - state = 'CHANGE ME' - fh.write(line) - - elif line.startswith('DEFUN ('): - state = 'DEFUN_HEADER' - re_name = re.search('DEFUN \((.*),', line.strip()) - name = re_name.group(1) - defun = defuns.get(name) - fh.write(defun.dump()) - else: - fh.write(line) - - elif state == 'CHANGE ME': - if line.strip() == '*/': - state = None - fh.write(line) - elif line.strip().startswith('* ') and not line.strip().startswith('* '): - new_line = expand_command_string(line[3:]) # chop the leading " * " - fh.write(" * %s" % new_line) - else: - fh.write(line) - - elif state == 'DEFUN_HEADER': - if line.strip() == '{': - state = 'DEFUN_BODY' - - elif state == 'DEFUN_BODY': - if line.rstrip() == '}': - state = None - - # uncomment to debug state machine - # print "%5d %12s: %s" % (line_number, state, line.rstrip()) - - -if __name__ == '__main__': - (print_options, ended_with_space, sys.argv) = get_network_docopt_info(sys.argv) - cli = NetworkDocopt(__doc__) - - if print_options: - cli.print_options(ended_with_space) - else: - cli.run() - - if cli.get('rebuild-defuns'): - if cli.get(''): - filename = cli.get('') - update_argvs(filename) - - else: - output = subprocess.check_output("grep -l DEFUN *.c", shell=True).splitlines() - for filename in output: - filename = filename.strip() - print "crunching %s" % filename - update_argvs(filename) diff --git a/tools/quagga_parser_to_network_docopt.py b/tools/quagga_parser_to_network_docopt.py deleted file mode 100755 index 89a6fd7985..0000000000 --- a/tools/quagga_parser_to_network_docopt.py +++ /dev/null @@ -1,1327 +0,0 @@ -#!/usr/bin/env python - -""" -The primary use case of this tool is to print a network-docopt compatible -docstring that covers all bgp and ospf commands in quagga. -""" - -import argparse -import logging -import os -import re -import sys -from pprint import pprint, pformat - -# All of the clear commands in bgp_clear_ignore will be covered by these clear commands: -# quagga clear bgp (|||*) -# quagga clear bgp (|||*) soft [in|out] -# quagga clear bgp prefix -bgp_clear_ignore = """ quagga clear bgp (||) - quagga clear bgp (||) in - quagga clear bgp (||) in prefix-filter - quagga clear bgp (||) out - quagga clear bgp (||) soft - quagga clear bgp (||) soft in - quagga clear bgp (||) soft out - quagga clear bgp * - quagga clear bgp * in - quagga clear bgp * in prefix-filter - quagga clear bgp * out - quagga clear bgp * soft - quagga clear bgp * soft in - quagga clear bgp * soft out - quagga clear bgp <1-4294967295> - quagga clear bgp <1-4294967295> in - quagga clear bgp <1-4294967295> in prefix-filter - quagga clear bgp <1-4294967295> out - quagga clear bgp <1-4294967295> soft - quagga clear bgp <1-4294967295> soft in - quagga clear bgp <1-4294967295> soft out - quagga clear bgp BGP_INSTANCE_CMD * - quagga clear bgp BGP_INSTANCE_CMD * soft - quagga clear bgp BGP_INSTANCE_CMD * soft in - quagga clear bgp BGP_INSTANCE_CMD * soft out - quagga clear bgp external - quagga clear bgp external in - quagga clear bgp external in prefix-filter - quagga clear bgp external out - quagga clear bgp external soft - quagga clear bgp external soft in - quagga clear bgp external soft out - quagga clear bgp ipv6 (||) - quagga clear bgp ipv6 (||) in - quagga clear bgp ipv6 (||) in prefix-filter - quagga clear bgp ipv6 (||) out - quagga clear bgp ipv6 (||) soft - quagga clear bgp ipv6 (||) soft in - quagga clear bgp ipv6 (||) soft out - quagga clear bgp ipv6 (unicast|multicast) prefix - quagga clear bgp ipv6 * - quagga clear bgp ipv6 * in - quagga clear bgp ipv6 * in prefix-filter - quagga clear bgp ipv6 * out - quagga clear bgp ipv6 * soft - quagga clear bgp ipv6 * soft in - quagga clear bgp ipv6 * soft out - quagga clear bgp ipv6 <1-4294967295> - quagga clear bgp ipv6 <1-4294967295> in - quagga clear bgp ipv6 <1-4294967295> in prefix-filter - quagga clear bgp ipv6 <1-4294967295> out - quagga clear bgp ipv6 <1-4294967295> soft - quagga clear bgp ipv6 <1-4294967295> soft in - quagga clear bgp ipv6 <1-4294967295> soft out - quagga clear bgp ipv6 external - quagga clear bgp ipv6 external WORD in - quagga clear bgp ipv6 external WORD out - quagga clear bgp ipv6 external in prefix-filter - quagga clear bgp ipv6 external soft - quagga clear bgp ipv6 external soft in - quagga clear bgp ipv6 external soft out - quagga clear bgp ipv6 peer-group WORD - quagga clear bgp ipv6 peer-group WORD in - quagga clear bgp ipv6 peer-group WORD in prefix-filter - quagga clear bgp ipv6 peer-group WORD out - quagga clear bgp ipv6 peer-group WORD soft - quagga clear bgp ipv6 peer-group WORD soft in - quagga clear bgp ipv6 peer-group WORD soft out - quagga clear bgp peer-group WORD - quagga clear bgp peer-group WORD in - quagga clear bgp peer-group WORD in prefix-filter - quagga clear bgp peer-group WORD out - quagga clear bgp peer-group WORD soft - quagga clear bgp peer-group WORD soft in - quagga clear bgp peer-group WORD soft out - quagga clear ip bgp (|) in - quagga clear ip bgp (|) in prefix-filter - quagga clear ip bgp (|) ipv4 (unicast|multicast) in - quagga clear ip bgp (|) ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp (|) ipv4 (unicast|multicast) out - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft in - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft out - quagga clear ip bgp (|) out - quagga clear ip bgp (|) soft - quagga clear ip bgp (|) soft in - quagga clear ip bgp (|) soft out - quagga clear ip bgp (|) vpnv4 unicast in - quagga clear ip bgp (|) vpnv4 unicast out - quagga clear ip bgp (|) vpnv4 unicast soft - quagga clear ip bgp (|) vpnv4 unicast soft in - quagga clear ip bgp (|) vpnv4 unicast soft out - quagga clear ip bgp (||) - quagga clear ip bgp * - quagga clear ip bgp * in - quagga clear ip bgp * in prefix-filter - quagga clear ip bgp * ipv4 (unicast|multicast) in - quagga clear ip bgp * ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp * ipv4 (unicast|multicast) out - quagga clear ip bgp * ipv4 (unicast|multicast) soft - quagga clear ip bgp * ipv4 (unicast|multicast) soft in - quagga clear ip bgp * ipv4 (unicast|multicast) soft out - quagga clear ip bgp * out - quagga clear ip bgp * soft - quagga clear ip bgp * soft in - quagga clear ip bgp * soft out - quagga clear ip bgp * vpnv4 unicast in - quagga clear ip bgp * vpnv4 unicast out - quagga clear ip bgp * vpnv4 unicast soft - quagga clear ip bgp * vpnv4 unicast soft in - quagga clear ip bgp * vpnv4 unicast soft out - quagga clear ip bgp <1-4294967295> - quagga clear ip bgp <1-4294967295> in - quagga clear ip bgp <1-4294967295> in prefix-filter - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) out - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft in - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft out - quagga clear ip bgp <1-4294967295> out - quagga clear ip bgp <1-4294967295> soft - quagga clear ip bgp <1-4294967295> soft in - quagga clear ip bgp <1-4294967295> soft out - quagga clear ip bgp <1-4294967295> vpnv4 unicast in - quagga clear ip bgp <1-4294967295> vpnv4 unicast out - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft in - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft out - quagga clear ip bgp BGP_INSTANCE_CMD * - quagga clear ip bgp BGP_INSTANCE_CMD * in prefix-filter - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft in - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft out - quagga clear ip bgp BGP_INSTANCE_CMD * soft - quagga clear ip bgp BGP_INSTANCE_CMD * soft in - quagga clear ip bgp BGP_INSTANCE_CMD * soft out - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp external - quagga clear ip bgp external in - quagga clear ip bgp external in prefix-filter - quagga clear ip bgp external ipv4 (unicast|multicast) in - quagga clear ip bgp external ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp external ipv4 (unicast|multicast) out - quagga clear ip bgp external ipv4 (unicast|multicast) soft - quagga clear ip bgp external ipv4 (unicast|multicast) soft in - quagga clear ip bgp external ipv4 (unicast|multicast) soft out - quagga clear ip bgp external out - quagga clear ip bgp external soft - quagga clear ip bgp external soft in - quagga clear ip bgp external soft out - quagga clear ip bgp peer-group WORD - quagga clear ip bgp peer-group WORD in - quagga clear ip bgp peer-group WORD in prefix-filter - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) out - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out - quagga clear ip bgp peer-group WORD out - quagga clear ip bgp peer-group WORD soft - quagga clear ip bgp peer-group WORD soft in - quagga clear ip bgp peer-group WORD soft out - quagga clear ip bgp prefix """.splitlines() - -# All of the debug commands in bgp_debug_ignore will be covered by these debug commands: -# quagga (add|del) debug bgp bestpath -# quagga (add|del) debug bgp keepalives (||) -# quagga (add|del) debug bgp neighbor-events (||) -# quagga (add|del) debug bgp nht -# quagga (add|del) debug bgp update-groups -# quagga (add|del) debug bgp updates prefix -# quagga (add|del) debug bgp zebra prefix -bgp_debug_ignore = """ quagga debug bgp as4 - quagga debug bgp as4 segment - quagga debug bgp bestpath (|) - quagga debug bgp keepalives - quagga debug bgp keepalives (||) - quagga debug bgp neighbor-events - quagga debug bgp neighbor-events (||) - quagga debug bgp nht - quagga debug bgp update-groups - quagga debug bgp updates - quagga debug bgp updates (in|out) - quagga debug bgp updates (in|out) (||) - quagga debug bgp updates prefix (|) - quagga debug bgp zebra - quagga debug bgp zebra prefix (|)""".splitlines() - - -bgp_show_ignore = """ quagga show bgp (ipv4) (vpnv4) statistics - quagga show bgp (ipv4|ipv6) (unicast|multicast) statistics - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp (bestpath|multipath) [json] - quagga show bgp [json] - quagga show bgp longer-prefixes - quagga show bgp (bestpath|multipath) [json] - quagga show bgp [json] - quagga show bgp BGP_INSTANCE_CMD (ipv4) (vpnv4) statistics - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) neighbors (||) (advertised-routes|received-routes) [json] - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) statistics - quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD longer-prefixes - quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) - quagga show bgp BGP_INSTANCE_CMD filter-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 (unicast|multicast) summary [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 longer-prefixes - quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 community-list (<1-500>|WORD) - quagga show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) advertised-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) dampened-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) flap-statistics [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) prefix-counts [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received prefix-filter [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 route-map WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 summary [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) dampened-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) flap-statistics [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) received prefix-filter [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors [json] - quagga show bgp BGP_INSTANCE_CMD prefix-list WORD - quagga show bgp BGP_INSTANCE_CMD route-map WORD - quagga show bgp BGP_INSTANCE_CMD summary [json] - quagga show bgp BGP_INSTANCE_CMD update-groups - quagga show bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID - quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp [json] - quagga show bgp community - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community-list (<1-500>|WORD) - quagga show bgp community-list (<1-500>|WORD) exact-match - quagga show bgp filter-list WORD - quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) summary [json] - quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) summary [json] - quagga show bgp ipv6 (bestpath|multipath) [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 longer-prefixes - quagga show bgp ipv6 (bestpath|multipath) [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 community - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community-list (<1-500>|WORD) - quagga show bgp ipv6 community-list (<1-500>|WORD) exact-match - quagga show bgp ipv6 filter-list WORD - quagga show bgp ipv6 neighbors (||) [json] - quagga show bgp ipv6 neighbors (||) advertised-routes [json] - quagga show bgp ipv6 neighbors (||) dampened-routes [json] - quagga show bgp ipv6 neighbors (||) flap-statistics [json] - quagga show bgp ipv6 neighbors (||) prefix-counts [json] - quagga show bgp ipv6 neighbors (||) received prefix-filter [json] - quagga show bgp ipv6 neighbors (||) received-routes [json] - quagga show bgp ipv6 neighbors (||) routes [json] - quagga show bgp ipv6 neighbors [json] - quagga show bgp ipv6 prefix-list WORD - quagga show bgp ipv6 regexp LINE - quagga show bgp ipv6 route-map WORD - quagga show bgp ipv6 summary [json] - quagga show bgp memory - quagga show bgp neighbors (||) [json] - quagga show bgp neighbors (||) advertised-routes [json] - quagga show bgp neighbors (||) dampened-routes [json] - quagga show bgp neighbors (||) flap-statistics [json] - quagga show bgp neighbors (||) received prefix-filter [json] - quagga show bgp neighbors (||) received-routes [json] - quagga show bgp neighbors (||) routes [json] - quagga show bgp neighbors [json] - quagga show bgp prefix-list WORD - quagga show bgp regexp LINE - quagga show bgp route-map WORD - quagga show bgp summary [json] - quagga show bgp update-groups - quagga show bgp update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp update-groups SUBGROUP-ID - quagga show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp view WORD ipv4 (unicast|multicast) summary [json] - quagga show bgp views - quagga show bgp vrfs [json] - quagga show debugging bgp - quagga show ip as-path-access-list - quagga show ip as-path-access-list WORD - quagga show ip bgp (bestpath|multipath) [json] - quagga show ip bgp [json] - quagga show ip bgp longer-prefixes - quagga show ip bgp (bestpath|multipath) [json] - quagga show ip bgp [json] - quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD longer-prefixes - quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) - quagga show ip bgp BGP_INSTANCE_CMD filter-list WORD - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) prefix-counts [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors [json] - quagga show ip bgp BGP_INSTANCE_CMD nexthop - quagga show ip bgp BGP_INSTANCE_CMD nexthop detail - quagga show ip bgp BGP_INSTANCE_CMD peer-group - quagga show ip bgp BGP_INSTANCE_CMD peer-group WORD - quagga show ip bgp BGP_INSTANCE_CMD prefix-list WORD - quagga show ip bgp BGP_INSTANCE_CMD route-map WORD - quagga show ip bgp BGP_INSTANCE_CMD summary [json] - quagga show ip bgp BGP_INSTANCE_CMD update-groups - quagga show ip bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID - quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp [json] - quagga show ip bgp attribute-info - quagga show ip bgp cidr-only - quagga show ip bgp community - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community-info - quagga show ip bgp community-list (<1-500>|WORD) - quagga show ip bgp community-list (<1-500>|WORD) exact-match - quagga show ip bgp dampened-paths - quagga show ip bgp filter-list WORD - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics longer-prefixes - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics cidr-only - quagga show ip bgp flap-statistics filter-list WORD - quagga show ip bgp flap-statistics prefix-list WORD - quagga show ip bgp flap-statistics regexp LINE - quagga show ip bgp flap-statistics route-map WORD - quagga show ip bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) longer-prefixes - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) cidr-only - quagga show ip bgp ipv4 (unicast|multicast) community - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) - quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match - quagga show ip bgp ipv4 (unicast|multicast) filter-list WORD - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) prefix-counts [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received prefix-filter [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors [json] - quagga show ip bgp ipv4 (unicast|multicast) paths - quagga show ip bgp ipv4 (unicast|multicast) prefix-list WORD - quagga show ip bgp ipv4 (unicast|multicast) regexp LINE - quagga show ip bgp ipv4 (unicast|multicast) route-map WORD - quagga show ip bgp ipv4 (unicast|multicast) summary [json] - quagga show ip bgp neighbors (||) [json] - quagga show ip bgp neighbors (||) advertised-routes [json] - quagga show ip bgp neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp neighbors (||) dampened-routes [json] - quagga show ip bgp neighbors (||) flap-statistics [json] - quagga show ip bgp neighbors (||) prefix-counts [json] - quagga show ip bgp neighbors (||) received prefix-filter [json] - quagga show ip bgp neighbors (||) received-routes [json] - quagga show ip bgp neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp neighbors (||) routes [json] - quagga show ip bgp neighbors [json] - quagga show ip bgp nexthop - quagga show ip bgp nexthop detail - quagga show ip bgp paths - quagga show ip bgp peer-group - quagga show ip bgp peer-group WORD - quagga show ip bgp prefix-list WORD - quagga show ip bgp regexp LINE - quagga show ip bgp route-map WORD - quagga show ip bgp summary [json] - quagga show ip bgp update-groups - quagga show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp update-groups SUBGROUP-ID - quagga show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp view WORD ipv4 (unicast|multicast) summary [json] - quagga show ip bgp vpnv4 all - quagga show ip bgp vpnv4 all [json] - quagga show ip bgp vpnv4 all [json] - quagga show ip bgp vpnv4 all neighbors (||) prefix-counts [json] - quagga show ip bgp vpnv4 all neighbors [json] - quagga show ip bgp vpnv4 all neighbors advertised-routes [json] - quagga show ip bgp vpnv4 all neighbors routes [json] - quagga show ip bgp vpnv4 all neighbors [json] - quagga show ip bgp vpnv4 all summary [json] - quagga show ip bgp vpnv4 all tags - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors advertised-routes [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors routes [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags - quagga show ip community-list - quagga show ip community-list (<1-500>|WORD) - quagga show ip extcommunity-list - quagga show ip extcommunity-list (<1-500>|WORD) - quagga show ipv6 bgp [json] - quagga show ipv6 bgp longer-prefixes - quagga show ipv6 bgp [json] - quagga show ipv6 bgp [json] - quagga show ipv6 bgp community - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community-list WORD - quagga show ipv6 bgp community-list WORD exact-match - quagga show ipv6 bgp filter-list WORD - quagga show ipv6 bgp neighbors (||) advertised-routes [json] - quagga show ipv6 bgp neighbors (||) received-routes [json] - quagga show ipv6 bgp neighbors (||) routes [json] - quagga show ipv6 bgp prefix-list WORD - quagga show ipv6 bgp regexp LINE - quagga show ipv6 bgp summary [json] - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp longer-prefixes - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp community - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community-list WORD - quagga show ipv6 mbgp community-list WORD exact-match - quagga show ipv6 mbgp filter-list WORD - quagga show ipv6 mbgp neighbors (||) advertised-routes [json] - quagga show ipv6 mbgp neighbors (||) received-routes [json] - quagga show ipv6 mbgp neighbors (||) routes [json] - quagga show ipv6 mbgp prefix-list WORD - quagga show ipv6 mbgp regexp LINE - quagga show ipv6 mbgp summary [json]""".splitlines() - -bgp_config_ignore = """ quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) activate - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-all-paths - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-bestpath-per-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in <1-10> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) as-override - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged (as-path|next-hop|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path (next-hop|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path med next-hop - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path next-hop med - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med (as-path|next-hop) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med as-path next-hop - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med next-hop as-path - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop (as-path|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop as-path med - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop med as-path - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) capability orf prefix-list (both|send|receive) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate route-map WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) distribute-list (<1-199>|<1300-2699>|WORD) (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) filter-list WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> restart <1-65535> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> warning-only - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> restart <1-65535> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> warning-only - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self force - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) peer-group WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) prefix-list WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all replace-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS replace-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-map WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-reflector-client - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-server-client - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community (both|extended|standard) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) soft-reconfiguration inbound - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) unsuppress-map WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map WORD - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths <1-255> - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> equal-cluster-length - quagga (add|del) bgp always-compare-med - quagga (add|del) bgp bestpath as-path confed - quagga (add|del) bgp bestpath as-path ignore - quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set] - quagga (add|del) bgp bestpath compare-routerid - quagga (add|del) bgp bestpath med (confed|missing-as-worst) - quagga (add|del) bgp bestpath med confed missing-as-worst - quagga (add|del) bgp bestpath med missing-as-worst confed - quagga (add|del) bgp client-to-client reflection - quagga (add|del) bgp cluster-id <1-4294967295> - quagga (add|del) bgp cluster-id - quagga (add|del) bgp confederation identifier <1-4294967295> - quagga (add|del) bgp confederation peers . <1-4294967295> - quagga (add|del) bgp default ipv4-unicast - quagga (add|del) bgp default local-preference <0-4294967295> - quagga (add|del) bgp default show-hostname - quagga (add|del) bgp default subgroup-pkt-queue-max <20-100> - quagga (add|del) bgp deterministic-med - quagga (add|del) bgp disable-ebgp-connected-route-check - quagga (add|del) bgp enforce-first-as - quagga (add|del) bgp fast-external-failover - quagga (add|del) bgp graceful-restart - quagga (add|del) bgp graceful-restart stalepath-time <1-3600> - quagga (add|del) bgp listen limit <1-5000> - quagga (add|del) bgp listen range (|) peer-group WORD - quagga (add|del) bgp log-neighbor-changes - quagga (add|del) bgp max-med administrative - quagga (add|del) bgp max-med administrative <0-4294967294> - quagga (add|del) bgp max-med on-startup <5-86400> - quagga (add|del) bgp max-med on-startup <5-86400> <0-4294967294> - quagga (add|del) bgp network import-check - quagga (add|del) bgp route-map delay-timer <0-600> - quagga (add|del) bgp route-reflector allow-outbound-policy - quagga (add|del) bgp router-id - quagga (add|del) bgp coalesce-time <0-4294967295> - quagga (add|del) bgp distance <1-255> - quagga (add|del) bgp distance <1-255> WORD - quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255> - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set - quagga (add|del) bgp ipv4 [unicast|multicast] network - quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD - quagga (add|del) bgp ipv4 [unicast|multicast] network - quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen - quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen route-map WORD - quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD - quagga (add|del) bgp ipv4 unicast bgp dampening - quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> - quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> <1-20000> <1-20000> <1-255> - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295> - quagga (add|del) bgp ipv6 [unicast|multicast] network - quagga (add|del) bgp ipv6 bgp aggregate-address - quagga (add|del) bgp ipv6 bgp aggregate-address summary-only - quagga (add|del) bgp ipv6 bgp network - quagga (add|del) bgp ipv6 unicast aggregate-address - quagga (add|del) bgp ipv6 unicast aggregate-address summary-only - quagga (add|del) bgp ipv6 unicast neighbor (||) nexthop-local unchanged - quagga (add|del) bgp ipv6 unicast network route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD metric <0-4294967295> - quagga (add|del) bgp neighbor (|) interface WORD - quagga (add|del) bgp neighbor (|) port <0-65535> - quagga (add|del) bgp neighbor (|) strict-capability-match - quagga (add|del) bgp neighbor (||) advertisement-interval <0-600> - quagga (add|del) bgp neighbor (||) bfd - quagga (add|del) bgp neighbor (||) bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> - quagga (add|del) bgp neighbor (||) capability dynamic - quagga (add|del) bgp neighbor (||) capability extended-nexthop - quagga (add|del) bgp neighbor (||) description LINE - quagga (add|del) bgp neighbor (||) disable-connected-check - quagga (add|del) bgp neighbor (||) dont-capability-negotiate - quagga (add|del) bgp neighbor (||) ebgp-multihop - quagga (add|del) bgp neighbor (||) ebgp-multihop <1-255> - quagga (add|del) bgp neighbor (||) enforce-multihop - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend replace-as - quagga (add|del) bgp neighbor (||) override-capability - quagga (add|del) bgp neighbor (||) passive - quagga (add|del) bgp neighbor (||) password LINE - quagga (add|del) bgp neighbor (||) remote-as (<1-4294967295>|external|internal) - quagga (add|del) bgp neighbor (||) shutdown - quagga (add|del) bgp neighbor (||) solo - quagga (add|del) bgp neighbor (||) timers <0-65535> <0-65535> - quagga (add|del) bgp neighbor (||) timers connect <1-65535> - quagga (add|del) bgp neighbor (||) ttl-security hops <1-254> - quagga (add|del) bgp neighbor (||) update-source (||) - quagga (add|del) bgp neighbor (||) weight <0-65535> - quagga (add|del) bgp neighbor WORD interface - quagga (add|del) bgp neighbor WORD interface peer-group WORD - quagga (add|del) bgp neighbor WORD interface v6only - quagga (add|del) bgp neighbor WORD interface v6only peer-group WORD - quagga (add|del) bgp neighbor WORD peer-group - quagga (add|del) bgp network backdoor - quagga (add|del) bgp network backdoor - quagga (add|del) bgp network prefixlen backdoor - quagga (add|del) bgp timers bgp <0-65535> <0-65535> - quagga (add|del) bgp update-delay <0-3600> - quagga (add|del) bgp update-delay <0-3600> <1-3600> - quagga (add|del) bgp write-quanta <1-10000>""".splitlines() - -ospf_clear_ignore = [" quagga clear ip ospf interface [IFNAME]", ] - -ospf_debug_ignore = """ quagga debug ospf <1-65535> event - quagga debug ospf <1-65535> ism - quagga debug ospf <1-65535> ism (status|events|timers) - quagga debug ospf <1-65535> lsa - quagga debug ospf <1-65535> lsa (generate|flooding|install|refresh) - quagga debug ospf <1-65535> nsm - quagga debug ospf <1-65535> nsm (status|events|timers) - quagga debug ospf <1-65535> nssa - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) - quagga debug ospf <1-65535> zebra - quagga debug ospf <1-65535> zebra (interface|redistribute) - quagga debug ospf event - quagga debug ospf ism - quagga debug ospf ism (status|events|timers) - quagga debug ospf lsa - quagga debug ospf lsa (generate|flooding|install|refresh) - quagga debug ospf nsm - quagga debug ospf nsm (status|events|timers) - quagga debug ospf nssa - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) - quagga debug ospf zebra - quagga debug ospf zebra (interface|redistribute)""".splitlines() - -ospf_show_ignore = """ quagga show debugging ospf - quagga show debugging ospf <1-65535> - quagga show ip ospf <1-65535> [json] - quagga show ip ospf <1-65535> border-routers - quagga show ip ospf <1-65535> database - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) - quagga show ip ospf <1-65535> interface [INTERFACE] [json] - quagga show ip ospf <1-65535> neighbor [json] - quagga show ip ospf <1-65535> neighbor IFNAME [json] - quagga show ip ospf <1-65535> neighbor IFNAME detail [json] - quagga show ip ospf <1-65535> neighbor [json] - quagga show ip ospf <1-65535> neighbor all [json] - quagga show ip ospf <1-65535> neighbor detail [json] - quagga show ip ospf <1-65535> neighbor detail all [json] - quagga show ip ospf <1-65535> route - quagga show ip ospf [json] - quagga show ip ospf border-routers - quagga show ip ospf database - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) - quagga show ip ospf interface [INTERFACE] [json] - quagga show ip ospf neighbor [json] - quagga show ip ospf neighbor IFNAME [json] - quagga show ip ospf neighbor IFNAME detail [json] - quagga show ip ospf neighbor [json] - quagga show ip ospf neighbor all [json] - quagga show ip ospf neighbor detail [json] - quagga show ip ospf neighbor detail all [json] - quagga show ip ospf route - quagga show mpls-te interface [INTERFACE] - quagga show mpls-te router""".splitlines() - -ospf_config_ignore = """ quagga (add|del) ip ospf <1-65535> area (|<0-4294967295>) - quagga (add|del) ip ospf area (|<0-4294967295>) - quagga (add|del) ip ospf authentication - quagga (add|del) ip ospf authentication (null|message-digest) - quagga (add|del) ip ospf authentication (null|message-digest) - quagga (add|del) ip ospf authentication - quagga (add|del) ip ospf authentication-key AUTH_KEY - quagga (add|del) ip ospf authentication-key AUTH_KEY - quagga (add|del) ip ospf bfd - quagga (add|del) ip ospf bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> - quagga (add|del) ip ospf cost <1-65535> - quagga (add|del) ip ospf cost <1-65535> - quagga (add|del) ip ospf dead-interval <1-65535> - quagga (add|del) ip ospf dead-interval <1-65535> - quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> - quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> - quagga (add|del) ip ospf hello-interval <1-65535> - quagga (add|del) ip ospf hello-interval <1-65535> - quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY - quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY - quagga (add|del) ip ospf mtu-ignore - quagga (add|del) ip ospf mtu-ignore - quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) - quagga (add|del) ip ospf priority <0-255> - quagga (add|del) ip ospf priority <0-255> - quagga (add|del) ip ospf retransmit-interval <3-65535> - quagga (add|del) ip ospf retransmit-interval <3-65535> - quagga (add|del) ip ospf transmit-delay <1-65535> - quagga (add|del) ip ospf transmit-delay <1-65535> - quagga (add|del) mpls-te link max-bw BANDWIDTH - quagga (add|del) mpls-te link max-rsv-bw BANDWIDTH - quagga (add|del) mpls-te link metric <0-4294967295> - quagga (add|del) mpls-te link rsc-clsclr BITPATTERN - quagga (add|del) mpls-te link unrsv-bw <0-7> BANDWIDTH - quagga (add|del) ospf abr-type (cisco|ibm|shortcut|standard) - quagga (add|del) ospf area (|<0-4294967295>) authentication - quagga (add|del) ospf area (|<0-4294967295>) authentication message-digest - quagga (add|del) ospf area (|<0-4294967295>) default-cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) export-list NAME - quagga (add|del) ospf area (|<0-4294967295>) filter-list prefix WORD (in|out) - quagga (add|del) ospf area (|<0-4294967295>) import-list NAME - quagga (add|del) ospf area (|<0-4294967295>) nssa - quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) - quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary - quagga (add|del) ospf area (|<0-4294967295>) nssa no-summary - quagga (add|del) ospf area (|<0-4294967295>) range - quagga (add|del) ospf area (|<0-4294967295>) range advertise - quagga (add|del) ospf area (|<0-4294967295>) range advertise cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) range cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) range not-advertise - quagga (add|del) ospf area (|<0-4294967295>) range substitute - quagga (add|del) ospf area (|<0-4294967295>) shortcut (default|enable|disable) - quagga (add|del) ospf area (|<0-4294967295>) stub - quagga (add|del) ospf area (|<0-4294967295>) stub no-summary - quagga (add|del) ospf area (|<0-4294967295>) virtual-link - quagga (add|del) ospf area (|<0-4294967295>) virtual-link - quagga (add|del) ospf auto-cost reference-bandwidth <1-4294967> - quagga (add|del) ospf capability opaque - quagga (add|del) ospf compatible rfc1583 - quagga (add|del) ospf default-information originate - quagga (add|del) ospf default-metric <0-16777214> - quagga (add|del) ospf distance <1-255> - quagga (add|del) ospf distance <1-255> - quagga (add|del) ospf distance <1-255> WORD - quagga (add|del) ospf distance ospf - quagga (add|del) ospf distribute-list WORD out QUAGGA_REDIST_STR_OSPFD - quagga (add|del) ospf log-adjacency-changes - quagga (add|del) ospf log-adjacency-changes detail - quagga (add|del) ospf max-metric router-lsa administrative - quagga (add|del) ospf max-metric router-lsa on-shutdown <5-100> - quagga (add|del) ospf max-metric router-lsa on-startup <5-86400> - quagga (add|del) ospf mpls-te - quagga (add|del) ospf mpls-te on - quagga (add|del) ospf mpls-te router-address - quagga (add|del) ospf neighbor - quagga (add|del) ospf neighbor poll-interval <1-65535> - quagga (add|del) ospf neighbor poll-interval <1-65535> priority <0-255> - quagga (add|del) ospf neighbor priority <0-255> - quagga (add|del) ospf neighbor priority <0-255> poll-interval <1-65535> - quagga (add|del) ospf network area (|<0-4294967295>) - quagga (add|del) ospf opaque-lsa - quagga (add|del) ospf passive-interface IFNAME - quagga (add|del) ospf passive-interface IFNAME - quagga (add|del) ospf passive-interface default - quagga (add|del) ospf redistribute (ospf|table) <1-65535> - quagga (add|del) ospf redistribute QUAGGA_REDIST_STR_OSPFD - quagga (add|del) ospf rfc1583compatibility - quagga (add|del) ospf router-id - quagga (add|del) ospf timers lsa arrival <0-1000> - quagga (add|del) ospf timers lsa min-arrival <0-600000> - quagga (add|del) ospf timers throttle lsa all <0-5000> - quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000> - quagga (add|del) ospf write-multiplier <1-100> - quagga (add|del) ospf write-multiplier <1-100>""".splitlines() - -def replace_constants(line): - line = line.replace('NO_NEIGHBOR_CMD2', 'no neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NEIGHBOR_CMD2', 'neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NO_NEIGHBOR_CMD', 'no neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('NEIGHBOR_CMD', 'neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('CMD_AS_RANGE', '<1-4294967295>') - line = line.replace('LISTEN_RANGE_CMD', 'bgp listen range (A.B.C.D/M|X:X::X:X/M) ') - line = line.replace('DYNAMIC_NEIGHBOR_LIMIT_RANGE', '<1-5000>') - line = line.replace('QUAGGA_IP_REDIST_STR_BGPD', '(kernel|connected|static|rip|ospf|isis)') - line = line.replace('QUAGGA_IP6_REDIST_STR_BGPD', '(kernel|connected|static|ripng|ospf6|isis)') - line = line.replace('QUAGGA_IP6_REDIST_STR_ZEBRA', '(kernel|connected|static|ripng|ospf6|isis|bgp)') - line = line.replace('QUAGGA_IP_REDIST_STR_ZEBRA', '(kernel|connected|static|rip|ospf|isis|bgp)') - line = line.replace('OSPF_LSA_TYPES_CMD_STR', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') - line = line.replace('CMD_RANGE_STR(1, MULTIPATH_NUM)', '<1-255>') - line = line.replace('CMD_RANGE_STR(1, MAXTTL)', '<1-255>') - line = line.replace('BFD_CMD_DETECT_MULT_RANGE', '<2-255>') - line = line.replace('BFD_CMD_MIN_TX_RANGE', '<50-60000>') - line = line.replace('BGP_UPDATE_SOURCE_REQ_STR', '(A.B.C.D|X:X::X:X|WORD)') - line = line.replace('BGP_UPDATE_SOURCE_OPT_STR', '{A.B.C.D|X:X::X:X|WORD}') - line = line.replace('.LINE', 'LINE') - line = line.replace('.AA:NN', 'AA:NN') - # line = line.replace('', '') - return line - - -ignore = {} -ignore['bgpd'] = [] -ignore['bgpd'].append('address-family ipv4') -ignore['bgpd'].append('address-family ipv4 (unicast|multicast)') -ignore['bgpd'].append('address-family ipv6') -ignore['bgpd'].append('address-family ipv6 (unicast|multicast)') -ignore['bgpd'].append('address-family vpnv4') -ignore['bgpd'].append('address-family vpnv4 unicast') -ignore['bgpd'].append('exit-address-family') - -ignore['ospfd'] = [] - - -class Command(object): - - def __init__(self, defun, text, line_number): - self.defun = defun - self.text = text - self.line_number = line_number - self.context = [] - self.docstring = None - - def __str__(self): - return "%s - %s" % (self.context, self.text) - - def set_docstring(self): - ds = self.text - - if self.text in ignore['bgpd']: - return None - - # For these two WORD means an interface name - ds = ds.replace('A.B.C.D|X:X::X:X|WORD', '||') - ds = ds.replace('A.B.C.D|WORD', '|') - - ds = ds.replace('A.B.C.D/M', '') - ds = ds.replace('A.B.C.D', '') - ds = ds.replace('X:X::X:X/M', '') - ds = ds.replace('X:X::X:X', '') - ds = ds.replace('{json}', '[json]') - ds = ds.replace('{', '[') - ds = ds.replace('}', ']') - ds = ds.replace(' PATH ', ' ') - - afis = [] - safis = [] - - if 'BGP_IPV4_NODE' in self.context: - afis.append('ipv4') - safis.append('unicast') - - if 'BGP_IPV4M_NODE' in self.context: - afis.append('ipv4') - safis.append('multicast') - - if 'BGP_IPV6_NODE' in self.context: - afis.append('ipv6') - safis.append('unicast') - - if 'BGP_IPV6M_NODE' in self.context: - afis.append('ipv6') - safis.append('multicast') - - afis = list(set(afis)) - safis = list(set(safis)) - - # clear, debug, show, etc - if 'ENABLE_NODE' in self.context: - pass - - # config command so need to add (add|del) and maybe afi/safi - else: - if afis: - if len(afis) > 1: - afi_string = "[%s]" % '|'.join(afis) - else: - afi_string = afis[0] - - if len(safis) > 1: - safi_string = "[%s]" % '|'.join(safis) - else: - safi_string = safis[0] - - ds = "(add|del) bgp %s %s " % (afi_string, safi_string) + ds - - elif 'BGP_NODE' in self.context: - if ds.startswith('bgp'): - ds = "(add|del) " + ds - else: - ds = "(add|del) bgp " + ds - - elif 'INTERFACE_NODE' in self.context: - ds = "(add|del) " + ds - - elif 'OSPF_NODE' in self.context: - if ds.startswith('ospf'): - ds = "(add|del) " + ds - else: - ds = "(add|del) ospf " + ds - - # Ignore the route-map commands, ip community-list, etc for now - else: - ds = None - - if ds: - ds = ds.rstrip() - self.docstring = ' quagga ' + ds - - -if __name__ == '__main__': - - parser = argparse.ArgumentParser(description='Parse the quagga parser') - parser.add_argument('directory', help='quagga directory') - parser.add_argument('daemon', help='bgpd, ospfd, etc') - parser.add_argument('--print-quagga', action='store_true', help='print the raw quagga commands') - parser.add_argument('--print-docstring', action='store_true', help='print a docstring for network-docopt') - parser.add_argument('--print-context', action='store_true', help='print quagga commands with their context') - args = parser.parse_args() - - logging.basicConfig(level=logging.INFO, - format='%(asctime)s %(levelname)7s: %(message)s') - log = logging.getLogger(__name__) - - # Color the errors and warnings in red - logging.addLevelName(logging.ERROR, "\033[91m %s\033[0m" % logging.getLevelName(logging.ERROR)) - logging.addLevelName(logging.WARNING, "\033[91m%s\033[0m" % logging.getLevelName(logging.WARNING)) - - bgpd = os.path.join(args.directory, 'bgpd') - isisd = os.path.join(args.directory, 'isisd') - ospfd = os.path.join(args.directory, 'ospfd') - ospf6d = os.path.join(args.directory, 'ospf6d') - ripd = os.path.join(args.directory, 'ripd') - ripngd = os.path.join(args.directory, 'ripngd') - zebra = os.path.join(args.directory, 'zebra') - parser_files = [] - - for (directory, foo, files) in sorted(os.walk(args.directory)): - - # We do not care about crunching files in these directories - if (directory.endswith('vtysh') or - directory.endswith('quagga-0.99.23.1/') or - directory.endswith('lib') or - directory.endswith('isisd') or - directory.endswith('ripd') or - directory.endswith('ripngd') or - directory.endswith('m4') or - directory.endswith('tests')): - continue - - if args.daemon not in directory: - continue - - for x in sorted(files): - if x.endswith('.c'): - filename = os.path.join(directory, x) - parser_files.append(filename) - - commands = {} - defun_to_context = {} - - for filename in parser_files: - - with open(filename, 'r') as fh: - state = 'LIMBO' - line_number = 1 - - for line in fh.readlines(): - - if state == 'LIMBO': - if (line.startswith('DEFUN ') or line.startswith('ALIAS ')): - state = 'DEFUN_LINE_1' - - elif 'install_element' in line: - # install_element (BGP_NODE, &neighbor_bfd_cmd); - re_line = re.search('install_element\s*\(\s*(\S+)\s*, \&(\S+)\)', line) - - if re_line: - context = re_line.group(1) - defun = re_line.group(2) - - if defun not in defun_to_context: - defun_to_context[defun] = [] - defun_to_context[defun].append(context) - else: - log.warning("regex failed on '%s'" % line.strip()) - - elif state == 'DEFUN_LINE_1': - state = 'DEFUN_LINE_2' - # remove spaces and trailing comma - defun = line.strip()[0:-1] - - elif state == 'DEFUN_LINE_2': - if 'ifdef HAVE_IPV6' in line: - pass - else: - state = 'LIMBO' - - # remove the leading and trailing spaces - # remove the leading and trailing " - # remove the trailing , - line = line.strip() - line = replace_constants(line) - - if line.endswith(','): - line = line.rstrip().lstrip()[:-1] - - if line.startswith('"'): - line = line.rstrip().lstrip()[1:] - - if line.endswith('"'): - line = line.rstrip().lstrip()[:-1] - - line = line.replace(' " ', ' ') - line = line.replace(' "', ' ') - line = line.replace('" ', ' ') - line = line.replace('( ', '(') - line = line.replace(' )', ')') - - line = line.replace('| ', '|') - line = line.replace(' |', '|') - - # compress multiple whitespaces - while ' ' in line: - line = line.replace(' ', ' ') - - commands[line] = Command(defun, line, line_number) - defun = None - line_number += 1 - - # Fill in the context for each Command based on its defun - for cmd in commands.itervalues(): - cmd.context = defun_to_context.get(cmd.defun) - if cmd.context is None: - log.error("%s: could not find defun for %s" % (cmd, cmd.defun)) - continue - cmd.set_docstring() - - normal = [] - expert = [] - - if args.print_docstring: - if args.daemon == 'bgpd': - normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] summary [json]') - normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] [|] [bestpath|multipath] [json]') - normal.append(' quagga show bgp neighbor [|]') - normal.append(' quagga clear bgp (||*)') - normal.append(' quagga clear bgp (||*) soft [in|out]') - normal.append(' quagga clear bgp prefix ') - normal.append(' quagga (add|del) debug bgp bestpath ') - normal.append(' quagga (add|del) debug bgp keepalives ()') - normal.append(' quagga (add|del) debug bgp neighbor-events (|)') - expert.append(' quagga (add|del) debug bgp nht') - expert.append(' quagga (add|del) debug bgp update-groups') - normal.append(' quagga (add|del) debug bgp updates prefix ') - normal.append(' quagga (add|del) debug bgp zebra prefix ') - - bgp_bgp = ['always-compare-med', - 'bestpath', - 'client-to-client reflection', - 'cluster-id', - 'confederation peers', - 'default ipv4-unicast', - 'default local-preference', - 'default show-hostname', - 'default subgroup-pkt-queue-max', - 'deterministic-med', - 'disable-ebgp-connected-route-check', - 'enforce-first-as', - 'fast-external-failover', - 'graceful-restart', - 'listen', - 'log-neighbor-changes', - 'max-med', - 'network import-check', - 'route-map delay-timer', - 'route-reflector allow-outbound-policy', - 'router-id'] - - # ====== - # global - # ====== - normal.append(' quagga (add|del) bgp always-compare-med') - expert.append(' quagga (add|del) bgp bestpath as-path (confed|ignore)') - normal.append(' quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]') - expert.append(' quagga (add|del) bgp bestpath med (confed|missing-as-worst)') - expert.append(' quagga (add|del) bgp client-to-client reflection') - expert.append(' quagga (add|del) bgp cluster-id (|<1-4294967295>)') - expert.append(' quagga (add|del) bgp confederation peers <1-4294967295>') - expert.append(' quagga (add|del) bgp default ipv4-unicast') - expert.append(' quagga (add|del) bgp default local-preference <0-4294967295>') - expert.append(' quagga (add|del) bgp default show-hostname') - expert.append(' quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>') - expert.append(' quagga (add|del) bgp deterministic-med') - expert.append(' quagga (add|del) bgp disable-ebgp-connected-route-check') - expert.append(' quagga (add|del) bgp enforce-first-as') - expert.append(' quagga (add|del) bgp fast-external-failover') - expert.append(' quagga (add|del) bgp graceful-restart') - expert.append(' quagga (add|del) bgp listen limit <1-5000>') - expert.append(' quagga (add|del) bgp listen range (|) peer-group ') - expert.append(' quagga (add|del) bgp log-neighbor-changes') - expert.append(' quagga (add|del) bgp max-med administrative <0-4294967294>') - expert.append(' quagga (add|del) bgp max-med on-startup <5-86400> [<0-4294967294>]') - expert.append(' quagga (add|del) bgp network import-check') - expert.append(' quagga (add|del) bgp route-map delay-timer <0-600>') - expert.append(' quagga (add|del) bgp route-reflector allow-outbound-policy') - normal.append(' quagga (add|del) bgp router-id ') - expert.append(' quagga (add|del) bgp coalesce-time <0-4294967295>') - expert.append(' quagga (add|del) bgp distance <1-255> ') - expert.append(' quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>') - expert.append(' quagga (add|del) bgp timers bgp <0-65535> <0-65535>') - expert.append(' quagga (add|del) bgp update-delay <0-3600> [<1-3600>]') - expert.append(' quagga (add|del) bgp write-quanta <1-10000>') - - # ==================== - # peer global afi/safi - # ==================== - normal.append(' quagga (add|del) bgp neighbor interface') - normal.append(' quagga (add|del) bgp neighbor interface peer-group ') - expert.append(' quagga (add|del) bgp neighbor interface v6only') - expert.append(' quagga (add|del) bgp neighbor interface v6only peer-group ') - normal.append(' quagga (add|del) bgp neighbor peer-group') - expert.append(' quagga (add|del) bgp neighbor (|) advertisement-interval <0-600>') - expert.append(' quagga (add|del) bgp neighbor (|) bfd') - expert.append(' quagga (add|del) bgp neighbor (|) capability dynamic') - normal.append(' quagga (add|del) bgp neighbor (|) capability extended-nexthop') - normal.append(' quagga (add|del) bgp neighbor (|) description ') - expert.append(' quagga (add|del) bgp neighbor (|) disable-connected-check') - expert.append(' quagga (add|del) bgp neighbor (|) dont-capability-negotiate') - normal.append(' quagga (add|del) bgp neighbor (|) ebgp-multihop [<1-255>]') - expert.append(' quagga (add|del) bgp neighbor (|) enforce-multihop') - expert.append(' quagga (add|del) bgp neighbor (|) local-as <1-4294967295> [no-prepend] [replace-as]') - expert.append(' quagga (add|del) bgp neighbor (|) override-capability') - expert.append(' quagga (add|del) bgp neighbor (|) passive') - normal.append(' quagga (add|del) bgp neighbor (|) password ') - expert.append(' quagga (add|del) bgp neighbor (|) port <0-65535>') - normal.append(' quagga (add|del) bgp neighbor (|) remote-as (<1-4294967295>|external|internal)') - normal.append(' quagga (add|del) bgp neighbor (|) shutdown') - expert.append(' quagga (add|del) bgp neighbor (|) solo') - expert.append(' quagga (add|del) bgp neighbor (|) strict-capability-match') - normal.append(' quagga (add|del) bgp neighbor (|) timers <0-65535> <0-65535>') - normal.append(' quagga (add|del) bgp neighbor (|) timers connect <1-65535>') - expert.append(' quagga (add|del) bgp neighbor (|) ttl-security hops <1-254>') - normal.append(' quagga (add|del) bgp neighbor (|) update-source (||)') - expert.append(' quagga (add|del) bgp neighbor (|) weight <0-65535>') - - # ================= - # peer per afi/safi - # ================= - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-all-paths') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-bestpath-per-AS') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) allowas-in [<1-10>]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) as-override') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) attribute-unchanged [as-path] [next-hop] [med]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) capability orf prefix-list (both|send|receive)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) default-originate [route-map ]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) distribute-list (<1-199>|<1300-2699>|) (in|out)') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) filter-list (in|out)') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) maximum-prefix <1-4294967295>') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) next-hop-self [force]') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) peer-group ') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) prefix-list (in|out)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) remove-private-AS [all] [replace-AS]') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-map (in|out)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-reflector-client') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-server-client') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) send-community [both|extended|standard]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) soft-reconfiguration inbound') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) unsuppress-map ') - expert.append(' quagga (add|del) bgp ipv6 unicast neighbor (|) nexthop-local unchanged') - - # ============ - # per afi/safi - # ============ - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] maximum-paths [ibgp] <1-255> [equal-cluster-length]') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] aggregate-address [as-set] [summary-only]') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|)') - expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|) route-map ') - expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] bgp dampening <1-45> <1-20000> <1-20000> <1-255>') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] redistribute (kernel|connected|static|rip|ospf|isis) [metric <0-4294967295>] [route-map ]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map ') - - if args.daemon == 'ospfd': - normal.append(' quagga clear ip ospf interface []') - normal.append(' quagga (add|del) debug ospf [<1-65535>] ism [status|events|timers]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] lsa [generate|flooding|install|refresh]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] nsm [status|events|timers]') - expert.append(' quagga (add|del) debug ospf [<1-65535>] nssa') - normal.append(' quagga (add|del) debug ospf [<1-65535>] packet [hello|dd|ls-request|ls-update|ls-ack|all] [send|recv|detail]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] zebra [interface|redistribute]') - normal.append(' quagga show ip ospf [<1-65535>]') - expert.append(' quagga show ip ospf [<1-65535>] border-routers') - expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) [self-originate]') - expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) adv-router ') - normal.append(' quagga show ip ospf [<1-65535>] interface [] [json]') - normal.append(' quagga show ip ospf [<1-65535>] neighbor (all||) [detail] [json]') - normal.append(' quagga show ip ospf [<1-65535>] route') - - normal.append(' quagga (add|del) ip ospf [<1-65535>] area (|<0-4294967295>)') - normal.append(' quagga (add|del) ip ospf dead-interval <1-65535>') - normal.append(' quagga (add|del) ip ospf hello-interval <1-65535>') - normal.append(' quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)') - normal.append(' quagga (add|del) ospf network area (|<0-4294967295>)') - normal.append(' quagga (add|del) ospf passive-interface IFNAME') - normal.append(' quagga (add|del) ospf router-id ') - normal.append(' quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>') - - - - ignore_list = bgp_clear_ignore + bgp_debug_ignore + bgp_show_ignore + bgp_config_ignore - ignore_list += ospf_clear_ignore + ospf_debug_ignore + ospf_show_ignore + ospf_config_ignore - - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - if cmd.docstring: - if cmd.docstring not in ignore_list: - normal.append(cmd.docstring) - - elif args.print_quagga: - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - normal.append(cmd.text) - - elif args.print_context: - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - normal.append("%s - %s" % (cmd.context, cmd.text)) - else: - raise Exception("No print option specified") - - normal = sorted(normal) - print '\n'.join(map(str, normal)) From 1084263fb1da90839b3052a91695408d40b3ac41 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 13 Nov 2016 09:37:43 +0000 Subject: [PATCH 263/280] bgpd: Rework bgp 'attribute-unchanged' commands Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 52b7da1d50..d8ffcc4679 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3964,7 +3964,12 @@ DEFUN (no_neighbor_nexthop_local_unchanged, DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, - "neighbor attribute-unchanged [ [ []]]", + "neighbor attribute-unchanged\ + [<\ + as-path [next-hop [med]]|as-path [med [next-hop]]|\ + next-hop [as-path [med]]|next-hop [med [as-path]]|\ + med [as-path [nexthop]]|med [next-hop [as-path]]\ + >]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" @@ -3972,11 +3977,20 @@ DEFUN (neighbor_attr_unchanged, "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" + "Med attribute\n" + "Nexthop attribute\n" + "Nexthop attribute\n" + "As-path attribute\n" + "Med attribute\n" "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" + "Med attribute\n" + "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n") + "Med attribute\n" + "Nexthop attribute\n" + "As-path attribute\n") { int idx = 0; char *peer = argv[1]->arg; @@ -4003,7 +4017,12 @@ DEFUN (neighbor_attr_unchanged, DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, - "no neighbor attribute-unchanged [ [ []]]", + "no neighbor attribute-unchanged\ + [<\ + as-path [next-hop [med]]|as-path [med [next-hop]]|\ + next-hop [as-path [med]]|next-hop [med [as-path]]|\ + med [as-path [nexthop]]|med [next-hop [as-path]]\ + >]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -4012,11 +4031,20 @@ DEFUN (no_neighbor_attr_unchanged, "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" + "Med attribute\n" + "Nexthop attribute\n" + "Nexthop attribute\n" + "As-path attribute\n" + "Med attribute\n" "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" + "Med attribute\n" + "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n") + "Med attribute\n" + "Nexthop attribute\n" + "As-path attribute\n") { int idx = 0; char *peer = argv[2]->arg; From 7ae5fc81078c479af15909dd625b47d4da0bda1c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 14 Nov 2016 19:15:43 +0000 Subject: [PATCH 264/280] bgpd: Fix partial match on for remote-as Ticket: CM-8545 Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index d8ffcc4679..148d8f19a0 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2547,12 +2547,12 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, bgp = vty->index; - if (strncmp(as_str, "internal", strlen("internal")) == 0) + if (as_str[0] == 'i') { as = 0; as_type = AS_INTERNAL; } - else if (strncmp(as_str, "external", strlen("external")) == 0) + else if (as_str[0] == 'e') { as = 0; as_type = AS_EXTERNAL; @@ -2644,11 +2644,11 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, if (as_str) { - if (strncmp(as_str, "internal", strlen("internal")) == 0) + if (as_str[0] == 'i') { as_type = AS_INTERNAL; } - else if (strncmp(as_str, "external", strlen("external")) == 0) + else if (as_str[0] == 'e') { as_type = AS_EXTERNAL; } From fefa0d82145890019b5cf66bc2e2323f603f6d79 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 15 Nov 2016 01:45:58 +0000 Subject: [PATCH 265/280] ospfd: Fix bad index for ospf message-digest-key Signed-off-by: Quentin Young --- lib/memtypes.h | 249 +++++++++++++++++++++++++++++++++++++++++++++++ ospfd/ospf_vty.c | 21 ++-- 2 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 lib/memtypes.h diff --git a/lib/memtypes.h b/lib/memtypes.h new file mode 100644 index 0000000000..c9300bd9b1 --- /dev/null +++ b/lib/memtypes.h @@ -0,0 +1,249 @@ +/* Auto-generated from memtypes.c by gawk. */ +/* Do not edit! */ + +#ifndef _QUAGGA_MEMTYPES_H +#define _QUAGGA_MEMTYPES_H + +enum +{ + MTYPE_TMP = 1, + MTYPE_STRVEC, + MTYPE_VECTOR, + MTYPE_VECTOR_INDEX, + MTYPE_LINK_LIST, + MTYPE_LINK_NODE, + MTYPE_THREAD, + MTYPE_THREAD_MASTER, + MTYPE_THREAD_STATS, + MTYPE_VTY, + MTYPE_VTY_OUT_BUF, + MTYPE_VTY_HIST, + MTYPE_IF, + MTYPE_CONNECTED, + MTYPE_NBR_CONNECTED, + MTYPE_CONNECTED_LABEL, + MTYPE_BUFFER, + MTYPE_BUFFER_DATA, + MTYPE_STREAM, + MTYPE_STREAM_DATA, + MTYPE_STREAM_FIFO, + MTYPE_PREFIX, + MTYPE_PREFIX_IPV4, + MTYPE_PREFIX_IPV6, + MTYPE_HASH, + MTYPE_HASH_BACKET, + MTYPE_HASH_INDEX, + MTYPE_ROUTE_TABLE, + MTYPE_ROUTE_NODE, + MTYPE_DISTRIBUTE, + MTYPE_DISTRIBUTE_IFNAME, + MTYPE_DISTRIBUTE_NAME, + MTYPE_ACCESS_LIST, + MTYPE_ACCESS_LIST_STR, + MTYPE_ACCESS_FILTER, + MTYPE_PREFIX_LIST, + MTYPE_PREFIX_LIST_ENTRY, + MTYPE_PREFIX_LIST_STR, + MTYPE_PREFIX_LIST_TRIE, + MTYPE_ROUTE_MAP, + MTYPE_ROUTE_MAP_NAME, + MTYPE_ROUTE_MAP_INDEX, + MTYPE_ROUTE_MAP_RULE, + MTYPE_ROUTE_MAP_RULE_STR, + MTYPE_ROUTE_MAP_COMPILED, + MTYPE_ROUTE_MAP_DEP, + MTYPE_CMD_TOKENS, + MTYPE_KEY, + MTYPE_KEYCHAIN, + MTYPE_IF_RMAP, + MTYPE_IF_RMAP_NAME, + MTYPE_SOCKUNION, + MTYPE_PRIVS, + MTYPE_ZLOG, + MTYPE_ZCLIENT, + MTYPE_WORK_QUEUE, + MTYPE_WORK_QUEUE_ITEM, + MTYPE_WORK_QUEUE_NAME, + MTYPE_PQUEUE, + MTYPE_PQUEUE_DATA, + MTYPE_HOST, + MTYPE_BFD_INFO, + MTYPE_VRF, + MTYPE_VRF_NAME, + MTYPE_VRF_BITMAP, + MTYPE_RTADV_PREFIX, + MTYPE_ZEBRA_NS, + MTYPE_ZEBRA_VRF, + MTYPE_NEXTHOP, + MTYPE_RIB, + MTYPE_RIB_QUEUE, + MTYPE_STATIC_ROUTE, + MTYPE_RIB_DEST, + MTYPE_RIB_TABLE_INFO, + MTYPE_RNH, + MTYPE_NETLINK_NAME, + MTYPE_BGP, + MTYPE_BGP_LISTENER, + MTYPE_BGP_PEER, + MTYPE_BGP_PEER_HOST, + MTYPE_BGP_PEER_IFNAME, + MTYPE_BGP_PEER_GROUP, + MTYPE_BGP_PEER_GROUP_HOST, + MTYPE_PEER_DESC, + MTYPE_PEER_PASSWORD, + MTYPE_BGP_PEER_AF, + MTYPE_BGP_UPDGRP, + MTYPE_BGP_UPD_SUBGRP, + MTYPE_BGP_PACKET, + MTYPE_ATTR, + MTYPE_ATTR_EXTRA, + MTYPE_AS_PATH, + MTYPE_AS_SEG, + MTYPE_AS_SEG_DATA, + MTYPE_AS_STR, + MTYPE_BGP_TABLE, + MTYPE_BGP_NODE, + MTYPE_BGP_ROUTE, + MTYPE_BGP_ROUTE_EXTRA, + MTYPE_BGP_CONN, + MTYPE_BGP_STATIC, + MTYPE_BGP_ADVERTISE_ATTR, + MTYPE_BGP_ADVERTISE, + MTYPE_BGP_SYNCHRONISE, + MTYPE_BGP_ADJ_IN, + MTYPE_BGP_ADJ_OUT, + MTYPE_BGP_MPATH_INFO, + MTYPE_AS_LIST, + MTYPE_AS_FILTER, + MTYPE_AS_FILTER_STR, + MTYPE_COMMUNITY, + MTYPE_COMMUNITY_VAL, + MTYPE_COMMUNITY_STR, + MTYPE_ECOMMUNITY, + MTYPE_ECOMMUNITY_VAL, + MTYPE_ECOMMUNITY_STR, + MTYPE_COMMUNITY_LIST, + MTYPE_COMMUNITY_LIST_NAME, + MTYPE_COMMUNITY_LIST_ENTRY, + MTYPE_COMMUNITY_LIST_CONFIG, + MTYPE_COMMUNITY_LIST_HANDLER, + MTYPE_CLUSTER, + MTYPE_CLUSTER_VAL, + MTYPE_BGP_PROCESS_QUEUE, + MTYPE_BGP_CLEAR_NODE_QUEUE, + MTYPE_TRANSIT, + MTYPE_TRANSIT_VAL, + MTYPE_BGP_DEBUG_FILTER, + MTYPE_BGP_DEBUG_STR, + MTYPE_BGP_DISTANCE, + MTYPE_BGP_NEXTHOP_CACHE, + MTYPE_BGP_CONFED_LIST, + MTYPE_PEER_UPDATE_SOURCE, + MTYPE_PEER_CONF_IF, + MTYPE_BGP_DAMP_INFO, + MTYPE_BGP_DAMP_ARRAY, + MTYPE_BGP_REGEXP, + MTYPE_BGP_AGGREGATE, + MTYPE_BGP_ADDR, + MTYPE_BGP_REDIST, + MTYPE_BGP_FILTER_NAME, + MTYPE_BGP_DUMP_STR, + MTYPE_ENCAP_TLV, + MTYPE_RIP, + MTYPE_RIP_INFO, + MTYPE_RIP_INTERFACE, + MTYPE_RIP_PEER, + MTYPE_RIP_OFFSET_LIST, + MTYPE_RIP_DISTANCE, + MTYPE_RIPNG, + MTYPE_RIPNG_ROUTE, + MTYPE_RIPNG_AGGREGATE, + MTYPE_RIPNG_PEER, + MTYPE_RIPNG_OFFSET_LIST, + MTYPE_RIPNG_RTE_DATA, + MTYPE_OSPF_TOP, + MTYPE_OSPF_AREA, + MTYPE_OSPF_AREA_RANGE, + MTYPE_OSPF_NETWORK, + MTYPE_OSPF_NEIGHBOR_STATIC, + MTYPE_OSPF_IF, + MTYPE_OSPF_NEIGHBOR, + MTYPE_OSPF_ROUTE, + MTYPE_OSPF_TMP, + MTYPE_OSPF_LSA, + MTYPE_OSPF_LSA_DATA, + MTYPE_OSPF_LSDB, + MTYPE_OSPF_PACKET, + MTYPE_OSPF_FIFO, + MTYPE_OSPF_VERTEX, + MTYPE_OSPF_VERTEX_PARENT, + MTYPE_OSPF_NEXTHOP, + MTYPE_OSPF_PATH, + MTYPE_OSPF_VL_DATA, + MTYPE_OSPF_CRYPT_KEY, + MTYPE_OSPF_EXTERNAL_INFO, + MTYPE_OSPF_DISTANCE, + MTYPE_OSPF_IF_INFO, + MTYPE_OSPF_IF_PARAMS, + MTYPE_OSPF_MESSAGE, + MTYPE_OSPF6_TOP, + MTYPE_OSPF6_AREA, + MTYPE_OSPF6_IF, + MTYPE_OSPF6_NEIGHBOR, + MTYPE_OSPF6_ROUTE, + MTYPE_OSPF6_PREFIX, + MTYPE_OSPF6_MESSAGE, + MTYPE_OSPF6_LSA, + MTYPE_OSPF6_LSA_SUMMARY, + MTYPE_OSPF6_LSDB, + MTYPE_OSPF6_VERTEX, + MTYPE_OSPF6_SPFTREE, + MTYPE_OSPF6_NEXTHOP, + MTYPE_OSPF6_EXTERNAL_INFO, + MTYPE_OSPF6_OTHER, + MTYPE_ISIS, + MTYPE_ISIS_TMP, + MTYPE_ISIS_CIRCUIT, + MTYPE_ISIS_LSP, + MTYPE_ISIS_ADJACENCY, + MTYPE_ISIS_AREA, + MTYPE_ISIS_AREA_ADDR, + MTYPE_ISIS_TLV, + MTYPE_ISIS_DYNHN, + MTYPE_ISIS_SPFTREE, + MTYPE_ISIS_VERTEX, + MTYPE_ISIS_ROUTE_INFO, + MTYPE_ISIS_NEXTHOP, + MTYPE_ISIS_NEXTHOP6, + MTYPE_ISIS_DICT, + MTYPE_ISIS_DICT_NODE, + MTYPE_PIM_CHANNEL_OIL, + MTYPE_PIM_INTERFACE, + MTYPE_PIM_IGMP_JOIN, + MTYPE_PIM_IGMP_SOCKET, + MTYPE_PIM_IGMP_GROUP, + MTYPE_PIM_IGMP_GROUP_SOURCE, + MTYPE_PIM_NEIGHBOR, + MTYPE_PIM_IFCHANNEL, + MTYPE_PIM_UPSTREAM, + MTYPE_PIM_SSMPINGD, + MTYPE_PIM_STATIC_ROUTE, + MTYPE_PIM_BR, + MTYPE_VTYSH_CONFIG, + MTYPE_VTYSH_CONFIG_LINE, + MTYPE_MAX, +}; + +extern struct memory_list memory_list_lib[]; +extern struct memory_list memory_list_zebra[]; +extern struct memory_list memory_list_bgp[]; +extern struct memory_list memory_list_rip[]; +extern struct memory_list memory_list_ripng[]; +extern struct memory_list memory_list_ospf[]; +extern struct memory_list memory_list_ospf6[]; +extern struct memory_list memory_list_isis[]; +extern struct memory_list memory_list_pim[]; +extern struct memory_list memory_list_vtysh[]; + +#endif /* _QUAGGA_MEMTYPES_H */ + diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 48c0de5f69..88c61ab175 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6180,11 +6180,9 @@ DEFUN (ip_ospf_message_digest_key, "Message digest authentication password (key)\n" "Key ID\n" "Use MD5 algorithm\n" - "The OSPF password (key)" - "Address of interface") + "The OSPF password (key)\n" + "Address of interface\n") { - int idx_number = 3; - int idx_ipv4 = 6; struct interface *ifp; struct crypt_key *ck; u_char key_id; @@ -6194,10 +6192,17 @@ DEFUN (ip_ospf_message_digest_key, ifp = vty->index; params = IF_DEF_PARAMS (ifp); + int idx = 0; - if (argc == 7) + argv_find (argv, argc, "(1-255)", &idx); + char *keyid = argv[idx]->arg; + argv_find (argv, argc, "KEY", &idx); + char *cryptkey = argv[idx]->arg; + char *ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; + + if (ifaddr) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); + ret = inet_aton(ifaddr, &addr); if (!ret) { vty_out (vty, "Please specify interface address by A.B.C.D%s", @@ -6209,7 +6214,7 @@ DEFUN (ip_ospf_message_digest_key, ospf_if_update_params (ifp, addr); } - key_id = strtol (argv[idx_number]->arg, NULL, 10); + key_id = strtol (keyid, NULL, 10); if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) { vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); @@ -6219,7 +6224,7 @@ DEFUN (ip_ospf_message_digest_key, ck = ospf_crypt_key_new (); ck->key_id = (u_char) key_id; memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy ((char *) ck->auth_key, argv[idx_ipv4]->arg, OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, cryptkey, OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (params->auth_crypt, ck); SET_IF_PARAM (params, auth_crypt); From 3c7ca60c410fe87dc10ab5a26049b89e15dada78 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 15 Nov 2016 22:15:18 +0000 Subject: [PATCH 266/280] lib: Fix nondeterministic command matches in rare cases When a user erroneously defines two commands which can match the same input and at least one of the tokens defined last in the command is a selector or option, the matcher does not detect an ambiguous match and matches the command installed first (leftmost in the graph). Fix is to do a full walkthrough of the follow set when matching the final token in a command to check that there is exactly one possible match, and to throw an ambiguity error otherwise. Signed-off-by: Quentin Young --- lib/command_match.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index 82090be732..06a50656b6 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -240,6 +240,11 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) struct cmd_token *tok = gn->data; if (tok->type == END_TKN) { + if (currbest) // there is more than one END_TKN in the follow set + { + ambiguous = 1; + break; + } currbest = list_new(); // node should have one child node with the element struct graph_node *leaf = vector_slot (gn->to, 0); @@ -251,9 +256,10 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) struct cmd_element *el = leaf->data; listnode_add (currbest, el); currbest->del = (void (*)(void *)) &del_cmd_token; - break; + // do not break immediately; continue walking through the follow set + // to ensure that there is exactly one END_TKN } - else continue; + continue; } // else recurse on candidate child node From 5c2fc921e5852342262ac2d1cb00c6c4f6ff9ea4 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 16 Nov 2016 01:05:39 +0000 Subject: [PATCH 267/280] ospfd: Fix and consolidate ospf cost commands Also hide deprecated unconfiguration forms. Signed-off-by: Quentin Young --- ospfd/ospf_vty.c | 271 +++++++---------------------------------------- 1 file changed, 37 insertions(+), 234 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 88c61ab175..ba8e113014 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6437,37 +6437,31 @@ DEFUN (no_ip_ospf_message_digest_key, } DEFUN (ip_ospf_cost, - ip_ospf_cost_u32_inet4_cmd, + ip_ospf_cost_cmd, "ip ospf cost (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Interface cost\n" "Cost\n" - "Address of interface") + "Address of interface\n") { - int idx_number = 3; - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; u_int32_t cost; struct in_addr addr; - int ret; struct ospf_if_params *params; - params = IF_DEF_PARAMS (ifp); - cost = strtol (argv[idx_number]->arg, NULL, 10); + // get arguments + char *coststr = NULL, *ifaddr = NULL; + coststr = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL; + ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; - /* cost range is <1-65535>. */ - if (cost < 1 || cost > 65535) - { - vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } + cost = strtol (coststr, NULL, 10); - if (argc == 5) + if (ifaddr) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if(!inet_aton(ifaddr, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6482,186 +6476,48 @@ DEFUN (ip_ospf_cost, params->output_cost_cmd = cost; ospf_if_recalculate_output_cost (ifp); - + return CMD_SUCCESS; } DEFUN_HIDDEN (ospf_cost, - ospf_cost_u32_inet4_cmd, - "ospf cost (1-65535) A.B.C.D", + ospf_cost_cmd, + "ospf cost (1-65535) [A.B.C.D]", "OSPF interface commands\n" "Interface cost\n" "Cost\n" - "Address of interface") + "Address of interface\n") { - int idx_number = 2; - int idx_ipv4 = 3; - struct interface *ifp = vty->index; - u_int32_t cost; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - - params = IF_DEF_PARAMS (ifp); - - cost = strtol (argv[idx_number]->arg, NULL, 10); - - /* cost range is <1-65535>. */ - if (cost < 1 || cost > 65535) - { - vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_get_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - SET_IF_PARAM (params, output_cost_cmd); - params->output_cost_cmd = cost; - - ospf_if_recalculate_output_cost (ifp); - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_cost, - no_ospf_cost_inet4_cmd, - "no ospf cost [A.B.C.D]", - NO_STR - "OSPF interface commands\n" - "Interface cost\n" - "Address of interface") -{ - int idx_ipv4 = 3; - struct interface *ifp = vty->index; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - if (argc == 4) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - UNSET_IF_PARAM (params, output_cost_cmd); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - ospf_if_recalculate_output_cost (ifp); - - return CMD_SUCCESS; + return ip_ospf_cost (self, vty, argc, argv); } DEFUN (no_ip_ospf_cost, - no_ip_ospf_cost_inet4_cmd, - "no ip ospf cost [A.B.C.D]", + no_ip_ospf_cost_cmd, + "no ip ospf cost [(1-65535)] [A.B.C.D]", NO_STR - "IP Information\n" "OSPF interface commands\n" "Interface cost\n" "Address of interface") { - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; struct in_addr addr; - int ret; struct ospf_if_params *params; ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - UNSET_IF_PARAM (params, output_cost_cmd); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - ospf_if_recalculate_output_cost (ifp); - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_cost2, - no_ospf_cost_u32_cmd, - "no ospf cost [(1-65535) [A.B.C.D]]", - NO_STR - "OSPF interface commands\n" - "Interface cost\n" - "Cost\n" - "Address of interface\n") -{ - int idx_number = 3; - int idx_ipv4 = 4; - struct interface *ifp = vty->index; - struct in_addr addr; - u_int32_t cost; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); + // get arguments + char *ifaddr = NULL; + ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; /* According to the semantics we are mimicking "no ip ospf cost N" is * always treated as "no ip ospf cost" regardless of the actual value - * of N already configured for the interface. Thus the first argument - * is always checked to be a number, but is ignored after that. - */ - cost = strtol (argv[idx_number]->arg, NULL, 10); - if (cost < 1 || cost > 65535) - { - vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } + * of N already configured for the interface. Thus ignore cost. */ - if (argc == 5) + if (ifaddr) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(ifaddr, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6686,70 +6542,19 @@ DEFUN (no_ospf_cost2, return CMD_SUCCESS; } -DEFUN (no_ip_ospf_cost2, - no_ip_ospf_cost_u32_cmd, - "no ip ospf cost (1-65535) [A.B.C.D]", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Interface cost\n" - "Cost\n" - "Address of interface\n") +DEFUN_HIDDEN (no_ospf_cost, + no_ospf_cost_cmd, + "no ospf cost [(1-65535)] [A.B.C.D]", + NO_STR + "OSPF interface commands\n" + "Interface cost\n" + "Cost\n" + "Address of interface\n") { - int idx_number = 4; - int idx_ipv4 = 5; - struct interface *ifp = vty->index; - struct in_addr addr; - u_int32_t cost; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - /* According to the semantics we are mimicking "no ip ospf cost N" is - * always treated as "no ip ospf cost" regardless of the actual value - * of N already configured for the interface. Thus the first argument - * is always checked to be a number, but is ignored after that. - */ - cost = strtol (argv[idx_number]->arg, NULL, 10); - if (cost < 1 || cost > 65535) - { - vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - UNSET_IF_PARAM (params, output_cost_cmd); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - ospf_if_recalculate_output_cost (ifp); - - return CMD_SUCCESS; + return no_ip_ospf_cost (self, vty, argc, argv); } - - static void ospf_nbr_timer_update (struct ospf_interface *oi) { @@ -9980,11 +9785,10 @@ ospf_vty_if_init (void) install_element (INTERFACE_NODE, &no_ospf_message_digest_key_addr_cmd); /* "ip ospf cost" commands. */ - install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); + install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); + install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); + install_element (INTERFACE_NODE, &ospf_cost_cmd); + install_element (INTERFACE_NODE, &no_ospf_cost_cmd); /* "ip ospf mtu-ignore" commands. */ install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); @@ -10028,7 +9832,6 @@ ospf_vty_if_init (void) /* These commands are compatibitliy for previous version. */ install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); - install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); install_element (INTERFACE_NODE, &ospf_network_cmd); From 0d829fa74cb3fd0d52196d7840967605db1bed0b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 16 Nov 2016 07:46:49 +0000 Subject: [PATCH 268/280] ospfd: Clean up ospf_vty.c Refactor a bunch of commands. * Make hidden configuration items consistent * Remove duplicate code * Make unconfig consistent with config Signed-off-by: Quentin Young --- ospfd/ospf_vty.c | 911 ++++++++++------------------------------------- 1 file changed, 198 insertions(+), 713 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ba8e113014..45f84af76e 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6026,6 +6026,7 @@ DEFUN (no_ip_ospf_authentication, return CMD_SUCCESS; } + DEFUN (ip_ospf_authentication_key, ip_ospf_authentication_key_addr_cmd, "ip ospf authentication-key AUTH_KEY [A.B.C.D]", @@ -6035,19 +6036,17 @@ DEFUN (ip_ospf_authentication_key, "The OSPF password (key)\n" "Address of interface") { - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp; struct in_addr addr; - int ret; struct ospf_if_params *params; ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 5) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6065,67 +6064,15 @@ DEFUN (ip_ospf_authentication_key, return CMD_SUCCESS; } - DEFUN_HIDDEN (ospf_authentication_key, ospf_authentication_key_cmd, - "ospf authentication-key AUTH_KEY", + "ospf authentication-key AUTH_KEY [A.B.C.D]", "OSPF interface commands\n" "Authentication password (key)\n" - "The OSPF password (key)") + "The OSPF password (key)\n" + "Address of interface\n") { - struct interface *ifp; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy ((char *) params->auth_simple, argv[2]->arg, OSPF_AUTH_SIMPLE_SIZE); - SET_IF_PARAM (params, auth_simple); - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_authentication_key, - no_ospf_authentication_key_authkey_addr_cmd, - "no ospf authentication-key [AUTH_KEY [A.B.C.D]]", - NO_STR - "OSPF interface commands\n" - "Authentication password (key)\n" - "The OSPF password (key)") -{ - struct interface *ifp; - struct in_addr addr; - struct ospf_if_params *params; - int ret; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - if (argc == 5) - { - ret = inet_aton(argv[4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); - UNSET_IF_PARAM (params, auth_simple); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - return CMD_SUCCESS; + return ip_ospf_authentication_key (self, vty, argc, argv); } DEFUN (no_ip_ospf_authentication_key, @@ -6137,18 +6084,16 @@ DEFUN (no_ip_ospf_authentication_key, "Authentication password (key)\n" "The OSPF password (key)") { + int idx = 0; struct interface *ifp; struct in_addr addr; struct ospf_if_params *params; - int ret; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 6) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(argv[5]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6172,6 +6117,17 @@ DEFUN (no_ip_ospf_authentication_key, return CMD_SUCCESS; } +DEFUN_HIDDEN (no_ospf_authentication_key, + no_ospf_authentication_key_authkey_addr_cmd, + "no ospf authentication-key [AUTH_KEY [A.B.C.D]]", + NO_STR + "OSPF interface commands\n" + "Authentication password (key)\n" + "The OSPF password (key)") +{ + return no_ip_ospf_authentication_key (self, vty, argc, argv); +} + DEFUN (ip_ospf_message_digest_key, ip_ospf_message_digest_key_addr_cmd, "ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", @@ -6187,7 +6143,6 @@ DEFUN (ip_ospf_message_digest_key, struct crypt_key *ck; u_char key_id; struct in_addr addr; - int ret; struct ospf_if_params *params; ifp = vty->index; @@ -6195,15 +6150,13 @@ DEFUN (ip_ospf_message_digest_key, int idx = 0; argv_find (argv, argc, "(1-255)", &idx); - char *keyid = argv[idx]->arg; + char *keyid = argv[idx]->arg; argv_find (argv, argc, "KEY", &idx); char *cryptkey = argv[idx]->arg; - char *ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; - if (ifaddr) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(ifaddr, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6232,69 +6185,46 @@ DEFUN (ip_ospf_message_digest_key, return CMD_SUCCESS; } - DEFUN_HIDDEN (ospf_message_digest_key, ospf_message_digest_key_cmd, - "ospf message-digest-key (1-255) md5 KEY", + "ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", "OSPF interface commands\n" "Message digest authentication password (key)\n" "Key ID\n" "Use MD5 algorithm\n" - "The OSPF password (key)") + "The OSPF password (key)\n" + "Address of interface\n") { - int idx_number = 2; - struct interface *ifp; - struct crypt_key *ck; - u_char key_id; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - key_id = strtol (argv[idx_number]->arg, NULL, 10); - if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) - { - vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); - return CMD_WARNING; - } - - ck = ospf_crypt_key_new (); - ck->key_id = (u_char) key_id; - memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy ((char *) ck->auth_key, argv[idx_number]->arg, OSPF_AUTH_MD5_SIZE); - - ospf_crypt_key_add (params->auth_crypt, ck); - SET_IF_PARAM (params, auth_crypt); - - return CMD_SUCCESS; + return ip_ospf_message_digest_key (self, vty, argc, argv); } DEFUN (no_ip_ospf_message_digest_key_md5, no_ip_ospf_message_digest_key_md5_addr_cmd, - "no ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", + "no ip ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" "Message digest authentication password (key)\n" "Key ID\n" "Use MD5 algorithm\n" - "The OSPF password (key)" - "Address of interface") + "The OSPF password (key)\n" + "Address of interface\n") { - int idx_number = 4; + int idx = 0; struct interface *ifp; struct crypt_key *ck; int key_id; struct in_addr addr; - int ret; struct ospf_if_params *params; - ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 8) + argv_find (argv, argc, "(1-255)", &idx); + char *keyid = argv[idx]->arg; + + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(argv[7]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6306,7 +6236,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } - key_id = strtol (argv[idx_number]->arg, NULL, 10); + key_id = strtol (keyid, NULL, 10); ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); if (ck == NULL) { @@ -6325,115 +6255,16 @@ DEFUN (no_ip_ospf_message_digest_key_md5, return CMD_SUCCESS; } -DEFUN (no_ospf_message_digest_key, - no_ospf_message_digest_key_addr_cmd, - "no ospf message-digest-key (1-255) [A.B.C.D]", - NO_STR - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n" - "Address of interface") +DEFUN_HIDDEN (no_ospf_message_digest_key, + no_ospf_message_digest_key_addr_cmd, + "no ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]", + NO_STR + "OSPF interface commands\n" + "Message digest authentication password (key)\n" + "Key ID\n" + "Address of interface") { - int idx_number = 3; - int idx_ipv4 = 4; - struct interface *ifp; - struct crypt_key *ck; - int key_id; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - key_id = strtol (argv[idx_number]->arg, NULL, 10); - ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); - if (ck == NULL) - { - vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); - return CMD_WARNING; - } - - ospf_crypt_key_delete (params->auth_crypt, key_id); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - return CMD_SUCCESS; -} - -DEFUN (no_ip_ospf_message_digest_key, - no_ip_ospf_message_digest_key_addr_cmd, - "no ip ospf message-digest-key (1-255) [A.B.C.D]", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Message digest authentication password (key)\n" - "Key ID\n" - "Address of interface") -{ - int idx_number = 4; - int idx_ipv4 = 5; - struct interface *ifp; - struct crypt_key *ck; - int key_id; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - if (argc == 6) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - key_id = strtol (argv[idx_number]->arg, NULL, 10); - ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); - if (ck == NULL) - { - vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); - return CMD_WARNING; - } - - ospf_crypt_key_delete (params->auth_crypt, key_id); - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - return CMD_SUCCESS; + return no_ip_ospf_message_digest_key_md5 (self, vty, argc, argv); } DEFUN (ip_ospf_cost, @@ -6554,7 +6385,6 @@ DEFUN_HIDDEN (no_ospf_cost, return no_ip_ospf_cost (self, vty, argc, argv); } - static void ospf_nbr_timer_update (struct ospf_interface *oi) { @@ -6651,7 +6481,7 @@ ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, } DEFUN (ip_ospf_dead_interval, - ip_ospf_dead_interval_addr_cmd, + ip_ospf_dead_interval_cmd, "ip ospf dead-interval (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" @@ -6659,25 +6489,22 @@ DEFUN (ip_ospf_dead_interval, "Seconds\n" "Address of interface\n") { - int idx_number = 3; - int idx_ipv4 = 4; - if (argc == 5) - return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, argv[idx_ipv4]->arg, NULL); - else - return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL); + int idx = 0; + char *interval = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL; + char *ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; + return ospf_vty_dead_interval_set (vty, interval, ifaddr, NULL); } DEFUN_HIDDEN (ospf_dead_interval, ospf_dead_interval_cmd, - "ospf dead-interval (1-65535)", + "ospf dead-interval (1-65535) [A.B.C.D]", "OSPF interface commands\n" "Interval after which a neighbor is declared dead\n" - "Seconds\n") + "Seconds\n" + "Address of interface\n") { - int idx_number = 2; - - return ospf_vty_dead_interval_set (vty, argv[idx_number]->arg, NULL, NULL); + return ip_ospf_dead_interval (self, vty, argc, argv); } DEFUN (ip_ospf_dead_interval_minimal, @@ -6699,30 +6526,8 @@ DEFUN (ip_ospf_dead_interval_minimal, return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg); } -DEFUN (no_ospf_dead_interval, - no_ospf_dead_interval_cmd, - "no ospf dead-interval", - NO_STR - "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n") -{ - struct interface *ifp = vty->index; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - UNSET_IF_PARAM (params, v_wait); - params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; - - UNSET_IF_PARAM (params, fast_hello); - params->fast_hello = OSPF_FAST_HELLO_DEFAULT; - - return CMD_SUCCESS; -} - DEFUN (no_ip_ospf_dead_interval, - no_ip_ospf_dead_interval_addr_cmd, + no_ip_ospf_dead_interval_cmd, "no ip ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]", NO_STR "IP Information\n" @@ -6791,38 +6596,40 @@ DEFUN (no_ip_ospf_dead_interval, return CMD_SUCCESS; } +DEFUN_HIDDEN (no_ospf_dead_interval, + no_ospf_dead_interval_cmd, + "no ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]", + NO_STR + "OSPF interface commands\n" + "Interval after which a neighbor is declared dead\n" + "Seconds\n" + "Address of interface") +{ + return no_ip_ospf_dead_interval (self, vty, argc, argv); +} + DEFUN (ip_ospf_hello_interval, - ip_ospf_hello_interval_addr_cmd, + ip_ospf_hello_interval_cmd, "ip ospf hello-interval (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" "Time between HELLO packets\n" "Seconds\n" - "Address of interface") + "Address of interface\n") { - int idx_number = 3; - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; - u_int32_t seconds; struct in_addr addr; - int ret; struct ospf_if_params *params; - params = IF_DEF_PARAMS (ifp); + u_int32_t seconds = 0; - seconds = strtol (argv[idx_number]->arg, NULL, 10); + argv_find (argv, argc, "(1-65535)", &idx); + seconds = strtol (argv[idx]->arg, NULL, 10); - /* HelloInterval range is <1-65535>. */ - if (seconds < 1 || seconds > 65535) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if(!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6839,62 +6646,36 @@ DEFUN (ip_ospf_hello_interval, return CMD_SUCCESS; } - DEFUN_HIDDEN (ospf_hello_interval, ospf_hello_interval_cmd, - "ospf hello-interval (1-65535)", + "ospf hello-interval (1-65535) [A.B.C.D]", "OSPF interface commands\n" "Time between HELLO packets\n" - "Seconds\n") + "Seconds\n" + "Address of interface\n") { - int idx_number = 2; - struct interface *ifp = vty->index; - u_int32_t seconds; - struct ospf_if_params *params; - - params = IF_DEF_PARAMS (ifp); - - seconds = strtol (argv[idx_number]->arg, NULL, 10); - - /* HelloInterval range is <1-65535>. */ - if (seconds < 1 || seconds > 65535) - { - vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - SET_IF_PARAM (params, v_hello); - params->v_hello = seconds; - - return CMD_SUCCESS; + return ip_ospf_hello_interval (self, vty, argc, argv); } DEFUN (no_ip_ospf_hello_interval, - no_ip_ospf_hello_interval_addr_cmd, - "no [ip] ospf hello-interval [(1-65535) [A.B.C.D]]", + no_ip_ospf_hello_interval_cmd, + "no ip ospf hello-interval [(1-65535) [A.B.C.D]]", NO_STR "IP Information\n" "OSPF interface commands\n" - "Time between HELLO packets\n" + "Time between HELLO packets\n" // ignored "Seconds\n" - "Address of interface") + "Address of interface\n") { - int idx_ipv4 = 5; + int idx = 0; struct interface *ifp = vty->index; struct in_addr addr; - int ret; struct ospf_if_params *params; - - ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (strcmp (argv[1]->arg, "ip") == 0) - idx_ipv4 = 4; - - if (argc == idx_ipv4+1) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if(!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -6918,8 +6699,17 @@ DEFUN (no_ip_ospf_hello_interval, return CMD_SUCCESS; } - - +DEFUN_HIDDEN (no_ospf_hello_interval, + no_ospf_hello_interval_cmd, + "no ospf hello-interval [(1-65535) [A.B.C.D]]", + NO_STR + "OSPF interface commands\n" + "Time between HELLO packets\n" // ignored + "Seconds\n" + "Address of interface\n") +{ + return no_ospf_hello_interval (self, vty, argc, argv); +} DEFUN (ip_ospf_network, ip_ospf_network_cmd, @@ -6932,7 +6722,7 @@ DEFUN (ip_ospf_network, "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") { - int idx_network = 3; + int idx = 0; struct interface *ifp = vty->index; int old_type = IF_DEF_PARAMS (ifp)->type; struct route_node *rn; @@ -6943,13 +6733,13 @@ DEFUN (ip_ospf_network, return CMD_WARNING; } - if (strncmp (argv[idx_network]->arg, "b", 1) == 0) + if (argv_find (argv, argc, "broadcast", &idx)) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; - else if (strncmp (argv[idx_network]->arg, "n", 1) == 0) + else if (argv_find (argv, argc, "non-broadcast", &idx)) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; - else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0) + else if (argv_find (argv, argc, "point-to-multipoint", &idx)) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; - else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0) + else if (argv_find (argv, argc, "point-to-point", &idx)) IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; if (IF_DEF_PARAMS (ifp)->type == old_type) @@ -6986,87 +6776,7 @@ DEFUN_HIDDEN (ospf_network, "Specify OSPF point-to-multipoint network\n" "Specify OSPF point-to-point network\n") { - int idx_network = 2; - struct interface *ifp = vty->index; - int old_type = IF_DEF_PARAMS (ifp)->type; - struct route_node *rn; - - if (old_type == OSPF_IFTYPE_LOOPBACK) - { - vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (strncmp (argv[idx_network]->arg, "b", 1) == 0) - IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; - else if (strncmp (argv[idx_network]->arg, "n", 1) == 0) - IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; - else if (strncmp (argv[idx_network]->arg, "point-to-m", 10) == 0) - IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; - else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0) - IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; - - if (IF_DEF_PARAMS (ifp)->type == old_type) - return CMD_SUCCESS; - - SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); - - for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) - { - struct ospf_interface *oi = rn->info; - - if (!oi) - continue; - - oi->type = IF_DEF_PARAMS (ifp)->type; - - if (oi->state > ISM_Down) - { - OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); - OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); - } - } - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_network, - no_ospf_network_cmd, - "no ospf network []", - NO_STR - "OSPF interface commands\n" - "Network type\n" - "Specify OSPF broadcast multi-access network\n" - "Specify OSPF NBMA network\n" - "Specify OSPF point-to-multipoint network\n" - "Specify OSPF point-to-point network\n") -{ - struct interface *ifp = vty->index; - int old_type = IF_DEF_PARAMS (ifp)->type; - struct route_node *rn; - - IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); - - if (IF_DEF_PARAMS (ifp)->type == old_type) - return CMD_SUCCESS; - - for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) - { - struct ospf_interface *oi = rn->info; - - if (!oi) - continue; - - oi->type = IF_DEF_PARAMS (ifp)->type; - - if (oi->state > ISM_Down) - { - OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); - OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); - } - } - - return CMD_SUCCESS; + return ip_ospf_network (self, vty, argc, argv); } DEFUN (no_ip_ospf_network, @@ -7109,6 +6819,20 @@ DEFUN (no_ip_ospf_network, return CMD_SUCCESS; } +DEFUN_HIDDEN (no_ospf_network, + no_ospf_network_cmd, + "no ospf network []", + NO_STR + "OSPF interface commands\n" + "Network type\n" + "Specify OSPF broadcast multi-access network\n" + "Specify OSPF NBMA network\n" + "Specify OSPF point-to-multipoint network\n" + "Specify OSPF point-to-point network\n") +{ + return no_ip_ospf_network (self, vty, argc, argv); +} + DEFUN (ip_ospf_priority, ip_ospf_priority_addr_cmd, "ip ospf priority (0-255) [A.B.C.D]", @@ -7118,30 +6842,20 @@ DEFUN (ip_ospf_priority, "Priority\n" "Address of interface") { - int idx_number = 3; - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; long priority; struct route_node *rn; struct in_addr addr; - int ret; struct ospf_if_params *params; - params = IF_DEF_PARAMS (ifp); - priority = strtol (argv[idx_number]->arg, NULL, 10); + argv_find (argv, argc, "(0-255)", &idx); + priority = strtol (argv[idx]->arg, NULL, 10); - /* Router Priority range is <0-255>. */ - if (priority < 0 || priority > 255) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7172,111 +6886,14 @@ DEFUN (ip_ospf_priority, return CMD_SUCCESS; } - DEFUN_HIDDEN (ospf_priority, ospf_priority_cmd, - "ospf priority (0-255)", + "ospf priority (0-255) [A.B.C.D]", "OSPF interface commands\n" "Router priority\n" "Priority\n") { - int idx_number = 2; - struct interface *ifp = vty->index; - long priority; - struct route_node *rn; - struct ospf_if_params *params; - - params = IF_DEF_PARAMS (ifp); - - priority = strtol (argv[idx_number]->arg, NULL, 10); - - /* Router Priority range is <0-255>. */ - if (priority < 0 || priority > 255) - { - vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - SET_IF_PARAM (params, priority); - params->priority = priority; - - for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) - { - struct ospf_interface *oi = rn->info; - - if (!oi) - continue; - - - if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) - { - PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); - OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); - } - } - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_priority, - no_ospf_priority_addr_cmd, - "no ospf priority [(0-255) [A.B.C.D]]", - NO_STR - "OSPF interface commands\n" - "Router priority\n" - "Priority\n" - "Address of interface") -{ - int idx_ipv4 = 4; - struct interface *ifp = vty->index; - struct route_node *rn; - struct in_addr addr; - int ret; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) - { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); - return CMD_WARNING; - } - - params = ospf_lookup_if_params (ifp, addr); - if (params == NULL) - return CMD_SUCCESS; - } - - UNSET_IF_PARAM (params, priority); - params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; - - if (params != IF_DEF_PARAMS (ifp)) - { - ospf_free_if_params (ifp, addr); - ospf_if_update_params (ifp, addr); - } - - for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) - { - struct ospf_interface *oi = rn->info; - - if (!oi) - continue; - - - if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) - { - PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); - OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); - } - } - - return CMD_SUCCESS; + return ip_ospf_priority (self, vty, argc, argv); } DEFUN (no_ip_ospf_priority, @@ -7285,24 +6902,22 @@ DEFUN (no_ip_ospf_priority, NO_STR "IP Information\n" "OSPF interface commands\n" - "Router priority\n" + "Router priority\n" // ignored "Priority\n" "Address of interface") { - int idx_ipv4 = 5; + int idx = 0; struct interface *ifp = vty->index; struct route_node *rn; struct in_addr addr; - int ret; struct ospf_if_params *params; ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc == 6) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7330,7 +6945,6 @@ DEFUN (no_ip_ospf_priority, if (!oi) continue; - if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) { PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); @@ -7341,6 +6955,17 @@ DEFUN (no_ip_ospf_priority, return CMD_SUCCESS; } +DEFUN_HIDDEN (no_ospf_priority, + no_ospf_priority_addr_cmd, + "no ospf priority [(0-255) [A.B.C.D]]", + NO_STR + "OSPF interface commands\n" + "Router priority\n" + "Priority\n" + "Address of interface") +{ + return no_ip_ospf_priority (self, vty, argc, argv); +} DEFUN (ip_ospf_retransmit_interval, ip_ospf_retransmit_interval_addr_cmd, @@ -7351,29 +6976,19 @@ DEFUN (ip_ospf_retransmit_interval, "Seconds\n" "Address of interface") { - int idx_number = 3; - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; u_int32_t seconds; struct in_addr addr; - int ret; struct ospf_if_params *params; - params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[idx_number]->arg, NULL, 10); - /* Retransmit Interval range is <3-65535>. */ - if (seconds < 3 || seconds > 65535) + argv_find (argv, argc, "(3-65535)", &idx); + seconds = strtol (argv[idx]->arg, NULL, 10); + + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7392,77 +7007,34 @@ DEFUN (ip_ospf_retransmit_interval, DEFUN_HIDDEN (ospf_retransmit_interval, ospf_retransmit_interval_cmd, - "ospf retransmit-interval (3-65535)", + "ospf retransmit-interval (3-65535) [A.B.C.D]", "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" "Seconds\n") { - int idx_number = 2; - struct interface *ifp = vty->index; - u_int32_t seconds; - struct ospf_if_params *params; - - params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[idx_number]->arg, NULL, 10); - - /* Retransmit Interval range is <3-65535>. */ - if (seconds < 3 || seconds > 65535) - { - vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - SET_IF_PARAM (params, retransmit_interval); - params->retransmit_interval = seconds; - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_retransmit_interval, - no_ospf_retransmit_interval_cmd, - "no ospf retransmit-interval", - NO_STR - "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n") -{ - struct interface *ifp = vty->index; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - UNSET_IF_PARAM (params, retransmit_interval); - params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; - - return CMD_SUCCESS; + return ip_ospf_retransmit_interval (self, vty, argc, argv); } DEFUN (no_ip_ospf_retransmit_interval, no_ip_ospf_retransmit_interval_addr_cmd, - "no ip ospf retransmit-interval [<(3-65535) [A.B.C.D]|A.B.C.D>]", + "no ip ospf retransmit-interval [(3-65535)] [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n" - "Address of interface") + "Time between retransmitting lost link state advertisements\n" //ignored + "Address of interface\n") { + int idx = 0; struct interface *ifp = vty->index; struct in_addr addr; - int ret; struct ospf_if_params *params; - int addr_index; ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc >= 5) + if (argv_find (argv, argc, "(3-65535)", &idx)) { - if (argc == 5) - addr_index = 4; - else - addr_index = 5; - - ret = inet_aton(argv[addr_index]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7486,6 +7058,15 @@ DEFUN (no_ip_ospf_retransmit_interval, return CMD_SUCCESS; } +DEFUN_HIDDEN (no_ospf_retransmit_interval, + no_ospf_retransmit_interval_cmd, + "no ospf retransmit-interval [(3-65535)] [A.B.C.D]", + NO_STR + "OSPF interface commands\n" + "Time between retransmitting lost link state advertisements\n") +{ + return no_ip_ospf_retransmit_interval (self, vty, argc, argv); +} DEFUN (ip_ospf_transmit_delay, ip_ospf_transmit_delay_addr_cmd, @@ -7496,28 +7077,19 @@ DEFUN (ip_ospf_transmit_delay, "Seconds\n" "Address of interface") { - int idx_number = 3; - int idx_ipv4 = 4; + int idx = 0; struct interface *ifp = vty->index; u_int32_t seconds; struct in_addr addr; - int ret; struct ospf_if_params *params; params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[idx_number]->arg, NULL, 10); + argv_find (argv, argc, "(1-65535)", &idx); + seconds = strtol (argv[idx]->arg, NULL, 10); - /* Transmit Delay range is <1-65535>. */ - if (seconds < 1 || seconds > 65535) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (argc == 5) - { - ret = inet_aton(argv[idx_ipv4]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7534,62 +7106,36 @@ DEFUN (ip_ospf_transmit_delay, return CMD_SUCCESS; } - DEFUN_HIDDEN (ospf_transmit_delay, ospf_transmit_delay_cmd, - "ospf transmit-delay (1-65535)", + "ospf transmit-delay (1-65535) [A.B.C.D]", "OSPF interface commands\n" "Link state transmit delay\n" "Seconds\n") { - int idx_number = 2; - struct interface *ifp = vty->index; - u_int32_t seconds; - struct ospf_if_params *params; - - params = IF_DEF_PARAMS (ifp); - seconds = strtol (argv[idx_number]->arg, NULL, 10); - - /* Transmit Delay range is <1-65535>. */ - if (seconds < 1 || seconds > 65535) - { - vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - SET_IF_PARAM (params, transmit_delay); - params->transmit_delay = seconds; - - return CMD_SUCCESS; + return ip_ospf_transmit_delay (self, vty, argc, argv); } DEFUN (no_ip_ospf_transmit_delay, no_ip_ospf_transmit_delay_addr_cmd, - "no ip ospf transmit-delay []", + "no ip ospf transmit-delay [(1-65535)] [A.B.C.D]", NO_STR "IP Information\n" "OSPF interface commands\n" "Link state transmit delay\n" "Address of interface") { + int idx = 0; struct interface *ifp = vty->index; struct in_addr addr; - int ret; struct ospf_if_params *params; - int addr_index; ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argc >= 5) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { - if (argc == 5) - addr_index = 4; - else - addr_index = 5; - - ret = inet_aton(argv[addr_index]->arg, &addr); - if (!ret) + if (!inet_aton(argv[idx]->arg, &addr)) { vty_out (vty, "Please specify interface address by A.B.C.D%s", VTY_NEWLINE); @@ -7614,45 +7160,14 @@ DEFUN (no_ip_ospf_transmit_delay, } -DEFUN (no_ospf_transmit_delay, - no_ospf_transmit_delay_cmd, - "no ospf transmit-delay", - NO_STR - "OSPF interface commands\n" - "Link state transmit delay\n") +DEFUN_HIDDEN (no_ospf_transmit_delay, + no_ospf_transmit_delay_cmd, + "no ospf transmit-delay", + NO_STR + "OSPF interface commands\n" + "Link state transmit delay\n") { - struct interface *ifp = vty->index; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - UNSET_IF_PARAM (params, transmit_delay); - params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; - - return CMD_SUCCESS; -} - -DEFUN (no_ip_ospf_transmit_delay_sec, - no_ip_ospf_transmit_delay_sec_cmd, - "no ip ospf transmit-delay (1-65535)", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Link state transmit delay\n" - "Seconds\n" - "Address of interface") -{ - struct interface *ifp = vty->index; - struct ospf_if_params *params; - - ifp = vty->index; - params = IF_DEF_PARAMS (ifp); - - UNSET_IF_PARAM (params, transmit_delay); - params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; - - return CMD_SUCCESS; + return no_ip_ospf_transmit_delay (self, vty, argc, argv); } DEFUN (ip_ospf_area, @@ -7665,7 +7180,7 @@ DEFUN (ip_ospf_area, "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { - int idx_ipv4_number = 2; + int idx = 0; struct interface *ifp = vty->index; int format, ret; struct in_addr area_id; @@ -7674,8 +7189,9 @@ DEFUN (ip_ospf_area, struct route_node *rn; u_short instance = 0; - if (argc == 5) - VTY_GET_INTEGER ("Instance", instance, argv[idx_ipv4_number]->arg); + if (argv_find (argv, argc, "(1-65535)", &idx)) + instance = strtol (argv[idx]->arg, NULL, 10); + char *areaid = argv[argc - 1]->arg; ospf = ospf_lookup_instance (instance); if (ospf == NULL) @@ -7690,7 +7206,7 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } - ret = ospf_str2area_id (argv[instance ? 4 : 3]->arg, &area_id, &format); + ret = ospf_str2area_id (areaid, &area_id, &format); if (ret < 0) { vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s", @@ -7730,7 +7246,7 @@ DEFUN (ip_ospf_area, DEFUN (no_ip_ospf_area, no_ip_ospf_area_cmd, - "no ip ospf area []", + "no ip ospf [(1-65535)] area []", NO_STR "IP Information\n" "OSPF interface commands\n" @@ -7738,50 +7254,22 @@ DEFUN (no_ip_ospf_area, "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") { + int idx = 0; struct interface *ifp = vty->index; struct ospf *ospf; struct ospf_if_params *params; u_short instance = 0; + if (argv_find (argv, argc, "(1-65535)", &idx)) + instance = strtol (argv[idx]->arg, NULL, 10); + if ((ospf = ospf_lookup_instance (instance)) == NULL) return CMD_SUCCESS; params = IF_DEF_PARAMS (ifp); if (!OSPF_IF_PARAM_CONFIGURED(params, if_area)) { - vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ospf_interface_unset (ifp); - ospf->if_ospf_cli_count--; - return CMD_SUCCESS; -} - -DEFUN (no_ip_ospf_instance_area, - no_ip_ospf_instance_area_cmd, - "no ip ospf (1-65535) area []", - NO_STR - "IP Information\n" - "OSPF interface commands\n" - "Instance ID\n" - "Disable OSPF on this interface\n") -{ - int idx_number = 3; - struct interface *ifp = vty->index; - struct ospf *ospf; - struct ospf_if_params *params; - u_short instance = 0; - - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - - if ((ospf = ospf_lookup_instance (instance)) == NULL) - return CMD_SUCCESS; - - params = IF_DEF_PARAMS (ifp); - if (!OSPF_IF_PARAM_CONFIGURED(params, if_area)) - { - vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE); + vty_out (vty, "Can't find specified interface area configuration.%s", VTY_NEWLINE); return CMD_WARNING; } @@ -9780,7 +9268,6 @@ ospf_vty_if_init (void) /* "ip ospf message-digest-key" commands. */ install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd); install_element (INTERFACE_NODE, &no_ospf_message_digest_key_addr_cmd); @@ -9795,13 +9282,13 @@ ospf_vty_if_init (void) install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); /* "ip ospf dead-interval" commands. */ - install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); + install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); + install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); /* "ip ospf hello-interval" commands. */ - install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); + install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); + install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); /* "ip ospf network" commands. */ install_element (INTERFACE_NODE, &ip_ospf_network_cmd); @@ -9821,13 +9308,11 @@ ospf_vty_if_init (void) /* "ip ospf transmit-delay" commands. */ install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_cmd); install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); /* "ip ospf area" commands. */ install_element (INTERFACE_NODE, &ip_ospf_area_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_area_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_instance_area_cmd); /* These commands are compatibitliy for previous version. */ install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); From 537eae3f2808ae9566e443b767b8d054247f65c1 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 16 Nov 2016 08:09:32 +0000 Subject: [PATCH 269/280] ospfd: Use sane cmd names and organize install_element's Signed-off-by: Quentin Young --- ospfd/ospf_vty.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 45f84af76e..07159174c1 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6129,7 +6129,7 @@ DEFUN_HIDDEN (no_ospf_authentication_key, } DEFUN (ip_ospf_message_digest_key, - ip_ospf_message_digest_key_addr_cmd, + ip_ospf_message_digest_key_cmd, "ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" @@ -6198,8 +6198,8 @@ DEFUN_HIDDEN (ospf_message_digest_key, return ip_ospf_message_digest_key (self, vty, argc, argv); } -DEFUN (no_ip_ospf_message_digest_key_md5, - no_ip_ospf_message_digest_key_md5_addr_cmd, +DEFUN (no_ip_ospf_message_digest_key, + no_ip_ospf_message_digest_key_cmd, "no ip ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]", NO_STR "IP Information\n" @@ -6256,7 +6256,7 @@ DEFUN (no_ip_ospf_message_digest_key_md5, } DEFUN_HIDDEN (no_ospf_message_digest_key, - no_ospf_message_digest_key_addr_cmd, + no_ospf_message_digest_key_cmd, "no ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]", NO_STR "OSPF interface commands\n" @@ -6264,7 +6264,7 @@ DEFUN_HIDDEN (no_ospf_message_digest_key, "Key ID\n" "Address of interface") { - return no_ip_ospf_message_digest_key_md5 (self, vty, argc, argv); + return no_ip_ospf_message_digest_key (self, vty, argc, argv); } DEFUN (ip_ospf_cost, @@ -6834,7 +6834,7 @@ DEFUN_HIDDEN (no_ospf_network, } DEFUN (ip_ospf_priority, - ip_ospf_priority_addr_cmd, + ip_ospf_priority_cmd, "ip ospf priority (0-255) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" @@ -6897,7 +6897,7 @@ DEFUN_HIDDEN (ospf_priority, } DEFUN (no_ip_ospf_priority, - no_ip_ospf_priority_addr_cmd, + no_ip_ospf_priority_cmd, "no ip ospf priority [(0-255) [A.B.C.D]]", NO_STR "IP Information\n" @@ -6956,7 +6956,7 @@ DEFUN (no_ip_ospf_priority, } DEFUN_HIDDEN (no_ospf_priority, - no_ospf_priority_addr_cmd, + no_ospf_priority_cmd, "no ospf priority [(0-255) [A.B.C.D]]", NO_STR "OSPF interface commands\n" @@ -9267,15 +9267,12 @@ ospf_vty_if_init (void) install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_addr_cmd); /* "ip ospf message-digest-key" commands. */ - install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd); - install_element (INTERFACE_NODE, &no_ospf_message_digest_key_addr_cmd); + install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); + install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); /* "ip ospf cost" commands. */ install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); - install_element (INTERFACE_NODE, &ospf_cost_cmd); - install_element (INTERFACE_NODE, &no_ospf_cost_cmd); /* "ip ospf mtu-ignore" commands. */ install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); @@ -9293,22 +9290,18 @@ ospf_vty_if_init (void) /* "ip ospf network" commands. */ install_element (INTERFACE_NODE, &ip_ospf_network_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); - install_element (INTERFACE_NODE, &no_ospf_network_cmd); /* "ip ospf priority" commands. */ - install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); - install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); - install_element (INTERFACE_NODE, &no_ospf_priority_addr_cmd); + install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); + install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); /* "ip ospf retransmit-interval" commands. */ install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); - install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); /* "ip ospf transmit-delay" commands. */ install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); - install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); /* "ip ospf area" commands. */ install_element (INTERFACE_NODE, &ip_ospf_area_cmd); @@ -9317,12 +9310,21 @@ ospf_vty_if_init (void) /* These commands are compatibitliy for previous version. */ install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); + install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); + install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); + install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); + install_element (INTERFACE_NODE, &ospf_cost_cmd); + install_element (INTERFACE_NODE, &no_ospf_cost_cmd); install_element (INTERFACE_NODE, &ospf_network_cmd); + install_element (INTERFACE_NODE, &no_ospf_network_cmd); install_element (INTERFACE_NODE, &ospf_priority_cmd); + install_element (INTERFACE_NODE, &no_ospf_priority_cmd); install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); + install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); + install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); } static void From 47b91972ad36a64d8341e9b4bd68f9303b74b159 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 20:18:34 +0000 Subject: [PATCH 270/280] ospfd: Fix typo in retransmit-interval arg parsing Signed-off-by: Quentin Young --- ospfd/ospf_vty.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 07159174c1..c6d9488a10 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -7028,11 +7028,11 @@ DEFUN (no_ip_ospf_retransmit_interval, struct interface *ifp = vty->index; struct in_addr addr; struct ospf_if_params *params; - + ifp = vty->index; params = IF_DEF_PARAMS (ifp); - if (argv_find (argv, argc, "(3-65535)", &idx)) + if (argv_find (argv, argc, "A.B.C.D", &idx)) { if (!inet_aton(argv[idx]->arg, &addr)) { @@ -7082,7 +7082,7 @@ DEFUN (ip_ospf_transmit_delay, u_int32_t seconds; struct in_addr addr; struct ospf_if_params *params; - + params = IF_DEF_PARAMS (ifp); argv_find (argv, argc, "(1-65535)", &idx); seconds = strtol (argv[idx]->arg, NULL, 10); @@ -7100,7 +7100,7 @@ DEFUN (ip_ospf_transmit_delay, ospf_if_update_params (ifp, addr); } - SET_IF_PARAM (params, transmit_delay); + SET_IF_PARAM (params, transmit_delay); params->transmit_delay = seconds; return CMD_SUCCESS; From 99a522c71bbeeed1442865fb53e581480fc299cc Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 20:19:27 +0000 Subject: [PATCH 271/280] ospfd, ospf6d: Clean up and unify doc strings Signed-off-by: Quentin Young --- ospf6d/ospf6_interface.c | 14 +++++++------- ospfd/ospf_vty.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 45977c616e..3d15b0b3f8 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1328,7 +1328,7 @@ DEFUN (ipv6_ospf6_hellointerval, "ipv6 ospf6 hello-interval (1-65535)", IP6_STR OSPF6_STR - "Interval time of Hello packets\n" + "Time between HELLO packets\n" SECONDS_STR ) { @@ -1380,7 +1380,7 @@ DEFUN (ipv6_ospf6_transmitdelay, "ipv6 ospf6 transmit-delay (1-3600)", IP6_STR OSPF6_STR - "Transmit delay of this interface\n" + "Link state transmit delay\n" SECONDS_STR ) { @@ -1489,7 +1489,7 @@ DEFUN (ipv6_ospf6_passive, "ipv6 ospf6 passive", IP6_STR OSPF6_STR - "passive interface, No adjacency will be formed on this interface\n" + "Passive interface; no adjacency will be formed on this interface\n" ) { struct ospf6_interface *oi; @@ -1550,7 +1550,7 @@ DEFUN (ipv6_ospf6_mtu_ignore, "ipv6 ospf6 mtu-ignore", IP6_STR OSPF6_STR - "Ignore MTU mismatch on this interface\n" + "Disable MTU mismatch detection on this interface\n" ) { struct ospf6_interface *oi; @@ -1575,7 +1575,7 @@ DEFUN (no_ipv6_ospf6_mtu_ignore, NO_STR IP6_STR OSPF6_STR - "Ignore MTU mismatch on this interface\n" + "Disable MTU mismatch detection on this interface\n" ) { struct ospf6_interface *oi; @@ -1684,7 +1684,7 @@ DEFUN (ipv6_ospf6_network, "ipv6 ospf6 network ", IP6_STR OSPF6_STR - "Network Type\n" + "Network type\n" "Specify OSPF6 broadcast network\n" "Specify OSPF6 point-to-point network\n" ) @@ -1730,7 +1730,7 @@ DEFUN (no_ipv6_ospf6_network, NO_STR IP6_STR OSPF6_STR - "Network Type\n" + "Network type\n" "Default to whatever interface type system specifies" ) { diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index c6d9488a10..4f5204be77 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1029,7 +1029,7 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) "Time between HELLO packets\n" \ "Time between retransmitting lost link state advertisements\n" \ "Link state transmit delay\n" \ - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" #define VLINK_HELPSTR_TIME_PARAM \ VLINK_HELPSTR_TIME_PARAM_NOSECS \ @@ -6485,7 +6485,7 @@ DEFUN (ip_ospf_dead_interval, "ip ospf dead-interval (1-65535) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" "Seconds\n" "Address of interface\n") { @@ -6500,7 +6500,7 @@ DEFUN_HIDDEN (ospf_dead_interval, ospf_dead_interval_cmd, "ospf dead-interval (1-65535) [A.B.C.D]", "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" "Seconds\n" "Address of interface\n") { @@ -6512,7 +6512,7 @@ DEFUN (ip_ospf_dead_interval_minimal, "ip ospf dead-interval minimal hello-multiplier (1-10) [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" "Minimal 1s dead-interval with fast sub-second hellos\n" "Hello multiplier factor\n" "Number of Hellos to send each second\n" @@ -6532,7 +6532,7 @@ DEFUN (no_ip_ospf_dead_interval, NO_STR "IP Information\n" "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" "Seconds\n" "Address of interface") { @@ -6601,7 +6601,7 @@ DEFUN_HIDDEN (no_ospf_dead_interval, "no ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]", NO_STR "OSPF interface commands\n" - "Interval after which a neighbor is declared dead\n" + "Interval time after which a neighbor is declared down\n" "Seconds\n" "Address of interface") { @@ -7880,7 +7880,7 @@ DEFUN (ip_ospf_mtu_ignore, "ip ospf mtu-ignore [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" - "Disable mtu mismatch detection\n" + "Disable MTU mismatch detection on this interface\n" "Address of interface") { int idx_ipv4 = 3; @@ -7923,7 +7923,7 @@ DEFUN (no_ip_ospf_mtu_ignore, "no ip ospf mtu-ignore [A.B.C.D]", "IP Information\n" "OSPF interface commands\n" - "Disable mtu mismatch detection\n" + "Disable MTU mismatch detection on this interface\n" "Address of interface") { int idx_ipv4 = 4; From 98cfd06b41622c3b0c2be8b2fa00079696f5fd0d Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 20:39:41 +0000 Subject: [PATCH 272/280] lib, ospf6d: Change SECONDS_STR to be more generic Signed-off-by: Quentin Young --- lib/command.h | 2 +- ospf6d/ospf6_interface.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/command.h b/lib/command.h index 50323d3753..f5572f7f83 100644 --- a/lib/command.h +++ b/lib/command.h @@ -367,7 +367,7 @@ struct cmd_element #define IP6_STR "IPv6 Information\n" #define OSPF6_STR "Open Shortest Path First (OSPF) for IPv6\n" #define OSPF6_INSTANCE_STR "(1-65535) Instance ID\n" -#define SECONDS_STR "(1-65535) Seconds\n" +#define SECONDS_STR "Seconds\n" #define ROUTE_STR "Routing Table\n" #define PREFIX_LIST_STR "Build a prefix list\n" #define OSPF6_DUMP_TYPE_LIST \ diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 3d15b0b3f8..8ea4b16957 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1381,8 +1381,7 @@ DEFUN (ipv6_ospf6_transmitdelay, IP6_STR OSPF6_STR "Link state transmit delay\n" - SECONDS_STR - ) + SECONDS_STR) { int idx_number = 3; struct ospf6_interface *oi; From 7fa12b130fd48aac63fccedb99411fcdeb11ce51 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 21:33:04 +0000 Subject: [PATCH 273/280] bgpd: Add missing [ip] qualifiers to a couple BGP commands Missed these when I was unifying the `show bgp` and `show ip bgp` command trees. Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 148d8f19a0..517684a571 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6066,7 +6066,7 @@ DEFUN (show_bgp_vrfs, DEFUN (show_bgp_memory, show_bgp_memory_cmd, - "show bgp memory", + "show [ip] bgp memory", SHOW_STR BGP_STR "Global BGP memory statistics\n") @@ -8565,7 +8565,7 @@ DEFUN (show_ip_bgp_neighbors, same.*/ DEFUN (show_ip_bgp_paths, show_ip_bgp_paths_cmd, - "show ip bgp paths", + "show [ip] bgp [] paths", SHOW_STR IP_STR BGP_STR @@ -8576,23 +8576,6 @@ DEFUN (show_ip_bgp_paths, return CMD_SUCCESS; } -DEFUN (show_ip_bgp_ipv4_paths, - show_ip_bgp_ipv4_paths_cmd, - "show ip bgp ipv4 paths", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Address Family modifier\n" - "Address Family modifier\n" - "Path information\n") -{ - vty_out (vty, "Address Refcnt Path\r\n"); - aspath_print_all_vty (vty); - - return CMD_SUCCESS; -} - #include "hash.h" static void @@ -10738,7 +10721,6 @@ bgp_vty_init (void) /* "show ip bgp paths" commands. */ install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); - install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); /* "show ip bgp community" commands. */ install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); From 55cb674303c57f4652a4883284bdc4fe4ae11256 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 21:54:36 +0000 Subject: [PATCH 274/280] zebra: Fix `no ip nht ...` commands Signed-off-by: Quentin Young --- zebra/zebra_routemap.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index af69a9d0e0..28f09fea01 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -704,23 +704,22 @@ DEFUN (no_ip_protocol_nht_rmap, "Specify route map\n" "Route map name\n") { + int idx = 0; char *proto = argv[3]->text; - char *rmap = (argc == 6) ? argv[5]->arg : NULL; - int i; + char *rmap = argv_find (argv, argc, "ROUTE-MAP", &idx) ? argv[idx]->arg : NULL; + + int i = strmatch(proto, "any") ? ZEBRA_ROUTE_MAX : proto_name2num(proto); - if (strcasecmp(proto, "any") == 0) - i = ZEBRA_ROUTE_MAX; - else - i = proto_name2num(proto); if (i < 0) { vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE); return CMD_WARNING; } + if (!nht_rm[AFI_IP][i]) return CMD_SUCCESS; - if (!rmap && strcmp(rmap, nht_rm[AFI_IP][i]) == 0) + if (!rmap || strcmp(rmap, nht_rm[AFI_IP][i]) == 0) { XFREE (MTYPE_ROUTE_MAP_NAME, nht_rm[AFI_IP][i]); nht_rm[AFI_IP][i] = NULL; From 332bafd852bbca6ceb1d644ac4665df13019b72a Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 17 Nov 2016 22:51:32 +0000 Subject: [PATCH 275/280] bgpd: Fix `ip as-path access-list ...` breakage Signed-off-by: Quentin Young --- bgpd/bgp_filter.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 6755335535..2244e959b6 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -437,34 +437,28 @@ DEFUN (ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { - int idx_word = 3; - int idx_permit_deny = 4; + int idx = 0; enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; regex_t *regex; char *regstr; + /* Retrieve access list name */ + char *alname = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + /* Check the filter type. */ - if (strncmp (argv[idx_permit_deny]->arg, "p", 1) == 0) - type = AS_FILTER_PERMIT; - else if (strncmp (argv[idx_permit_deny]->arg, "d", 1) == 0) - type = AS_FILTER_DENY; - else - { - vty_out (vty, "filter type must be [permit|deny]%s", VTY_NEWLINE); - return CMD_WARNING; - } + type = argv_find (argv, argc, "deny", &idx) ? AS_FILTER_DENY : AS_FILTER_PERMIT; /* Check AS path regex. */ - regstr = argv_concat(argv, argc, idx_permit_deny); + argv_find (argv, argc, "LINE", &idx); + regstr = argv_concat(argv, argc, idx); regex = bgp_regcomp (regstr); if (!regex) { XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[idx_word]->arg, - VTY_NEWLINE); + vty_out (vty, "can't compile regexp %s%s", regstr, VTY_NEWLINE); return CMD_WARNING; } @@ -473,7 +467,7 @@ DEFUN (ip_as_path, XFREE (MTYPE_TMP, regstr); /* Install new filter to the access_list. */ - aslist = as_list_get (argv[idx_word]->arg); + aslist = as_list_get (alname); /* Duplicate insertion check. */; if (as_list_dup_check (aslist, asfilter)) From 37bc45eb4791531f1401cb908d91943b04cec754 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 18 Nov 2016 00:23:29 +0000 Subject: [PATCH 276/280] bgpd: Fix incorrect config dumps for `dump bgp...` * Correct dump type was not showing for routes-mrt & updates-et * Could not unconfigure most of them Signed-off-by: Quentin Young --- bgpd/bgp_dump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index e1f54bbfef..511eb34028 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -784,7 +784,7 @@ DEFUN (dump_bgp_all, DEFUN (no_dump_bgp_all, no_dump_bgp_all_cmd, - "no dump bgp [PATH] [INTERVAL]", + "no dump bgp [PATH [INTERVAL]]", NO_STR "Stop dump packet\n" "Stop BGP packet dump\n" @@ -884,7 +884,7 @@ config_write_bgp_dump (struct vty *vty) bgp_dump_updates.filename, bgp_dump_updates.interval_str, VTY_NEWLINE); else - vty_out (vty, "dump bgp updates %s%s", + vty_out (vty, "dump bgp %s %s%s", type_str, bgp_dump_updates.filename, VTY_NEWLINE); } if (bgp_dump_routes.filename) @@ -893,6 +893,10 @@ config_write_bgp_dump (struct vty *vty) vty_out (vty, "dump bgp routes-mrt %s %s%s", bgp_dump_routes.filename, bgp_dump_routes.interval_str, VTY_NEWLINE); + else + vty_out (vty, "dump bgp routes-mrt %s%s", + bgp_dump_routes.filename, VTY_NEWLINE); + } return 0; } From 46c699abd11fad5d51940525d0ad33b4aadf6969 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 18 Nov 2016 20:51:40 +0000 Subject: [PATCH 277/280] bgpd: Fix `no ip as-path access-list...` Signed-off-by: Quentin Young --- bgpd/bgp_filter.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 2244e959b6..0de2663dd4 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -457,8 +457,8 @@ DEFUN (ip_as_path, regex = bgp_regcomp (regstr); if (!regex) { - XFREE (MTYPE_TMP, regstr); vty_out (vty, "can't compile regexp %s%s", regstr, VTY_NEWLINE); + XFREE (MTYPE_TMP, regstr); return CMD_WARNING; } @@ -490,27 +490,28 @@ DEFUN (no_ip_as_path, "Specify packets to forward\n" "A regular-expression to match the BGP AS paths\n") { - int idx_word = 4; - int idx_permit_deny = 5; + int idx = 0; enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; char *regstr; regex_t *regex; + char *aslistname = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + /* Lookup AS list from AS path list. */ - aslist = as_list_lookup (argv[idx_word]->arg); + aslist = as_list_lookup (aslistname); if (aslist == NULL) { - vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[idx_word]->arg, + vty_out (vty, "ip as-path access-list %s doesn't exist%s", aslistname, VTY_NEWLINE); return CMD_WARNING; } /* Check the filter type. */ - if (strncmp (argv[idx_permit_deny]->arg, "p", 1) == 0) + if (argv_find (argv, argc, "permit", &idx)) type = AS_FILTER_PERMIT; - else if (strncmp (argv[idx_permit_deny]->arg, "d", 1) == 0) + else if (argv_find (argv, argc, "deny", &idx)) type = AS_FILTER_DENY; else { @@ -519,14 +520,14 @@ DEFUN (no_ip_as_path, } /* Compile AS path. */ - regstr = argv_concat(argv, argc, idx_permit_deny); + argv_find (argv, argc, "LINE", &idx); + regstr = argv_concat(argv, argc, idx); regex = bgp_regcomp (regstr); if (!regex) { + vty_out (vty, "can't compile regexp %s%s", regstr, VTY_NEWLINE); XFREE (MTYPE_TMP, regstr); - vty_out (vty, "can't compile regexp %s%s", argv[idx_word]->arg, - VTY_NEWLINE); return CMD_WARNING; } From 5435e6e88c46071924a40a53d70daf5b6490bd49 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 18 Nov 2016 21:27:30 +0000 Subject: [PATCH 278/280] lib: Fix `ipv6 access-list...` and `ipv6 prefix-list...` Signed-off-by: Quentin Young --- lib/filter.c | 20 ++++++++++---------- lib/plist.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/filter.c b/lib/filter.c index 501b28f2da..072d3ddc2e 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1539,12 +1539,12 @@ DEFUN (ipv6_access_list, "IPv6 zebra access-list\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Prefix to match. e.g. 3ffe:506::/32\n") + "IPv6 prefix\n") { - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 0, 1); + int idx = 0; + char *alname = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + char *prefix = argv_find (argv, argc, "X:X::X:X/M", &idx) ? argv[idx]->arg : NULL; + return filter_set_zebra (vty, alname, argv[3]->text, AFI_IP6, prefix, 0, 1); } DEFUN (ipv6_access_list_exact, @@ -1555,13 +1555,13 @@ DEFUN (ipv6_access_list_exact, "IPv6 zebra access-list\n" "Specify packets to reject\n" "Specify packets to forward\n" - "Prefix to match. e.g. 3ffe:506::/32\n" + "IPv6 prefix\n" "Exact match of the prefixes\n") { - int idx_word = 2; - int idx_permit_deny = 3; - int idx_ipv6_prefixlen = 4; - return filter_set_zebra (vty, argv[idx_word]->arg, argv[idx_permit_deny]->arg, AFI_IP6, argv[idx_ipv6_prefixlen]->arg, 1, 1); + int idx = 0; + char *alname = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + char *prefix = argv_find (argv, argc, "X:X::X:X/M", &idx) ? argv[idx]->arg : NULL; + return filter_set_zebra (vty, alname, argv[3]->text, AFI_IP6, prefix, 1, 1); } DEFUN (ipv6_access_list_any, diff --git a/lib/plist.c b/lib/plist.c index a854ad52b3..1f5e595fd8 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -2671,7 +2671,7 @@ DEFUN (no_ipv6_prefix_list_description_comment, "Prefix-list specific description\n" "Up to 80 characters describing this prefix-list\n") { - return no_ipv6_prefix_list_description_comment (self, vty, argc, argv); + return no_ipv6_prefix_list_description (self, vty, argc, argv); } From ddbaf941d9618125eb9d1a778c1f704c84109abf Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 22 Nov 2016 22:43:39 +0000 Subject: [PATCH 279/280] bgpd: Fix ambiguous commands for `...attribute-unchanged...` Signed-off-by: Quentin Young --- bgpd/bgp_vty.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index e7ed9e1911..77cf410a0f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3966,9 +3966,9 @@ DEFUN (neighbor_attr_unchanged, neighbor_attr_unchanged_cmd, "neighbor attribute-unchanged\ [<\ - as-path [next-hop [med]]|as-path [med [next-hop]]|\ - next-hop [as-path [med]]|next-hop [med [as-path]]|\ - med [as-path [nexthop]]|med [next-hop [as-path]]\ + as-path []|\ + next-hop []|\ + med []\ >]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -3976,19 +3976,16 @@ DEFUN (neighbor_attr_unchanged, "As-path attribute\n" "Nexthop attribute\n" "Med attribute\n" - "As-path attribute\n" "Med attribute\n" "Nexthop attribute\n" "Nexthop attribute\n" "As-path attribute\n" "Med attribute\n" - "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" "Med attribute\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" "Nexthop attribute\n" "As-path attribute\n") { @@ -4019,9 +4016,9 @@ DEFUN (no_neighbor_attr_unchanged, no_neighbor_attr_unchanged_cmd, "no neighbor attribute-unchanged\ [<\ - as-path [next-hop [med]]|as-path [med [next-hop]]|\ - next-hop [as-path [med]]|next-hop [med [as-path]]|\ - med [as-path [nexthop]]|med [next-hop [as-path]]\ + as-path []|\ + next-hop []|\ + med []\ >]", NO_STR NEIGHBOR_STR @@ -4030,19 +4027,16 @@ DEFUN (no_neighbor_attr_unchanged, "As-path attribute\n" "Nexthop attribute\n" "Med attribute\n" - "As-path attribute\n" "Med attribute\n" "Nexthop attribute\n" "Nexthop attribute\n" "As-path attribute\n" "Med attribute\n" - "Nexthop attribute\n" "Med attribute\n" "As-path attribute\n" "Med attribute\n" "As-path attribute\n" "Nexthop attribute\n" - "Med attribute\n" "Nexthop attribute\n" "As-path attribute\n") { From bf31fc8174b6d130b90e6ee1a67c543c3c8f1615 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 28 Nov 2016 17:46:55 +0100 Subject: [PATCH 280/280] lib: pre-remove str.[ch] for merge, move strmatch() lib/str.[ch] was removed in cleaning up autoconf deadweight. best place for strmatch seems to be a #define in zebra.h Signed-off-by: David Lamparter --- lib/str.c | 143 ---------------------------------------------------- lib/str.h | 35 ------------- lib/zebra.h | 2 + 3 files changed, 2 insertions(+), 178 deletions(-) delete mode 100644 lib/str.c delete mode 100644 lib/str.h diff --git a/lib/str.c b/lib/str.c deleted file mode 100644 index cfdb6e024e..0000000000 --- a/lib/str.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * zebra string function - * - * XXX This version of snprintf does not check bounds! - */ - -/* - The implementations of strlcpy and strlcat are copied from rsync (GPL): - Copyright (C) Andrew Tridgell 1998 - Copyright (C) 2002 by Martin Pool - - Note that these are not terribly efficient, since they make more than one - pass over the argument strings. At some point, they should be optimized. - - The implementation of strndup is copied from glibc-2.3.5: - Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. -*/ - -/* - * This file is part of Quagga. - * - * Quagga is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * Quagga is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Quagga; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#ifndef HAVE_SNPRINTF -/* - * snprint() is a real basic wrapper around the standard sprintf() - * without any bounds checking - */ -int -snprintf(char *str, size_t size, const char *format, ...) -{ - va_list args; - - va_start (args, format); - - return vsprintf (str, format, args); -} -#endif - -#ifndef HAVE_STRLCPY -/* - * Copy string src to buffer dst of size dsize. At most dsize-1 - * chars will be copied. Always NUL terminates (unless dsize == 0). - * Returns strlen(src); if retval >= dsize, truncation occurred. - */ -size_t -strlcpy(char *dst, const char *src, size_t dsize) -{ - const char *osrc = src; - size_t nleft = dsize; - - /* Copy as many bytes as will fit. */ - if (nleft != 0) { - while (--nleft != 0) { - if ((*dst++ = *src++) == '\0') - break; - } - } - - /* Not enough room in dst, add NUL and traverse rest of src. */ - if (nleft == 0) { - if (dsize != 0) - *dst = '\0'; /* NUL-terminate dst */ - while (*src++) - ; - } - - return(src - osrc - 1); /* count does not include NUL */ -} -#endif - -#ifndef HAVE_STRLCAT -/** - * Like strncat() but does not 0 fill the buffer and always null - * terminates. - * - * @param bufsize length of the buffer, which should be one more than - * the maximum resulting string length. - **/ -size_t -strlcat(char *d, const char *s, size_t bufsize) -{ - size_t len1 = strlen(d); - size_t len2 = strlen(s); - size_t ret = len1 + len2; - - if (len1 < bufsize - 1) { - if (len2 >= bufsize - len1) - len2 = bufsize - len1 - 1; - memcpy(d+len1, s, len2); - d[len1+len2] = 0; - } - return ret; -} -#endif - -#ifndef HAVE_STRNLEN -size_t -strnlen(const char *s, size_t maxlen) -{ - const char *p; - return (p = (const char *)memchr(s, '\0', maxlen)) ? (size_t)(p-s) : maxlen; -} -#endif - -#ifndef HAVE_STRNDUP -char * -strndup (const char *s, size_t maxlen) -{ - size_t len = strnlen (s, maxlen); - char *new = (char *) malloc (len + 1); - - if (new == NULL) - return NULL; - - new[len] = '\0'; - return (char *) memcpy (new, s, len); -} -#endif - -extern int -strmatch (const char *str1, const char *str2) -{ - if (!strcmp(str1, str2)) - return 1; - return 0; -} diff --git a/lib/str.h b/lib/str.h deleted file mode 100644 index dc8e7e5d67..0000000000 --- a/lib/str.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id: str.h,v 1.4 2005/09/19 09:53:21 hasso Exp $ - */ - -#ifndef _ZEBRA_STR_H -#define _ZEBRA_STR_H - -#ifndef HAVE_SNPRINTF -extern int snprintf(char *, size_t, const char *, ...); -#endif - -#ifndef HAVE_VSNPRINTF -#define vsnprintf(buf, size, format, args) vsprintf(buf, format, args) -#endif - -#ifndef HAVE_STRLCPY -extern size_t strlcpy(char *, const char *, size_t); -#endif - -#ifndef HAVE_STRLCAT -extern size_t strlcat(char *, const char *, size_t); -#endif - -#ifndef HAVE_STRNLEN -extern size_t strnlen(const char *s, size_t maxlen); -#endif - -#ifndef HAVE_STRNDUP -extern char * strndup (const char *, size_t); -#endif - -extern int strmatch (const char *, const char *); - -#endif /* _ZEBRA_STR_H */ - diff --git a/lib/zebra.h b/lib/zebra.h index 08c50c68bc..a37cdd9472 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -461,6 +461,8 @@ extern int proto_redistnum(int afi, const char *s); extern const char *zserv_command_string (unsigned int command); +#define strmatch(a,b) (!strcmp((a), (b))) + /* Error codes of zebra. */ #define ZEBRA_ERR_NOERROR 0 #define ZEBRA_ERR_RTEXIST -1